1. Bu site çerez kullanmaktadır. Siteyi kullanmaya devam etmeniz halinde çerez kullanımı ile ilgili site koşullarını kabul etmiş sayılırsınız. Daha Fazlasını Öğren.
  2. Forum İllegal Uyarısı Forum kuralları gereği forumda video ve illagal paylaşım yapmak yasaktır.Program Arşivimizde ise kısıtlanmış sürüm yada dağıtımı serbest olan (trial - freeware) yazılımlar yayınlayınız..Aksi takdirde mesajlarınız silinecektir..

Interface Multiple 7seg Digits

Konusu 'Pic Uygulama Ve Devreleri' forumundadır ve guclusat tarafından 6 Mayıs 2016 başlatılmıştır.

  1. guclusat
    Offline

    guclusat Tanınmış Üye Süper Moderatör

    Katılım:
    14 Haziran 2009
    Mesajlar:
    9.754
    Ödül Puanları:
    48
    Things are getting a little bit more complicated here. We want to have three different 7-seg that each one will show a different number. Normally, we would need 7 pins for each one, so a total of 21 pins are required, right? No, because in that way, if we wanted to have 6 digits (for a frequency meter for example) we would need 42 pins! Instead, we will make a trick, a trick with the eye. The catch is that the human eye does not operate non-stop all the time. Instead, it takes 10 'photos' each second. Between those photos, the brain will keep the last photo taken active, something like a 'latch'. We will take advantage of this characteristic for this circuit.



    The circuit

    here is the circuit of this tutorial:

    multipledigits_1251583248.jpg

    As you can see, we only use the 8 lines from PORTB for the segments (7 segments + one for the dot) and three more lines, RA0, RA1 and RA2 for the drive-lines for the displays. All digit segments are connected in parallel using only one set of limiting resistors. The common-cathode pin of each display is not connected directly to ground. Instead, a 2N2222 transistor is connected between and used as a switching transistor.

    Only one display is active at a time and it remains active for about 4mSec. Then this display is turned off and the next one is active for 4mSec. Because the displays are turned on and off very quickly, the eye will be tricked. The numbers will appear as if they are illuminated all the time.

    With this way, you can easily have many 7-seg displays connected using the 7 (or 8) pins for the segments and one extra pin for each additional display. The turn-on time that i have chosen is 4 mSec but you may need to reduce this time in case of more digits. Do not make it too small though. You can use a lower-value limiting resistor for the segments as long as the current does not excess 25mA.

    The Code

    Here is the code for lighting the displays:

    Kod:
    ; Definitions -------------------------------------------------------------
            #define Left_Seg porta,0
            #define Mid_Seg porta,1
            #define Right_Seg porta,2
            #define Segments portb
    ; Main Program ------------------------------------------------------------
    Start
                    bank1                    ;Go to bank 1
                    movlw b'11111000'        ;
                    movwf TRISA                ;Set the port pin types of the RA
    
                    movlw b'00000000'        ;
                    movwf TRISB                ;Set the port pin types of the RB
                    bank0                    ;Go to bank 0
    
    MainLoop
                    call HideAllSegments
                    movlw b'00000110'        ;Number 1
                    movwf Segments
                    call ShowLeftSegment
    
                    call HideAllSegments
                    movlw b'01011011'        ;Number 2
                    movwf PORTB
                    call ShowMiddleSegment
    
                    call HideAllSegments
                    movlw b'01001111'        ;Number 3
                    movwf PORTB
                    call ShowRightSegment
    
                    goto MainLoop
    HideAllSegments
                    bcf Left_Seg
                    bcf Mid_Seg
                    bcf Right_Seg
                    return
    
    ShowLeftSegment
                    bsf Left_Seg
                    call Wait4mSec
                    return
    
    ShowMiddleSegment
                    bsf Mid_Seg
                    call Wait4mSec
                    return
    
    ShowRightSegment
                    bsf Right_Seg
                    call Wait4mSec
                    return
    The project Files

    Following are the files for this project:
     

    Ekli Dosyalar:

Yüklüyor...
Benzer Konular - Interface Multiple 7seg
  1. guclusat
    Mesaj:
    0
    Görüntüleme:
    548
  2. guclusat
    Mesaj:
    0
    Görüntüleme:
    64

Sayfayı Paylaş