LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to receive and read continuous data

There are two ways the while loop will stop.  One is when an error occurs when reading bytes at port.  I don't think this is your problem.  The other is when the bytes at port is greater than or equal to the byte threshold value.  This is probably what is happening.  The byte threshold is a front panel control.  Either increase the value of the control on the front panel, or get rid of it.  If you increase the value, the loop will continue until the new value is exceeded.  If you get rid of it, the only way the loop will stop is when there is an error.  You could replace the loop stop condition with a button so that you can stop it when you press the button.
- tbob

Inventor of the WORM Global
Message 11 of 14
(1,834 Views)

Hi srt,

Attached is a very basic vi you can play with.  Please configure the serial port appropriately.

And remember:  have fun 😉

JLV

 

PS:  Don't forget to assign a VISA Resource NAme (ie: COM1).  Otherwise you'll get an error instantly.. 🙂

Message Edited by JoeLabView on 10-04-2005 07:19 PM

Message 12 of 14
(1,883 Views)
Hi srt,
 
I forgot to ask... which version of LV are you using???  The example was done in 7.0
 
JLV
Message 13 of 14
(1,878 Views)
 

@JoeLabView wrote:
Hi srt,
 
You should start by creating a while loop.  Wire a stop button to the loop control.
 
Outside (before) the while loop, configure the serial port, open the serial port, check to see if there is any data at the port.  Feed the number of bytes into a Read Serial Vi and use this data to initialize your loop (use a shift register).
 
Within the loop, place the check no of bytes at serial port and feed this value to the read Serial Port.  Make sure you do not use the setting to timeout for a certain amount of bytes.  Merge the newly obtained data to the previous data by wiring the input shift register to the merge string vi (top port) and wire the new data to the bottom port.  Feed the output of the merge string to the output shift register (located at the right of the loop).  You can place a display inside the loop (a better way is to place it outside... but that is beyond the scope of this explanation 😉  ). 
 
You can also use the data coming out of the shift register after the while loop is stopped.  It will contain all the data coming from the serial port.
 
Regards,
 
JLV



Re-visiting an old thread...
 
I have a fairly large sequence structure with 12 commands to a spectrophotometer that logs baseline information, performs a baseline, logs scan information, and then performs a scan.  The only problem is the handling of data.  When in normal operation mode (board on the machine) the scan information plots a nice graph and records information on the display.  However, in RS232 mode the information and graph are sent to the internal printer on the spectrophotometer and prints out an unnecessary graph.  I've turned the internal printer off, completely deactivated it...but when a subsequent explicit request to print something such as a graph is made, the printer turns back on. 
 
I need to be able to read the scan information during the scan, or be able to read the scan immediately after it finishes (a matter of very few miliseconds).  I used JLV's suggestion, but I am in need of a very, very, very fast read process.
 
Thanks,
 
0 Kudos
Message 14 of 14
(1,710 Views)