02-20-2015 11:23 AM
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
02-20-2015 12:26 PM
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.
02-20-2015 12:42 PM
Just use a Chart and wire it up to your numeric output.
02-20-2015 02:27 PM
I think i converted it to 2012 version. Let me know if it is still in 2014
02-20-2015 03:55 PM - edited 02-20-2015 03:55 PM
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!
02-23-2015 09:50 AM
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
02-23-2015 10:17 AM
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.
02-23-2015 10:33 AM
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.
02-23-2015 10:48 AM
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......... ?
02-23-2015 11:02 AM
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.