Author Topic: Adding new registers to compiler\'s library  (Read 6864 times)

enliteneer

  • Guest
Adding new registers to compiler\'s library
« on: December 11, 2005, 11:56:58 pm »
The Atmel AT89C51 comes in a bigger package (which includes 2 extra ports) that I would like to use.  

However, the Micro-C 8051 compiler doesnt recognize the \'P4\' and \'P5\' declartions, so  Id like to add these to the proper general compiler files.    Is there a chance that the addresses used by P4 (0xC0) and P5 (0xD8) are already assigned to something else.

Which files should these new declarations go in?

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Adding new registers to compiler\'s library
« Reply #1 on: December 12, 2005, 01:25:41 pm »
asm
{
P4      EQU $C0
P5      EQU $C7
}
extern register unsigned char P4,P5;

void main()
{
     int val;
     val = P4;
     P5 = 0
     P5 |=1;
.....      
}

enliteneer

  • Guest
Re: Adding new registers to compiler\'s library
« Reply #2 on: December 12, 2005, 02:49:31 pm »
Thanks!  

Just as a note, if someone plans on bit addressing port 5 (i.e. CLR P5.3), then the D8 address should be used instead of the C7... P5 EQU $D8.

BTW, can this be included in an existing library file so that it can be used across any future projects?