;
; The seven LED columns are 'scanned' one at a time at 1-msec
; interrupt intervals for an overall 14.3% LED duty cycle and
; 142.85-Hz refresh rate...
;
; A minimum PWM 'on' time of 2% guarantees a minimum window
; of 20-usecs (80 instruction cycles) at the beginning of
; each interrupt cycle where PWM drives the <OE> input high
; (display off)... This allows me to reuse the RB1 and RB2
; column driver lines temporarily as '5821 <DAT> and <CLK>
; lines to load the '5821 (without messing up the display)
; before RB1 and RB2 resume their column driver duties when
; PWM drives <OE> low (display on)...
;
; The 2% minimum PWM 'on' time limits maximum brightness to
; 98% but the 2% loss of brightness is inperceivable
;
ISR_LED
movlw d'8' ; |B0
movwf TEMP ; serial bit count |B0
ISR_Load
bcf SERCLK ; preset '5821 CLK line lo (RB1) |B0
bcf SERDAT ; preset '5821 DAT line lo (RB2) |B0
rlf SEGDAT,F ; shift data bit into Carry |B0
skpnc ; a '1' bit? |B0
bsf SERDAT ; yes, set SERDAT line to 1 |B0
bsf SERCLK ; clock data bit into the '5821 |B0
decfsz TEMP,F ; all 8 bits sent/loaded? |B0
goto ISR_Load ; no, branch and do another |B0
;
; now setup Port B column drivers before PWM drives the '5821
; <OE> pin low to turn on the segment driver outputs & display
;
; COLPOS variable cycles through the following fixed values
; one interrupt at a time to 'scan' the display and switches;
;
; 00000010, column 1, inverted 11111101
; 00000100, column 2, inverted 11111011
; 00001000, column 3, inverted 11110111
; 00010000, column 4, inverted 11101111
; 00100000, column 5, inverted 11011111
; 01000000, column 6, inverted 10111111
; 10000000, column 7, inverted 01111111
;
ISR_Column
comf COLPOS,W ; invert bits (only 1 bit low) |B0
movwf PORTB ; setup the column drivers |B0
;