LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: read bytes at serial port

Solved!
Go to solution

Hi everybody!

I am trying to read 3 signals in labview but this signals come too slow. I added the function millis() in arduino and try to read it from labview to see what was going on and the thing  is that the seconds were going much slower in labview. After five seconds i could see in labview how the value of variable related to millis had only increased in one second...

I am using labview in my MAC...

thank you in advance

Here  I add my arduino code...

// put your setup code here, to run once:
Serial.begin(230400);
}
char Buffer[16]; 
int sensor0 = 0;
int sensor1 = 0;
int sensor2 = 0;
int sensor3 = 0;

void loop() {
// put your main code here, to run repeatedly:

sensor0=analogRead(0);
sensor1=analogRead(1);
sensor2=analogRead(2);
sensor3=millis()/1000 ;
sprintf(Buffer,"%04i\t %04i\t%04i\t%04i",sensor0,sensor1,sensor2,sensor3);
Serial.println (Buffer);
delay(1000);
}

0 Kudos
Message 21 of 23
(1,115 Views)

Hi carlos,

 

when using \-codes in string constants you should ALWAYS enable the display mode display of the string!

 

Please set the format string constant to "\-code display", then correct your format string…

Also disabling the TermChar should be done once before the loop, no need to repeat that with each iteration. And keep in mind: the VISAConfigureSerialPort already has an option to do that!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 22 of 23
(1,103 Views)

You are right! I also take out of the loop the first element of the link side. This made my loop go much slower.

Thank you very much!!

0 Kudos
Message 23 of 23
(1,087 Views)