View previous topic :: View next topic |
Author |
Message |
Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
Constants used to identify pins in the header files? |
Posted: Tue Feb 06, 2007 3:35 pm |
|
|
How does this number work?
I have tried all the ways that I can think of to get this number.
Like for Pin_B3 for the 18F4550 this is at address F81.2
The header file has 31755?
Thank all Tom |
|
|
kamputty Guest
|
|
Posted: Tue Feb 06, 2007 3:50 pm |
|
|
F81.2 = memory address F81 bit 2
F81 HEX = 3969 DEC
31755 = number of BITS, so the byte is 31755/8 = 3969.38 or 3969 BYTES with a remainder of 3, or the 3rd bit.
The numbers in the header file are BIT based (at least the pins!)
Yes?
~Kam (^8* |
|
|
Ttelmah Guest
|
|
Posted: Tue Feb 06, 2007 3:56 pm |
|
|
The number, is the register address, times 8, plus the bit number. Pin B3, is 0xF81.3, not 0xF81.2.
0xF81, is 3969 in decimal. Times 8 gives 31752. Add three for the bit number, gives 31755.
Best Wishes |
|
|
Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
Thanks All |
Posted: Tue Feb 06, 2007 4:01 pm |
|
|
I knew that it had to be straight forward.
Thank
Tom |
|
|
|