Cov txheej txheem:
- Kauj Ruam 1: Tau Koj Tus Compiler thiab Lwm Yam Cuab Yeej
- Kauj Ruam 2: Tsim Tus Qauv
- Kauj Ruam 3: Tsim Cov Ntawv Tshiab
- Kauj Ruam 4: Cia Peb Khiav
- Kauj Ruam 5: Xaus
Video: Yuav Teeb Li Cas AVR Txoj Haujlwm Ib puag ncig ntawm Linux: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Yog tias koj xav tau program AVR microcontrollers ntawm Windows koj muaj Studio tab sis ntawm Linux txhua yam peb muaj yog Dude.
AVRDUDE yog kab hais kom ua kab ke rau program AVR chips, nws tuaj yeem ua rau me ntsis kom teeb tsa thaum xub thawj.
Ua ntej kuv yuav txhim kho tag nrho AVRDUDE thiab txhua qhov yuav tsum tau muaj kev vam khom ces kuv yuav tsim tsab ntawv BASH uas yuav pab tau hauv kev sau ntawv
Kauj Ruam 1: Tau Koj Tus Compiler thiab Lwm Yam Cuab Yeej
Hauv lwm qhov rau program AVR chips koj xav tau tus tshwj xeeb tus neeg sau npe hu ua gcc-avr thiab lwm yam cuab yeej zoo li binutils-avr, avr-libc, gdb-avr kawg tab sis tsis yog avrdude tsawg kawg.
sudo apt-tau nruab gcc-avr binutils-avr avr-libc gdb-avr avrdude
Kauj Ruam 2: Tsim Tus Qauv
Yog tias koj qhib qhov kos duab tshiab hauv arduino koj tau txais tus qauv qauv uas muaj ob txoj haujlwm, qhov no txuag koj ntau lub sijhawm.
AVRDUDE siv C thiab nws tuaj yeem yog qhov txaus siab me ntsis kom ib txwm tsim txoj hauv kev tseem ceeb txhua lub sijhawm koj xav tau tus lej, yog li kuv yuav tsim tus qauv AVR.
kov ~/Templates/AVR.c
Siv qhov kov hais kom ua los ua cov ntaub ntawv khoob hauv Templates nplaub tshev.
vi ~/Templates/AVR.c
qhib cov ntawv nrog koj cov ntawv nyeem uas kuv nyiam tshaj, kuv siv vi.
#define F_CPU 16000000L
#include #include int main () {thaum () {} rov qab 0; }
Ntaus cov cai saum toj no thiab khaws cov ntawv. Cov cai no yuav ua haujlwm raws li peb tus qauv.
Nco tseg: Kuv teeb tsa kuv lub moos zaus li 16000000, koj tuaj yeem teeb tsa koj li ib txwm muaj tej zaum yog 8000000.
Kauj Ruam 3: Tsim Cov Ntawv Tshiab
Tam sim no peb muaj tus qauv rau peb cov lej AVR, txhua yam peb yuav tsum tau ua yog tsim cov ntawv tshiab. Kuv yuav tsim cov lus txib bash uas yuav siv nyob rau hauv ib qho kev sib cav (lub npe cov ntaub ntawv) tom qab ntawd tsim cov ntawv ntawd muaj AVR tus qauv.
cia ua cov ntaub ntawv khoob hu ua "tsim"
kov tsim
hloov cov ntawv tso cai vim qhov no yuav yog tsab ntawv BASH
chmod 755 tsim
Qhib "tsim" nrog koj cov ntawv sau. Tam sim no cia hloov "tsim", ntxiv cov lus txib hauv qab no kab ntawm kab.
#!/bin/tsoo
Nov yog txoj hauv kev rau tus neeg txhais lus rau "tsim" uas yog bash.
cp ~/Qauv/AVR.c/tsev/$ USER
Qhov no luam peb cov ntaub ntawv tus qauv rau cov neeg siv hauv tsev.
mv ~/AVR.c $ 1
Nco ntsoov kuv tau hais tias "tsim" siv rau hauv ib qho kev sib cav, $ 1 txhais tau tias thawj qhov kev sib cav ntawm peb cov lus txib qhov kev sib cav no yog lub hom phiaj cov ntaub ntawv, qhov kawg uas peb xav tau yog ntau cov ntaub ntawv muaj tib lub npe. Cov lus txib hloov npe lub npe filename rau peb qhov kev sib cav.
vi $ 1 ib
Qhov no yog nyob ntawm yeem tab sis nws yuav zoo qhib peb cov ntawv, tam sim tom qab peb tau tsim nws.
Peb tau ua tiav nrog kev kho tsim, txuag nws thiab kaw nws.
Nov yog qhov piv txwv ntawm kev tsim hauv kev nqis tes ua.
./create blink.c
Qhov no tsim cov ntaub ntawv hu ua blink.c, cov ntawv no yuav tsum muaj tus qauv ntawm AVR.c.
Kauj Ruam 4: Cia Peb Khiav
Peb yuav tsum tsim lwm tsab ntawv bash hu ua "khiav", tsab ntawv no yuav siv 3 qhov kev sib cav (avr microcontroller peb tab tom siv, lub npe thiab tus programmer)
Wb coj nws kab ntawm kab.
#!/bin/tsoo
peb shebang
avr -gcc -Wall -g -0s -mmcu = $ 1 -o $ 2.bin $ 2.c
Cov lus txib saum toj no ua raws peb cov cai, '$ 1' yog peb thawj qhov kev sib cav uas yog microcontroller peb tab tom ua haujlwm. $ 2 yog peb qhov kev sib cav zaum thib ob uas yog lub npe ntaub ntawv.
avr -objcopy -j.text -j.data -O ihex $ 2.bin $ 2.hex
Qhov no hloov peb cov ntawv ua tiav rau hex.
avrdude -p $ 1 -c $ 3 -U nyem: w: $ 2.hex -P usb
Tam sim no avrdude hlawv cov cai rau hauv AVR nti. $ 3 yog peb qhov kev sib cav zaum thib 3 uas yog tus programmer peb tab tom siv.
Txuag cov ntaub ntawv "khiav"
muab nws ua kev tso cai
chmod 755 ua
Tam sim no cia peb sim nws. Cia peb hais tias peb xav upload blink.c thiab peb tab tom siv lub rooj sib tham arduino ncaj qha, peb kuj tseem siv tus programmer usbasp. Nov yog qhov peb siv tsab ntawv "run".
./run atmega328p ntsais USBasp
Arduino board muaj atmega328p nti, koj tuaj yeem siv ib qho AVR microcontroller uas koj xaiv.
Qhov kev sib cav zaum thib ob yog koj lub npe ntawv, tab sis lub sijhawm no tsis ntxiv cov ntawv txuas ntxiv cov ntawv ua haujlwm.
Tom qab ntawd peb muaj qhov kev sib cav zaum thib peb uas yog tus programmer koj siv, kuv tab tom siv USBasp programmer.
Kauj Ruam 5: Xaus
Nov yog txoj hauv kev zoo ntawm kev siv koj li kev paub avr, koj tuaj yeem txav cov ntaub ntawv bash "tsim" thiab "khiav" mus rau "~/.local/bin" yog li koj tuaj yeem siv cov ntawv sau los ntawm cov ntawv teev npe uas koj xaiv.
Pom zoo:
Kuv Xav Tau Nyob Ib puag ncig los ntawm ITunes Pom Kev Pom Zoo!: 5 Cov Kauj Ruam
Kuv Xav Tau Nyob Ib puag ncig los ntawm ITunes Visual Effect!: ITunes Visual Effect yog qhov zoo heev. Kuv nyiam pom kuv li iTunes Visual Effect mloog nkauj. Lub caij no, Kuv nyiam HOMESTAR tsim los ntawm SEGATOYS. HOMESTAR yog lub hnub qub hauv tsev. Nws tuaj yeem ua lub hnub qub saum ntuj ntawm 3 meters txoj kab uas hla mus rau
Kev Siv Hluav Taws Xob & Kev Saib Xyuas Ib puag ncig ntawm Sigfox: 8 Cov Kauj Ruam
Kev Siv Hluav Taws Xob & Kev Saib Xyuas Ib puag ncig ntawm Sigfox: Nqe lus piav qhia Qhov haujlwm no yuav qhia koj yuav ua li cas thiaj tau txais kev siv hluav taws xob ntawm ib chav ntawm peb-theem kev faib hluav taws xob thiab tom qab ntawd xa nws mus rau server siv Sigfox network txhua 10 feeb. Yuav ua li cas ntsuas lub zog? Peb tau txais peb lub clamps tam sim no los ntawm
Yuav Ua Li Cas Upload Txoj Haujlwm lossis Txoj Cai Rau Hauv Arduino Pro Mini los ntawm Kev Siv CH340 UART Serial Converter Cable: 4 Cov Kauj Ruam
Yuav Ua Li Cas Txhim Kho Txoj Haujlwm lossis Txoj Cai Rau Hauv Arduino Pro Mini los ntawm Kev Siv CH340 UART Serial Converter Cable: USB TTL Cov lej txuas yog ntau yam ntawm USB rau txuas txuas txuas txuas uas muab kev sib txuas ntawm USB thiab txuas UART cuam tshuam. Ntau cov kab hluav taws xob tau muaj kev sib txuas ntawm 5 volts, 3.3 volts lossis cov neeg siv tau teev tseg cov teeb liab theem wi
Txoj Haujlwm 2: Yuav Rov Rov Ua Haujlwm Li Cas: 11 Kauj Ruam (nrog Duab)
Txoj Haujlwm 2: Yuav Rov Rov Ua Haujlwm Li Cas: Nyob zoo cov phooj ywg, Kuv tus phooj ywg zoo ntawm kuv tau muab tso ua ke ob peb yam nrog rau Raspberry Pi txhawm rau txiav txim siab RS232 raws tu qauv rau TTL. Qhov kawg tshwm sim tau muab pov rau hauv ib lub thawv uas muaj 3 lub hauv paus tseem ceeb: lub zog hloov pauv mus rau lub zog t
Yuav Ua Li Cas Ntxiv Cov Suab Ib puag ncig rau Chav Ua Ntej Ua Ntej: 5 Kauj Ruam
Yuav Ua Li Cas Ntxiv Cov Suab Ib puag ncig rau Chav Ua Ntej Ua Ntej: Koj puas xav ntxiv lub suab ib puag ncig rau hauv chav tab sis pom tias koj yuav tsum tau sib cais koj cov phab ntsa lossis ua qhov hauv qab nthab? Zoo ntawm no yog txoj hauv kev yooj yim me ntsis tso rau hauv cov xaim nrog tsis ua ib qho kev tsim kho loj, lossis ib qho hlo li