Yetti segmentli bitta raqamli ko‘rsatkich
Download 1.18 Mb.
|
Tirkashev Xojiakbar
- Bu sahifa navigatsiya:
- Laboratoriyaning nazariy qismi.
- Texnik parametrlar
- Umumiy malumot.
Laboratoriya ishi № 18.Arduinoda 8x8 LED diodli matritsani boshqarish. Laboratoriya ishining maqsadi: 8x8 LED matritsasini tanishtirish, nazorat qilish va uni loyihalarda qo‘llash. Laboratoriyaning nazariy qismi.Keling, MAX7219-ga asoslangan LED matritsali modulni va uni Arduino-ga qanday ulashni ko‘rib chiqaylik. Bu modul qulay, chunki quvvat manbaidan tashqari, boshqarish uchun faqat 3 ta kontakt ishlatiladi. Bunday bir nechta modullarni katta displeyga birlashtirish mumkin, lekin modullar soni oshgani sayin chizish tezligi pasayadi. Texnik parametrlarMAX7219; Ko‘rsatkichlar turi 1088BS: umumiy katod; 1088BS indikatoridagi LEDlar soni: 64; LED Yagona LED diametri: 3 mm; LED rangi: qizil, ko‘k, yashil; Matritsali ulanish interfeysi: SPI; Quvvat kuchlanishi: 5 V; o Matritsaning o‘lchami: 32 x 32 x 14 mm; Umumiy ma'lumot.Modul ikki qismdan iborat, pastki qismida MAX7219 mikrosxemasi kichik elektr zanjiri o‘rnatilgan, yuqori qismida umumiy katotli (32 mm x 32 mm x 1088BS LED matritsali) bosilgan elektron platasi joylashgan. 8 mm). 1088BS matritsasida 16 ta pin bor, ulardan 8 tasi qatorlar uchun, qolgan 8 tasi ustunlar uchun, LEDlarning umumiy soni 64 dona. Keling, MAX7219 ni batafsil ko‘rib chiqaylik. Mikrosxemalar Arduino tekshirgichi bilan aloqa qilish uchun faqat 3 ta sim yordamida 64 ta alohida LEDni boshqarishi va bir xil MAX7219 ni bitta katta matritsaga ulash uchun bir xil simlardan foydalanishi mumkin. 64 LEDni boshqarish uchun MAX7219 faqat 16 ta pinni ishlatadi va bir vaqtning o‘zida sakkizta LEDni yoqishi mumkin. LED massivi 8 qator va 8 ustundan iborat, shuning uchun MAX7219 har bir ustuni juda qisqa vaqt davomida yoqadi va har bir qatorni bir vaqtning o‘zida yoqadi. Shuning uchun, inson ko‘zi tez o‘tishni sezmaydi, faqat uzluksiz nurni ko‘radi. unsigned char i; unsigned char j; int Max7219_pinCLK = 10; int Max7219_pinCS = 9; int Max7219_pinDIN = 8; unsigned char disp1[33][8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // yurak rasmi 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x40, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x60, 0x80, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x60, 0x90, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x60, 0x90, 0x88, 0x40, 0x40, 0x00, 0x00, 0x00, 0x60, 0x90, 0x88, 0x44, 0x40, 0x00, 0x00, 0x00, 0x60, 0x90, 0x88, 0x44, 0x44, 0x00, 0x00, 0x00, 0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x00, 0x00, 0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x00, 0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x20, 0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x10, 0x60, 0x60, 0x90, 0x88, 0x44, 0x44, 0x08, 0x90, 0x60, 0x60, 0x90, 0x88, 0x44, 0x44, 0x88, 0x90, 0x60 // yurak rasmi }; void Write_Max7219_byte(unsigned char DATA) { unsigned char i; digitalWrite(Max7219_pinCS, LOW); for (i = 8; i >= 1; i--) { digitalWrite(Max7219_pinCLK, LOW); digitalWrite(Max7219_pinDIN, DATA & 0x80); DATA = DATA << 1; digitalWrite(Max7219_pinCLK, HIGH); } } void Write_Max7219(unsigned char address, unsigned char dat) { digitalWrite(Max7219_pinCS, LOW); Write_Max7219_byte(address); Write_Max7219_byte(dat); digitalWrite(Max7219_pinCS, HIGH); } void Init_MAX7219(void) { Write_Max7219(0x09, 0x00); Write_Max7219(0x0a, 0x03); Write_Max7219(0x0b, 0x07); Write_Max7219(0x0c, 0x01); Write_Max7219(0x0f, 0x00); } void setup() { pinMode(Max7219_pinCLK, OUTPUT); pinMode(Max7219_pinCS, OUTPUT); pinMode(Max7219_pinDIN, OUTPUT); delay(50); Init_MAX7219(); } void loop() { //yurak rasmini chizami for (j = 0; j < 17; j++) { for (i = 1; i < 9; i++) Write_Max7219(i, disp1[j][i - 1]); delay(100); } // hamma narsani bo‘yash for (i = 1; i < 9; i++) { Write_Max7219(i, 0xFF); delay(100); } //все стираем for (i = 1; i < 9; i++) { Write_Max7219(i, 0x00); delay(100); } //пауза delay(800); } Download 1.18 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling