LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem --serial port reading one character at a time

Hi Friend,

I reading the serial port  one character at a time ,  i specified it in the "serial bytes to read" option in serial port read examples.
The problem is ----------i can able to read  the data.
but only the first character is reading again and again...and "reading string indicator" in the serial port example shows only the first character sent ..only for a single time.since i am reading continously ----aleast the first character should display as many times i running the program
(i am running the vi by run continous option..........)..

please help me ....how to read the character one by one.....

regards
rajasekar





0 Kudos
Message 1 of 5
(3,691 Views)
Do not use run continuous option. That is not the correct way to keep executing a portion of code. Put a while loop around just the read. That way, the serial port is not initialized with each run.
0 Kudos
Message 2 of 5
(3,686 Views)
Hey rajasekar,

Dennis is exactly right.  You will need to put the read vi in a while loop.  A great example that implements this in LabVIEW can be found in the Example Finder.  The example is called Basic Serial Write and Read.vi

I hope this helps!

Best regards,

Jason W
Applications Engineer
National Instruments
0 Kudos
Message 3 of 5
(3,670 Views)
Hi jason...

I can able to read the serial port by 1 byte or 2 byte or 4 byte as i can specify it in the serial port read bytes option..(in visa serial read)..
I need to acquire 4 bytes of data and pass it to the Math-script node..and save these 4bytes of data in array (1 row and 4 column)..
And split this array(just like array-indexing.vi) and processing it each each column separately....
or suggest some method to achieve my task.....please.

one more thing the math-script node is placed in a while loop.....in order to read sequence of bytes continously.......


regards
rajasekar



0 Kudos
Message 4 of 5
(3,658 Views)

What exactly are you having difficulty with? Is it the building array, indexing it, or the math script? When you say 'just like array-indexing.vi', the array indexing function is able to get an entire column so you don't need something like it. You just use it.

If you can post the code you've written (7.1 format please) or an image of the block diagram, it would help to understand what you need to do.

0 Kudos
Message 5 of 5
(3,649 Views)