12-21-2014 07:22 AM - edited 12-21-2014 07:29 AM
Hi everyone!
I am using Arduino from 2 zigbee. Ive attached my program.
When I highlight the execution I get a correct reading which is:
31.2
30.75
30.50
in both node A and B.
But when I turn off the highlight execution I get a reading like:
3
30
31.
I dont know why it is like that. Im quite new to LabView and I based my program through research.
Oh and if you have any suggestion to improve my program please feel free to tell me. Especially on the part of if it is equal to A or B, I dont know other way for it.
If possible are there function like if else statement.
Thank You!!
12-22-2014 01:39 AM - edited 12-22-2014 01:40 AM
Hi,
There is no synchronisation between youre program and the device you read.
At moment x you look at the number of bytes received and read those bytes. How do you know your device is ready ?
The easiest way is to use the termination character but it depends on what the other side sends. Or the answer must be of fixed length's than you can wait for a number of bytes to be ready.
btw. 'serial is never too fast'
Kees
12-22-2014 07:21 AM
Since you are using an Arduino, change that code to send an End Of Line character (0xA) at the end of each transmission. Do NOT use the Bytes At Port. The VISA Read will stop reading when it reads the given number of bytes, finds the termination character, or times out, whichever happens first. So use the termination character. Just tell the VISA Read to read a lot more bytes than you would expect (like 10).
01-01-2015 10:48 PM
Hi. I tried to use the function End on Reads, nothing happens, I cant read any of my data.
The zigbee sends:
Serial.print(temp);
Serial.print('\n');
temp is the temperature data.
In synchronization for labviwe and the device. What are the methods to do this?
sorry new in labview
01-02-2015 02:27 PM
Hi,
To all, Best wishes for the new year.
You should enable the termination character. Now it is set to false. Set it to true. One of the input of the VI 'Configure serial port'
Kees
01-02-2015 02:35 PM
01-03-2015 10:11 PM - edited 01-03-2015 10:13 PM
Hi guys! thank you for your reply.
I tried to use this:
http://digital.ni.com/public.nsf/allkb/6E2C88C43C76A77386256975006DB10A
the disable.vi for me to see what the read actually reads.
It reads:
øB33.
¦HøD
5
…D
I should expect to receive:
A33.25
B23.50
A33.50
stuff like that. I gives me othe characters.
BUT... When I ' highlight Execution' it gives me a value of:
A33.25
B23.50
A33.50
And sometimes a blank space. How is this?
01-04-2015 06:26 AM
The linked VI still has a disabled termination character. You should enable the termination character by setting the constant to true.
01-05-2015 05:36 AM
@shogunato3 wrote:
It reads:
øB33.¦HøD
5
…D
I should expect to receive:
A33.25
B23.50
A33.50
1. As has been repeatedly said, turn on the termination character.
2. Are you constantly setting up the port? That's what it looks like to me since you are getting "weird" characters (usually a symptom of having the wrong baud rate and/or the data frames being out of synch). If you are using the Run Continuously button, stop that. You should have a loop around your read section of code. Also be sure to close the port after that loop.
01-05-2015 06:01 AM
Maybe this will help. I changed your VI. Added a while loop. It far from good but I think this will give you a better result.
Try to learn from others.......