What does 'upper' and 'lower' byte mean - IrRemote 4.1.2 Hex Conversion

Hi there, I am trying to figure out how to convert online posted Infrared Remote signals into a Hex address to be used in the IRRemote library.
Example: IrSender.sendNEC(0xBF00, 0xD, 0);// Address, Command, Repeats

I have learnt about Hexadecimals, conversion into binary/decimal and have also familiarised myself with the docs for IRScrutinizer. and the IRRemote Library

The website I am using for the remote button codes gives me parametric values (NECx2 D:7 S:7 F:1) which i can generate into other formats in the Iscrutinizer software . However I am unsure how to make them fit the format for IRRemote 4.1.2, as exampled above.

.

My Issue is the IRRemote docs says that the 'D' and 'S' values will be the upper and lower bytes of the address but I am unsure what this means? Does that mean I make the address decimal 77 meaning in my arduino code the hex is 0x4D or maybe 0x004D? As it does not seem to work?

Quote from the docs:

The codes found in the irdb database specify a device, a subdevice and a function. Most of the times, device and subdevice can be taken as upper and lower byte of the address parameter and function is the command parameter for the new structured functions with address, command and repeat-count parameters like e.g. IrSender.sendNEC((device << 8) | subdevice, 0x19, 2).

Any help will be greatly appreciated! I do also acknowledge it may not even be the correct remote code for my TV, but I would like to understand these terms better anyway, thank you!

Welcome to the forum

In your example the address is 0xBF00 which is a 2 byte integer. The upper byte of 0xBF and the lower byte is 0x00

Does that help ?

1 Like

Hi thank you for the reply and the welcome,

It does help, however I am wondering if you could confirm that it works the opposite way as well? As I am trying to turn Decimal upper byte 7 and lower byte 7 into a suitable IR Remote address Hex value?

Am I correct in assuming that would make 0x004D? as I guessed you would join them into '77' which becomes hex '4D'? Or would it mean literally using 2 bytes of 7: 0111 and 0111 to make 0x77?

Thank you.

7 in décimal is the same in hex, represented on a byte as 0x07

if you combine both, one in the upper byte and one in the lower byte you get 0x0707 not 0x77

1 Like

Awsome thank you so much for the reply and clarification!

That has worked now on my TV using 0x0707 :slight_smile: I didnt realise you needed to do 0x07 for the conversion. But I am glad I was on the right track and I really appreciate your help with it, thank you.

have fun, glad it helped

Have you read the NEC Protocol explanation
https://www.digikey.com.au/en/maker/blogs/2021/understanding-the-basics-of-infrared-communications#:~:text=The%20NEC%20protocol%20uses%20pulse,eight%2Dbit%20address%20and%20command.

Also
https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

Hi no I had not read the explination on the NEC protocol, thanks for the link.

I see where it mentions an 'eight-bit address', that makes sense meaning each upper/lower would be 4 bits.

I guess I was not too sure how to convert '7-7' into 4 bits each. I was trying to use this Hex/Decimal calculator to convert my figures but it only put out 7 as 0x7 instead of 0x07. And when I done '01110111' it gave me '0x77' too.

Edit: Thanks for the extra link, I will have to have a read of that one also!

You're welcome, it's an interesting read
Here is one with more depth

https://exploreembedded.com/wiki/NEC_IR_Remote_Control_Interface_with_8051

Hello :slight_smile:
This post has absolutely nothing to do with this thread, but you, UKHeliBob , said, that you would not like to have PM and that you prefer to answer directly in the forum.
Unfortunately the thread I would like to ask you a question is already closed.
If I open up a new thread - will you read it ? :slight_smile:
Many thanks - and sorry for this interruption.

Flag it as "Something else" and ask for it to be opened again

Upper and Lower Bytes Explained

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.