Cov txheej txheem:

Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment: 6 Cov Kauj Ruam
Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment: 6 Cov Kauj Ruam

Video: Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment: 6 Cov Kauj Ruam

Video: Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment: 6 Cov Kauj Ruam
Video: 8051 microcontroller programming 2024, Hlis ntuj nqeg
Anonim
Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment
Stopwatch Siv Pic18f4520 hauv Proteus Nrog 7 Segment

Kuv nyuam qhuav pib ua haujlwm nrog pic tswj, ib tus ntawm kuv tus phooj ywg thov kom kuv tsim lub tswb moos los ntawm nws. Yog li kuv tsis muaj cov duab kho vajtse los qhia, Kuv tau sau cov cai thiab simulate nws ntawm Proteus software.

ntawm no kuv tau qhia cov txheej txheem rau tib yam.

peb qhov sib txawv milliseconds, vib nas this, feeb tau txhais

ntawm no peb tau siv sijhawm ncua sijhawm ntawm 10 ms, rau txhua 1000 milliseconds, vib nas this hloov pauv yuav nce, rau txhua 60 vib nas this feeb qhov sib txawv yuav nce ntxiv.

Kauj Ruam 1: Yam Yuav Tsum Tau

1 pic18f4520 maub los

2 xya ntu qhia tawm

3bc547 ua

4 hloov rau pib/nres/pib dua

5 resistors 330E, 10K, 1K

6 rub tawm mikroC rau pic

7 download proteus

Kauj ruam 2: Code Logic thiab Zaub

Code Logic thiab Zaub
Code Logic thiab Zaub
Code Logic thiab Zaub
Code Logic thiab Zaub

Xya Segment Display yog Dab Tsi? Xya Segment Display (SSD) yog ib qho uas muaj ntau tshaj, pheej yig thiab yooj yim siv los tso saib. Nws zoo li saum toj no.

ntawm no peb yuav tsum siv Hom cathode Hom ntawm 7 ntu zaub - Hauv hom cathode hom SSD, terminalve davhlau ya nyob twg ntawm txhua lub LEDs feem ntau txuas nrog 'COM' tus pin. Ib ntu tuaj yeem pom kev pom thaum '1' tau muab rau ntu ntu LED thiab hauv av txuas nrog rau ib qho. Sab hauv yog muab hauv daim duab 2.

Kauj Ruam 3: Tsav Tsheb Nrog Microcontroller

Tsav Tsheb Nrog Microcontroller
Tsav Tsheb Nrog Microcontroller

Hauv kuv qhov kev sib tham, Kuv tau siv NPN BC547 Transistor.

Rau kev siv yooj yim ntawm BJT ua qhov hloov pauv, cov emitter-sau cov khoom sib txuas tau luv dua thaum muaj lub teeb liab nkag ntawm lub hauv paus dav hlau, lwm qhov nws tseem raug txiav tawm. Cov tswv yim yuav tsum muab los ntawm tus tiv thaiv haum.

Kauj Ruam 4: Vim Li Cas Multiplexing?

Feem ntau peb yuav tsum siv ob, peb lossis ntau dua SSDs thiab uas ib yam siv tsuas yog MCU nkaus xwb, tab sis ib qho teeb meem uas peb ntsib yog tsis muaj I/O pins hauv MCU, raws li ib qho SSD yuav siv 8 tus pin, thiab yog li peb SSDs yuav siv 24 tus pin. Hauv daim duab 18, peb tsuas muaj 48 I/O pins. Yog li qhov kev daws teeb meem yog dab tsi?

Ib qhov muaj peev xwm yog tias peb siv MCU loj dua nrog ntau I/O pins. Tab sis tom qab ntawv peb tseem txwv tsuas yog qhov siab tshaj ntawm 3 SSDs uas tuaj yeem siv tau. Lwm qhov zoo dua thiab pom zoo daws rau qhov teeb meem no yog ua kom sib npaug rau Xya Segment Displays.

Wikipedia hais tias 'Hauv kev sib txuas lus hauv xov tooj cua thiab khoos phis tawj, kev sib txuas sib txuas (tseem hu ua muxing) yog ib txoj hauv kev uas muaj ntau cov lus sib tham sib piv lossis cov ntaub ntawv xov xwm digital tau sib koom ua ke rau hauv ib lub teeb liab tshaj li qhov nruab nrab. Lub hom phiaj yog sib qhia cov peev txheej kim. 'Peb txhais li cas los ntawm kev sib npaug ntawm xya-ntu tso tawm yog tias peb yuav siv tsuas yog 7 qhov chaw nres nkoj tso tawm kom muab cov zaub ntawm txhua qhov SSDs.

Kauj Ruam 5: Yuav Ua Li Cas Kom Ua Tau Li No?

Ntawm no, peb yuav siv 'Persistence of Vision'. Tam sim no koj yuav tsum tau hla cov lus no ua ntej. Yog, qhov no yog tib cov txheej txheem uas tau siv hauv kev ua yeeb yaj kiab (tso duab kom nrawm heev uas peb lub hlwb tsis tuaj yeem paub qhov txawv ntawm ob daim duab sib law liag). Zoo sib xws, thaum peb mux ntau dua ib qho SSD, peb tso tawm tsuas yog ib qho SSD nyob rau ib lub sijhawm, thiab peb hloov ntawm lawv nrawm heev uas peb lub hlwb tsis tuaj yeem sib txawv ntawm lawv.

Cia hais tias txhua qhov kev ua haujlwm tsuas yog 5 milliseconds ntawm ib lub sijhawm, piv txwv li nws tau teeb pom kev 1/0.0045 zaug ib pliag, uas yog kwv yees li 222 zaug/thib ob. Peb lub qhov muag tsis tuaj yeem hnov qhov hloov pauv sai, thiab yog li qhov peb pom yog tias txhua qhov kev ua haujlwm tau ua haujlwm ib txhij. Dab tsi tshwm sim tiag tiag hauv kho vajtse yog tias MCU muab '1' rau tus pin (nco ntsoov, muab '1' rau lub hauv paus ntawm BJT luv tus Collector thiab emitter sib txuas?), Uas txuas nrog lub hauv paus ntawm transistor ntawm cov lus qhia tshwj xeeb, khaws qhov chaw nres nkoj 'ON' rau 5 milliseconds, thiab tom qab ntawd tig nws tawm dua. Cov txheej txheem no tau muab tso rau hauv qhov tsis muaj qhov kawg, yog li peb pom cov zaub tsis tu ncua.

Kauj Ruam 6: Multiplexing Algorithm

Multiplexing Algorithm
Multiplexing Algorithm

Txhais ob qhov chaw nres nkoj hauv cov cai, ib qho rau ntu ntu cov ntaub ntawv chaw nres nkoj thiab ntu tswj chaw nres nkoj.

dag ntawm no yog koj tso tawm cov ntaub ntawv ntawm txhua 7 ntu. thiab qhib ib tus pin tswj hwm uas koj yuav tsum tso tawm cov ntaub ntawv ntawd. hloov cov ntaub ntawv thiab hloov pauv tus pin.

ntawm no hauv cov lus qhia no peb tau siv 6 tus lej sib tshooj, tsuas yog hla c cov ntawv txuas thiab koj yuav tau txais nws tshem tawm.

Pom zoo: