08-17-2010 08:05 AM
I have problem with serial port. I have connected two computers by serial port and I need to create program in Labview for transfer strings using start bits and stop bits. My problem is that my program is working quite well ...when I press start bit it starts to concatenate strings and if i press stop bits it stops...this is the purpose of this program...but problem is that it working only with delay...and need that this program dont need delay, because it can only concatenating data depends on delay from start bit....I wana solved problem with delay...I dont want using delay process in my program, but allways when I try to delete this delay it stop works correct
here is my program
08-17-2010 09:13 AM
Ok this should be simple - if I understand you correctly.
You have the VISA session initialized with read termination character enabled. So reading the number of bytes at port is NOT the correct way to read from the port. Set the read number of bytes to something large (say 4096) and the read will return as soon as a termination character is received (or timeout).
You'll need to make sure the sending device is configured to send termination character on writes (you can set that with a VISA property node) and that you are sending the correct termination character. The default is 0x0A (newline).
08-17-2010 09:32 AM
You also should NOT be placing the serial port configration and the close inside the loop. These should be outside the loop. Why would you need to reconfigure the serial port each and every time you iterate through the loop?
08-17-2010 09:42 AM
It is better but it allways send me an error message:
08-17-2010 09:47 AM
That implies that the sender is not appending a linefeed at the end of the command.
I think you're a little confused with terminology here. The start and stop bits are part of the protocol. You do not explicitly set these via strings. Have you read the information on the NI site on serial port programming, or the Wikipedia article on RS-232?