Cov txheej txheem:
- Kauj ruam 1: Kho vajtse
- Kauj Ruam 2: Pinout thiab Cov Cim
- Kauj Ruam 3: Txoj Cai
- Kauj ruam 4: Software
Video: Yuav ua li cas cuam tshuam MAX7219 Tsav LED Matrix 8x8 Nrog ATtiny85 Microcontroller: 7 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
MAX7219 tus tswj hwm yog tsim los ntawm Maxim Kev Sib Koom yog kev cog lus, cov ntawv tso tawm/tso tawm ntau-cathode cov tsav tsheb uas tuaj yeem cuam tshuam microcontrollers rau 64 tus neeg LEDs, 7-ntu lej LED qhia txog li 8 tus lej, kab lus qhia, thiab lwm yam. -chip yog BCD code-B decoder, multiplex scan circuitry, ntu thiab tus lej tsav tsheb thiab 8 × 8 zoo li qub RAM uas khaws txhua tus lej.
MAX7219 cov qauv tau yooj yim heev rau siv nrog microcontrollers xws li ATtiny85, lossis, hauv peb qhov xwm txheej Tinusaur Board.
Kauj ruam 1: Kho vajtse
MAX7219 cov qauv feem ntau zoo li qhov no. Lawv muaj lub tsheb npav nkag ntawm ib sab thiab tso tsheb npav mus rau lwm qhov. Qhov no tso cai rau koj kom daisy saw 2 lossis ntau qhov qauv, piv txwv li ib qho dhau ib qho, txhawm rau tsim teeb tsa nyuaj dua.
Cov qauv uas peb tab tom siv muaj peev xwm txuas rau hauv cov saw siv 5 tus dhia me. Saib daim duab hauv qab no.
Kauj Ruam 2: Pinout thiab Cov Cim
MAX7219 module muaj 5 tus pin:
- VCC - hwj chim (+)
- GND-hauv av (-)
- DIN - Cov ntaub ntawv tawm tswv yim
- CS - Chip xaiv
- CLK - Clock
Qhov ntawd txhais tau tias peb xav tau 3 tus pin ntawm ATtiny85 microcontroller sab los tswj tus qauv. Cov ntawd yuav yog:
- PB0 - txuas nrog CLK
- PB1 - txuas nrog CS
- PB2 - txuas nrog DIN
Qhov no txaus los txuas rau MAX7219 tus qauv thiab ua haujlwm rau nws.
Kauj Ruam 3: Txoj Cai
Kev sib txuas lus nrog MAX7219 yog qhov yooj yim - nws siv cov txheej txheem sib xws uas txhais tau tias rau txhua cov ntaub ntawv me ntsis peb xa mus muaj lub moos ncig uas qhia tau tias muaj cov ntaub ntawv ntawd me ntsis.
Hauv lwm lo lus, peb xa 2 ntu sib luag rau cov khoom - ib qho rau lub moos thiab lwm qhov rau cov ntaub ntawv. Nov yog qhov software ua.
Kauj ruam 4: Software
Txoj hauv kev no MAX7219 module ua haujlwm yog qhov no:
- Peb sau bytes rau nws daim ntawv sau npe sab hauv.
- MAX7219 txhais cov ntaub ntawv.
- MAX7219 tswj cov LEDs hauv matrix.
Qhov ntawd kuj txhais tau tias peb tsis tas yuav tsum tau viav vias hla kab ntawm LEDs txhua lub sijhawm txhawm rau teeb lawv - MAX7219 tus tswj hwm saib xyuas qhov ntawd. Nws kuj tseem tuaj yeem tswj qhov kev siv ntawm LEDs.
Yog li, txhawm rau siv MAX7219 cov qauv hauv txoj hauv kev yooj yim peb xav tau lub tsev qiv ntawv ua haujlwm kom ua tiav lub hom phiaj ntawd.
Ua ntej, peb xav tau qee qhov haujlwm tseem ceeb txhawm rau sau mus rau MAX7219 cov npe.
- Sau ib byte rau MAX7219.
- Sau ib lo lus (2 bytes) rau MAX7219.
Txoj haujlwm uas sau ib byte rau tus tswj xyuas zoo li no:
void max7219_byte (uint8_t data) {rau (uint8_t i = 8; i> = 1; i--) {PORTB & = ~ (1 << MAX7219_CLK); // Teeb CLK rau LOW yog tias (cov ntaub ntawv & 0x80) // Mask MSB ntawm cov ntaub ntawv PORTB | = (1 << MAX7219_DIN); // Teeb DIN rau HIGH lwm PORTB & = ~ (1 << MAX7219_DIN); // Teeb DIN rau LOW PORTB | = (1 << MAX7219_CLK); // Teeb CLK rau HIGH cov ntaub ntawv << = 1; // Hloov mus rau sab laug}}
Tam sim no peb tuaj yeem xa bytes mus rau MAX7219 peb tuaj yeem pib xa cov lus txib. Qhov no yog ua tiav los ntawm kev xa 2 byes - 1st rau qhov chaw nyob ntawm kev sau npe sab hauv thiab thib 2 rau cov ntaub ntawv peb xav xa.
Muaj ntau dua kaum ob ntawm kev sau npe hauv MAX7219 tus tswj.
Xa cov lus txib, lossis lo lus, yog qhov pib xa 2 bytes sib law liag. Kev ua haujlwm uas yooj yim heev.
void max7219_word (uint8_t chaw nyob, uint8_t cov ntaub ntawv) {PORTB & = ~ (1 << MAX7219_CS); // Teeb CS rau LOW max7219_byte (chaw nyob); // Xa qhov chaw nyob max7219_byte (cov ntaub ntawv); // Xa cov ntaub ntawv PORTB | = (1 << MAX7219_CS); // Teeb CS rau HIGH PORTB & = ~ (1 << MAX7219_CLK); // Teeb CLK rau LOW}
Nws yog ib qho tseem ceeb kom nco ntsoov ntawm no kab uas peb coj CS lub teeb liab rov qab mus rau HIGH - qhov no yog qhov xaus ntawm qhov ua ntu zus - qhov xwm txheej no, qhov kawg ntawm qhov hais kom ua. Cov txheej txheem zoo sib xws tau siv thaum tswj hwm ntau qhov ib qho txuas nrog hauv cov saw hlau. Qhov kauj ruam tom ntej, ua ntej peb pib qhib thiab tua lub LEDs, yog los pib lub MAX7219 maub los. Qhov no yog ua tiav los ntawm kev sau qee qhov txiaj ntsig rau qee cov npe. Txhawm rau kom yooj yim, thaum coding nws peb tuaj yeem tso qhov pib ua ntu zus hauv ib qho array.
uint8_t initseq = {0x09, 0x00, // Decode-Mode Register, 00 = No decode 0x0a, 0x01, // Intensity Register, 0x00.. 0x0f 0x0b, 0x07, // Scan-Limit Register, 0x07 to show all lines 0x0c, 0x01, // Shutdown Register, 0x01 = Normal Operation 0x0f, 0x00, // Display-Test Register, 0x00 = Normal Operation};
Peb tsuas yog xav xa 5 cov lus txib saum toj no hauv ib ntu raws li chaw nyob/cov ntaub ntawv txuas ntxiv mus.
Nov yog qhov yooj yim heev - peb tsuas yog sau ib lo lus txib qhov twg 1 byte yog qhov chaw nyob (los ntawm 0 txog 7) thiab thib ob byte yog 8 khoom sawv cev rau 8 LEDs hauv kab.
void max7219_row (uint8_t address, uint8_t data) {if (address> = 1 && address <= 8) max7219_word (address, data); }
Nws yog ib qho tseem ceeb kom nco ntsoov tias qhov no yuav ua haujlwm rau 1 matrix nkaus xwb. Yog tias peb txuas ntau cov lej hauv cov saw lawv txhua tus yuav qhia tib cov ntaub ntawv. Qhov laj thawj rau qhov no yog tias tom qab xa cov lus txib peb coj CS teeb liab rov qab mus rau HIGH uas ua rau txhua tus MAX7219 tus tswj hwm hauv cov saw los tuav thiab qhia qhov twg los xij qhov lus txib kawg.
Pom zoo:
Kev cuam tshuam Atmega16 Microcontroller Nrog Dot Matrix Led Zaub: 5 Cov Kauj Ruam
Kev cuam tshuam ntawm Atmega16 Microcontroller Nrog Dot Matrix Led Zaub: Hauv qhov haujlwm no peb tab tom cuam tshuam ib qho teev matrix LED zaub nrog AVR (Atmega16) microcontroller. Ntawm no peb yuav qhia simulation hauv proteus, koj tuaj yeem siv tib yam hauv koj cov khoom siv kho vajtse. Yog li ntawm no peb yuav xub luam ib tus cim cia peb hais 'A' hauv t
Kev cuam tshuam Brushless DC Tsav (BLDC) Nrog Arduino: 4 Cov Kauj Ruam (nrog Duab)
Interfacing Brushless DC Motor (BLDC) Nrog Arduino: Nov yog qhia txog kev cuam tshuam li cas thiab ua haujlwm Brushless DC lub cev siv Arduino. Yog tias koj muaj lus nug lossis lus pom thov teb hauv cov lus lossis xa mus rau rautmithil [ntawm] gmail [dot] com. Koj tseem tuaj yeem tiv tauj nrog kuv @mithilraut ntawm twitter.To
Sib cuam tshuam Servo Tsav Nrog NodeMCU: 6 Cov Kauj Ruam (nrog Duab)
Interfacing Servo Motor Nrog NodeMCU: Nyob Zoo Txhua Tus, Nov yog kuv thawj qhov haujlwm Qhia. Yog li koj xav pib nrog NodeMCU? Zoo, kuv nyob ntawm no los qhia rau koj. Hnub no, kuv yuav qhia koj yuav pib li cas nrog NodeMCU. Cia peb mus! NodeMCU muaj nyob hauv nkoj ESP8266-12E ua rau
Kev cuam tshuam 8051 Microcontroller Nrog 7 Segment Display: 5 Cov Kauj Ruam (nrog Duab)
Kev cuam tshuam 8051 Microcontroller Nrog 7 Segment Display: Hauv qhov haujlwm no peb yuav qhia koj txog yuav ua li cas peb tuaj yeem cuam tshuam 7 ntu zaub nrog 8051 microcontroller
Tus Cuam Tshuam Cuam Tshuam (ntsuas phoo Cam Cuam Tshuam Cuam Tshuam): 4 Cov Kauj Ruam
Solder Saver (txhav tas Cam Cuam Tshuam Cuam Tshuam): "Yuav ua li cas kuv thiaj yuav tsum qhia ua ntej Cov Lus Qhia no?" Kuv nug kuv tus kheej. Zoo li, txij li thaum pib ntawm lub sijhawm, tus txiv neej muaj qhov xav kom lo lo rau hauv tus cwj mem thiab tshaj tawm cov duab online. Zoo, Kuv tau txiav txim siab luv luv delving rau hauv keeb kwm loj dua ntawm tus cwj mem yaj, b