; AVR software UART demo by Randy Ott - 4/22/98 ; Read contents of EEPROM and put result on port B ;***** Global register variables .def temp =R16 ;temporary storage register .def EEard =R17 ;EEPROM address pointer .def lights =R18 ;LED holding register .cseg .org 0 rjmp reset ;***** Program Execution Starts Here .org 16 ;avoid all possible interrupt vectors reset: ldi temp,0xff ;port B pins all outputs out DDRB,temp ldi lights,0 ;turn on all LEDs loop: ldi EEard,0 ;set EEPROM address to 0 EERead: sbic EECR,EEWE ;if EEWE not clear rjmp EERead ; wait more out EEAR,EEard ;output address sbi EECR,EERE ;set EEPROM Read strobe ;This instruction takes 4 clock cycles since ;it halts the CPU for two clock cycles ; sbi EECR,EERE ;set EEPROM Read strobe 2nd time ;This instruction takes 4 clock cycles since ;it halts the CPU for two clock cycles in temp,EEDR ;get data from EEPROM com temp ;invert data or lights,temp ;set bits out PORTB,lights ;show it on LEDs inc EEard ;point to next EE address cpi EEard,63 ;see if at end of EEPROM breq loop ; if so, start over rjmp EERead .eseg .org 0 .db 0x55 .include "1200def.inc"