Cov ntsiab lus piav qhia:
1 Txoj cai ntawm infrared teeb liab transmitter
2 Kev sib txuas lus ntawm infrared teeb liab transmitter thiab receiver
3 Infrared transmitter muaj nuj nqi ua piv txwv
1 Txoj cai ntawm infrared teeb liab transmitter
Thawj yog lub cuab yeej nws tus kheej uas tawm lub teeb liab infrared, uas feem ntau zoo li no:
Txoj kab uas hla ntawm infrared diode hauv daim duab yog 3 hli, thiab lwm qhov yog 5 hli.
Lawv yuav luag zoo ib yam li lub teeb-emitting LEDs, yog li cov pins ntev txuas nrog tus ncej zoo, thiab lwm qhov yog txuas nrog tus ncej tsis zoo.
Txoj kev tsav tsheb yooj yim tshaj plaws yog ntxiv 1k tam sim no limiting resistor rau txoj kev zoo 3.3v, thiab tom qab ntawd txuas cov electrode tsis zoo rau IO ntawm micro maub los.Raws li qhia hauv qab no:
2 Kev sib txuas lus ntawm infrared teeb liab transmitter thiab receiver
Tau hais tias, Kuv yuav tsum tau kho qhov yuam kev hauv tsab xov xwm tom ntej nrog koj.
Nyob rau hauv daim duab saum toj no, nws tau hais tias theem teeb liab ntawm lub transmitter thiab receiver yog opposite.Ntawd yog, tib yam li cov ntsiab lus ncig hauv lub thawv liab thiab xiav hauv daim duab saum toj no.
Qhov tseeb, nyob rau hauv qhov tseeb waveform, xiav ib feem ntawm lub transmitter tsis yog ib qho yooj yim theem siab ntawm 0.56ms.Theej, nws yog 0.56ms pwm yoj ntawm 38kHz.
Qhov tseeb ntsuas waveform yog raws li nram no:
Lub waveform cov ntsiab lus ntawm yoj xim ib feem ntawm lub transmitter nyob rau hauv daim duab yog raws li nram no:
Nws tuaj yeem pom tau tias qhov zaus ntawm qhov ntom ntom nti no yog 38kHz.
Ntawm no yog cov ntsiab lus: kev sib txuas lus ntawm transmitter thiab receiver ntawm infrared chaw taws teeb tswj:
Thaum lub transmitter outputs 38kHz square nthwv dej, lub receiver yog tsawg, txwv tsis pub tus receiver yog siab.
3 Infrared transmitter muaj nuj nqi ua piv txwv
Tam sim no cia peb mus rau kev xyaum ua programming.
Raws li cov lus qhia yav dhau los, peb paub tias kom paub txog kev ua haujlwm ntawm infrared chaw taws teeb tswj, peb yuav tsum xub paub txog ob txoj haujlwm yooj yim:
1 38 kHz square wave tso zis
2 Tswj lub 38kHz square nthwv dej kom qhib thiab tawm ntawm lub sijhawm xav tau
Thawj yog 38kHz square wave tso zis.Peb tsuas yog siv lub pwm yoj los tsim nws.Ntawm no, peb yuav tsum siv pwm ua haujlwm ntawm lub sijhawm.Kuv tab tom siv STM32L011F4P6 qis zog nti ntawm no.
Ua ntej siv lub cim tsim cov cuab yeej artifact cube los tsim cov cai:
Initialization code:
Tom qab ntawd muaj kev ua haujlwm ntawm kev tig los yog tawm ntawm pwm yoj raws li cov cai coding, uas yog siv los ntawm timer cuam tshuam, thiab tom qab ntawd hloov qhov ntev ntawm lub pwm nthwv dej qhib lossis tawm los ntawm kev hloov kho lub sijhawm tuaj txog ntawm lub sijhawm tom ntej. cuam tshuam:
Tseem muaj qee cov ntsiab lus ntawm cov ntaub ntawv encoded uas yuav tsis muab tso rau ntawm no.Yog tias koj xav tau ntau qhov chaws, txais tos kom tso cov lus, thiab kuv yuav muab cov lus qhia ntxaws ntxaws rau koj sai li sai tau.
Post lub sij hawm: Feb-24-2022