lovemachinez Posted October 21, 2014 Report Share Posted October 21, 2014 Hi, I have a project to get the sensor data from 4-5 serial ports in order to plot the data to waveform graph as real-time as possible. Right now, I have already got the data from one serial port and plot them on waveform graph and it works well, but I have no idea to get the data from more than one port. Any suggestion please help. Thank you in advance. PS. Sorry for my bad English. Quote Link to comment
QueueYueue Posted October 21, 2014 Report Share Posted October 21, 2014 I'm not exactly sure where you're having the trouble. There are a lot of ways to do this. I'd say you should first take a look at how to use Multiple Plot graphs and charts (in the detailed help of the Chart control). There are example VIs with these. Now you should be able to use the code that you already have to read from 1 serial port in a For Loop (each iteration of the for loop will read from a different serial port) to acquire all of your data. Now you just need to put the two together. 1 Quote Link to comment
lovemachinez Posted October 22, 2014 Author Report Share Posted October 22, 2014 I'm not exactly sure where you're having the trouble. There are a lot of ways to do this. I'd say you should first take a look at how to use Multiple Plot graphs and charts (in the detailed help of the Chart control). There are example VIs with these. Now you should be able to use the code that you already have to read from 1 serial port in a For Loop (each iteration of the for loop will read from a different serial port) to acquire all of your data. Now you just need to put the two together. Thank you for your replied, QueueYueue. Well, I have just no idea about how to get the data from more serial ports. So refer to your reply, I just change the COM port# to get data from another port in the loop accordingly right? Shall I have to close the previous port before get to another port in the row? Thank you again. Quote Link to comment
Steve Morris Posted October 22, 2014 Report Share Posted October 22, 2014 lovemachinez, You don't need to close the previous port before you read from the next port. You should open all your ports, read from them in the For Loop as QueueYueue suggested, and then close all of them when you are finished. See attached example. multiport example LV2010.vi 1 Quote Link to comment
lovemachinez Posted October 24, 2014 Author Report Share Posted October 24, 2014 lovemachinez, You don't need to close the previous port before you read from the next port. You should open all your ports, read from them in the For Loop as QueueYueue suggested, and then close all of them when you are finished. See attached example. Thank you so much. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.