avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] stumped by my ATmega48 (again)


From: David VanHorn
Subject: Re: [avr-gcc-list] stumped by my ATmega48 (again)
Date: Fri, 5 Oct 2007 10:59:52 -0400

What does the compiled code tell you?

I absolutely know that the following will toggle a given port:

ldi R16,$FF
out  DDRx,R16  ;any given port that lives in I/O space, otherwise STS

loop:
out PORTx,R16 ;Similarly, PORTx must be in I/O space, otherwise STS.
ldi  R16,$00
out PORTx,R16
ldi  R16,$00
rjmp Loop

This will toggle the bits so fast that you won't be able to observe it
with an LED though, but you can use a meter, and show roughly VCC/2 on
the pins, proving that it's on half the time.  A couple of NOPs
between the ldi of $00 and the next out would trim that up.




reply via email to

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