Forum

Convert decimal value to hex value and back

To control a pan/tilt/zoom security camera I need to send some strings of hexidecimal values to my rs232 port.
I’d like to generate those from decimal values but I can’t find out how to get it in the right hex format.
When I convert with spellvalue and input a decimal ‘0’ I get a hex ‘0’ but the camera needs ‘00’.
Can anyone help me how to convert decimal numbers to two digit hex-numbers?

Second, I need to read the answer from the camera. Which is in hex. How can I convert hex back to dec?

Sorry for my newbe question, there must be a very simpel sulotion for this I suppose.

To control a pan/tilt/zoom security camera I need to send some strings of hexidecimal values to my rs232 port.
I’d like to generate those from decimal values but I can’t find out how to get it in the right hex format.
When I convert with spellvalue and input a decimal ‘0’ I get a hex ‘0’ but the camera needs ‘00’.
Can anyone help me how to convert decimal numbers to two digit hex-numbers?

You can use Pad with size=2, Padding=‘0’ and align=“right”.

Second, I need to read the answer from the camera. Which is in hex. How can I convert hex back to dec?

I think the Ord node with the right Hex format should work.

Once I wrote a bit off text on how I controlled a kramer switch with RS232, I mention all kind off usefull nodes, perhaps it helps.

Thanks for the fast response!

Pad and Ord work great.

Problem solved!