LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino and myRio communication delay issues

I connected Arduino and myRIO via UART, there is successful communication between them. I've connected I2C sensors to arduino and I'm reading these sensors' data from Arduino to myRIO, not writing anything to Arduino. The baud rate for both devices have been set 9600.

My labview program is attached below. 

 

The problem is that there is correct data transfer between both only when i set a delay value of around 100ms in Arduino and 150ms in labview program. If i set the labview program delay to zero, data transfer does happen but not properly. The 'string data' is fine but in the 'depth sensor' and 'IMU', there is a 0 value after every 3-4 incoming values. And sometimes even the values are not correct.

 

 

Is this because of the difference between the data execution rate between myrio and arduino? Or is it anything related to UART communication?

 

0 Kudos
Message 1 of 2
(755 Views)

I probably have no business rendering an opinion here, because I've never worked with Arduino's, but have worked with VISA devices and myRIOs, and have also had very mixed feelings about Express VIs.  Here are some comments:

  • Why are you using such a slow Baud rate?  I used 9600 back in the days of minicomputers and telephone modems (which "whistled" at each other when the connection was made).  I remember splurging for a 57,600 baud modem to speed up connection to a time-sharing PDP-11.  I would expect the myRIO and Arduino would be able to handle 115200 ...
  • What do you know about using VISA in LabVIEW?  There have been a number of NI Week Talks, discussions on this Forum, etc. by @crossrulz and others discussing the proper way to use VISA communication.  One is to set a Termination Character (default, I believe, is LF) and to never use "Bytes at Port", but rather a 10-second TimeOut on Reads of 1000 Characters (or, if you like binary, 1024 characters), expecting a much shorter "terminated" line.
  • The problem is that the UART Express VIs violates several of the LabVIEW VISA "best practices".  Maybe this is necessary for Arduino, but I'm betting that "Arduino can speak Ascii" and isn't speaking "binary".  If that's the case, you need to get rid of the Express VI and write proper VISA code.

Bob Schor

0 Kudos
Message 2 of 2
(727 Views)