Microprocessor and Development Tools - Embedded Control - Communications - Connectivity
   
Low-Cost Dev Kits
Application Kits
RabbitCores
Latest Downloads
Single-Board Computers
Rabbit Support Forums
Training/Events



Support > Ask Larry > September 27th, 2007

Ask Larry

Dear Larry,

I am rather curious about this 0x84 in my code. Can you explain to me the significance of 0x84?

Hector G.

Well Hector, the 0x84 that you are seeing is a hexadecimal number. We use this system because it makes it easier to read the bits at a glance. We found that it helps to speed up the development process. Take a look at this table:

HexBinary
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111

Each hexadecimal digit is 4 bits and two digits gives us a full byte.

Some examples:

0x00 = 0000 0000
0x40 = 0100 0000
0xAC = 1010 1100
ox84 = 1000 0100

Being able to see the value of each bit is especially useful when we want to look at a register.

For example look at the following statement:

WrPortI(SPCR, &SPCRShadow, 0x84)

It writes "1000 0100" to the bits of the SPCR register.

Looking at the Easy Reference Poster and finding SPCR on the right side under SLAVE PORT we can decode what the bits are doing.

Bit 7 - 0 (program fetch as a function of smode pins)
Bit 6 - 0 (ignored for Write)
Bit 5 - 1 (ignored for Write)
Bit 4 - 0 (always zero)
Bit 3 - 0 (Disable slave port - port is byte-wide input)
Bit 2 - 0 (Disable slave port - port is byte-wide input)
Bit 1 - 0 (Priority 2 interrupt)
Bit 0 - 1 (Priority 2 interrupt)

I hope that explains why hexadecimal is so useful. Good luck with your application!

- Larry C.

Larry Cicchinelli is Rabbit Semiconductor’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.

Submit your questions for Larry via email at AskLarry@rabbit.com

Read more Ask Larry Answers




   Site Map | Privacy Policy | Contact Us | Feedback Copyright © Rabbit All Rights Reserved    A Digi International® Brand  
View Cart | Contact Us
View Cart
Products Solutions Support Company Channel partners Careers Ordering Information