Hi all, i'm very new in serial port communication.. here i got some problem in writing to the serial port.. i have done the connection successfully.. let me explain my situation.. i'm doing a system for toll.. here, there have a device name TFI (Toll Fare Indicator)..This device has to display 3 things (vehicle class, fare, and message).. now, i'm connecting my pc to this device using Serial Port.. i write to the serial port using byte.. now, to differentiate between those 3 things in TFI, i've been given the header.. here the codes
in Load i set the settings for the serial Port
#region TFI INIT
SerialPort comTFI = new SerialPort();
comTFI.PortName="COM3";
comTFI.BaudRate=9600;
comTFI.Parity=Parity.None;
comTFI.StopBits.One;
comTFI.Open();
#endregion
Now, i'm doing the writing inside the keydown event
comTFI.Write(new byte[] {byteAdd},0,1); //where byteAdd is in a byte with
// value 0x03
comTFI.Write("C"+strClass); //where strClass is a string with value 1
//and C is a header to initiate the vehicle class
this is done successfully.. where the value "1" is display in the TFI in column vehicle class . Now, in the same event, i try to skip to the second column (fare column), by writing the code below
comTFI.Write("P"+tfiFare); //where tfiFareis a string with value 105
//and P is a header to initiate the fare.
but, the result is not what i'm expected..
it returns all in the same column (in the vehicle class column).
the output would be = 1P105 where, it only concat the class.
I only can get the expected output, if i write the fare and class in different event.
but i want to do both in the same event.. so anyone can help me? please..