.include"m8535def.inc".deftmp=R16.org0 rjmpInit.org14 rjmpADC_Comp Init: ; ldir16,high(RAMEND) outSPH,r16 ldir16,low(RAMEND) outSPL,r16 ; lditmp,0b outDDRB,tmp outPORTB,tmp lditmp,0b outDDRD,tmp outPORTD,tmp
lditmp,0b outTCCR0,tmp lditmp,254 outOCR0,tmp lditmp,0b outTCCR1A,tmp lditmp,0b outTCCR1B,tmp lditmp,254 outOCR1AH,R7 outOCR1AL,tmp lditmp,0b outTCCR2,tmp lditmp,0 outASSR,tmp lditmp,254 outOCR2,tmp
lditmp,0b outSFIOR,tmp ; lditmp,0b outADMUX,tmp lditmp,0b outADCSRA,tmp ; sei Loop:nop nop rjmpLoop ADC_Comp: lditmp,1 outOCR0,tmp reti intmp,ADCH outOCR0,tmp lditmp,0b outADMUX,tmp lditmp,0b outADCSRA,tmp reti
intmp,ADMUX anditmp,0b cpitmp,0 breqChangeBlue cpitmp,2 breqChangeGreen cpitmp,4 breqChangeRed ChangeBlue: intmp,ADCH outOCR0,tmp lditmp,0b outADMUX,tmp lditmp,0b outADCSRA,tmp reti ChangeGreen: intmp,ADCH outOCR1AH,R7 outOCR1AL,tmp lditmp,0b outADMUX,tmp lditmp,0b outADCSRA,tmp reti
ChangeRed: intmp,ADCH outOCR2,tmp lditmp,0b outADMUX,tmp lditmp,0b outADCSRA,tmp reti