120 likes | 231 Vues
Supervised by : Borovitskyi V . N . Kondratenko D . U. Project by : Galushkina E . O . Sleptsova E . G . Kucherenko I . V. NATIONAL TECHNICAL UNIVERSITY OF UKRAINE “KPI” INSTRUMENT MAKING FACULTY OPTICAL AND OPTOELECTRONIC DEVICES DEPARTMENT. Multitone alarm ”LIK”. 2008.
E N D
Supervised by: BorovitskyiV.N. KondratenkoD.U. Project by: Galushkina E.O. SleptsovaE.G. KucherenkoI.V. NATIONAL TECHNICAL UNIVERSITY OF UKRAINE “KPI”INSTRUMENT MAKING FACULTY OPTICAL AND OPTOELECTRONIC DEVICES DEPARTMENT Multitone alarm ”LIK” 2008
Short description • This device functions as a multitone alarm. It may be used as a door bell or as a signal for a burglar alarm. • Algorithm of the device is the following: when power is supplied the device plays several tunes one after another. This is managed by means of software.
Software • .include "d:\avr\avrasm\appnotes\2313def.inc" • .def Temp1=R16 • .def Temp2=R17 • .def Temp3=R18 • .def Temp4=R19 • .def Temp=R20 • .dseg • CountRate: .byte 1 • MelAddL: .byte 1 • MelAddH: .byte 1 • ;****************************************************************************** • .macro stsi ;save_immediate <SRAM_cell>,<k> • ldi Temp,@1 • sts @0,Temp • .endmacro • .macro rdm • ldi ZH,High(@0*2) • ldi ZL,Low(@0*2) • add ZL,XL • adc ZH,XH • lpm • mov Temp3,r0 • .endmacro • ;****************************************************************************** • .cseg • .org 0 • rjmp RESET ; Reset Handler • rjmp EXT_INT0 ; IRQ0 Handler • rjmp EXT_INT1 ; IRQ1 Handler • rjmp TIM_CAPT1 ; Timer1 Capture Handler • rjmp TIM_COMP1 ; Timer1 Compare Handler • rjmp TIM_OVF1 ; Timer1 Overflow Handler • rjmp TIM_OVF0 ; Timer0 Overflow Handler • rjmp UART_RXC ; UART RX Complete Handler • rjmp UART_DRE ; UDR Empty Handler • rjmp UART_TXC ; UART TX Complete Handler • rjmp ANA_COMP ; Analog Comparator Handler • EXT_INT0 : ret • EXT_INT1 : ret
Software • TIM_CAPT1 : ret • TIM_OVF0 : ret • TIM_OVF1 : ret • UART_RXC : ret • UART_DRE : ret • UART_TXC : ret • ANA_COMP : ret • TIM_COMP1 : ret • reset: ldi Temp1,RamEnd ;set stack • out SPL,Temp1 • cli • inc Temp3 • ldi temp1,0xff ;port init • out ddrb,temp1 • ldi temp1,0b00000001 • out portb,Temp1 • ;timers init • ldi temp1,0b01000000 ;OC1 toggle at compare • out tccr1a,temp1 • ldi temp1,0b00001011 • out tccr1b,temp1 ;clear on compare, clk=C/64 • ldi Temp1,1 • sts CountRate,Temp1 • ;********************************************************************************************** • ;Partiture reader • ;input: • ;output: Temp3 - code of current note • Partiture: ldi XL,0 • ldi XH,0 • ldi Temp1,0 • ldi Temp2,0 • Play: • rdm HymnUSSR • cpi Temp3,0xff ;comparing with "end" flag • breq Partiture • sts MelAddL,XL • sts MelAddH,XH
Thank you for your attention! Contact us: • National Technical University of Ukraine “KPI”Optical and optoelectronic devices departmentKyiv 03056, prospektPeremogy 37 http://ooep.ntu-kpi.kiev.ua/ Project developed within the limits of subject “Microprocessors and computers” http://ooep.ntu-kpi.kiev.ua/microcontrollers/