
Originally Posted by
ericgibbs If the refresh rate is too fast for some LED's a short inter LED delay would be easy to implement.
I agree. Here's a simple low overhead 8 bit DelayUS() sub-system (macro and subroutine) that could be used by those interested in experimenting with inter-digit delay time;
Code:
radix dec
;******************************************************************
; *
; DelayUS(8..1031), 4 MHz clock Mike McLaren, K8LH, Jun'07 *
; *
; requires the use of constant operands known at assembly time! *
; *
; 7 words, 0 ram variables, 14 bit core *
; ^^^^^^^^^^^ *
; the macro generates 2 instructions; *
; *
DelayUS macro delay ; parameter 8..1031
movlw delay/4-1
call Delay4Tcy-(delay%4)
endm
; *
; code for simulation testing; *
; *
SimTest DelayUS(1000) ; delay 'n' usecs
nop ; put simulator break point here
; *
;******************************************************************
nop ; entry point for (delay%4) == 3 |B0
nop ; entry point for (delay%4) == 2 |B0
nop ; entry point for (delay%4) == 1 |B0
Delay4Tcy
addlw -1 ; entry point for (delay%4) == 0 |B0
skpz ; |B0
goto Delay4Tcy ; |B0
return ; |B0
;******************************************************************
You might use it within the driver loop like this;
Code:
Loop
movf PORTA,W ; get Lo input in b3..b0
btfsc Dig_Sel,7 ; low digit? yes, skip, else
swapf PORTA,W ; get Hi input in b3..b0
call SegData ; get segment data
iorwf Dig_Sel,W ; pick up digit select bit (b7)
movwf PORTB ; update display
DelayUS(1000) ; delay 1 msec
movlw b'10000000' ; digit select bit mask
xorwf Dig_Sel,F ; toggle b7 digit select bit
goto Loop ;