10-24-2006 11:52 AM
Hi
I am trying to read the data coming out of a torque meter, (microtec systems MT-TRA1000).
I have no trouble getting the data into my labview, so the I know my serial setting are correct.
my problem occurs with the data it's self, reading from the serial port I can obtain the following
-00.00a+0000.0d
where the first reading is the torque (a) and the second is the angle(d). This was gathered by simply setting the 'bytes to read' to 15.
However the data is streamed constantly from the meter to the com port and the following randomly occurs
0000.0d-00.00a+
This is most unwelcome as it give false readings.
Increasing the number of 'bytes to read' reduces the problem but does not solve it.
Can any one help?
Do i need to sync / lock the data?
Many thanks
Jamie Sayers
10-24-2006 11:55 AM
Please see attached vi
10-25-2006 06:56 AM
I can't open you sample, however here are some thoughts:
If your device send continiusly data, the trick is to sync to the/a termination character if possible, and setup the VISA read until that termination character
Read 90 bytes and have a look at the output string. Are there termination characters send? (switch the diplay to '\-code' mode)
are there /r or /n or both? choose the last char send.
at least you can use the 'd' character.
Oh the termination char and mode of VISA can be set with the propertys (open bytes at port, select the termination properties, and set them to write)
10-25-2006 10:52 AM
Hi Henrik
Thanks for the reply, I have tried syncing on the 'a' and the 'd' by setting the termination character to hex 61 and 64, this did not work all that was returned was random characters
I have changed the output string to display '\code' and below are 90 bytes read back, the data does not contain any standard termination characters.
d-00.03a+0015.9d-00.03a+0015.9d-00.03a+0015.9d-00.03a+0015.9d-00.03a+0015.9d-00.03a+0015.9#
I have all so changed the attached vi to open in labview 8 and 8.2.
Regards
jamie
10-25-2006 02:24 PM
Jamie,
Why not use the "Search/Split String" function to always find the character "d" in the buffered data. Then you know where you are in the stream of data.
10-26-2006 06:59 AM
Hi,
another alternative, especially if you're finding that occasionally the data is coming back different, is to read a character at a time (obviously depending on the rate of incoming data) and then you can doa quick piece of analysis to say if you have the whole message as you'd expect it. (Us a shift register to maintain the string message whilst you haven't hit the end of the message). You can try to do a scan from string, and if you get an error saying it's not matched, then you know the formatting isn't complete yet.
Hope that helps
Thanks
Sacha Emery
National Instruments (UK)
10-31-2006 10:56 AM
Thank you all for replies
I have found the solution scanning for the 'd' character
Regards
Jamie