V
V
Vlad Zaitsev2015-05-20 00:51:30
hex
Vlad Zaitsev, 2015-05-20 00:51:30

How to turn DEC representation of a two-byte variable into HEX?

With a LUA script, I read two bytes from the device. But the problem is that the script outputs the value as a two-byte variable (that is, from zero to 65535), and I need to get two separate bytes (it can be in the form of a string, it can be immediately in the HEX representation). I'm not strong in lua. You can't get into the script, it's in the firmware.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Martyanov, 2015-05-20
@vilgeforce

lo = word & 0xFF
hi = (word >> 8) & 0xFF

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question