; evg_uc3872.asm ; ; Program for ECG ; Author: Christian Koch ; ; Usage of the works is permitted provided that this ; instrument is retained with the works, so that any entity ; that uses the works is notified of this instrument. ; ; DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. ; ; [2004, Fair License; rhid.com/fair] ; ; Changelog: ; ; 2008-02-08 evg_uc3872.asm v0.1 ; - initial revision ; device: Atmel ATtiny45 or other ATtiny's ; fCLK = 128 kHz ; BODLEVEL = 4.3 V .NOLIST .INCLUDE "tn45def.inc" .LIST ; port pin assignments .EQU LED_UC3872 = PORTB0 ; indicates enable UC3872 .EQU SUPPLY = PORTB1 ; 12 V supply voltage .EQU UC3872 = PORTB2 ; enable UC3872 .EQU LED_SUPPLY = PORTB3 ; indicates 12 V supply voltage .EQU LDR = PORTB4 ; LDR .DEF TIMER1 = r0 .DEF TEMP1 = r16 .DEF SEMAPHORE = r17 .DEF COUNTER = r18 .DEF LUX = r19 .CSEG .ORG 0x0000 rjmp RESET .ORG OVF1addr rjmp TIM1_OVF .ORG ACIaddr rjmp ACI_SUPPLY .ORG ADCCaddr rjmp ADC_COMPLETE ; timer 1 overflow ; registers: (SREG), TEMP1, TIMER1, SEMAPHORE TIM1_OVF: dec TIMER1 brne tim1_ovf1 ser SEMAPHORE clr TEMP1 ; stop timer 1 out TCCR1, TEMP1 tim1_ovf1: reti ; 12 V supply undervoltage ; registers: TEMP1 ACI_SUPPLY: clr TEMP1 out PORTB, TEMP1 ; disable all outputs, switch off UC3872 and LEDs out DDRB, TEMP1 ; tristate PORTB ldi TEMP1, (1<