AT90S2313-EEPROM-Write-Read
This is a project, which demonstrates the application of AVR 90S2313 in writing values, 00-0F to EEPROM location & displaying the written data.
This project uses one AT90S2313 Microcontroller, two 7-segment displays & 2 display drivers.
The program is as shown:
_SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
.text
.global main
.type main, @function
main:
;---------------------------------------------------------------------------
;------ WRITING VALUES TO EEPROM OF 90S2313 AND DISPLAYING THE DATA
; -------------MAIN ROUTINE ---------------------------------------
ldi r20,0x00
L1:
out 0X1E,R20 ; Loading the initial address value 00 to EEAR
out 0X1D,R20 ; Writing 0 to EEDR
ori R21,0x04 ; Enabling the EEPROM Master Write Enable Bit of EECR
out 0X1C,R21
ORI R21,0X02
OUT 0X1C,R21 ; Enabling the EEPROM Write Enable Bit of EECR
out 0X1C,R21
INC R20 ; Incrementing R20
CPI R20,0X0F ; Checking whether R20 = 0x0F
BRNE L1
l2:
OUT 0X1E,R20 ;Routine for reading data into EEPROM
LDI R24,0X01
OUT 0X1C,R24 ; Setting the Read Enable Bit of EECR
IN r22,0X1D ; Loading the value of EEDR on R22
LDI R25,0XFF ; Setting the DDRB reg in output mode
OUT 0X17,R25
OUT 0X18,R22 ; Outputting the EEDR value through PORTB
LDI R26,0X02 ; Setting the TOIE0 bit of TIMSK register.
OUT 0X39,R26
SEI
LDI R26,0X01 ; Starting Timer 0
OUT 0X33,R26
loop3:
rjmp loop3
; -------------------------------------------------------
; 8BIT TIMER0 OVERFLOW------------------
; INTERRUPT SERVICE ROUTINE 6-------
;--------------------------------------------------------
.size main, .-main
.global __vector_6
.type __vector_6, @function
__vector_6:
DEC R20 ; Decrementing R20
BRNE l2