• Dastur kodi C++da
  • Atmega328 texnik parametrlari




    Download 1,66 Mb.
    bet9/9
    Sana19.01.2024
    Hajmi1,66 Mb.
    #141179
    1   2   3   4   5   6   7   8   9
    Bog'liq
    14 mavzu (1)

    4.4rasm. ARO‗ga beriluvi tayach
    Sxemalarning ikkinchisida musbat kuchlanishning kompensatsion integral stabilizatori (DA1 – Maxim/Dallas stabilizatori) ko’rsatilgan.
    ARO’(ATSP) uchun tayanch kuchlanishini stabilizator chiqishidan olish yoki aloxida kuchlanish ishlatish mumkin. Agarda ARO’ga aloxida kuchlanish ishlatiladigan bo’lsa 4.4rasm ko’rsatilgan sxemani qo’llash o’rinli bo’ladi. R1, VD1, VD2 elementlari mikrokontrollerni sakrashsimon kuchlanishlardan himoyalaydi. R2,C1 filtri ARO’ kirishidagi yuqori chastotali shovqinni yo’qotadi.

    Tashqi elektr zanjirdagi sakrovchi kuchlanishdan
    kuchlanishni filtrlash


    DC Power
    ximoyalanish uchun tahminot sxemasida bog’lanishsiz zanjir usulini qo’llash mumkin (5.5rasm).

      1. rasm. Himoyalovchi tahminot sxemasi

    Himoyalovchi sxemadagi asosiy xavfsizlikni optotiristor bajaridi. Nurlatuvchi indikator xolatiga muvofiq tranzistor ochilishi yoki yopilishi mumkin.


    Bundan tashqari himoyalash tahminotida va boshqaruv signalini uzatishda mikrokontrollerni ximoyalash uchun optik juftliklar (svetodiod-fotodiod, optorele va optik yarim o’tkazgichlar) va releli elementlardan foydalanish o’rinli (4.6rasm).

      1. rasm. Optojuftliklarni o’artli ko’rinishlari

        1. diodli chiqish; b) tranzistorli chiqish; v) bazadan yo’nalgan tranzistorli chiqish;

    g) raqamli chiqish; d) qisqa tutashuvli elektron kalit (optorele).

    Dastur kodi C++da


    //Atmega328

    #define F_CPU 8000000 //8MHz


    #include //input-output module #include

    void persets(){

    DDRB = 0xFF; PORTB = 0x00;


    DDRC = 0xFF; PORTC = 0x00;


    DDRD = 0xFF; PORTD = 0x00;


    TCCR0 = (1<





    }




    static unsigned char

    digit[]={

    (0b00111111),

    //0

    (0b00000110),

    //1

    (0b01011011),

    //2

    (0b01001111),

    //3

    (0b01100110),

    //4

    (0b01101101),

    //5

    (0b01111101),

    //6

    (0b00000111),

    //7

    (0b01111111),

    //8

    (0b01101111),

    //9

    };

    void ind (unsigned char chislo){


    unsigned char desjatki = 0; unsigned char sotni = 0; while (desjatki >= 100){


    desjatki-=100; sotni++;
    }
    while (chislo >= 10){ chislo-=10; desjatki++;
    }

    PORTC = (1<


    PORTB = digit[sotni];
    _delay_ms(5);
    PORTC = ~(1<
    PORTC = (1<

    PORTB = digit[desjatki];
    _delay_ms(5);
    PORTC = ~(1<

    PORTC = (1<


    PORTB = digit[chislo];
    _delay_ms(5);
    PORTC = ~(1<
    }
    /////////////////////////////////////////////////////////////////////////////
    //////

    int main(void)


    {
    int n = 0; // Variable for TCNT0 persets(); // Persets Ports
    PORTD = (1<
    while(1)
    { n += TCNT0; // n = n + TCNT0;
    _delay_ms(10); ind(n);
    if (n >= 715)
    {
    PORTD = (0<
    // OFF Motor
    }
    if (n <= 685)
    {
    PORTD = (1<
    ON Motor
    }
    _delay_ms(10); TCNT0 = 0x00; n = 0x00;
    _delay_ms(10);
    }
    }

    Savollar:





    1. ATmega328 texnik parametrlari haqida nimani bilasiz?




    1. Analog raqamli o’zgartgichlar ishlash prinsipi nimalardan iborat?




    1. Rostlash tizimining texnik vositalari haqida gapirib bering?




    1. Mikrokontrollerli tizimining texnik qurilmalar bilan bog’lanishi qanday?

    Download 1,66 Mb.
    1   2   3   4   5   6   7   8   9




    Download 1,66 Mb.