LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real Time Graphing from Com Port Data

I am creating a school project in which power consumption data is graphed in real time.  I started by using a "continuous read write" example vi, and added on to it so it converts ASCII to hex and decimal as well.  So far when i send a character from my MSP430 to the COM port via Xbees, labview reads in the character and converts it to hex and decimal correctly.  I would like to set this up so that I can send a stream of Hex values (Power Consumption Data), and have labview plot this data in real time.  I have attached my vi so far.  I am brand new to labview, so any help would be greatly appreciated.

 

Thank you

0 Kudos
Message 1 of 39
(3,324 Views)

I don't have 2014 installed yet, but I'd be willing to take a look if you save this as a previous version to 2012.



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 2 of 39
(3,305 Views)

Just use a Chart and wire it up to your numeric output.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 39
(3,298 Views)

I think i converted it to 2012 version.  Let me know if it is still in 2014

0 Kudos
Message 4 of 39
(3,276 Views)

I changed a couple of things in your loop.  First, the way it was before, if you chose to write a command, it would write that command every 5 mS until you could turn the Write off.  It's now event driven, where if you click write, it will write the command every time you click.  I put the read loop in a timeout state timed at 5mS.  So, if Read is enabled, and you don't write any commands to it, data will be read and displayed every 5 ms.  Otherwise, the timeout case does nothing, but pass data back to the beginnging of the loop. 

Additionally, I put the responses into an array, when the stop button is clicked or an error occurs and ends the loop, it will display all of the responses from the device.  You can then wire this up pretty easily to save to a text file, or however you would like if neceessary.

 

I hope this helps!



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 5 of 39
(3,265 Views)

Bruce,

 

Thank you so much for the help.  I made a test program (for MSP430) that sends 0 1 2 3 4 5 4 3 2 1 0 and keeps looping, where the numbers are sent 1/4 of a second apart.  this corresponds to 0x30 0x31 0x32 0x33 0x34 0x35 0x34 0x33 0x32 0x31 0x30.  I run the labview program, but it times out and does not produce a graph.  I have attached the screenshot after it times out.  Do you know why it isn't graphing the data, and timing out?

 

Thanks,

Jonathan

0 Kudos
Message 6 of 39
(3,211 Views)

Try reading fewer bytes.  You are requesting a 1000 bytes.  The default timeout for a serial read is 10 seconds.  At 960 baud, you'll probably only get about 960 bytes, or 872 bytes.  But it might be even fewer depending on how fast the other side is sending the data.  You will almost certainly timeout.

0 Kudos
Message 7 of 39
(3,204 Views)

Have the MSP generate an EOL after the data.  The 100 bytes is the maximum number of bytes it will read.  You could set it to 4096 bytes and it will stop reading once it gets the EOL.

 

Essentially what's happening, or what appears to be happening is that the MSP is just spitting out data.  And even though you look at the data as several samples, Labview looks at it like one data point.



Bruce K

Not as smart as many other peepz on here....
Message 8 of 39
(3,197 Views)

When you say EOL, does that mean end of line?  Does that mean the termination character, which i beleive is set to 0xA?  So do I send, 0x30 0xA 0x31 0xA 0x32 0xA......... ?

0 Kudos
Message 9 of 39
(3,192 Views)

Yes, I mean End of Line.  We typically use a carriage return/line feed for our communication, which I believe would be 0x0D0A.  But you can configure the EOL string in LabView to be whatever you would like with a property node on one of the VISA reference lines.

 

Try that out and see if it works for ya.

 

 



Bruce K

Not as smart as many other peepz on here....
Message 10 of 39
(3,181 Views)