AVR register from C program

Status
Not open for further replies.

Diamant

Newbie level 6
Joined
Oct 23, 2003
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
113
Im working with avr300.asm file from Atmel (software master I2C). Simply make it accessible for IAR AVR C. Conversion between Atmel assembler to IAR assembler was succesful.
The assembler program uses R16-R18 registers in my 2313 AVR chip to store variables.
I need to write and read these registers from my C program.
Is there a way to create pointers at R16-R18 registers in my C program?
may be there is another more simple way to achieve registers?

Thanks
 

Hi diamant,

i think the registers are located in the ram space.
so u can access them with pointer. Try this code:

void main(void)
{
char *p;
p=(char *)0x00;// Register 0
*p=10;
}
 

revolt
Bingo, Thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…