04-06-2018 05:15 AM
We actually want to get continuous data from micro-controller 89C51 in labview through serial communication via RS232.
But in labview we are not getting continuous data from read buffer.
It is first reading data but then untill the next data it is not giving any output.
kindly check the below video.
Please help in this regard.
Solved! Go to Solution.
04-06-2018 05:50 AM
No video... A VI will be more useful.
04-06-2018 05:55 AM
@pdpanchal05 wrote:
We actually want to get continuous data from micro-controller 89C51 in labview through serial communication via RS232.
But in labview we are not getting continuous data from read buffer.
It is first reading data but then untill the next data it is not giving any output.
kindly check the below video.
Please help in this regard.
Kindly check the attached video.
04-06-2018 06:39 AM
wiebe@CARYA wrote:
A VI will be more useful.
And just as useful would be a definition of the syntax the microcontroller is using to send the data out. Is it raw binary/hex data? Is the data converted to ASCII before being sent out? Is there a termination character such as a Line Feed?
But in general, DO NOT USE THE BYTES AT PORT!!!!!!!!!!
Based on the code you shared, the message is in an ASCII format. So it should also have a termination character. So just tell the VISA Read to read more bytes than you ever expect in a message. When the termination character is read, the read will stop. This is how you know for sure you got a complete message.
04-06-2018 06:52 AM
@crossrulz wrote:
wiebe@CARYA wrote:
A VI will be more useful.
And just as useful would be a definition of the syntax the microcontroller is using to send the data out. Is it raw binary/hex data? Is the data converted to ASCII before being sent out? Is there a termination character such as a Line Feed?
But in general, DO NOT USE THE BYTES AT PORT!!!!!!!!!!
Based on the code you shared, the message is in an ASCII format. So it should also have a termination character. So just tell the VISA Read to read more bytes than you ever expect in a message. When the termination character is read, the read will stop. This is how you know for sure you got a complete message.
Actually, I don't know about this "Is there a termination character such as a Line Feed?"
Yes, it is converted to ASCII then it is being transmitted.
If we remove !!!BYTES AT PORT!!! then what should be used as an alternative?
And how to add the termination character?
If its possible then can you edit the same file and send the .vi file.
04-06-2018 07:52 AM
@pdpanchal05 wrote:
Actually, I don't know about this "Is there a termination character such as a Line Feed?"
Look at VISA init. It has a termination character and a Boolean (that is IIRC true by default).
If we remove !!!BYTES AT PORT!!! then what should be used as an alternative?
A termination character. Tell the read to get 10000 characters, and if the termination character is configured, it will stop when it is encountered.
There are two simple ways: 1) use end termination characters, 2) send the length of the message with a known number of bytes, read those number of bytes to get the length of the message, then read the message.
2) works better for binary data, but can go out of sync and is hard to recover when it does.
And how to add the termination character?
Configure it in VISA Init...
If its possible then can you edit the same file and send the .vi file.
It is possible, but it's better (for both our schedule and your learning curve) if you try first.
04-06-2018 09:14 AM - edited 04-06-2018 09:25 AM
wrote: If we remove !!!BYTES AT PORT!!! then what should be used as an alternative?
Did you not read all of my last post? I clearly stated to use a number that was larger than the number of bytes you ever expect in a message.
@pdpanchal05 wrote:
Actually, I don't know about this "Is there a termination character such as a Line Feed?"
You have to know the protocol the microcontroller is using or you cannot reliably talk. The question is simple: What is the exact format of the message that is being sent to you? In regards to the termination character, the question is: Does the microcontroller add an End Of Line or some other indication that the message is over? With an Arduino this is done for you when you use the PrintLn command (adds a Carriage Return and a Line Feed to the end of the message). Perhaps your microcontroller is doing something similar. If it is sending ASCII data, then it really needs to either use a termination character or set the message to be a fixed size, the preferred being the termination character since it help alleviate offset issues.
@pdpanchal05 wrote:
If its possible then can you edit the same file and send the .vi file.
It is definitely possible. I cleaned it up quicker than it took me to type all of this up.