I/O Ports

A Dr. Taylor Tutorial

       ser  r16        ; Sets all the bits in r16 to 1 (r16 = 255)
       out  DDRB, r16


       ldi  r16, 0xff
       out  DDRB, r16
       out PORTB, r17   ; sends value of r17 to PORTB


       ldi  r16, 0x00
       out  DDRC, r16
       in  PINC, r17   ; sends value of PINC to r17

Mixed I/O and Masking

       ldi  r16, 0b00001111
       out  DDRA, r16
       andi r16, 0x0f  ; masking operation that clears 4 most sign. bits
       out  PORTA, r16

Pull-up Resistors for Input Ports

       clr   r16
       out   DDRA, r16  ; Configure PORTA as input on all bits
       ser   r16
       out   PORTA, r16 ; Enable pull-up resistors for all input bits on PORTA

Tutorials for Other Courses

Additional Links

Site Mirror

This is a mirror to be used when http://myweb.msoe.edu/taylor/, (EDU instead of US) is not available.