01-25-2011 07:24 AM
Hello,
I want to control an Arduino with LabVIEW. It’s the first time I am dealing with RS232 communication and I would appreciate some help. I found really useful examples and I can write and read with RS232. For example I can enable-disable a DO channel on Arduino board. However, I can’t imagine which should be the programming practice (concerning the RS232 communication) in LabVIEW when you want to control more channels e.g two digital outputs. I realize that the corresponding “arduino program” should be also uploaded on Arduino board but I think I can deal with it. I am missing the LabVIEW part.
Thank you in advance
01-25-2011 07:37 AM
If you are communicating serially with the arduino through LabVIEW then you have the hard part dealt with. Now you just need to structure your code so that you can send different messages. Without seeing your code I suspect that you have everything "wired serially" in your serial communications. Sorry for the pun, but what I mean is that you have a function opening the serial port, then another that sends the message, then a close. If this is true then you need to put the "send" into a loop, ideally in a event structure within a loop, so that you can send different messages to the arduino.
If you could attach your latest attempt so that we can look at it, it will help. Tell us which version of LabVIEw you are using (I only have access to 8.6 during the day myself). Also describe what you have to do to talk to one, more channels. Is it just a different serial message sent?
As to uploading the arduino program, do you mean a run alone, or one needed to allow communications with the arduino, what? I haven't played with arduinos yet.
01-25-2011 08:13 AM
Hello LV_Pro,
Thank you for your reply. First of all I am using LabVIEW 8.6. What I want to accomplish is learning to read all the input channels and write to all output channels of Arduino (Duemilanove ). Thus, I want to program all my code in LabVIEW but writing to Arduino channels or read from Arduino channes by using RS232 communication. With the vi and the arduino code attached you can see what I did up to now. It’s very simple project, just enable or disable a digital output. If I am correct this action was possible by sending a string of “1” in case of DO enabling and a string of “0” in case of disabling. My real question is: how can I enable an additional DO channel using a new Boolean (using two Booleans at the same time, meaning sending different strings from the same COM?, and what’s the difference since a string of 0 or 1 should be also sent to control the second DO channel. How arduino will distinguish between the two DO channels?). In other words how can I simultaneously writing to a DO channel and reading an analog input or writing a value to an analog output etc through RS232?. Sorry for my simple question.
Thank you in advance