Atmega128(l) – Rainbow Electronics ATmega128L User Manual
Page 64
Advertising
64
ATmega128(L)
2467B–09/01
Figure 31. Synchronization when Reading a Software Assigned Pin Value
The following code example shows how to set port B pins 0 and 1 high, 2 and 3 low, and
define the port pins from 4 to 7 as input with pull-ups assigned to port pins 6 and 7. The
resulting pin values are read back again, but as previously discussed, a nop instruction
is included to be able to read back the value recently assigned to some of the pins.
nop
in r17, PINx
0xFF
0x00
0xFF
t
pd
out PORTx, r16
SYSTEM CLK
r16
INSTRUCTIONS
SYNC LATCH
PINxn
r17
Advertising