My question comes from the MsComm control.
I am trying to write a test program to control a microcontoler that I have programed. The Microcontroler has 12 commands that it receivers from and rs232 interface programed into the chip. What I am trying to do is to build an operations interface for the microcontroler. What I am trying to do.
When I click on a button I want to send out a byte string.
Say command 1, I want to send eight bits that are "00000001". I am trying to use this code
Private Sub Command1_Click()
Dim Buffer As Variant
Dim Channel1 As Byte
Channel1 = 1
Buffer = Channel1
MSComm1.CommPort = 3
MSComm1.PortOpen = True
MSComm1.Output = Channel1
Now the VB Books on line tells me that the type BYTE is
"Byte variables are stored as single, unsigned, 8-bit (1-byte) numbers ranging in value from 0–255"
Well this is what I want to output
But when I use my code I get an error saying type mismatch.
The Vb books online say this
To send binary data, you must pass a Variant which contains a byte array to the Output property.
What am I doing wrong.