Cov txheej txheem:

Pib Ua Haujlwm Nrog Daim Duab Flow: 7 Cov Kauj Ruam
Pib Ua Haujlwm Nrog Daim Duab Flow: 7 Cov Kauj Ruam

Video: Pib Ua Haujlwm Nrog Daim Duab Flow: 7 Cov Kauj Ruam

Video: Pib Ua Haujlwm Nrog Daim Duab Flow: 7 Cov Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Pib Programming Nrog Daim Ntawv Flow
Pib Programming Nrog Daim Ntawv Flow

Pib siv PIC micro tswj rau koj cov haujlwm? lawv muaj txiaj ntsig zoo tab sis ntxhov siab heev thaum koj qhov program tsuas ua haujlwm tsis tau. Nov yog ib txoj hauv kev txhawm rau txheeb xyuas koj cov tswv yim los ntawm kev kos daim duab ntws. Nov yog txoj hauv kev uas cov kws tshaj lij feem ntau tsim lawv cov txuj ci. Pib nrog tus xaum yooj yim thiab ntawv kom tau txais lawv lub tswv yim rau qee yam kev xaj khoom. Qhov no muaj txiaj ntsig tshwj xeeb thaum cov txheej txheem koj tau txhais yog txheej txheem uas txav ib kauj ruam zuj zus. neeg hlau Tau kawg rau txoj haujlwm yooj yim heev koj tsis tas yuav ua qhov no.

Kauj Ruam 1: Cov Cim

Cov Cim
Cov Cim

Txhawm rau ua kom yooj yim daim phiaj koj tsuas yog siv 2 lub cim. Qhov duab plaub pom ib qho piv txwv ACTION - tig hais lub cav qhib lossis tua, tig lub LED qhib lossis kaw. Peb pob zeb diamond qhia qhov kev txiav txim siab - piv txwv - yog hloov mus, yog lub hau kaw, tus neeg hlau kov txhua yam.

Kauj Ruam 2: Siv Cov Cim

Siv Cov Cim
Siv Cov Cim

Koj cov txheej txheem yuav tsum haum rau ib kauj ruam ntawm cov kauj ruam ntawm kev nqis tes ua, Ua qhov no, Tom qab ntawd ua li ntawd, Puas tau muaj qhov no tshwm sim? Piv txwv li. Puas yog lub tshuab ntxhua khaub ncaws kaw? cov thawv thiab sau rau lawv tias yam kev txiav txim lossis txiav txim siab yog dab tsi. Koj yuav xav pauv khoom ib puag ncig lossis rov xaj lawv kom txog thaum koj tuaj yeem pom tias txhua yam nyob hauv qhov yog thiab qhov chaw raug yog li nws tshwm sim rau lub sijhawm.

Kauj Ruam 3: Yam Nyuaj Tshaj

Yam Nyuaj Tshaj
Yam Nyuaj Tshaj

Ib txoj haujlwm nyuaj uas tswj tau hais tias neeg hlau lossis tshuab ntxhua khaub ncaws yuav muaj ntau yam ntxiv.

Kauj Ruam 4: Hloov Flowchart rau hauv Txoj Haujlwm

Hloov Txoj Cai Flowchart rau hauv Txoj Haujlwm
Hloov Txoj Cai Flowchart rau hauv Txoj Haujlwm

Nov yog qhov twg cov qhab nias ntsuas. Tam sim no tuaj yeem sau cov lus txib tsim nyog ntawm ib sab ntawm txhua lub npov kab ntawv. Ua ntej koj yuav tsum txheeb tawm qhov kev tawm tswv yim thiab cov txiaj ntsig tau txuas nrog rau yam khoom dab tsi ntawm lub neej tiag tiag. TXHUA lub tshuab tuaj yeem piav qhia raws li 3 ntu hauv qab no INPUT - PROCESS - OUTPUTThe input ntu cuam tshuam nrog cov sensors xws li keyboards, ultrasonic sensors, microphones thiab lwm yam. Lub cev muaj zog, LEDs, Teeb, Hais lus, thiab lwm yam Cov lus tso tawm no lub rooj (I/O rooj) muaj 4 qhov tawm thiab 1 lub tswv yim thiab yuav siv los tswj tus neeg hlau me. Yog li tig qhov tso tawm 0 ntawm yuav ua rau lub tshuab kom raug mus rau tom ntej, tig qhov tso tawm 0 tawm yuav tso tseg txoj cai tsav.

Kauj Ruam 5: Ntxiv rau Daim Ntawv Flow

Ntxiv rau daim Flow Chart
Ntxiv rau daim Flow Chart
Ntxiv rau daim Flow Chart
Ntxiv rau daim Flow Chart

Cov lus no tau yooj yim thov rau daim phiaj ntws. Qhov twg muaj qhov ua qhov no feem ntau yuav tig ib yam rau lossis tawm lossis tos ib pliag kom tso cai rau ua kom tiav. Qhov twg muaj kev txiav txim siab ib txwm koj yuav tau tshuaj xyuas qhov nkag mus rau ib qho twg kev ua. Hauv feem ntau ntawm PIC cov phiaj xwm qhov no yuav yog los ntawm kev nug "Yog hais tias x yog nyob rau hauv ces ua qhov no.." Cov lus txib no tuaj yeem siv rau daim phiaj ntws siv I/O lub rooj raws li hauv qab no

Kauj Ruam 6: Hloov nws mus rau qhov program

Tam sim no peb nyob rau hauv txoj haujlwm zoo kom tau txais qhov program uas yuav ua haujlwm feem ntau raws li peb npaj siab ua. Cov lus txib tam sim no tuaj yeem sau rau hauv daim ntawv tsim nyog rau cov lus programming uas koj siv. Kuv feem ntau yog peb PICAXE microprocessor system https:// www.picaxe.com qhov no tau teeb tsa nyob rau hauv daim ntawv ntawm BASIC uas kuv pom yooj yim siv rau feem ntau daim ntawv thov. Tam sim no txoj haujlwm yuav raug sau zoo li no - Kuv tau tawm tswv yim qhov no yog li koj tuaj yeem pom dab tsi txhua kab ua. thiab nws cuam tshuam nrog daim ntawv ntws.: Pib: 'qhov no yog daim ntawv lo yog li peb tuaj yeem dhia ncig qhov haujlwm yog tias peb xav tau. Siab 0 'hloov cov zis 0 ntawm siab 1' hloov qhov tso tawm 1 ntawm daim tshev: lwm daim ntawv lo Yog tus pin 3 = 1 ces tig thaum lub tswv yim 3 tab tom dhia mus rau daim ntawv lo tig mus rau kos 'yog tias cov tswv yim 3 tsis nyob ntawm no ces khaws xyuas kom txog thaum nws yog. tig: qis 0 'tig tso tawm 0 tawm qis 1' tig tso tawm 1 tawm siab 2 tig tso zis 2 ntawm siab 4 'tig tso tawm 4 ntawm tos 2' tos rau 2 vib nas this thaum tus neeg hlau rov qab me ntsis. qis 2low 4goto pib 'rov qab mus rau qhov pib txav mus rau tom ntej dua.

Kauj Ruam 7: TAM SIM NO Tiag

Qhov no txhua yam zoo li ntev heev thaum txhua yam koj xav ua yog tau txais koj lub neeg hlau/tshuab ntxhua khaub ncaws/wigit ua haujlwm. Kuv pom zoo, txawm hais tias qhov no tau coj kuv mus ntev dua los sau dua li qhov nws yuav siv los ua thiab nws tsim nyog siv zog. 1. koj yuav pom nrog cov haujlwm nyuaj nws tsis yooj yim kom tau txais yam hauv qhov yog. 2. Koj nco tej yam (nws nyuaj) 3. Ntawv yog pheej yig thiab koj lub sijhawm yuav tsis yog - ntseeg kuv qhov no sai dua nyob rau lub sijhawm ntev rau txhua yam nyuaj dua li tig LED rau thiab tua. 4. Kev ntxhov siab yog tus tua neeg rau kev kawm txuj ci tshiab, Tsis muaj dab tsi phem dua li tsim qee yam nrog hluav taws xob thiab nws yuav tsis ua haujlwm, koj tsis paub vim li cas lossis pib qhov twg. YUAV zoo dua kom muaj sijhawm zoo los hais qhov program zoo yuav tsum ua haujlwm nws yuav tsum yog kho vajtse. Ua nws sim koj yuav xav tsis thoob nrog qhov kev xav meej uas nws muab rau koj.

Pom zoo: