I am trying to transmit some control codes via the serial port using the RS232 class, and cant find the way to do it. I am able to transmit ascii characters and control chars up to 127 decimal, but not above even though my port is set to 8 data bits! The control char I would like to send is 254 decimal.
In VB6 you could set the mode to ascii or binary. Is there an equivelant in VB .NET?
Here is my port setup code:
Here is the code that outputs the data:
Any ideas? Thanks.
In VB6 you could set the mode to ascii or binary. Is there an equivelant in VB .NET?
Here is my port setup code:
VB.NET:
visual basic code:
With moRS232
.Port = Port // Uses COM1
.BaudRate = 2400 // 2400 baud rate
.DataBit = 8 // 8 data bits
.StopBit = Rs232.DataStopBit.StopBit_1 // 1 Stop bit
.Parity = Rs232.DataParity.Parity_Even // No Parity
.Timeout = 10
Here is the code that outputs the data:
VB.NET:
visual basic code:
moRS232.Write(Chr(254))// this line doen't work!
moRS232.Write(Chr(70))// transmits ascii "F"
moRS232.Write(Chr(3))// transmits decimal 3
moRS232.Write(Chr(0))// transmits decimal zero
Any ideas? Thanks.