• 1. 7 segmentli displey nima uchun qo’llaniladi
  • 7 segmentli led displeyi haqida




    Download 326,9 Kb.
    bet4/4
    Sana12.01.2024
    Hajmi326,9 Kb.
    #135784
    1   2   3   4
    Bog'liq
    4-mavzu

    Ulanish


    Ushbu tajribada 7-segmentli displeyning har bir AG pinini mos ravishda bitta 200 ohm oqim cheklovchi qarshilikka ulang va keyin 4-11 pinga ulang. GND GND ga ulanadi. Dasturlash orqali biz mos keladigan LED (lar) ni yoqish uchun pin4-11 ning bir yoki bir nechtasini Yuqori darajali qilib sozlashimiz mumkin.
    7 segmentli displey va SunFounder Uno platasi orasidagi simlar:

    7-segmentli displey

    Arduino Uno

    A

    7

    B

    6

    C

    5

    D.

    11

    E

    10

    F

    8

    G

    9

    DP

    4

    Kom

    GND

    ulanish diagrammasi

    2- rasm. 7 segmentli displayni ulanish diagrammasi

    Dasur kodi esa quydagicha bo’ladi



    int a=7;
    int b=6;
    int c=5;
    int d=11;
    int e=10;
    int f=8;
    int g=9;
    int dp=4;
    // 1
    void display1(void)
    {
    digitalWrite(b,HIGH);
    digitalWrite(c,HIGH);
    }
    //
    void display2(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(e,HIGH);
    digitalWrite(d,HIGH);
    }
    // 3
    void display3(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    digitalWrite(g,HIGH);
    }
    // 4
    void display4(void)
    {
    digitalWrite(f,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(c,HIGH);
    }
    // 5
    void display5(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(f,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    }
    // 6
    void display6(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(f,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    digitalWrite(e,HIGH);
    }
    // 7
    void display7(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(c,HIGH);
    }
    // 8
    void display8(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    digitalWrite(e,HIGH);
    digitalWrite(f,HIGH);
    }
    void clearDisplay(void)
    {
    digitalWrite(a,LOW);
    digitalWrite(b,LOW);
    digitalWrite(g,LOW);
    digitalWrite(c,LOW);
    digitalWrite(d,LOW);
    digitalWrite(e,LOW);
    digitalWrite(f,LOW);
    }
    void display9(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(g,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    digitalWrite(f,HIGH);
    }
    void display0(void)
    {
    digitalWrite(a,HIGH);
    digitalWrite(b,HIGH);
    digitalWrite(c,HIGH);
    digitalWrite(d,HIGH);
    digitalWrite(e,HIGH);
    digitalWrite(f,HIGH);
    }
    void setup()
    {
    int i;
    for(i=4;i<=11;i++)
    pinMode(i,OUTPUT);
    }
    void loop()
    {
    while(1)
    { clearDisplay();
    display0();
    delay(2000);
    clearDisplay();
    display1();
    delay(2000);
    clearDisplay();
    display2();
    delay(2000);
    clearDisplay();
    display3();
    delay(2000);
    clearDisplay();
    display4();
    delay(2000);
    clearDisplay();
    display5();
    delay(2000);
    clearDisplay();
    display6();
    delay(2000);
    clearDisplay();
    display7();
    delay(2000);
    clearDisplay();
    display8();
    delay(2000);
    clearDisplay();
    display9();
    delay(2000);
    }
    }

    5. Nazorat savollari.

    1. 7 segmentli displey nima uchun qo’llaniladi?


    2. 7 segmentli displey qanday tuzilishga ega?
    3. 7 segmentli displeyni qanday turlarini bilasiz?
    4. 7 segmentli displeyni qayerlarda qo’llash mumkin?
    5. 7 segmentli displeyga dastur qay tarzda yoziladi?
    6. Led lampalari bilan 7 segmentli displeyni uxshashlik tomonlari bormi?


    Download 326,9 Kb.
    1   2   3   4




    Download 326,9 Kb.