;
; soft PWM "counter method", 256 levels, 16 bit core
; 50 usec interrupts, 12.8 msec "frame", 78.125 Hz refresh
;
; void isr_hi()
; { pir1.TMR2IF = 0; //
; if(dcy >= Led[0]) shadow.0 = 0; //
; if(dcy >= Led[1]) shadow.1 = 0; //
; if(dcy >= Led[2]) shadow.2 = 0; //
; if(dcy >= Led[3]) shadow.3 = 0; //
; if(dcy >= Led[4]) shadow.4 = 0; //
; if(dcy >= Led[5]) shadow.5 = 0; //
; if(dcy >= Led[6]) shadow.6 = 0; //
; if(dcy >= Led[7]) shadow.7 = 0; //
; latb = shadow; //
; dcy++ // inc duty cycle, 0..255
; if(dcy == 0) // if end-of-period
; shadow = 255; // reset shadow
; }
;
; 23 words, 26 cycles (isochronous), 10 bytes RAM
;
isr_hi
bcf PIR1,TMR2IF ; clear timer 2 interrupt flag
movf dcy,W ; duty cycle counter, 0..255
cpfsgt Led+0 ; if(Led[0] >= dcy)
bcf Shadow,0 ; Shadow.0 = 0
cpfsgt Led+1 ; if(Led[1] >= dcy)
bcf Shadow,1 ; Shadow.1 = 0
cpfsgt Led+2 ;
bcf Shadow,2 ;
cpfsgt Led+3 ;
bcf Shadow,3 ;
cpfsgt Led+4 ;
bcf Shadow,4 ;
cpfsgt Led+5 ;
bcf Shadow,5 ;
cpfsgt Led+6 ;
bcf Shadow,6 ;
cpfsgt Led+7 ;
bcf Shadow,8 ;
movff Shadow,LATB ;
infsnz dcy,F ; if end-of-period
setf Shadow ; reset shadow
retfie FAST ;
;