LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert "8 byte, 2's complement, Least significant byte first" number into a decimal number?

Solved!
Go to solution

your vi is missing. Wait your text is missing too

0 Kudos
Message 21 of 29
(1,711 Views)

Here's the screenshot of the front panel and the block diagram. For some reason, i can't get he vi upoloaded.

 

http://www.thinksrs.com/downloads/PDFs/Manuals/RGAm.pdf

According to the user's manual (see the pdf), "The ion current is expressed in the usual format: 4 byte long, 2's complement integer in units of 10-16 A, with Least Significant Byte transmitted first."

 

RGA Scan.PNGRGA_scan block.PNG

0 Kudos
Message 22 of 29
(1,700 Views)

Please make a right click on the string indicator in the display array and select "Hex Display".

 

Thanks,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 23 of 29
(1,697 Views)

Didn't realize it was that easy.

 

RGA Scan.jpg

 

0 Kudos
Message 24 of 29
(1,687 Views)
Solution
Accepted by topic author rosh

If you take a peak at my previous post there is a driver for that device.  The driver DOES have serious issues and probably should not be used as is.  If It was me, I'd use it to guide me in helping to interperate the poorly worded areas in the manual and redo it as a VISA Plug-n-Play (Project) style driver.  The cast to signed integer makes little sense   The manual and driver as shipped differ in implementation but try  the following

 

Do not enable the term character in the VISA session properties (the character used for termination is a valid value that will sometimes be seen in the data--a poor choice on the developers part)

Clear buffers

Send measurement request

read the number of characters expected in the response (4 per measurement)

Cast string read to array of U32 (don't bother reversing)  and don't use a signed integer-  It is impossible to get negative absolute pressure. (the universe really does not suck)

Multiply by 1e-16 to get a value in Amps- use the existing driver and maunal as guides on how to convert Amps to the the pressure unit you want. 


"Should be" isn't "Is" -Jay
Message 25 of 29
(1,686 Views)

This seems to be working. Thanks Jeff and everyone else tried to help.

RGA_scan block.PNG

0 Kudos
Message 27 of 29
(1,665 Views)

Do make sure you close down that VISA session after your loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 28 of 29
(1,662 Views)

No problem.  Once you showed your front panel with the hex values it was a big clue that the values were returned in descending order of significance.  (these 0000's would almost have to be the high order bits right?).

 

The Handshaking flow control sould work better for read write end of message in this case anyway I can't imagine why they do a CR LF with flow control enabled.  But I've often given up trying to figure out what some firmware engineer was thinking.  Perhaps they all got trained in the 1950s and just keep using the same code over and over.

 

Now get some proper error handling on your functions and have fun with LabVIEW.  (Sub vi's in a driver should pass any incomming errors unchanged or debugging your vis gets "Painful")


"Should be" isn't "Is" -Jay
Message 29 of 29
(1,652 Views)