Pages: [1] 2   Go Down
Author Topic: Trouble shooting Serial Interface  (Read 2389 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26248
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't see any code.
Logged

"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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18737
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Read this before posting a programming question

Code tags please.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18737
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You may find this helpful:

http://www.gammon.com.au/serial
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Any other suggestions?

Howard
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Show us a picture of the labview code.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* Basic Serial Write and Read.vi (26.2 KB - downloaded 14 times.)
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* ScreenHunter_07 Oct. 07 17.04.pdf (173.41 KB - downloaded 44 times.)

* ScreenHunter_07 Oct. 07 17.04.png (62.9 KB, 1024x768 - viewed 35 times.)
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Pages: [1] 2   Go Up
Jump to: