ON 20080330@8:40:35 PM at page:
http://www.piclist.com/techref/member/kan-MMM-UA4/index.htm#39537.8615046296
kyoji anekawa nonomura[kan-MMM-UA4] change Pages:
/techref/io/led/8x7s8pin.htm
Driving 8 or 9 7 segment displays with 8 or 9 io pins (and no extra
circuitry)
ON 20080330@8:41:36 PM at page:
http://www.piclist.com/techref/member/kan-MMM-UA4/index.htm#39537.8622106481
kyoji anekawa nonomura[kan-MMM-UA4] Says
;I arrange it a little.
init_
movlw b'11111111' ;ALL Hi
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
movwf TRISB ;PORTB Hi inp
bsf PORTA,0 ;PORTA,0 Hi inp
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0
goto digitstart ;1Digit Start
;
isrled
;Loop
;PORTB
movf BITPOS,W ;Digit=1
movwf PORTB ;PortB Digit=1 Segment=0
;PORTA,0
bcf PORTA,0 ;Flbit=0 Segment on,Digit off
btfsc STATUS,Z ;Digit9=ALL,0 is Z1 to Next,Z0 to Jmp
bsf PORTA,0 ;Flbit=1 Digit on J |
;dig=9 a0=1 ; Segment off J
;
;TRISB
movf BUFPTR,W ;Read Point
movwf FSR ;Indirect
movf INDF,W ;Segment Data
iorwf BITPOS,W ;Digit Add
xorlw b'11111111' ;Invert 0=Output 1=Input
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
movwf TRISB ;Segment TRISB
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0
;
;TRISA,0
movf INDF,W ;Segment Data
andwf BITPOS,W ;Digit Mask
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
bsf TRISA,0 ;Flbit=1 Input
btfsc STATUS,Z ;seg*dig=0 is Z1 to nxt,Z0 to jmp
bcf TRISA,0 ;Flbit=0 Output J |
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0 J
;
;9Digit
movf BITPOS,W ;Digit Data
btfss STATUS,Z ;ALL,0? is Z1 to nxt,Z0 to jmp
goto isrnxt ;End Digit J @ |
; | |
digitstart | |
;1Digit | |
movlw b'00000001' ;Digitreset1 | J
movwf BITPOS ;Digit write |
movlw DIGIT0 ;Segment Data |
movwf BUFPTR ;Pointa Write |
goto israll ;Next Flow |
;NextDigit |
isrnxt
incf BUFPTR,f ;DigitPointa +1J
bcf STATUS,C ;cl carry
rlf BITPOS,f ;Shift Left
goto israll ;Next Flow
;
israll
;next flow is on time & etc prosses
goto isrled
end
ON 20080331@4:58:34 AM at page:
http://www.piclist.com/techref/member/kan-MMM-UA4/index.htm#39537.8622106481
kyoji anekawa nonomura[kan-MMM-UA4] removed post 39537.8622106481
|Delete '
;I arrange it a little.
init_
movlw b'11111111' ;ALL Hi
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
movwf TRISB ;PORTB Hi inp
bsf PORTA,0 ;PORTA,0 Hi inp
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0
goto digitstart ;1Digit Start
;
isrled
;Loop
;PORTB
movf BITPOS,W ;Digit=1
movwf PORTB ;PortB Digit=1 Segment=0
;PORTA,0
bcf PORTA,0 ;Flbit=0 Segment on,Digit off
btfsc STATUS,Z ;Digit9=ALL,0 is Z1 to Next,Z0 to Jmp
bsf PORTA,0 ;Flbit=1 Digit on J |
;dig=9 a0=1 ; Segment off J
;
;TRISB
movf BUFPTR,W ;Read Point
movwf FSR ;Indirect
movf INDF,W ;Segment Data
iorwf BITPOS,W ;Digit Add
xorlw b'11111111' ;Invert 0=Output 1=Input
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
movwf TRISB ;Segment TRISB
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0
;
;TRISA,0
movf INDF,W ;Segment Data
andwf BITPOS,W ;Digit Mask
bsf STATUS,RP0 ;Bank 1 (RP1 is clr) |B1
bsf TRISA,0 ;Flbit=1 Input
btfsc STATUS,Z ;seg*dig=0 is Z1 to nxt,Z0 to jmp
bcf TRISA,0 ;Flbit=0 Output J |
bcf STATUS,RP0 ;Bank 0 (RP1 is clr) |B0 J
;
;9Digit
movf BITPOS,W ;Digit Data
btfss STATUS,Z ;ALL,0? is Z1 to nxt,Z0 to jmp
goto isrnxt ;End Digit J @ |
; | |
digitstart | |
;1Digit | |
movlw b'00000001' ;Digitreset1 | J
movwf BITPOS ;Digit write |
movlw DIGIT0 ;Segment Data |
movwf BUFPTR ;Pointa Write |
goto israll ;Next Flow |
;NextDigit |
isrnxt
incf BUFPTR,f ;DigitPointa +1J
bcf STATUS,C ;cl carry
rlf BITPOS,f ;Shift Left
goto israll ;Next Flow
;
israll
;next flow is on time & etc prosses
goto isrled
end