I have an example app' for the 5-pin CC drawing but it won't be very useful to you.Would u have a code sample for that application?
That's almost a "thank you" so maybe there's hope for you yet (lol).I think that's an awesome solution, once I go C- anode.
Yes, use four PNP for a "normal" 4-digit CA display or four NPN for a "normal" 4-digit CC display.Your diagram shows 5 PNP, but I guess the extra is for the colon. Will a regular colon-less display work with 4 pnp?
Yes, five pins for the display. You can also use a single I/O pin to read up to four switches by driving the switches from the four column select lines. You'll need one signal diode per switch. Switch software is a breeze.If so that should just use 5 lines from the PIC, which helps, cause I was 1 pin short overall and was gonna have to do some antics to save a pin.
My current solution used 7 lines to drive the LED plu 2 more via a 74hc139 2-4line decoder, for a total of 9 pins.
Unless there's some compelling reason not to, you should be using interrupts already for the display driver and to sample and debounce switches.Since this is a serial soln, I need to achieve a 60Hz or better overall refresh to eliminate flicker. I may have to use an interrupt to ensure that. Or do some tight timings.
A 35-Hz refresh rate is too slow to avoid flicker.My code cycle atm is about 800us, which is about 6.5ms for a serial 8bit clk. That's 28 ms for a complete 4 digit sweep. Around 35Hz update now.
I figure that might flicker.
;
; select new column after loading the driver shift register
;
isrCol
movlw b'00011110' ;
iorwf PORTB,W ; turn off column select bits
xorwf colsel,W ; active lo column select bit
movwf PORTB ; select new column
;
; switch management (sample switch at current selected column)
;
isrSw
movf latch,W ; W = switch state latch
iorwf colsel,W ; set SWn bit to '1' (pressed)
btfsc PORTB,5 ; pressed ('0')? yes, skip, else
xorwf colsel,W ; set SWn bit to '0' (released)
xorwf latch,W ; W = changes, press or release
xorwf latch,F ; update switch state latch
andwf latch,W ; filter out "new release" bits
skpz ; a "new press"? no, skip, else
bsf beep,5 ; task a new press beep
xorwf flags,F ; toggle switch flag bits for main
;
;
; beep task (32-msec 500-Hz tone @ 1-msec interrupts)
;
isrBeep
movf beep,W ; beep task running?
bz isrNext ; no, branch, else
movlw 1<<spkr ; speaker pin mask
xorwf PORTB,F ; toggle speaker pin
decf beep,F ; decrement beep msec counter
;
; prep for next column update interrupt
;
isrNext
incf colnbr,F ; bump column number
bcf colnbr,2 ; 0..3 inclusive
clrc ;
rlf colsel,W ; advance column select bit
btfsc colsel,4 ; last column? no, skip, else
movlw b'00000010' ; reset to first column
movwf colsel ;
movlw disp ; W = &disp[0]
addwf colnbr,W ; add column number, 0..3
movwf FSR ; FSR = &disp[colnbr]
movf INDF,W ; W = disp[colnbr], 0..9
call segtable ; get segment data
movwf work ; SR data for next column
No you don't need 'em.Hmm , haven't used those, do they require any resistors at all?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?