[RESOLVED] sending 16 bit data to serial port
hi iam new bee to this forum.
just learning the basics.
i want to send 16 bit data ( 0000 0000 0000 0000) to microcontroller.
where in first 8 bit decides the o/p channel on microcontroller , and second 8 bit vary the duty cycle of the selected pwm o/p.
can any one tell me how to send 16 bit data from vb6, source codes to send 16 bit data.
many thabks in advance.
iam using vb6.
raj
Re: sending 16 bit data to serial port
You just send it in two bytes. Serial ports are 8-bit devices, so...
Example,
Dim Buffer(1) As Byte
Buffer(0) = &H00
Buffer(1) = &HFF
MSComm1.Output = Buffer
This will send &H00FF to your microcontroller.
You can find lots of examples online that show how to open the port, change settings, etc.
To receive binary data, you should set MSComm's InputMode property to comInputModeBinary, and then assign data from the Input property to a buffer of type Byte (similar to above).
Dick
Re: sending 16 bit data to serial port