AT90S2313-16 Bit Ext-Controlled-Counter
This project, using AT90S2313 is used to count from 00-7F. Giving clock on the T1pin of AT90S2313 can control the speed.
The circuit contains one AT90S2313 Microcontroller, two drivers and two seven segment displays.
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:
ldi r30,0x00 ; clearing the R30 to zeros
out 0x18,r30
ldi r16, lo8(0) ; setting the TCNT1L& TCNTLH to zero
out 0x2C,r16
di r16,hi8(0)
out 0x2D,r16
ldi r16,lo8(-128) ; loading the OCR1AL register with 128
out 0x2A,r16
ldi r16,hi8(0)
ldi r23, 0xff ; setting the DDRB register as output mode
out 0x17,r23
out 0x2B,r16 ; setting 0CR1AH with zeros
ldi r17,0xc0 ; setting the OCIE1A bit of TIMSK reg
out 0x39,r17
sei ; setting the global interrupt enable bit of SREG
ldi r17,0x07 ; setting up the external counting clock */
out 0X2E,r17
loop1:
in r27,0x2C ; outputing TCNT1L reg through PORTB
out 0x18,r27
rjmp loop1
;------ timer16 over flow routine--------
;--------INTERRUPT VECTOR 5--------
.size main, .-main
.global vector_5
.type vector_5, @function
__vector_5:
rjmp main