HEX display


Graphic

Recommended Posts

hi there

i'm working with daqfactory on a little project i need to the for the company i'm working for now.

is there a way that i can convert binairy numbers to hex

for example:

i need to go from 001 binairy to 1 hex

so 0101 binairy is the same as 7

does anybody understand this?

how do i do this in daqfactory

#... i saw i posted in the wrong section, could somebody please move it. sorry for the inconvenience#

Link to comment
Share on other sites

Well it depends. Where is this binary value stored? In a string I presume?

i'm sorry but i have no idea what your talking about about. i'm an intern at this company and they said i should learn how to use this program so that it could be used for controlling and monitoring of machines

so you see, i'm kinda a noob in this.

anyways, what kind of methods do you know on how to archieve this

kind regards

Link to comment
Share on other sites

Well, I've had cases before where customers didn't quite get that binary, decimal, and hex are all the same thing when talking about numbers. They are just different ways of displaying them. Usually are only two cases where you need to actually do a conversion:

1) With ASCII serial communications when the device sends a string containing a hex value and you need to convert that to base 10 (decimal).

2) When you have a number and for some reason you want to see it displayed on screen (or logged) as a hex string.

The key is that the hex values are strings not numbers. A number is a number is a number, it doesn't matter if its hex, decimal, octal or base 23. The computer is going to represent it internally the way it wants and you'll never know. Its only when you want to display it, which requires you to convert it to a string representation, or you want to go the other way and take a string representation and make a number that it makes a difference.

That all said, to convert a string hex value to a number you use the expression:

Evaluate("0x"+var.strMyString)

or if a binary string, use "0b" instead.

Under DAQFactory 5.15 there is no way to display a number as a hex string, but in DAQFactory 5.30 you can use the Format() function:

Format("%x",var.myvalue)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.