Table addwf PCL,F
retlw b'00000000' ;Letter 'A'
retlw b'00111111'
retlw b'01001001'
retlw b'01001001'
retlw b'01001001'
retlw b'00111111'
retlw b'10000000' ;80h
;**************************
;Main routine
;**************************
Start call CLRREG ;clear all RAM variables
clrf Pointer
movlw .100
movwf Scan_Count
Show_Loop movf Pointer,W
call Table
movwf Col5 ;load to col 5
xorlw 80h ;end of letter??
btfsc STATUS,Z
goto Start
[COLOR="Red"]Loop1 call Scan
decfsz Scan_Count,F
goto Loop1
movlw .100
movwf Scan_Count[/COLOR]
call Shift
incf Pointer,F
goto Show_Loop
;*************************
;simple multiplex routine
;*************************
Scan bcf PORTA,2 ;reset SR-74HC164
nop ;//
nop ;//
bsf PORTA,2 ;
nop
bsf PORTA,1 ;enable data pin
movf Col1,W ;1
call Clock_Pulse
bcf PORTA,1 ;disable data pin
movf Col2,W ;2
call Clock_Pulse
movf Col3,W ;3
call Clock_Pulse
movf Col4,W ;4
call Clock_Pulse
movf Col5,W ;5
call Clock_Pulse
return
;**********************************
;Clock pulse routine to SR-74HC164
;**********************************
Clock_Pulse movwf Col_Data ;save column data
clrf PORTB
goto $+1
goto $+1
goto $+1
goto $+1
goto $+1
bsf PORTA,0 ;low to high transition
nop
bcf PORTA,0 ;make low for next transition
nop
movf Col_Data,W
movwf PORTB
goto $+1
goto $+1
return
;**************************************
;shift - moves one column data to left
;**************************************
Shift movf Col2,W ;2 to 1
movwf Col1
movf Col3,W ;3 to 2
movwf Col2
movf Col4,W ;4 to 3
movwf Col3
movf Col5,W ;5 to 4
movwf Col4
return
Ya I have read them already.I think interrupt driven multiplexing routine is the only solution for my problem.
It must scan one column at a time without scanning the whole columns at once.
For now just only 5 columns may be it will end up with 128 columns.
Having difficulty with your code. What are Col1 thru' Col4? Are these constants? Schematic?
**********************************
;Clock pulse routine to SR-74HC164
;**********************************
Clock_Pulse movwf Col_Data ;save column data
clrf PORTB
[COLOR="Red"] goto $+1
goto $+1
goto $+1
goto $+1
goto $+1 [/COLOR]
bsf PORTA,0 ;low to high transition
nop
bcf PORTA,0 ;make low for next transition
nop
movf Col_Data,W
movwf PORTB
goto $+1
goto $+1
return
3v0 said:If not add more delay in the red code till the problem goes away. If that does not fix the problem I am wrong about it.
What clock speed are you running?
;========================================
;Scans 32 columns one at a time
;OSC=4MHz
;TMR0=78, Pre Scaller = 8
;Column registers starting with 30h-4Fh
;========================================
org 0004h
;
ISR_Enter movwf WT ;save off current W register contents
movf STATUS,W ;move status register into W register
movwf STAT
movfw PCLATH
movwf p_temp ;Save PCLATH
;78(TMR0)X8(PS) = 624uS interrupts
;624X32 =19968us
;1/19968us = 50Hz refresh rate
movlw .178 ;
movwf TMR0 ;load 78 TMR0
bcf INTCON,T0IF
Do_Col1 movf Col_Counter,W ;
btfss STATUS,Z
goto Do_Col_Scan
incf Col_Counter,F ;
bsf PORTA,1 ;enable data pin only at first column
Do_Col_Scan bcf Enable,0
movf Col_Counter,W
addlw 2Fh ;
movwf FSR
movf INDF,W
call Clock_Pulse
bcf PORTA,1 ;disable data pin
incf Col_Counter,F
movf Col_Counter,W ;check end of 32 columns?
xorlw .33 ;//
btfss STATUS,Z ;//
goto ISR_Exit ;no,
clrf Col_Counter ;yes,clear column counter
;
[COLOR="Red"]bsf Enable,0 ;Flag bit confirms end of columns[/COLOR]
goto ISR_Exit
;
ISR_Exit movfw p_temp
movwf PCLATH ;Restore PCLATH
movf STAT,W ;retrieve copy of STATUS register
movwf STATUS ;restore pre-isr STATUS register contents
swapf WT,F
swapf WT,W ;restore pre-isr W register contents
retfie
That's cool hard work but a lot of fun doing it.I have been working on 1 with 12f683 and now using 74hc595 for the columns and trying to get one down too two pins for the rolls
start:
setup clock to overflow as needed
Next:
// other stuff
if clock has not overflowed goto next
clear clock overflow bit
all the actions you had in your ISR goes here
goto Next
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?