Cov txheej txheem:

BlinkLED: 4 Kauj Ruam
BlinkLED: 4 Kauj Ruam

Video: BlinkLED: 4 Kauj Ruam

Video: BlinkLED: 4 Kauj Ruam
Video: niam tais vab part4 10/4/2018 2024, Kaum ib hlis
Anonim
BlinkLED
BlinkLED

BlinkLED yog LED uas muaj nws tus kheej PIC microcontroller. Cov qauv ntsais muag thiab cov nqi ntsais muag tuaj yeem siv tau thiab BlinkLEDs tuaj yeem siv ib tus zuj zus (rau LED Throwies) lossis hauv cov hlua rau hnub so lossis teeb pom kev tshwj xeeb. Kuv tau ua cov no vim tias kuv xav txiav kuv tsob ntoo Christmas nrog ib tus neeg ntsais muag teeb. Nrog BlinkLED, Kuv tuaj yeem ua qhov ntawd yooj yim thiab nyab xeeb. Lub BlinkLED daisy saw nrog 2 nyias ze rau qhov tsis pom cov xov hlau (#30 AWG xaim xaim xaim) thiab khiav los ntawm 3 - 5 volt dc fais fab mov lossis roj teeb yog li tsis muaj qhov hluav taws xob siab (120 vac) thaiv hluav taws xob xav tau. Daim vis dis aus qhia BlinkLEDs uas ntsais muag thiab hloov xim hloov ntawm liab thiab ntsuab. Lub sijhawm txhua BlinkLED tseem nyob hauv ib qho xim tau txiav txim siab yam tsis muaj qhov xav tsis thoob tom qab, koj yuav tsum muaj cov txuj ci sib dhos hluav taws xob thiab cov cuab yeej siv los ua haujlwm PIC microcontrollers.

Kauj Ruam 1: Xaiv Cov Cheeb Tsam

Xaiv Cheebtsam
Xaiv Cheebtsam

Rau txhua BlinkLED, koj yuav xav tau cov hauv qab no: 1 ea Microchip 12F509 PIC Microcontroller (Mouser PN 579-PIC12F509-I/P) 1 ea 22 ohm, 1/4 watt resistor (Mouser PN 291-22-RC). Kuv siv 22 ohm resistor hauv kuv tsab ntawv tab sis tus nqi nruab nrab ntawm 22 thiab 220 ohms yuav ua haujlwm. Nws nyob ntawm seb qhov khoom siv hluav taws xob koj yuav siv, qhov hluav taws xob poob thoob plaws LED, thiab qhov hluav taws xob mus tom ntej ntawm LED. Koj xav xaiv tus nqi uas yuav ua rau tam sim no ntawm 10 txog 20 milliamps los ntawm LED. Raws li txoj cai ntawm tus ntiv tes xoo, tus nqi tiv thaiv hauv ohms sib npaug ntawm qhov muab hluav taws xob rho tawm.5 volts rho tawm qhov hluav taws xob poob ntawm LED faib los ntawm LED tam sim no hauv amperes (1 milliampere =.001 ampere). Piv txwv li, rau lub ntsuab LED uas ib txwm muaj 2.2 qhov hluav taws xob poob nrog 3.2 volt fais fab mov: R = (3.2 volts -.5 volts -2.2 volts) /.020 amps = 25 ohms. Koj nco ntsoov tias cov xim sib txawv LED muaj txawv voltage poob hla lawv thaum lite. Cov txiaj ntsig raug yog: Ntsuab 2.2 volts, Yellow 2.1 volts, Red 2.0 volts, Blue 3.8 volts, thiab Dawb 3.2 volts. Koj yuav tsum nce cov khoom siv hluav taws xob thaum siv Xiav thiab/lossis Dawb LEDs txhawm rau tsav lawv kom ci ntsa iab. 1 ea LED. Tsuas yog hais txog ib qho LED yuav ua haujlwm. Rau kuv tus qauv, kuv xaiv lub ntsuab ntsuab tshem tawm ntawm Christmas txoj hlua teeb. Cov no muaj lub ntsej muag pom dav vim yog lub tiaj tiaj tiaj

Kauj Ruam 2: Sib Sau Koj Lub BlinkLED

Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED
Ua ke koj BlinkLED

Ua raws cov duab kom dhos koj lub BlinkLED. Kuv siv cov hlau me me thiab cov iav los tuav lub PIC. Nco tseg qhov kev taw qhia ntawm qhov thais thaum ua thawj qhov sib koom ua ke. Tus tiv thaiv tau muab xauv rau tus pin 8 ntawm PIC. Txuag cov xaim hlau txiav los ntawm tus tiv thaiv thiab muab nws txuas rau PIC hauv qib kawg. Koj qhov ua tiav BlinkLED yuav muaj ob txoj hauv kev pub dawb rau txuas lub zog (ntxiv rau [+] rau tus pin 1 [Vdd] thiab rho tawm [-] rau tus pin 8 [Vss], tus pin nrog tus tiv thaiv).

Kauj Ruam 3: Program PIC

Program PIC
Program PIC
Program PIC
Program PIC
Program PIC
Program PIC

Nov yog kuv qhov kev xeem PICBasic Pro. Nws pulses LED rau 35 ms thiab khaws nws tawm rau lub sijhawm sib txawv uas txiav txim los ntawm RANDOM ua haujlwm. Koj tuaj yeem hloov kho qhov program no kom tau txais BlinkLED kom ntsais qhov koj xav tau. '********************************************************** ***** 'Lub Npe Lub Npe: BlinkLED'Filename: BlinkLED'Version: v1.00' ***************************** ************************* +++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WORD''MAIN PROGRAM +++++++++++++++++++++++++++++++++++++++++++ Main Main:

HIGH LEDPAUSE 35LOW LED

RANDOM qeebPAUSE qeeb & %0000001111111111 'nrawm' PAUSE qeeb & %0000011111111111 'qeeb GOTO Main

KAWG

'################ END OF PROGRAM ############################

Txhawm rau sim koj BlinkLED, suav sau, ua haujlwm thiab khiav koj li PIC. Thaum koj zoo siab nrog qhov tshwm sim, tshem tawm BlinkLED los ntawm pawg thawj coj saib thiab txuas nws mus rau lub hwj chim lossis lub roj teeb. Qhov txuas lub roj teeb CR2032 thiab BlinkLED ua kom zoo LED Throwie uas yuav ntsais rau 1-2 lub lis piam txuas ntxiv.

Koj tuaj yeem tsim koj li BlinkLED's raws li qhia lossis zoo li koj tuaj yeem pom hauv daim vis dis aus, thaum kawg kuv tau ua PCB los txo qhov loj me ntawm txhua qhov BlinkLED thiab ntxiv cov kab taub hau kom nws yooj yim dua rau daisy saw units. Kuj ceeb tias kuv tau ntxiv lub hwj chim hla lub capacitor (.1 mf, 50 volt) thiab hloov PIC rau tus nqi qis PIC10F202 microcontroller. Kuv siv lub ntsej muag teeb tsa 51 ohm resistor thiab cov ntaub qhwv rau LED. Thaum tsim PCB, Kuv txiav txim siab ntxiv ob txheej txheej ntawm sab nraub qaum ntawm PCB. Cov ntaub qhwv ntxiv no tso cai ntxiv LED thib ob los tsim ob qhov xim (liab rau ntsuab rau liab) qhia hauv Christmas Tree Demo video. (Hauv kauj ruam tom ntej, kuv yuav qhia koj yuav tsim cov no li cas siv PIC12F509.) Kuv txuas nrog BlinkLEDs nrog #30 AWG xaim xaim xov hlau. Txij li txhua qhov BlinkLEDs tau txuas ua ke, kuv tsis txwv rau cov hlua teeb ci tab sis tuaj yeem muaj "ceg" cov hlua tawm ntawm "pob tw" hlua.

Kauj Ruam 4: Ua Liab/Ntsuab BlinkLED Nrog PIC12F509

Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509
Ua Liab/Ntsuab BlinkLED Nrog PIC12F509

Ua raws cov theem no kom ua rau liab/ntsuab BlinkLED siv PIC12F509. Kuv siv 3mm LEDs liab thiab ntsuab Lub polarity ntawm LEDs yog qhov tseem ceeb yog li ua raws cov kauj ruam ua tib zoo. Qhov hluav taws xob tiag tiag yog nyob ntawm LEDs koj siv. Yog tias qhov no tshwm sim siv qis dua qhov hluav taws xob. Rau kuv BlinkLEDs, qhov hluav taws xob nruab nrab ntawm 3.2 thiab 4.5 volts ua haujlwm tau zoo heev. Ntawm no yog kuv tus lej. Lub sijhawm BlinkLED yog xim liab lossis ntsuab yog txiav txim siab los ntawm RANDOM ua haujlwm.'PROGRAM INITIALIZATION +++++++++++++++++++++++++++++ Ntsuab coj ntawm sab sab, liab coj ntawm sab tsis sib xws'Steady ntsuab, ntsais grn/liab rau liab, tom qab ntawd rov qab

HIGH LED 'coj teeb tsa ntawm sab tsis sib xws

'MAIN PROGRAM +++++++++++++++++++++++++++++++++++++

RANDOM qeeb

'PAUSE Ncua & %000011111000' nrawm 'PAUSE Ncua & %001111100000' nruab nrab 'PAUSE Ncua & %111110000000' qeeb 50TOGGLE LEDPAUSE 50TOGGLE LEDPAUSE 50TOGGLE LED

GOTO MainEND

'################# Qhov kawg ntawm qhov program ###########################################################################################

Pom zoo: