12-05-2016 05:34 AM
Dear All,
I am new member in this community. And just started learning Labview. I need your help.
I wanted to command a device first (Command string is {M00), and then get data from the same device continously untill desired value achieved. Compare both values continously untill become same. The problem is that, it accepts the command but afterwards it does not display me the current values, and so it never reaches. I tried many things, but all in vain.
Kindly help. Waiting for your kind reply.
Thanks in Advance
Solved! Go to Solution.
12-05-2016 05:49 AM
Hi zahid,
THINK DATAFLOW! is the main thing you need to learn when using LabVIEW!
get data from the same device continously untill desired value achieved
You should program it this way: do something more than once (aka "in a loop") until a condition is met…
Ever tried to debug your VI and watch the DATAFLOW using highlight-debugging?
12-05-2016 06:09 AM
Dear GerdW,
Thanks for your kind reply. I tried getting and commanding in a while loop with some delay but still i don't get any value (from Huber Temp). If i run individually and put a loop, it works. like this:
But when i combined both of giving command and getting data, it does not works.
I am little bit confused.
Kindly help
12-05-2016 06:53 AM - edited 12-05-2016 06:54 AM
Hi zahid,
THINK DATAFLOW!
- Putting "string" control outside the loop seems wrong to me: either put it inside or use a string constant…
- using a 10s wait seems wrong to me
- using BytesAtPort is mostly wrong: you either use a TermChar with an arbitrary high number of bytes to read - or you use a known message length to read…
- using a sequence is just Rube-Goldberg here…
- remove coercion dots in your VI
- the whole string to number conversion looks overcomplicated to me…
Do you get error messages?
Did you debug your VI? Do you receive any string data at all?
12-05-2016 07:30 AM
Some (other) comments on getting data from your instrument:
Bob Schor
12-05-2016 09:16 AM
Dear GerdW,
Thankyou again for your reply. The VI is provided by the vender listed below. They also provide us string codes to command desired value to device or getting current value from device. This VI Works perfect.
When i need to command some value change, i use following conversion. and Give the key string as {M00.
This individually also works fine. And device accepts my custom Temperature.
Another thing is that, when i need to read current temperature, i use following program. With the string input as {M07****. Means to read something. It gives me value in 2 decimal digits. like 12.24. The VI is as follows.
But when i combine these, to do a comparison, as shown in my first origional post... it does not works. I just want to make them work in combination.
I hope you'll understand my point.
Thanks for your help. Waiting for a positive reply.
Regards,
Zahid
12-05-2016 09:36 AM - edited 12-05-2016 09:38 AM
Hi Zahid,
But when i combine these, to do a comparison, as shown in my first origional post... it does not works. I just want to make them work in combination.
In your original post you completely missed THINK DATAFLOW!
And you did not answer my question from message #4…
What exactly "does not work"?
Which errors do you get?
Did you debug your VI?
Hints:
- When those VIs are "vendor supplied" you should use them as subVIs in your MainVI.
- You should not try to read from and write to your device in parallel as been shown in your first post!
12-05-2016 09:37 AM
Zahid,
You ask for help, and both GerdW and I offer suggestions and advice. You ignore what we suggest (you still are using Sequences, you still use <CR> and <LF> constants instead of <CR/LF>, you still use Bytes at Port property, and I am guessing that you also have not tested your own device, which neither of us can do, with MAX), and then ask for more help.
Why don't you take a half hour and incorporate our suggestions? Who knows, you might go a long way to (a) improving your code and (b) solving your problems. At least we would know that you are listening.
Bob Schor
12-05-2016 10:46 AM
Dear Bob Schor,
Thanks for your reply. Sorry for so much questioning. Actually i don't know about MAX. I am a new user of labview. Now i am studying this. I am also trying to implement your's and GerdW's Suggestions. When i end up with these, i will be in touch if i got some trouble.
Thanks for your help and support.
Regards,
Zahid
12-05-2016 10:58 AM
Dear GerdW,
Thanks for your reply.
I want to Run the first command just once (In order to give device a required setpoint of temperature). After that i need to get/Read temperature from device continous basis. And then compare setpoint and actual current temperature. When both are equal, i need a notification. That is all i needed.
When i run these commands individually, i didn't get errors. But when i combine these, Either device does not update the set point or the current temperature command gives value=0. Still i didn't get any error.
I am trying to do it from last few days. But not yet done. I am also following your suggestions...
Regards,
M. Zahid Khan.