11-08-2017 12:36 AM
I'm trying to parse ASCII strings coming from Arduino as :
...
$TIDE,154,154,154.00,104.00
$TIDE,154,154,154.00,104.00
$TIDE,154,154,154.00,104.00
$TIDE,0,154,15.40,-34.60
$TIDE,0,154,30.80,-19.20
...
$TIDE is chosen for identity and followed by 4 numbers seperated by commas, each line ends with CR. Arduino sends data every 100ms through RS232 Shield to computer. I confirm that i receive data when i control with terminal software on PC.
It does not work, any help is appreciated.
11-08-2017 12:56 AM
Hi rockabilly,
each line ends with CR.
Then you should set the CR as Termination Char in the VISASerialPortInit function!
Just read its help!
It does not work, any help is appreciated.
What is "it"? What does not work?
Do you get any error messages? Did you check those errors?
I guess the error will be gone once you use the correct TermChar! 😄
11-08-2017 01:04 AM
Dear GerdW,
There is no VISASerialPortInit Function in my block, how can i add it ? And how to alter the value from 0xA to 0xD ? Sorry cannot find a visual example showing step by step for newbies.
Thanks.
11-08-2017 01:10 AM
11-08-2017 02:19 AM
Thank you, able to see values now on both four gauges. I also lowered the number to "250" attached to metronome symbol. But still buggy :
- Arduino sends ASCII data every 100ms
- LabView is showing them with delays (eg. i move the sensor but labview still show the old values with many delays, i also confirm it from debug line on bottom)
- All datas are set to zeros every second, so wrong values are shown
Thank you
11-08-2017 02:29 AM - edited 11-08-2017 02:29 AM
Hi rockabilly,
Arduino sends ASCII data every 100ms … LabView is showing them with delays … All datas are set to zeros every second
This is because of your "metronome" function! Get rid of this!
The VISARead will be sufficient as it already waits for the next message from your Arduino - that's one advantage of using a TermChar!
(You should also put some error handling in the loop, otherwise it might spin as fast as possible on error…)
11-08-2017 02:53 AM
I added termination char. as attached photo and removed metronome, but problem still continues, it goes to zero sometimes even data flows. My arduino code likes below :
...
ssSerial.print("$TIDE,");
ssSerial.print(sensorMin);
ssSerial.print(",");
ssSerial.print(sensorMax);
ssSerial.print(",");
ssSerial.print(average);
ssSerial.print(",");
ssSerial.println(offset);
delay(100);
...
"You should also put some error handling in the loop, otherwise it might spin as fast as possible on error…"
Could not understand error handling part 😞
11-08-2017 03:06 AM - edited 11-08-2017 03:07 AM
Hi rockabilly,
the problem with images is: we cannot debug them using LabVIEW!
When you want real (and better) help you should attach your VI! (Or atleast a snippet as this contains code too.)
it goes to zero sometimes even data flows. …Could not understand error handling part
Which data flows when you "go to zero"? How does the received string looks like?
Most often you will see the zero when there was a transmission error resulting in a conversion error later on.
To "handle errors" means to react on such errors programmatically!
11-08-2017 03:25 AM
VI exists on my first post, later i removed metronome etc. according to your help 🙂
11-08-2017 05:26 AM - edited 11-08-2017 05:29 AM
The problem still exists 😞