From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I get an actual hex number from an array. The array to hex converter produces two characters rather than a hex number.

What is the array data type? If integer, all you have to do is right click the control or indicator and choose Hexidecimal from the Format & Precision menu.
0 Kudos
Message 2 of 15
(4,151 Views)
Hello Dennis and Pierre,

I am VERY new to Labview and this is my first project.

More info: I have 8 on/off switches feeding a boolean array. The output of the array goes into a boolean array to number convertor. Then it goes through a Number to Hex string convertor. I have a a Hex String indicator connected to the output to see what is happening. Now I thought that this would produce a Hex number but it doesn't! It produces a Hex String NOT a Hex number.

For instance: If I set the switches to '11111111' the Hex display shows '4646'! If I set the display type to 'Normal Display' it shows 'FF'. If it was a proper Hex number it would show 'FF' when the display was set for 'Hexadecimal Display'.

Hex 46 is Decimal 70 which is the ASCII code for F.

How do I
get '11111111' to give me 'FF' on an Hex display?

Steve.
0 Kudos
Message 4 of 15
(4,151 Views)
The purpose of the "Hexadecimal Display" of the string indicator is to display the hex representation of the characters in the string for debug purposes. It sounds to me that you get exactly what you want using "Normal Display" so why not use that?

If you want a Hex numeric then skip the "Number to Hex string converter" and display the number from the "Boolean array to Number Converter" as Hex by selecting Hexadecimal format from format and precision.

Brian
0 Kudos
Message 5 of 15
(4,151 Views)
Brian,

I want to send the hex number to a scope. I want to send FF and not 4646. The scope doesn't understand 4646 but it does understand FF. I have to ignore what any of the display controls show the number as.

It seemed such a simple thing to do . Turn the output of 8 switches into a hex number and send it to the scope. I'm sure that a few more weeks of playing will make it seem simple but it isn't just yet.

Steve.
0 Kudos
Message 6 of 15
(4,151 Views)
How do you have to send it to the scope? If you have to send ASCII characters then what you have should work fine. If you have to send it as binary then convert the boolean array to a number then put that into a "build array". Next pass the number array into "Byte Array to String" and you should get what you are looking for. I'm not sure if this is the best way to do it, but it works for me.

Brian
0 Kudos
Message 7 of 15
(4,151 Views)
SteveL wrote:

> Brian,
>
> I want to send the hex number to a scope. I want to send FF and not
> 4646. The scope doesn't understand 4646 but it does understand FF. I
> have to ignore what any of the display controls show the number as.
>
> It seemed such a simple thing to do . Turn the output of 8 switches
> into a hex number and send it to the scope. I'm sure that a few more
> weeks of playing will make it seem simple but it isn't just yet.
>
> Steve.

Steve
Take a look at these samples (see attached). Hope, the first one is what
you are looking for.
--
Sergey Krasnishov
____________________________________
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
ht
tp://acs.levsha.ru
Download All
0 Kudos
Message 9 of 15
(4,151 Views)
Sergey,

Thank you. The second VI you sent me is the one I want. I still have a lot to learn but with a little help from you guys I will get there.

Steve Lawson
Chief Technician
York University
UK.
0 Kudos
Message 10 of 15
(4,151 Views)
SteveL wrote:
>
> how do I get an actual hex number from an array. The array to hex
> converter produces two characters rather than a hex number.

Hello,
in my opinion, that's normal. If I interpret your question correctly.
What else is a hex number than a string denoting a value.
Inside memory, numbers are more closely described by the binary notation. Consider the hex notation
just as a shorter way to write those binary numbers.
In your case, a string of 2 characters (ranging from 00 to FF) can describe a number ranging from
000 to 255 (those are decimal strings...) i.e. a 8-bit memory cell.
--
Pierre Meyer                        
Laboratoire de Physique des Solides     
Bt. 510, Universite de Paris Sud         
F 91405 ORSAY, FRANCE               
T : (33)-(
0)1 69 15 60 62
Fx : (33)-(0)1 69 15 60 86
e-mail : meyer@lps.u-psud.fr
homepage : http://www.lps.u-psud.fr/
0 Kudos
Message 3 of 15
(4,151 Views)
Pierre,

there is a distinct difference between a hex number and a hex string. If an indicator is showing a hex number like FF FF FF and you put the cursor in the indicator box, the cursor will move over each pair of FF's in one move because it is treated as a single number. If it is a hex string the cursor will move over each single F because it is a character

Steve..
0 Kudos
Message 8 of 15
(4,151 Views)