03-04-2019 09:44 AM
Dear LabVIEW members,
I'm trying to plot a force graph by reading real time data from the sensor. I use an Almemo device for measurement. According to that, in order to obtain the current value, you need to query with the command 'p'. Hence first I do VISA Write with p and then VISA READ.
Problem:
As shown below, I concatenate the strings with the previous(similar to shift register) with a feedback loop. Then it works fine and I can take one single long string with values.
What I want is finally to plot these values Real time on a XY Graph. For that i need to get only the value not the whole string of values. When I get rid of this and if I try "match string" it sometimes, matches and sometimes don't. (figure as follows)
Could the forum members please help me.. I'm really stuck from this point.
Thank you . I have also attached the vi if needed (2015)
Best,
Shane
Solved! Go to Solution.
03-04-2019 09:52 AM
Hi Shane,
why do you collect all the received data to a huge string? Why not handle the received message, parse it's data and forget about it?
Does your device always echo with the command? What's the char before the "p"? (Show your response in \-code or hex display mode.)
03-04-2019 10:09 AM - edited 03-04-2019 10:14 AM
Dear GerdW,
1. Thank you very much for the support you are giving..
2. My intention was also to get data first as string and then prase it to double, double, string.
But if I don't use the feedback loop, the device outputs, the following.. (i have added the /display for you to analyse) I don't understand why. the correct value always comes at the second iteration. at the first iteration it comes only - 03p/r/n
03-04-2019 10:17 AM
Because somehow your system is echoing the command you sent out.
Is this an RS-232 port? An RS-485? Does the device have any Echo ON settings?
Don't use feedback node. Just read 100 bytes. If you find the response is equal to your command you wrote, then read another 100 bytes. Parse that.
03-04-2019 10:34 AM - edited 03-04-2019 10:47 AM
Device says output- RS232 via USB. Yes you are write. that's an echo. I don't see any echo setting in the device though.. To an earlier device, this problem wasn't there since I used, Instrument IO Assistant. And in the code created there was an exit condition as such.. Maybe this helps for you to understand the prob. better.
03-05-2019 02:12 AM
While thanking both, @RavensFan and @ GerdW for pointing out the initial problem of echo so I could start looking for help on internet.
My solution is put here for someone in future..
You both were right.
1. To use two visa reads. (one for the echo and one for the data)
2. If command is appended as <command>\r\n in the hypertext terminal.
Best,
Shane.