07-11-2013 09:11 AM
Hello Everyone!
I'm quite new to LV and LIFA and for my project at the university I would like to connect 5 (later 10 arduinos) running LIFA to one .vi-File over RS485 (half-duplex).
Until now I successfully could read one arduino transmitting over RS485 with the VISA package only. With LIFA it wasn't working probably due to the half-duplex setup.
My UNO was connected through the pin 0 (RX), pin 1(TX) and pin 2 (change of the transmission mode) to the MAX481 chip which was connected to an isolated RS485/USB converter (EX9530) which is connected to my PC running LV 2011.
The idea is to be able to send and receive data from various arduinos over RS485 (half-duplex) . Time isn't so crucial.
I would really appreciate if you could give me some opinions if this idea is realizable? Also with one vi.file?
Would it be working with LIFA if I modify the LIFA_Base.file or LABVIEWInterface.file with an extra address command and an extra command for the change of the transmission mode (From RX to TX and back to RX-Mode)?
Any recommendations where I should put those?
I'm looking forward to your recommendations!
Cheers, Matt
07-11-2013 01:02 PM
An alternate approach for connecting multiple Arduinos to Labview is to use I2C instead of RS485. See:
<http://hacknmod.com/hack/how-to-connect-multiple-arduino-microcontrollers-using-i2c/>
hrh1818
07-11-2013 03:31 PM
Hi hrh1818,
thank you very much for your message.
I was also thinking about I2C, but in my design I forgot to mention that each arduino has to be galvanic isolated, i.e the communication over the MAX481 chip will be isolated and each arduino will get his own power supply and ground. Besides each of the arduino will have his own I2C - DAC.=)
But still thanks for the links! It will help me to establish the connection between arduinos and I2c-DAC shields.=)
07-13-2013 11:49 AM
Hi,
I would like to post my LIFA code specified for RS485 half duplex communication and the modified .vis.
I did following changes to the codes and unfortunatelly I cannot get any response from my Arduino. The Send Receive.vi seems not getting any data in Labview or serial monitor from the Arduino when the correct ID is selected.
In the LIFA_Base.ino, I included following variables and functions:
int rx2txPin = 2; // defines the transmission PIN
pinMode(rx2txPin,OUTPUT); // here or in the header file?
digitalWrite(rx2txPin, LOW); // => receiving mode of the MAX481 Chip
In the LabViewInterface.ino I add following:
If received ArduinoID=0x05 is correct, the arduino should continue; if it is wrong should do nothing.
4. To every command from the Serial.class (flush, write, print) inspite of Serial.available() I've attached following commands in the following structure:
digitalWrite(rx2txPin, HIGH); /Enables the SEND MODE of PIN 2
Serial.flush();
delaymicroseconds (207); //Arduino needs to wait until the transmission is complete before changing the transmission mode
// wait 2 characters: 1/9600=104,16us => 209us
digitalWrite(rx2txPin, LOW); // Back to the listening mode
Within Labview I did following changes:
Do you see errors in the arduino addressing procedure or code?
Why is arduino not answering?
Here the Link to my modfied LIFA files:
https://www.dropbox.com/sh/tcst317gla2fz2l/PW9xjPrKNG
10-10-2013 10:38 AM
I try to connect a couple of Arduino via RS485. I have read many posts, but the discussion often ended without success. The slaves should send the measurements to the master and then evaluate over Labview. Does it make sense to program the master so that it appeals to the slaves and collects the information, or is it easier to solve it with Labview (The Management). I also read a lot about the Modbus, would this be possible ?
It would be great if someone could help me or give me an advice.