LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview needs 2 goes to start the serial port

Hi,

When I use Labview with the serial port handlers, beit VISA or the serial routines, I always have to run my external device (microcontroller based system connected through the serial port) and then run Labview but the first time I run it it never works. I then need to reset my microcontroller system and run my Labview program again and it runs fine, and every time after that.

Has anybody else noticed this and what can I do to fix it?

Ken
0 Kudos
Message 1 of 4
(2,453 Views)
Your statement "it never works" is kind of vague. How doesn't it work? Do you get an error, garbage data, no data, or what? Is this system always spitting out data that needs to be synchronized? When you have it working, stop the LabVIEW program and restart it right away, do you have the same problem or do you only see it after stopping the system and restarting it? Aside from recomending that you do a flush of the serial port buffer before sending and receiving data from LabVIEW, more details would help to provide some sort of solution.
0 Kudos
Message 2 of 4
(2,443 Views)
By it never works I mean that the micro-controller needs to receive a carriage return and then it will send back ADC data. The first time I run the program it doesn't seem to receive the carriage return and sends back no data at all.

Having to purge the buffers would make a bit of sense in that if it's expecting a carriage return and receives something else from the serial buffers it would go into an unknown state.
0 Kudos
Message 3 of 4
(2,437 Views)
It's also possible that it's the micro that needs it's serial buffer cleared and that's what the reset of it does. If that's the case, at the beginning of the program you might put in a loop that does nothing but send a carriage return and wait for valid data.
0 Kudos
Message 4 of 4
(2,431 Views)