looks it works much better if I initialize the stack pointer... sorry!
ldi R16, LOW(RAMEND)
out SPL, R16
ldi R16, HIGH(RAMEND)
out SPH, R16
sei
Reply by sap●October 3, 20042004-10-03
in fact, it seems it bahaves like if Reset occurs immediatly after
Timer0Overflow.
but I still do not know why.
Reply by sap●October 3, 20042004-10-03
Hi,
I am wondering what happens here, like if code would run in the background
:-)
If I run this code (initialisation part being removed to clarify), PortB.2
remains low:
Timer0Overflow:
reti
Reset:
...
sei
cbi PORTB, 2
Main:
rjmp Main
And if I run following, PortB.2 goes low but immediatly after, et goes high
again (seen on my scope):
Timer0Overflow:
cbi PORTB, 2
reti
Reset:
...
sei
Main:
rjmp Main
In this second case the AVR behaves like if I would have cbi then sbi.
So, who is raising my PortB.2 output?
Regards