LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial read problems

OK, now I get it! I didn't realize that you were trying to use your own data format. Just a suggestion. You might want to package your data a bit differently. If you had "notification header", say a short bit string, you could set up your serial recieve to look for port activity, then toss away to header bits, decode the data, and then look for the carraige return, or whatever is your stop bit. I think you are seeing some of the difficulty of using a custom protocol. You have to set up your reciever to look for custom data. It helps a whole lot of you can arrange your total data packet, including header, data, and stop bits to be a known number of data bits. Then you can pre-set you recieve to look for this number of bits, and hopefully not
get a timeout error while waiting for more data.

Anyhow, I wish you luck.

Dave
0 Kudos
Message 11 of 13
(613 Views)
Thanks for the help, do you know of any examples I can have glance at to get a feel for setting up this custom communication?

The plc program is a prepackaged solution, and I'm just adding a program onto it to interpret the data that was specified.
0 Kudos
Message 12 of 13
(613 Views)
You do as others have said. Poll the serial port (Using a VISA property node "Bytes at serial port") to see if there's anything there ("Bytes at serial port" > 0). If there is, read it, if not, loop (with a sensible "Wait until multiple" delay, say 100 msec).

As I understood your problem, it was the actual serial port read which was causing problems, not your program. The termination character will sort this out. Give it a try.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 13 of 13
(819 Views)