please dont rip this site

Driving 8 or 9 7 segment displays with 8 or 9 io pins (and no extra circuitry)

w. v. ooijen / f. hanneman [wf@xs4all.nl] says:

Actually you can drive 9 [seven segment] displays (of seven segments + point) with 9 pins. [or 8 displays excluding the point with one port of 8 pins]. But this takes a bit more code. The trick is to use both the high, low and input states. Each display has its anode on one of the lines, and all of its cathodes's on the other 8 lines. Now to light one segment you make the pin connected to that displays anode positive, that segments cathode negative [or ground], and (this is the trick) all other lines inputs. Of course you multiplex one display at a time, not one segment.

[Ed: for anyone (like me) who didn't get that on the first reading, maybe this will help: each pin of the uP port is connected to 1 displays anode and to one of the the other 8 or 9 displays segments. e.g. pin1 = disp1anode & disp2a & disp3b & disp4c & disp5d & disp6e & disp7f & disp8g, pin2 = disp1a & disp2anode & disp3b & disp4c & disp5d & disp6e & disp7f & disp8g, etc...]

Mike McLaren's [k8lh@arrl.net] untested 9-pin 8-digit design (19-Jul-04):

The INIT section of the main program will need to initialize BITPOS to b'00000001', set BUFPTR to point at the the eight byte digit buffer, and setup RB0 as an output before turning on the interrupt source (Timer2 in my case)... The main program then simply stuffs the eight byte digit buffer with each digits segment data (bits 6..0 = segments G..A, respectively) and decimal point (bit 7)... Suppress a leading zero by setting that digits buffer to b'00000000' and perform a "lamp test" by setting all eight digit buffers to b'11111111'... The 9-pin design easily supports a 9th digit but the code gets a little bigger when we start manipulating TRISB and PORTB...

 ; 8-digit 9-pin LED display sample ISR code... 
 ;  (14-bit core instructions) 
 ; 
 ; Vars - BITPOS (float bit & digit position) 
 ;        BUFPTR (buffer pointer) 
 ;        DIGIT1 (start of 8 byte display data buffer) 
 ;               (bit 7=dp, bits 6..0=segments G..A) 
 ; 
 ISR_LED  bsf   STATUS,RP0   ;Bank 1 (RP1 is clr)     |B1 
          movlw b'11111111'  ;                        |B1 
          movwf TRISA        ;turn off display        |B1 
          bcf   STATUS,RP0   ;Bank 0 (RP1 is clr)     |B0 
          movf  BITPOS,W     ;example: b'00000001'    |B0 
          movwf PORTA        ;new output pattern      |B0 
 ; 
          bsf   PORTB,0      ;turn 'float bit' off    |B0 
          movf  BUFPTR,W     ;ptr to current digit    |B0 
          movwf FSR          ;setup indirect address  |B0 
          movf  INDF,W       ;get digit segment data  |B0 
          andwf BITPOS,W     ;AND float/column bit    |B0 
          btfss STATUS,Z     ;need the float bit?     |B0 
          bcf   PORTB,0      ;yes, 'float' bit on     |B0 
          iorwf BITPOS,W     ;pickup the BITPOS bit   |B0 
          iorwf INDF,W       ;get digit segment bits  |B0 
          xorlw b'11111111'  ;invert all bits         |B0 
          bsf   STATUS,RP0   ;Bank 1 (RP1 is clr)     |B1 
          movwf TRISA        ;display new digit       |B1 
          bcf   STATUS,RP0   ;Bank 0 (RP1 is clr)     |B0 
 ; 
          incf  BUFPTR,f     ;increment buffer ptr    |B0 
          bcf   STATUS,C     ;clear carry bit         |B0 
          rlf   BITPOS,f     ;shift our digit bit     |B0 
          btfss STATUS,C     ;all 8 digits scanned?   |B0 
          goto  ISR_NXT      ;no, branch              |B0 
 ; 
          rlf   BITPOS,f     ;reset to b'00000001'    |B0 
          movlw DIGIT1       ;get buffer address      |B0 
          movwf BUFPTR       ;reset the pointer       |B0 
 ; 
 ISR_NXT 

Questions:

See:

Comments:

Mike McLaren's [k8lh@arrl.net] 9-pin 8-digit display design (29-Nov-04):

The Agilent low current displays eliminate the need for digit driver transistors... The INIT section of your main program will need to initialize BITPOS to b'00000001', set BUFPTR to point at the the beginning of your eight byte digit buffer, turn on Port B weak pull-ups, and setup RA0 as a digital output before turning on the interrupt source (I use TMR2)... The main program then simply stuffs the eight byte digit buffer with each digits segment data (bits 6..0 = segments G..A, respectively) and decimal point (bit 7)... Suppress a leading zero by setting that digits buffer to b'00000000' and perform a "lamp test" by setting all eight digit buffers to b'11111111'... The 9-pin design will support a 9th digit but the code would become a little more complex...

 ;
 ; 8-Digit 9-Pin Charlieplexed CC LED ISR Sample Code
 ;   (14-bit core instructions)
 ;
 ; Vars - BITPOS (float bit & digit position)
 ;        BUFPTR (buffer pointer)
 ;        DIGIT1 (start of 8 byte display data buffer)
 ;               (bit 7=dp, bit 6=G...bit 0=A)
 ;
 ISR_LED  bsf   STATUS,RP0   ;Bank 1 (RP1 is clr)     |B1
          movlw b'11111111'  ;                        |B1
          movwf TRISB        ;turn off display        |B1
          bcf   STATUS,RP0   ;Bank 0 (RP1 is clr)     |B0
          xorwf BITPOS,W     ;inv float/column bits   |B0
          movwf PORTB        ;new output pattern      |B0
 ;
          bcf   PORTA,0      ;turn 'float bit' off    |B0
          movf  BUFPTR,W     ;ptr to current digit    |B0
          movwf FSR          ;setup indirect address  |B0
          movf  INDF,W       ;get digit segment data  |B0
          andwf BITPOS,W     ;and float/column bit    |B0
          btfss STATUS,Z     ;need the float bit?     |B0
          bsf   PORTA,0      ;yes, 'float' bit on     |B0
          iorwf BITPOS,W     ;pickup the BITPOS bit   |B0
          iorwf INDF,W       ;get digit segment bits  |B0
          xorlw b'11111111'  ;invert all bits         |B0
          bsf   STATUS,RP0   ;Bank 1 (RP1 is clr)     |B1
          movwf TRISB        ;display new digit       |B1
          bcf   STATUS,RP0   ;Bank 0 (RP1 is clr)     |B0
 ;
          incf  BUFPTR,f     ;increment buffer ptr    |B0
          bcf   STATUS,C     ;clear carry bit         |B0
          rlf   BITPOS,f     ;shift our digit bit     |B0
          btfss STATUS,C     ;all 8 digits scanned?   |B0
          goto  ISR_NXT      ;no, branch              |B0
 ;
          rlf   BITPOS,f     ;reset to b'00000001'    |B0
          movlw DIGIT1       ;get buffer address      |B0
          movwf BUFPTR       ;reset the pointer       |B0
 ;
 ISR_NXT



 ;
 ; 8-Digit 9-Pin Charlieplexed CC LED ISR Sample Code
 ;   (16-bit core instructions)
 ;
 ; Vars - BITPOS (float bit & digit position)
 ;        BUFPTR (buffer pointer)
 ;        DIGIT1 (start of 8 byte display data buffer)
 ;               (bit 7=dp, bit 6=G...bit 0=A)
 ;
 ISR_LED  movlw b'11111111'  ;
          movwf TRISB        ;turn off display
          comf  BITPOS,W     ;invert for common cathode
          movwf PORTB        ;new output pattern
                             ;11111110, 11111101, etc.
          bcf   PORTA,0      ;turn 'float bit' off
          lfsr  2,BUFPTR     ;ptr to current digit
          movf  INDF2,W      ;get digit segment data
          andwf BITPOS,W     ;AND float/column bit
          btfss STATUS,Z     ;need the float bit?
          bsf   PORTA,0      ;yes, 'float' bit on
          iorwf BITPOS,W     ;pickup the BITPOS bit
          iorwf INDF2,W      ;get digit segment bits
          xorlw b'11111111'  ;invert all bits
          movwf TRISB        ;display new digit
 ;
          incf  BUFPTR,f     ;increment buffer ptr
          rlncf BITPOS,f     ;setup for next digit
          decf  BITPOS,W     ;column 00000001?
          bnz   ISR_NXT      ;no, branch
                             ;else, reset pointer
          movlw DIGIT1       ;get buffer address
          movwf BUFPTR       ;reset the pointer
 ;
 ISR_NXT

Archive: LEDMPX I do not understand English.
The result was good and was not able to edit it.
Is nine columns of indication good by the following contents?
I reconsidered it well.
I changed it in a direct opening sentence not to do the bit operation of the port.

 ;By nonnno

   list      p=16F648A           ; list directive to define processor
    #include <p16F648A.inc>       ; processor specific variable definitions
    __CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _EXTCLK_OSC
 ; 9-Digit 9-Pin Charlieplexed AC LED ISR Sample Code
 ;   (14-bit core instructions)
 ; Vars - BITPOS (float bit & digit position)
 ;        BUFPTR (buffer pointer)
 ;        DIGIT0 (start of 8 byte display data buffer)
 ;               (bit 7=dp, bit 6=G...bit 0=A)
 ;LEDMPX coment |B is bank
    org    20h
BITPOS    res    1
BUFPTR    res    1
DIGIT0    res    1
DIGIT1    res    1
DIGIT2    res    1
DIGIT3    res    1
DIGIT4    res    1
DIGIT5    res    1
DIGIT6    res    1
DIGIT7    res    1
DIGIT8    res    1
DIGIT9    res    1
WORK    res    1
SDWPA    res    1
SDWPB    res    1
SDWTA    res    1
SDWTB    res    1
;CLOCKFREQ    EQU    12.8        ;  12.8 MHz X-tal used
; dispdata
D0_  equ b'00111111'
D1_  equ b'00000110'
D2_  equ b'01011011'
D3_  equ b'01001111'
D4_  equ b'01100110'
D5_  equ b'01101101'
D6_  equ b'01111101'
D7_  equ b'00000111'
D8_  equ b'01111111'
D9_  equ b'01101111'
Dp_  equ b'10111111'
D0p_ equ b'10111111'
D1p_ equ b'10000110'
D2p_ equ b'11011011'
D3p_ equ b'11001111'
D4p_ equ b'11100110'
D5p_ equ b'11101101'
D6p_ equ b'11111101'
D7p_ equ b'10000111'
D8p_ equ b'11111111'
D9p_ equ b'11101111'
    org    0
    goto    start
    org    4
start    org    5
    goto init_
init_;
    movlw    D0_
    movwf    DIGIT0
    movlw    D1_
    movwf    DIGIT1
    movlw    D2_
    movwf    DIGIT2
    movlw    D3_
    movwf    DIGIT3
    movlw    D4_
    movwf    DIGIT4
    movlw    D5_
    movwf    DIGIT5
    movlw    D6_
    movwf    DIGIT6
    movlw    D7_
    movwf    DIGIT7
    movlw    D8_
    movwf    DIGIT8
    movlw    D9_
    movwf    DIGIT9
    movlw    b'00000111'    ;all DIGTAL
    movwf    CMCON        ;
    goto    isb9
isrled;
    movf    BUFPTR,W    ;Z,32~3A
    movwf    FSR          ;setup indirect address
;9dig Hi
    movf    BITPOS,W    ;Z,DigData '00000001'    digPOS
      bcf    SDWPA,0        ; ,DP9=0      Dig9    9dig Lo
    btfsc    STATUS,Z    ; ,DG9 ? 0 1        9dig ?=1
    bsf    SDWPA,0        ; ,DP9=1 | *        9dig Hi
;1,2,3,5,6,7,8dig Hi=Com
    xorwf    SDWPB,W        ; ,Old Com Data
    andlw    b'11110111'    ; ,Not Bit3
    xorwf    SDWPB,F        ; ,NeW Com Data
;4dig Hi
    bcf    SDWPA,1        ; ,DP4=0      Dig4    4dig Lo
    btfsc    BITPOS,3    ; ,PB3 ? 0 1        4dig ?=1
    bsf    SDWPA,1        ; ,DP4=1 | *         4dig Hi
;Fbit,9dig on
    andwf    INDF,W        ;Z,
    bsf    SDWTA,0        ; ,DT9=1      F&D9    Fbit,9dig off
    btfsc    STATUS,Z    ; ,Fbt ? 0 1        Fbit ?=0 on
    btfsc    SDWPA,0        ; ,DG9 ? | 0 1        9dig ?=1 on
    bcf    SDWTA,0        ; ,DT9=0 * | *        Fbit,9dig on
;Seg                ; ,       *
    movf    BITPOS,W    ;Z,pickup the BITPOS bit  |B0 * 00000001
    iorwf    INDF,W        ;Z,get digit segment bits |B0   00000110 00000111
    movwf    WORK        ;
;Dbit,4dig on
    bsf    SDWTA,1        ; ,DT4=1      F&D4    Dbit,4dig off
    btfsc    WORK,3        ; ,PB3 ? 0 1        Dbit,4dig ?=1
    bcf    SDWTA,1        ; ,DT4=0 | *  SegD    Dbit,4dig on
    comf    WORK,W        ;Z,     R~>W
        xorwf    SDWTB,W        ; ,Old Data
    andlw    b'11110111'    ; ,Not Bit3
        xorwf    SDWTB,F        ; ,NeW Data
    movf    SDWPA,W        ;
    movwf PORTA        ;display new digit
    movf    SDWPB,W        ;
    movwf PORTB        ;display new digit
    movf    SDWTA,W        ;
    bsf   STATUS,RP0    ;Bank 1 (RP1 is clr)     |B1
    movwf TRISA        ;display new digit
    bcf   STATUS,RP0    ;Bank 0 (RP1 is clr)     |B0
    movf    SDWTB,W        ;
    bsf   STATUS,RP0    ;Bank 1 (RP1 is clr)     |B1
    movwf TRISB        ;display new digit
    bcf   STATUS,RP0    ;Bank 0 (RP1 is clr)     |B0
    movf    BITPOS,W    ;DigData '00000001'Z
;                          ;STATUS,Z'xxxxx2xx'
    btfss    STATUS,Z    ;Z=          1 0
    goto     isbp         ;         | *@
isb9;                ;         |  |
    movlw     b'00000001'     ;Digitreset1 *  |
     movwf     BITPOS         ;LoDigit write  |
     movlw     DIGIT0         ;Segment Data   |
     movwf     BUFPTR         ;Pointa Write   |
    goto     israll         ;Next Flow      |
isbp;                ;            |
    incf     BUFPTR,f     ;DigitPointa +1 *
     bcf     STATUS,C     ;cl carry      *
    rlf     BITPOS,f     ;Shift Left      |
    goto     israll         ;Next Flow   | *@ |
;                ;            |
israll;                ;            |
    nop            ;            *
     goto     isrled
;next flow is on time & etc prosses
     end


file: /Techref/io/led/8x7s8pin.htm, 23KB, , updated: 2009/12/3 08:57, local time: 2024/11/22 18:13, owner: kan-MMM-UA4,
TOP NEW HELP FIND: 
18.117.168.71:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/Techref/io/led/8x7s8pin.htm"> Driving 8 or 9 7 segment displays with 8 or 9 io pins (and no extra circuitry)</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .