Thomas Jude

Accessing internal registers and port bits

Discussion created by Thomas Jude on May 28, 2009
Latest reply on Jun 24, 2009 by Giacomo Petrini

I am using MC56F8013. I am very familar C30 complier of Microchip MPLAB. In C30 we can access any register with simple keywords. When we include the appropriate header file we can access any registers. For example ADCON1 register can be accessed like:

 

ADCON1 = 0x1234;

value = ADCON1;

 

And any port pin can be accessed like this:

 

_LATC13 = 1;

 

will make port bit 13 of port C.

 

We can make it more clear with

 

#define     mainsLED     _LATC13

#define     mainsPin     _RC14

 

if(mainsPin) 

   mainsLED = 1; 

else

   mainsLED = 0;

 

My question is: how to do it in codeWarrior? How can we access the internal registers of MC56F8013? For example one of the register related with ADC is CTRL1. So which file is to be included so that:

 

CTRL1 = 0x1234;

 

will not give any error message.

 

I need to access (read and write) port pins, and give names to port pins. How to do that? Which file is to be included?

Outcomes