Cov txheej txheem:

Siv Dot Matrix LED Nrog Arduino thiab Hloov Npe: 5 Kauj Ruam
Siv Dot Matrix LED Nrog Arduino thiab Hloov Npe: 5 Kauj Ruam

Video: Siv Dot Matrix LED Nrog Arduino thiab Hloov Npe: 5 Kauj Ruam

Video: Siv Dot Matrix LED Nrog Arduino thiab Hloov Npe: 5 Kauj Ruam
Video: Dot matrix display on a building 2024, Hlis ntuj nqeg
Anonim
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe
Siv Dot Matrix LED Nrog Arduino thiab Hloov Sau Npe

Siemens DLO7135 Dot matrix LED yog ib qho zoo kawg ntawm optoelectronics. Nws tau sau nqi raws li 5x7 Dot Matrix Intelligent Display (r) nrog Nco/Decoder/Driver. Nrog rau qhov kev nco ntawd, nws tau txais 96-cim ASCII zaub teeb tsa nrog cov ntawv loj thiab qis, lub cim tsim hluav taws xob thiab tus lej sib txuam, plaub qib ntawm kev siv lub teeb, thiab nws txhua tus khiav ntawm 5V., thiab ntawm $ 16 pop, nws yuav tsum yog. Thaum siv sijhawm ib nrab hnub ntawm kuv lub khw nyiam khoom siv hluav taws xob hauv zos Kuv pom lub thoob uas muaj cov no rau $ 1.50 ib thooj. Kuv tawm ntawm lub khw nrog ob peb. Cov lus qhia no yuav qhia koj yuav ua li cas txuas rau cov dot matrix LED's thiab qhia cov cim siv AVR-based Arduino. Yog tias koj tau nyeem ib qho ntawm kuv cov lus qhia yav dhau los, koj tuaj yeem tau txais lub tswv yim uas kuv feem ntau pom zoo rau kev daws teeb meem ntau tshaj plaws, thiab koj yuav tsis raug yuam kev, txawm tias kuv ua tsis tau raws lub hom phiaj ib zaug dhau los. Yog li ntawd, kuv tseem yuav mus rau lwm kauj ruam hauv cov lus qhia no thiab qhia koj li cas koj tuaj yeem txo tus naj npawb ntawm I/O cov chaw nres nkoj xav tau los tsav cov loj no, honkin 'dot matrix LED's.

Kauj ruam 1: Tau txais cov khoom …

Xaiv cov khoom…
Xaiv cov khoom…

Rau qhov haujlwm me me luv luv no, koj yuav xav tau:

  • AVR-based microcontroller zoo li Arduino lossis ib qho ntawm nws yog ilk. Cov lus qhia no tej zaum yuav raug yoog raws koj li MCU xaiv.
  • a DLO7135 dot matrix LED lossis lwm yam hauv tib tsev neeg
  • 8-ntsis hloov pauv npe xws li 74LS164, 74C299, lossis 74HC594
  • ib daim ntawv qhia zaub mov
  • hookup hlau, hlau txiav, thiab lwm yam.

Cov hlau tsis xav tau, txawm hais tias kuv siv tom qab; koj tuaj yeem tau txais yam tsis muaj nws.

Kauj Ruam 2: Txuas ncaj qha rau LED Zaub

Txuas ncaj qha mus rau LED Zaub
Txuas ncaj qha mus rau LED Zaub
Txuas ncaj qha mus rau LED Zaub
Txuas ncaj qha mus rau LED Zaub
Txuas ncaj qha mus rau LED Zaub
Txuas ncaj qha mus rau LED Zaub

Teem tawm koj daim ntawv teev npe me me ntawm ntu thiab lob cov LED. Muab nws tso rau ntawm daim ntawv qhia zaub mov nruab nrab me ntsis, hla nruab nrab kab zawj. Thawj ntu ntawm kev sib txuas yuav siv tag nrho ntawm sab laug ntawm LED. Pin #1 nyob rau sab laug sab saum toj raws li qhia los ntawm daim duab peb sab/xub. Kuv tso tus lej ua haujlwm ntawm daim duab rau koj siv thaum koj nyeem lossis txuas koj li LED.

Sab laug

Zoo thiab Tsis Zoo Pib ntawm sab laug saum toj, txuas Vcc rau 5V. Tej zaum nws yog lub tswv yim zoo kom tsis muaj koj lub rooj tsav xwm ua haujlwm kom txog thaum koj tau txais tag nrho sab laug ua tiav; lub LED tuaj yeem ci yog tias koj tab tom sim pom qhov me me txhawm rau txhawm rau hauv cov xov hlau. Txuas hauv qab sab laug GND rau hauv av. Teeb Teeb, Chip Pab Tau thiab Sau Qhov thib ob thiab thib 3 los ntawm sab saum toj ntawm sab laug yog Teeb Teeb thiab Chip Pab Tau. Cov no yog ob qho kev xav tsis zoo, txhais tau tias lawv tau ua haujlwm thaum lawv nyob ntawm qhov laj thawj 0 tsis yog 1. Kuv daim duab hauv qab no yuav tsum muaj kab hla lawv, tab sis kuv tsis tau hais qhia qhov ntawd rau ib qho ntawm lawv. LT tus pin thaum qhib teeb rau txhua qhov chaw hauv dot matrix ntawm 1/7th ci. Nws yog qhov ntsuas pixel ntau dua, tab sis qhov txaus siab txog LT tus pin yog tias nws tsis sau dua ib tus cim uas nyob hauv lub cim xeeb, yog li koj yog tias koj muaj ob peb yam ntawm cov no sib zog ua ke (lawv muaj 20ft saib nrug), strobing LT tuaj yeem ua rau nws zoo li tus cursor. Kom ntseeg tau tias nws xiam oob qhab, txuas nws mus rau 5V. The CE thiab WR pins kuj yog qhov tsis zoo thiab yuav tsum tau ua kom qhib rau lub cuab yeej ntse no los sau rau. Koj tuaj yeem tswj hwm cov pins no nrog cov khoom seem I/O ntawm koj lub microcontroller, tab sis peb yuav tsis thab ntawm no. Tsuas yog txuas lawv rau hauv av kom lawv ua haujlwm. The Brightness Levels Muaj plaub qhov programmable qib ci ci ntawm DLO tsev neeg ntawm LEDs:

  • Blank
  • 1/7 Brightness
  • 1/2 Brightness
  • Tag Nrho Brightness

BL1 HIGH thiab BL0 LOW yog 1/2 ci ci. Ob qho HIGH yog qhov ci tag nrho. Teeb nws rau yam koj nyiam. Ib zaug ntxiv, yog tias koj muaj I/O cov chaw nres nkoj kom tseg thiab nws tseem ceeb txaus rau koj, qhov no tseem tuaj yeem tswj tau los ntawm koj Arduino. That qhwv rau sab laug. Yog tias koj nqa lub zog rau koj lub rooj tsavxwm koj yuav tsum pom lub teeb ci LED. Ua si nrog kev tswj lub teeb ci thiab ntsuas lub teeb kom paub nws, yog tias koj xav paub.

Sab xis

Sab xis suav nrog cov ntaub ntawv tag nrho cov chaw nres nkoj. Hauv qab txoj cai, tus pin 8 lossis D0 kom raug, sawv cev rau Qhov Tsawg Tshaj Plaws Me ntsis hauv tus lej 7-ntsis. Sab saum toj sab xis, tus pin 14 lossis D6 sawv cev rau Qhov Tseem Ceeb Tshaj Plaws. Qhov no tso cai rau koj paub qhov kev txiav txim siab los shuffle koj cov khoom thaum sau rau LED. Thaum koj muaj cov ntaub ntawv nkag chaw nres nkoj txuas, pom xya qhov khoob digital I/O chaw nres nkoj ntawm koj Arduino lossis AVR thiab txuas lawv. Tej zaum koj yuav xav nco ntsoov cov ntaub ntawv tso tawm qhov chaw nres nkoj ntawm koj li AVR mus rau qhov twg cov ntaub ntawv nkag chaw nres nkoj ntawm LED. Tam sim no koj npaj txhij thawb qee cov ntaub ntawv mus rau qhov ntse LED. Puas yog koj tseem tshee hnyo nrog kev zoo siab? Kuv paub tias kuv yog…

Kauj Ruam 3: Qhia kom paub tus yam ntxwv kom pom

Qhia kom paub tus yam ntxwv kom pom
Qhia kom paub tus yam ntxwv kom pom

Cov cim uas tau siv ntawm CMOS LED no yog koj li ntawm-ntawm-zeb-ASCII pib ntawm 0x20 (zauv 32; ib qhov chaw) thiab xaus ntawm 0x7F (zauv 127; rho tawm, txawm hais tias sawv cev ntawm LED ua tus cursor duab). Yog li, muaj LED tso tus cim tsis muaj dab tsi ntau dua li thawb lub logic 1 lossis 0 ntawm koj cov ntaub ntawv tso tawm pins, feem ntau ua raws los ntawm WR mem tes, tab sis kuv tau hais ua ntej rau qhov kev tawm dag zog no yog li, koj tau sau tseg lossis nco qab dab tsi pins mus rau qhov chaw nres nkoj, txoj cai? Kuv xaiv PD [2..7] thiab PB0 (digital pins 2 txog 8 hauv Arduino-hais lus). Kuv ib txwm tsis hais qhia siv PD [0..1] vim tias kuv muab nws rau kuv qhov kev sib txuas lus txuas mus rau FreeBSD lub thawv, thiab Arduino li al. daim ntawv qhia cov pins rau lawv FTDI USB kev sib txuas lus channel, thiab txawm hais tias "lawv" SAY pins 0 thiab 1 yuav ua haujlwm yog tias koj tsis pib ua ntej kev sib txuas lus, Kuv yeej tsis tau siv cov pins li qub digital I/O. Qhov tseeb, kuv tau siv ob hnub los daws qhov teeb meem thaum kuv sim siv PD0 thiab PD1 thiab pom tias lawv ib txwm HIGH. * shrug* Nws yuav yog qhov zoo kom muaj qee yam kev tawm tswv yim sab nraud, zoo li tej zaum yog lub pob keypad, lub laub rub lossis tus ntiv tes xoo hloov, lossis tej zaum txawm tias nkag los ntawm lub davhlau ya nyob twg (kuv ArduinoTerm tseem tsis tau npaj rau lub sijhawm tseem tseem tsis tau …). Qhov kev xaiv yog koj li. Txog tam sim no, Kuv tsuas yog yuav piav qhia yuav ua li cas thiaj li tau txais tus lej kom tau tus yam ntxwv uas koj xav tau mus rau LED. Muaj zipfile rau rub tawm suav nrog qhov chaws thiab Makefile thiab tseem muaj cov yeeb yaj kiab luv luv uas qhia LED luam tawm nws cov cim teeb. Thov txim rau qhov ua tsis zoo ntawm daim vis dis aus. Qhov chaws hauv qab no luam tawm txoj hlua "Zoo siab txais tos rau Kuv Cov Lus Qhia!" tom qab ntawd mus los ntawm tag nrho cov cim teeb uas LED txhawb.

DDRD = 0xFF; // OutputDDRB = (1 << DDB0); char msg = "Zoo siab txais tos rau Kuv Cov Lus Qhia!"; uint8_t i; rau (;;) {rau (i = 0; kuv <27; i ++) {Print2LED (msg ); _delay_ms (150); } rau (kuv = 0x20; kuv <0x80; kuv ++) {Print2LED (kuv); _delay_ms (150); } Print2LED (& apos*& apos);}Qhov chaw nres nkoj tso tawm tau saib xyuas hauv Print2Led () ua haujlwm

voidPrint2LED (uint8_t kuv) {PORTD = (kuv << 2); yog (kuv & 0b01000000) PORTB = (1 <

Cov cai thiab Makefile tau suav nrog hauv cov ntawv zip hauv qab no.

Kauj Ruam 4: Txuag I/O Ports Nrog Kev Hloov Npe

Txuag I/O Ports Nrog Kev Hloov Npe
Txuag I/O Ports Nrog Kev Hloov Npe
Txuag I/O Ports Nrog Kev Hloov Npe
Txuag I/O Ports Nrog Kev Hloov Npe
Txuag I/O Ports Nrog Kev Hloov Npe
Txuag I/O Ports Nrog Kev Hloov Npe

Yog li tam sim no peb lub microcontroller tuaj yeem xa cov ntaub ntawv mus rau dot matrix LED tab sis nws siv yim qhov chaw nres nkoj I/O. Qhov tsis suav nrog siv ATtiny hauv pob 8-pin DIP, thiab txawm tias nrog Arduino tshiab ntaus pob ncaws pob ATmega328p uas yog ntau ntawm I/O chaw nres nkoj rau ib qho LED. Peb tuaj yeem hla qhov no, txawm li cas los xij, los ntawm kev siv IC hu ua daim ntawv pauv npe. Lub sijhawm los "hloov pauv" zog … Kev hloov npe tuaj yeem nkag siab zoo tshaj plaws los ntawm kev xav txog ob lo lus uas ua nws lub npe: "hloov" thiab "sau npe." Lo lus hloov pauv hais txog yuav ua li cas cov ntaub ntawv txav mus los ntawm kev sau npe. Nov (zoo li hauv peb Arduino thiab microcontrollers, feem ntau) sau npe yog qhov chaw uas tuav cov ntaub ntawv. Nws ua qhov no los ntawm kev ua raws cov kab sib txuas ntawm cov txheej txheem digital logic hu ua "flip flops" uas muaj ob lub xeev ruaj khov uas tuaj yeem sawv cev los ntawm 1 lossis 0. Yog li, los ntawm kev tso yim yim flip flops ua ke koj muaj lub cuab yeej uas muaj peev xwm tuav tau thiab sawv cev rau 8-ntsis byte. Just li muaj ob peb hom flip flops, thiab ntau qhov kev hloov pauv ntawm lub ntsiab lus ntawm kev hloov npe (xav txog/down counters thiab Johnson counters), kuj tseem muaj ntau hom kev hloov pauv rau npe raws li cov ntaub ntawv li cas tau kaw rau hauv daim ntawv sau npe thiab yuav ua li cas cov ntaub ntawv raug tso tawm. Raws li qhov no, xav txog cov hom kev hloov npe hauv qab no:

  • Serial Hauv / Parallel Out (SIPO)
  • Serial In / Serial Out (SISO)
  • Parallel In/ Serial Out (PISO)
  • Parallel In / Parallel Out (PIPO)

Ob qhov kev ceeb toom yog SIPO thiab PISO. SIPO sau npe siv cov ntaub ntawv ib ntus, uas yog, ib qho tom qab lwm qhov, hloov qhov kev nkag mus yav dhau los me ntsis mus rau qhov flip flop tom ntej thiab xa cov ntaub ntawv tawm ntawm txhua qhov kev nkag mus ib zaug. Qhov no ua rau lub koob npe zoo rau kev sib hloov hloov pauv. PISO hloov npe, sib tham, muaj cov tswv yim sib xws, yog li txhua qhov khoom nkag ib zaug, tab sis tso tawm ib zaug. Thiab koj twv nws, qhov no ua rau zoo sib xws rau cov hloov pauv. Kev hloov pauv npe peb xav siv los txo tus lej I/O pins yuav tso cai rau peb coj cov 8 IO pins uas peb siv ua ntej thiab txo lawv mus rau ib qho, lossis tej zaum tsuas yog ob peb leeg, txiav txim siab tias peb yuav xav tau tswj hwm peb li cas cov khoom. Yog li ntawd, qhov hloov pauv npe peb yuav siv yog Serial In / Parallel Out. Txhim kho txoj haujlwm sau npe ntawm LED thiab Arduino Siv kev sau npe ua haujlwm tau yooj yim. Qhov nyuaj tshaj plaws tsuas yog pom cov ntaub ntawv tso tawm pins thiab yuav ua li cas tus lej binary yuav xaus rau hauv IC, thiab yuav ua li cas lawv thiaj li tshwm sim ntawm LED. Siv sijhawm me ntsis los npaj qhov no. 1. Txuas 5V rau tus pin 14 (sab saum toj sab xis) thiab coj tus pin 7 (hauv qab sab laug) nqes mus rau hauv av. 2. Cov npe hloov pauv muaj ob qhov txuas nkag tab sis peb tsuas yog siv ib qho, yog li txuas tus pin ob rau 5V3. Peb yuav tsis siv tus pin tseeb (siv rau xoom tawm txhua qhov tawm) yog li tso nws ntab lossis tua nws mus rau 5V4. Txuas ib qho digital IO chaw nres nkoj txhawm rau pin ib qho ntawm cov npe hloov pauv. Nov yog tus lej nkag tus lej pin.5. Txuas ib qho digital IO chaw nres nkoj rau tus pin 8 (hauv qab txoj cai). Nov yog lub moos pin.6. Txuas koj cov ntaub ntawv kab los ntawm Q0 rau Q6. Peb tsuas yog siv 7 khoom vim tias ASCII cov cim teeb tsuas yog siv xya khoom. Kuv siv PD2 rau kev tso tawm kuv cov ntaub ntawv xov xwm thiab PD3 rau lub moos teeb liab. Txog cov ntaub ntawv pins, Kuv txuas Q0 rau D6 ntawm LED thiab txuas ntxiv txoj kev ntawd (Q1 txog D5, Q2 txog D4, thiab lwm yam). Txij li thaum peb tab tom xa tawm cov ntaub ntawv ntu peb yuav tau tshuaj xyuas qhov binary sawv cev ntawm txhua tus cim peb xav xa, saib 1's thiab 0's, thiab tso tawm txhua qhov me ntsis ntawm kab ntawv. Kuv tau suav nrog qhov thib ob ntawm dotmatrixled.c qhov chaw nrog rau Makefile hauv qab no. Nws mus los ntawm cov cim teeb tsa thiab nthuav tawm txhua tus cim (yog tias nws xav tsis thoob tias tsab ntawv tuaj yeem txawv lossis txawm tias, xav txog kev sawv cev binary rau ib pliag). Sim txiav txim siab yuav ua li cas thiaj ua nws lub voj voog los ntawm kev tso tawm txhua tus cim coj txawv txawv. Koj tuaj yeem sim ntxiv nrog kev sib txuas ntawm cov npe hloov pauv, dot matrix LED, thiab koj Arduino. Muaj ntau qhov kev tswj hwm nruab nrab ntawm LED thiab daim ntawv sau npe uas tuaj yeem tso cai rau koj kho kom raug koj li kev tswj hwm thaum cov ntaub ntawv raug teeb tsa.

Kauj ruam 5: Cov ntsiab lus

Ntsiab lus
Ntsiab lus
Ntsiab lus
Ntsiab lus

Hauv cov lus qhia no, kuv tau nthuav qhia DLO7135 dot matrix LED thiab yuav ua li cas thiaj ua haujlwm. Kuv tau txuas ntxiv, tham txog yuav ua li cas txo tus naj npawb ntawm qhov yuav tsum tau I/O chaw nres nkoj los ntawm yim rau tsuas yog ob qho siv kev hloov npe. DLO7135 dot matrix LED tuaj yeem sib zog ua ke kom pom qhov muag zoo nkauj thiab nthuav dav. Kuv vam tias koj tau lom zem nyeem cov lus qhia no! Yog tias muaj kev txhim kho koj xav tias kuv tuaj yeem ua lossis tawm tswv yim koj xav muab rau ntawm no lossis ib qho ntawm kuv ibles, Kuv zoo siab tau hnov lawv! Zoo siab AVR'ing!

Pom zoo: