Cov txheej txheem:

Serial Debugging Nrog CloudX: 3 Cov Kauj Ruam
Serial Debugging Nrog CloudX: 3 Cov Kauj Ruam

Video: Serial Debugging Nrog CloudX: 3 Cov Kauj Ruam

Video: Serial Debugging Nrog CloudX: 3 Cov Kauj Ruam
Video: #224 🛑 STOP using Serial.print in your Arduino code! THIS is better. 2024, Kaum ib hlis
Anonim
Serial Debugging Nrog CloudX
Serial Debugging Nrog CloudX

Hauv txoj haujlwm no, kuv xav kom piav qhia lub tswv yim ntawm kev debugging ntawm lub davhlau ya nyob twg. Tab sis ua ntej pib, cia piav qhia nws lub tswv yim los ntawm nws lub ntsiab lus.

1. serial kev sib txuas lus

kev sib txuas lus txuas yog rau kev sib txuas lus ntawm CloudX board thiab khoos phis tawj lossis lwm yam khoom siv. Txhua lub CloudX cov laug cam muaj tsawg kawg ib qho pom chaw nres nkoj (tseem hu ua UART lossis USART): Serial. Nws sib txuas lus ntawm tus lej RX thiab TX tus pin nrog lwm lub hardwares lossis cov qauv kev sib txuas lus (xws li gsm thiab gps) ib yam li khoos phis tawj ntawm USB siv SoftCard. Yog li, yog tias koj siv cov haujlwm no, koj tsis tuaj yeem siv TX thiab RX rau cov tswv yim digital lossis tso tawm. Koj tuaj yeem siv CloudX ib puag ncig lub hauv paus saib xyuas kev sib txuas lus nrog CloudX pawg thawj coj. Nyem rau kab ntawv saib lub pob hauv lub cuab yeej thiab xaiv tib qho baud tus nqi siv hauv qhov ntsuas hu ua serialBegin ().

2. Debug

Debugging yooj yim txhais tau tias txheeb xyuas thiab tshem tawm qhov ua yuam kev los ntawm (khoos phis tawj khoos phis tawj lossis software). Kev debugging yog ib feem ntawm cov txheej txheem ntsuas software thiab yog ib feem tseem ceeb ntawm tag nrho kev txhim kho software lub neej. Cia ua piv txwv tias koj cov cai tau suav ua tiav thiab koj tab tom sim koj cov cuab yeej thiab nws tsis ua haujlwm raws li qhov xav tau, txawm hais tias muaj ntau txoj hauv kev los debug koj cov cai; ib txoj hauv kev yooj yim thiab siv tau los debug nws yog los ntawm kev siv debugging cov lej. CloudX IDE tsim 2 hom ntaub ntawv ntawm kev sau ua tiav, HEX thiab COFF cov ntaub ntawv. HEX cov ntaub ntawv yog siv lub tshuab nruj me ntsis uas yog bootloaded rau hauv pawg thawj coj rau kev ua tiav hauv ntiaj teb tiag tiag tab sis kuj tseem tuaj yeem ua haujlwm ntawm koj lub PC sim ua software zoo li Proteus Isis thaum COFF cov ntaub ntawv yog cov ntawv nyeem tau ua tiav ntawm koj lub PC simulation softwares (Proteus Isis). Txog qhov no peb yuav txiav txim siab ob hom kev debugging ntawm cov txheej txheem raws cai,

1. Soft Serial Debugging:

Hauv txoj hauv kev no, txhua qhov kev sim thiab kev debug tau ua tiav hauv PC los ntawm qee cov software muaj txiaj ntsig zoo li Proteus ISIS. Vim tias CloudX pib tsim cov ntaub ntawv COFF, Kuv pom zoo siv qhov no rau PC kev sim vim nrog koj tuaj yeem pib ua ntu nruab nrab ntawm kab ntawm cov lej thiab xam qhov twg muaj teeb meem los ntawm, thiab yog tias koj cov cai yuav tsum khiav yam tsis muaj kauj ruam, siv virtual teminal los ntawm "virtual" hom cuab yeej "cuab yeej, koj ib txwm tuaj yeem paub qhov twg kab twg yog tus tswj hwm tau khiav ntawm txhua lub sijhawm. cia saib qhov piv txwv no,

Kauj ruam 1:

Duab
Duab
Duab
Duab

/*

* Cov ntaub ntawv: newmain.c

* Tus sau: OGBOYE GODWIN * * Tsim rau Lub Rau Hli 28, 2018, 10:15 AM */

#suav nrog

#suav nrog

/* peb yuav ua

liab pin1 ntsuab pin2 daj pin3 *khawm pin4 */ char *qhia = "hmmm, kuv tau kov lawm"; teeb tsa () {pinMode (1, OUTPUT); pinMode (2, NTAWV); pinMode (3, NTAWV); pinMode (4, INPUT); Serial_begin (9600); loop () {thaum (! readPin (4)); Serial_writeText (qhia); Serial_writeText ("…. txav mus rau liab"); Serial_write (0x0D); portWrite (1, 0x00) cov; pinSelect (1, HIGH); qeeb (200); // sim tshem tawm ntawm kev tawm tswv yim tag nrho ncua thiab pom dab tsi tshwm sim // tom qab ntawd hloov lawv (koj yeej yuav nyiam!). thaum (! readPin (4)); Serial_writeText (qhia); Serial_writeText ("….moog rau ntsuab"); Serial_write (0x0D); portWrite (1, 0x00) cov; pinSelect (2, HIGH); qeeb (200); // sim tshem tawm ntawm kev tawm tswv yim tag nrho ncua thiab pom dab tsi tshwm sim // tom qab ntawd hloov lawv (koj yeej yuav nyiam!).

thaum (! readPin (4));

Serial_writeText (qhia); Serial_writeText ("…. txav mus rau daj"); Serial_write (0x0D); portWrite (1, 0x00) cov; pinSelect (3, HIGH); qeeb (200); // sim tshem tawm ntawm kev tawm tswv yim tag nrho ncua thiab pom dab tsi tshwm sim // tom qab ntawd hloov lawv (koj yeej yuav nyiam!). }}

nrog rau qhov no koj tuaj yeem pom yuav ua li cas Serial debugging yog qhov tseem ceeb yog tias koj tshem qhov ncua sijhawm. yog tias koj tau ua qhov ntawd koj yuav tau pom muaj teeb meem li cas txoj cai yooj yim tuaj yeem ua rau yog tias nws tau ua tiav hauv lub ntiaj teb tiag tiag yam tsis muaj kev ncua sijhawm ntawd.

Kauj ruam 2:

Duab
Duab
Duab
Duab
Duab
Duab

2. Kho vajtse debugging:

Hauv txoj hauv kev no, txhua qhov kev sim thiab kev debug yog ua los ntawm kev txuas CloudX tsab ntawv pov thawj lub rooj rau lub PC siv softCard thiab siv ob qho tib si CloudX IDE lub davhlau ya nyob twg (pom zoo) lossis qee yam software zoo li Proteus ISIS compim, realTerm, thiab lwm yam Tsim COFF cov ntaub ntawv siv tsis tau ntawm no vim tias txoj hauv kev no xav tau HEX bootloaded rau hauv kho vajtse, Kuv pom zoo siv qhov no rau CloudX softcard. Nco ntsoov tias koj cov cai khiav tsis muaj kauj ruam yog li koj tuaj yeem ib txwm paub tias kab twg yog tus tswj hwm tau khiav ntawm txhua lub sijhawm los ntawm cov ntawv tso tawm. cia saib qhov chaws no zoo ib yam piv txwv teev tseg saum toj no, teeb tsa koj lub khoos phis tawj kom similer rau kuv lub teeb liab liab --------- rau pin1 ntsuab LED --------- pin2 daj LED- ------- pin3 khawm --------- pin4

Kauj ruam 3:

Duab
Duab

cov kauj ruam

1. Siv tib txoj cai raws li saud

2. bootload rau hauv koj lub rooj tsavxwm

3. pib CloudX lub davhlau ya nyob twg los ntawm txhaj "txuas" khawm hauv lub cuab yeej

4. xaiv qhov chaw nres nkoj xav tau thiab tus nqi baud (9600 hauv qhov kev qhia no)

5. pib lub davhlau ya nyob twg los ntawm txhaj rau txuas (txiav tawm yog tias koj xav txiav luam yeeb)

6. nrog qhov chaw nres nkoj tau qhib/txuas nrog, ib ntus thawb lub pob ntawm qhov yuav thiab koj yuav pom cov ntawv tso tawm uas pom ntawm lub qhov rais davhlau ya nyob twg. Nco ntsoov tias yog tias koj muaj kev ncua sijhawm ntawm txoj cai, koj yuav tau txais ntau kab ntawm cov ntawv tso tawm ua haujlwm nrawm heev yam tsis muaj kev tswj ua ntej koj tshem koj txhais tes tawm ntawm lub pob. Yog tias yog vim li cas hauv koj cov cai, koj muaj cov teeb meem zoo li no lossis zoo sib xws, koj ib txwm tuaj yeem siv txoj hauv kev no los debug.

Pom zoo: