Hi,
The controller that I am using is MCF52259.
1) How can I read the general purpose register "D0"?
2) Is mcf5225.h the header file to be used for type definitons of the registers?
If YES,
--> The reset control register of M52259 is an 8 bit register, whereas, the file "mcf5225.h" specifies it as a 16 bit int.
" uint_16 RCON; // Reset Configuration Register"
Why is this change? Or is there a seperate header file for M52259?
Thanks,
Chen
Hi.
1) What is 'general purpose register D0' ?
2) Yes, it is used also for definitions of registers.
Reset Configuration Register (RCON) is 16 bit wide register in mcf52259 (MCF52259 Ref. Manual, Rev. 1).
Sorry, my question was not about Reset Config Register[RCON], but Reset Control Register [RCR] in the reset controller module.
I could find it in mcf5222.h as:
------------------------------------------------------
typedef struct mcf5222_cim_struct
{
uchar RCR; // Reset control register
uchar RSR; // Reset status register
.......................
--------------------------------------------------------
But not in mcf5225.h
To access D0 (or any other core processor registers) from C code, you could use inline assembly. Search for 'asm' in codewarrior help. Here is one example given in the codewarrior help:
long int b;
struct mystruct {
long int a;
} ;
static asm long f(void) // Legal asm qualifier
{
move.l struct(mystruct.a)(A0),D0 // Accessing a struct.
add.l b,D0 // Using a global variable, put return value
// in D0.
rts // Return from the function:
// result = mystruct.a + b
}