Mike - K8LH
Well-Known Member
Hi guys,
I've got code to load seven 8-bit shift registers in parallel in about 4.8-usecs and that's workin' fine but I could use help speeding up the algorithm I use later in my ISR to convert the 'column' organized display data to the parallel data required to load the shift registers.
Some background. I use a 9-pin bus of sorts using all of Port B and a PWM pin to drive up to 56 multiplexed 7-segment displays. I use the PWM signal as an inverse Brightness control and a 1% minimum PWM duty cycle to provide a 10-usec 'window' at the beginning of the ISR where I can borrow the Port B column driver lines to load the seven shift registers. The <DAT> pin on each SR is connected to one unique Port B pin (RB1 through RB7) and the <CLK> pin on each SR is connected to RB0.
Loading the SR's at the beginning of the ISR is no problem. Converting the 'column' organized display data to parallel SR data for the next interrupt cycle currently takes about 153 cycles or approximately 30.6-usecs and this is the code I'd like to speed up.
TIA for any suggestions. Regards, Mike
I've got code to load seven 8-bit shift registers in parallel in about 4.8-usecs and that's workin' fine but I could use help speeding up the algorithm I use later in my ISR to convert the 'column' organized display data to the parallel data required to load the shift registers.
Some background. I use a 9-pin bus of sorts using all of Port B and a PWM pin to drive up to 56 multiplexed 7-segment displays. I use the PWM signal as an inverse Brightness control and a 1% minimum PWM duty cycle to provide a 10-usec 'window' at the beginning of the ISR where I can borrow the Port B column driver lines to load the seven shift registers. The <DAT> pin on each SR is connected to one unique Port B pin (RB1 through RB7) and the <CLK> pin on each SR is connected to RB0.
Loading the SR's at the beginning of the ISR is no problem. Converting the 'column' organized display data to parallel SR data for the next interrupt cycle currently takes about 153 cycles or approximately 30.6-usecs and this is the code I'd like to speed up.
TIA for any suggestions. Regards, Mike
Code:
;
; build scan data array for next display interrupt cycle.
; all the b7 bits in one byte, b6 bits in the next byte,
; and so on. Bit 0 <CLK> is preset to '0' in each byte.
;
; 153 cycles, 30.6-usecs
;
lfsr 0,SBuff ; scan buffer address
V1 rlcf WBuff+0,f ;
rlcf INDF0,f ;
rlcf WBuff+1,f ;
rlcf INDF0,f ;
rlcf WBuff+2,f ;
rlcf INDF0,f ;
rlcf WBuff+3,f ;
rlcf INDF0,f ;
rlcf WBuff+4,f ;
rlcf INDF0,f ;
rlcf WBuff+5,f ;
rlcf INDF0,f ;
rlcf WBuff+6,f ;
rlcf INDF0,f ;
bcf STATUS,C ;
rlcf POSTINC0,f ; set b0 <CLK> bit to '0'
btfss FSR0L,3 ; all 8 SBuff bytes setup?
bra V1 ; no, branch