LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading binary result from PM5B VDI Power Meter

Solved!
Go to solution
Solution
Accepted by topic author kurnwin9

Hi GerdW,

 

Thank you for your suggestion.

Yes, now it works. The results in the LabVIEW program have become the same with the reading of power meter' display.

But, I found other problem. The error out always send message '-1073807339' (Timeout expired before operation completed). Everything goes well, why the LabVIEW send the message? Actually this message has appeared since the beginning of the program.

 

Thank you.

kurnwin9_0-1639126977578.png

 

0 Kudos
Message 11 of 14
(685 Views)
Solution
Accepted by topic author kurnwin9

That's because you failed to notice all my remarks. You still request from VISA Read to read 64 characters but there are only 7 per message, 1 for the initial value 6, which is VERY likely the number of bytes that follow and 6 bytes for the actual message.

 

So VISA Read sits there, waiting for 64 bytes and after the timeout expires simply returns you that error that it did not succeed to return the required 64 bytes.

 

You should probably either read 7 bytes, check that the first is 6 and the second is 68 ('D') and then decode the frame accordingly, or you could read first one byte, and use that value as number of characters to read for the second VISA Read. Still check that this value is a reasonable one (6 or any other possible message your device might return) and the next character is really a 'D' before trying to decode the frame.

 

Also note that you do normally not want to open and close a VISA session inside a loop for every iteration of the loop. You rather put the VISA Open before the loop, and the VISA Close after the loop.

Rolf Kalbermatter
My Blog
0 Kudos
Message 12 of 14
(680 Views)

Hi Rolf,

 

Thank you for the suggestion.

 

Best regards,

 

Windi

0 Kudos
Message 13 of 14
(674 Views)

Dear Rolf,

 

I have changed the read byte to 7, put the VISA Open before the loop, and the VISA Close after the loop.

However, other message error is 1073676294 (The number of bytes transferred is equal to the requested input count. More data might be available).

The error message appear after I press stop button, but when I press abort execution to stop the mesaurment, the error did not apper.

 

 

Best regards, 

 

Windi

 

kurnwin9_0-1639137522211.png

 

0 Kudos
Message 14 of 14
(666 Views)