Arduino and LabVIEW Communication - Strange behavior

Hi y'all,

let me get right into the topic.

Right now i try to use the Arduino Genuino Micro to work with LabVIEW.

Things work perfectly when i use a terminal or console.

The Programm works like this. If i send a 'f' char i get 'ok' as an answer. If i send a '?' i get the output 'A100'.

char receivedChar;
boolean newData = false;


void setup() {
  Serial.begin(9600);
  Serial.println("Arduino is ready!");

}

void loop() {
  recvOneChar();
  if(receivedChar == 'f' && newData == true)
  {
    Serial.println("ok");
  }
  if(receivedChar == '?' && newData == true)
  {
    Serial.println("A100");
  }
}

void recvOneChar()
{
  if (Serial.available() > 0)
  {
    receivedChar = Serial.read();
    newData = true;
  }
  else{
  newData = false;
  }
}

Now to the strange thing, when i work with a terminal program like "Serial Input Monitor" or "H-Term" the device responses as it should. You can see it in the picture with the text "Terminal".

Now it gets iexciting, when i send the same strings with LabVIEW, i get different responses. It look like lag.

The first message is always correct. When i try an other character it responses with the wrong responses. See the picture with the text "LabVIEW". The problem is, this only happens in LabVIEW and nowhere else.

Any ideas?

Error_labVIEW.PNG

Does LabVIEW keep the Serial port open or does it open it, send a value then close it ?

Does LabVIEW send Carriage Return and/or Linfeed at the end of the message ?

Hey HeliBob,

thank you for your time.

LabVIEW opens the Port once and doesn't close it until LabVIEW is closed.

The Serial Monitor does keep track if a port is opened or close.

I just wrote the new code for the Arduino, so it returns everything that it reads. Well the result is a bit confusing.

It is still the same, in both scenarios they get the same Strings, yet behave differt. I just have no clue what is it that LabVIEW does differntly. I mean the just send the exact same thing, how comes that it doesn't yield the same results?

I tried a version with a termination character, still the same result.

Thanks again for your time!

Terminal_PART2.PNG

Please post the output of every byte received by the Arduino from a terminal emulator and from LabVIEW

I have no idea what I am looking at in the pictures that you have posted

How do you keep track of the serial port if the Serial monitor or LabView is open?

And luckily we're talking strings here, not Strings.