12-05-2008 07:17 AM
Hello Everyone,
I'm using Labview (8.6) to make a program that interacts with a measurement system.
The communication with the device is done trough a serial (Rs-422) port. The device sends messages at 5Hz rate after a request from the PC.
The structure of the messages sent by the device is always the same, with a known minimal length and a two-character terminaison.19200 baud , parity=none, bitstop=1, databits=8.
I'm trying to make an Event based program. Please find attached the example of vi that I use (8.5 version).
I have a lot of warnings and after 50 cycles an error comes if I don’t use the VISA Disable Event and VISA Discard Event. Il seems that the event FIFO is never emptied event if I use the VISA Wait On Event at each iteration of the loop.
The warnings and error are also attached. It seems that I haven’t good understood the event based programming. Can someone give me an explanation, how does it work or give me another proposition to identify the end of a serial message with 2 TermChar.
Thank you in advance for your support.
12-12-2008 09:02 PM
Hi MUserSTM,
Is this still an issue? Maybe the problem can be reproduced by having a simple VI write data to a COM port, and loop that to another COM port that your VI is listening on. There are a couple of USB/Serial adapters on my desk.
If you're still fighting with this, please reply and attach your most recent code!
Cheers.
12-15-2008 02:53 AM
Best regards
12-17-2008 03:44 AM
Hi MUserSTM,
There were a bunch of little problems, but the core problem - that the Event queue fills-up after 50 events - has a very strange solution:
It can be caused when the "event" output terminal is wired on the "VISA Wait Event"!?
Run the attached VI - it seems to work with event output unwired. Then click "Enable BUG" - it calls VISA Wait Event with "event" output wired and PRESTO! the full queue error after ~50 loops.
For future reference, the Detect Break Event.vi Example can also detect the "Serial-Term Char" event.
By the way, I've had problems using the "Bytes at port" node so programmed around it.
Also, your app will, theoretically, loop at 5KHz - in my experience, that's a pretty fast loop - does your program need to react instantly, based on a message value? If not, I'd be inclined to forget the event handling and just read multiple messages periodically.
Cheers!.
12-17-2008 10:13 AM
Corrections
VIagra wrote:There were a bunch of little problems, but the core problem
Should be: "There were several little problems in ExempleRS232.vi,but the core problem..."
VIagra wrote:... your app will, theoretically, loop at 5KHz - in my experience, that's a pretty fast loop - does your program need to react instantly, based on a message value? If not, I'd be inclined to forget the event handling and just read multiple messages periodically..
Should be: "that's a pretty fast serial IO loop"
and: "I'd be inclined to forget the event handling and just read multiple messages much more slowly - say @ 10Hz."
Cheers!