Go Down

Topic: Trouble shooting Serial Interface (Read 2659 times) previous topic - next topic

hrh1919

Object, send a string like "123,456H" from a Labview VI to an Arduino Uno board and have the Arduino Uno board return the string "All fields received 123,456".   The problem is no results are being returned when Labview sends this string.

When Arduino's Serial Monitor is used to send the string "123.456H" the correct results are returned.  The Free Serial Port Monitor shows that the same string is being sent from the Labview VI and the Arduino Serial Monitor to the Arduino Uno board .  And the Free Serial Port Monitor shows no data is returned when Labview is used.  The Arduino Uno board acts like it is not reading the "123,456H string when Labview is used.

Hence my question is why doesn't the Arduino Uno board respond when Labview is used?  What additional things should I do to trouble shoot this problem?

Howard

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

hrh1919

Here is the sketch used with both Labview and Arduino's Serial Monitor.

/*
* SerialReceiveMultipleFields with textFinder
* This code expects a message in the format:  12,-345H
*/

#include <TextFinder.h>

TextFinder  finder(Serial); 
const int NUMBER_OF_FIELDS = 2; // how many comma seperated fields we expect                                           
int values[NUMBER_OF_FIELDS];   // array holding values for all the fields

void setup()
{
  Serial.begin(9600); // Initialize serial port to send and receive at 9600 baud
}

void loop()
{
  int fieldIndex = 0;            // the current field being received

  while(fieldIndex < NUMBER_OF_FIELDS)
    values[fieldIndex++] = finder.getValue();     
  Serial.println("All fields received:");
  for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
    Serial.println(values[fieldIndex]);               
}


Howard




Nick Gammon

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

You may find this helpful:

http://www.gammon.com.au/serial
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

hrh1919

No, the Gammon article on using serial communications did not help. 

Any other suggestions?

Howard

WizenedEE

Try doing the loop-back test to make sure LabVIEW really is sending what you told it to. You'll need to write some more labview code (I don't think you can use the serial monitor because only one thing can connect to the serial port at a time) to just read the port and display it (but that's easy)

hrh1919

I performed the loop back test with both Arduino's Serial Monitor and a Labview Basic Serial Write and Read VI.  Both the Serial Monitor and Labview were able to read the transmitted string.

Any additional suggestions on why an Arduino Uno won't respond when Labview is used.  But will respond when the Serial Monitor is used and the same string is sent to an Arduino Uno board?

Howard

WizenedEE

Show us a picture of the labview code.

hrh1919

Attached is a copy of Basic Serial Write and Read.VI.  This VI is an example that is included with most versions of Labview and was used during the loop back test. 

Howard

WizenedEE

Well I'm not sure about other people, but I don't have a copy of labview on my computer so I can't help unless you post a picture.

hrh1919

Attached are two files showing the Basic Serial Write and Read Vi Block Diagram.  One is a PNG file that gives an overall view of the block diagram.  The other is a PDF file that may be used to provide a close up view of a parts of the block diagram.

Howard

tuxduino

Sorry for the stupid question, but did you double check the serial port settings in both Arduino and LabView ? Maybe there's a mismatch there...

hrh1919

Before I ran into this problem of Arduino not being able to read a string sent from Labview I was able to read a string sent from Arduino to Labview.  Both setups use the same 9600 bits per second, no parity and 8 data bits parameters.  The Labview read test was conducted with a simple sketch that only transmitted data from Arduino.  Hence I am convinced the serial port settings match. 

Howard

tuxduino

So... you send a string to the Arduino, wait for some time, then read the string back. Is this correct ?
Maybe you need to increase the delay between send and receive, to give the Arduino enough time to send back its response...

my 1 cent...

Go Up