PDA

View Full Version : vb6 mosquit-IO



racoon
06-02-2009, 07:52 AM
I am having trouble interfacing the mosquit-IO with Visual Basic 6 (VB6). My code is:
Dim a As String
a = "255 25 42 69 25 42 69 /r"
With MSComm1
.Commport = 8
.Settings = "19200,n,8,1"
.Portopen = True
.Handshaking = comRTS
.RThreashold = 1
.RTSEnable = True
.Output = a
End With

Any suggestions?

Alex
06-02-2009, 08:51 AM
aww man.... I'm totally rusty in vb6:)

I'm almost positive though that you need to send a Byte Array to the .Output method and not a String. Let me see if I can find an example for ya in vb6...

Alex
06-02-2009, 09:11 AM
Nope, I was sort of wrong. The .Output method takes a string, but you can also send a byte. To do so, you need to change the .InputMode to comInputModeBinary. I found an PDF that explains all the properties of MSComm object that might help ya out a bit: http://www.google.com/url?sa=t&source=web&ct=res&cd=8&url=http%3A%2F%2Fmachdien.com.vn%2FVB6%2520SOFTWAR E%2FMSCOMM_VB.pdf&ei=_y4lSsu5NdrnlAe3hejcBw&usg=AFQjCNH0TiUdIeG1Gkmp28LnOfVZj0f0qg (http://www.google.com/url?sa=t&source=web&ct=res&cd=8&url=http%3A%2F%2Fmachdien.com.vn%2FVB6%2520SOFTWAR E%2FMSCOMM_VB.pdf&ei=_y4lSsu5NdrnlAe3hejcBw&usg=AFQjCNH0TiUdIeG1Gkmp28LnOfVZj0f0qg)

Try this:

Dim bArray(6) As Byte


bArray(0) = 255
bArray(1) = 25
bArray(2) = 42
bArray(3) = 69
bArray(4) = 25
bArray(5) = 42
bArray(6) = 69

With MSComm1
.Commport = 8
.Settings = "19200,n,8,1"
.InputMode = comInputModeBinary
.Portopen = True
.Handshaking = comRTS
.RThreshold = 1
.RTSEnable = True
.Output = bArray
End With


You can shorten this, but I can't remember how to assign values in an Array in one line in vb6.


EDIT: I think the product page is wrong though. I'll verify with Andrew once he gets in, but I don't think it'll run off of 6V. It needs 7.2V - 9.6V.

Alex
06-02-2009, 01:04 PM
okay, I was wrong again:rolleyes:

It states on the board that the voltage needs to be between 7.2V and 9.6V, but it can still run off of 6V no problem.

I'm leaving now