469,950 Members | 2,309 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Serial Port Communication

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();


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..
Nov 9 '06 #1
0 1713

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Andreas Horneff | last post: by
7 posts views Thread by Michael Chong | last post: by
4 posts views Thread by max_mont | last post: by
reply views Thread by Dhananjay | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.