simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Simulavr-devel] PortE:Invalid write access to RWWriteToFile register w


From: zhengxiangwei
Subject: [Simulavr-devel] PortE:Invalid write access to RWWriteToFile register with value‏
Date: Fri, 6 Apr 2012 19:39:30 +0000

Hi, everyone.
   I encouter a problem to use Port Eof atmega128 in simulavr. Maybe it is a 
bug of simulavr or compiler.
The problem is I cannot write DDRE.(memory address rw[22])
   
Here is a simple code. It sets portE as output and sets the output value as 1,0 
and 1.
 * (volatile char * )0x22 |= (1 << 0);  //DDRE0  output

* (volatile char * )0x23 |= (1 << 0);  //PORTE0 1
* (volatile char * )0x23 &= ~(1 << 0);  //PORTE0 0
* (volatile char * )0x23 |= (1 << 0);  //PORTE0 1

When the simulation run until  * (volatile char * )0x22 |= (1 << 0);  //DDRE0  
output. It stops. 
When I press "Enter", it shows.

Invalid write access to RWWriteToFile register with value 
                                                          .
1216 LEDS 1
1218 LEDS 1
1220 LEDS 1

The error is showed in "specialmem.cpp".
I also test Port A,Port B,Port C,Port D. They are all OK. And initialization of 
Port E(in atmega128.cpp) are also OK. 

I also try to read the value of DDRE use the following code. And it works.

if( * (volatile char * )0x22 ==0);  //check DDRE0  output



* (volatile char * )0x23 |= (1 << 0);  //PORTE0 1

* (volatile char * )0x23 &= ~(1 << 0);  //PORTE0 0

* (volatile char * )0x23 |= (1 << 0);  //PORTE0 1




It is very wierd. Because the same code works on real board.
I suspect it is problem of simulavr or avr-gcc

BTW
I use avr-gcc to compile.
avr-gcc -mmcu=atmega128 testpio.c


If you have any advice, please let know and I will appreciate it.
Thank you.

 =================================
Xiangwei Zheng
Research Assistant
ECE Department, Virginia Tech
Office: Durham Hall 377
Tel: 540-553-6235

                                          


reply via email to

[Prev in Thread] Current Thread [Next in Thread]