Cov txheej txheem:

QHOV TSEEM CEEB NTAWM UART COMMUNICATION: 16 Cov Kauj Ruam
QHOV TSEEM CEEB NTAWM UART COMMUNICATION: 16 Cov Kauj Ruam

Video: QHOV TSEEM CEEB NTAWM UART COMMUNICATION: 16 Cov Kauj Ruam

Video: QHOV TSEEM CEEB NTAWM UART COMMUNICATION: 16 Cov Kauj Ruam
Video: Nkauj Ntseeg | "Qhov Tseem Ceeb ntawm Kev Thov Vajtswv" 2024, Hlis ntuj nqeg
Anonim
QHOV TSEEM CEEB NTAWM UART COMMUNICATION
QHOV TSEEM CEEB NTAWM UART COMMUNICATION

Nco ntsoov thaum cov tshuab luam ntawv, nas, thiab modems muaj cov hlua tuab nrog cov txuas txuas loj loj? Cov uas yuav tsum tau muab ntsia rau hauv koj lub computer? Cov cuab yeej no tej zaum siv UARTs los tham nrog koj lub khoos phis tawj. Thaum USB tau yuav luag hloov tag cov qub cables thiab cov txuas, UARTs yog qhov tseeb tsis yog ib yam ntawm yav dhau los. Koj yuav pom UARTs tau siv hauv ntau DIY cov phiaj xwm hluav taws xob txhawm rau txuas GPS cov qauv, Bluetooth cov qauv, thiab RFID daim npav nyeem ntawv cov qauv rau koj li Raspberry Pi, Arduino, lossis lwm yam microcontrollers.

UART sawv rau Universal Asynchronous Receiver/Transmitter. Nws tsis yog kev sib txuas lus raws li SPI thiab I2C, tab sis lub cev muaj zog hauv lub microcontroller, lossis IC sawv ib leeg. UART lub hom phiaj tseem ceeb yog xa thiab tau txais cov ntaub ntawv xov xwm.

Ib qhov zoo tshaj plaws txog UART yog tias nws tsuas yog siv ob lub xov hlau los xa cov ntaub ntawv ntawm cov khoom siv. Cov hauv paus ntsiab lus tom qab UART tau nkag siab yooj yim, tab sis yog tias koj tsis tau nyeem ib feem ntawm kab ntawv no, Cov hauv paus ntawm SPI Kev Sib Tham Txheej Txheem, uas yuav yog qhov chaw zoo pib.

Kauj Ruam 1: QHOV TSEEB RAU UART Kev Sib Tham

Hauv UART kev sib txuas lus, ob UARTs sib txuas lus ncaj qha nrog txhua lwm yam. Kev xa UART hloov pauv cov ntaub ntawv sib luag los ntawm kev tswj hwm lub cuab yeej zoo li CPU rau hauv daim ntawv txuas, xa nws hauv cov ntawv mus rau qhov tau txais UART, uas tom qab ntawd hloov cov ntaub ntawv hauv xov tooj rov qab rau hauv cov ntaub ntawv sib luag rau cov khoom siv tau txais. Tsuas yog ob lub xov hlau xav tau los xa cov ntaub ntawv ntawm ob UARTs. Cov ntaub ntawv ntws los ntawm Tx tus pin ntawm kev xa UART mus rau Rx tus pin ntawm qhov tau txais UART:

Kauj Ruam 2: Cov ntaub ntawv ntws los ntawm Tx Pin ntawm UM kis mus rau Rx Pin ntawm Kev Txais UART:

Cov ntaub ntawv ntws los ntawm Tx Pin ntawm Kev Tshaj Tawm UART mus rau Rx Pin ntawm Kev Txais UART
Cov ntaub ntawv ntws los ntawm Tx Pin ntawm Kev Tshaj Tawm UART mus rau Rx Pin ntawm Kev Txais UART

Kauj ruam 3:

UARTs xa cov ntaub ntawv asynchronously, uas txhais tau tias tsis muaj lub moos teeb liab los ua ke cov khoom tawm los ntawm kev xa UART mus rau qhov piv txwv ntawm cov khoom los ntawm kev tau txais UART. Hloov chaw ntawm lub moos teeb liab, kis UART ntxiv qhov pib thiab nres cov khoom mus rau cov ntaub ntawv pob ntawv raug xa mus. Cov khoom no piav qhia qhov pib thiab qhov kawg ntawm cov ntaub ntawv pob kom tau txais UART paub thaum pib nyeem cov khoom.

Thaum qhov tau txais UART pom qhov pib me ntsis, nws pib nyeem cov khoom nkag ntawm qhov tshwj xeeb zaus hu ua tus nqi baud. Baud tus nqi yog ntsuas ntawm qhov nrawm ntawm cov ntaub ntawv hloov pauv, qhia tawm hauv cov khoom ib ob (bps). Ob UARTs yuav tsum ua haujlwm ntawm kwv yees li tus nqi baud. Tus nqi baud nruab nrab ntawm kev xa thiab tau txais UARTs tuaj yeem sib txawv li ntawm 10% ua ntej lub sijhawm ntawm cov khoom tau dhau mus deb heev.

Kauj ruam 4:

Duab
Duab

Ob qho UARTs tseem yuav tsum tau teeb tsa kom xa thiab tau txais tib cov ntaub ntawv pob ntawv qauv.

Kauj Ruam 5: YUAV UA LI CAS YUAV UA LI CAS

UART uas yuav xa cov ntaub ntawv tau txais cov ntaub ntawv los ntawm cov tsheb npav. Cov tsheb npav siv los xa cov ntaub ntawv mus rau UART los ntawm lwm lub cuab yeej zoo li CPU, nco, lossis microcontroller. Cov ntaub ntawv raug xa los ntawm cov tsheb npav mus rau kis UART hauv daim ntawv sib luag. Tom qab kis UART tau txais cov ntaub ntawv sib luag los ntawm cov tsheb npav, nws ntxiv qhov pib me ntsis, sib npaug me ntsis, thiab nres me ntsis, tsim cov pob ntawv cov ntaub ntawv. Tom ntej no, cov ntaub ntawv pob ntawv raug tso tawm ib ntus, me ntsis ntawm Tx tus pin. Qhov tau txais UART nyeem cov ntaub ntawv pob me ntsis ntawm nws tus lej Rx. Qhov tau txais UART tom qab ntawd hloov cov ntaub ntawv rov qab rau hauv daim ntawv sib luag thiab tshem tawm qhov pib me ntsis, sib luag me ntsis, thiab tso tseg cov khoom. Thaum kawg, qhov tau txais UART hloov cov ntaub ntawv pob ntawv ua ke mus rau cov ntaub ntawv tsheb npav ntawm qhov kawg tau txais:

Kauj Ruam 6: Duab Ua Li Cas UART Ua Haujlwm

Duab Yuav Ua Li Cas UART Ua Haujlwm
Duab Yuav Ua Li Cas UART Ua Haujlwm

Kauj ruam 7:

UART cov ntaub ntawv xa tawm tau teeb tsa rau hauv pob ntawv. Txhua pob ntawv muaj 1 qhov pib me ntsis, 5 txog 9 cov ntaub ntawv me me (nyob ntawm UART), xaiv qhov sib luag me ntsis, thiab 1 lossis 2 nres cov khoom:

Kauj Ruam 8: UART Cov Ntaub Ntawv Tshaj Tawm tau npaj rau hauv Pob Duab

UART Cov Ntaub Ntawv Tshaj Tawm tau npaj rau hauv Pob Duab
UART Cov Ntaub Ntawv Tshaj Tawm tau npaj rau hauv Pob Duab

Kauj ruam 9:

Pib QHIA

UART cov ntaub ntawv xa kab yog ib txwm muaj nyob ntawm qib siab thaum nws tsis xa cov ntaub ntawv. Txhawm rau pib hloov pauv cov ntaub ntawv, kev xa xov UART rub cov kab sib kis los ntawm qhov siab mus rau qis rau ib teev ntawm lub moos. Thaum qhov tau txais UART pom qhov hloov pauv mus rau qhov siab thiab qis, nws pib nyeem cov khoom hauv cov ntaub ntawv ntawm qhov zaus ntawm tus nqi baud.

DATA NTAWV

Cov ntaub ntawv muaj cov ntaub ntawv raug xa mus. Nws tuaj yeem yog 5 khoom mus txog 8 ntsis ntev yog siv qhov sib luag me ntsis. Yog tias tsis siv qhov sib luag me ntsis, cov ntaub ntawv tuaj yeem yog 9 ntsis ntev. Feem ntau, cov ntaub ntawv raug xa nrog qhov tsawg kawg tseem ceeb me ntsis ua ntej.

PARITY

Parity piav qhia qhov sib npaug lossis qhov txawv ntawm tus lej. Qhov sib npaug me ntsis yog ib txoj hauv kev tau txais UART los qhia yog tias muaj cov ntaub ntawv tau hloov pauv thaum kis. Cov khoom tuaj yeem hloov pauv los ntawm hluav taws xob hluav taws xob, tsis sib xws baud tus nqi, lossis cov ntaub ntawv xa mus deb deb. Tom qab tau txais UART nyeem cov ntaub ntawv, nws suav tus lej ntawm cov khoom nrog tus nqi 1 thiab kos yog tias tag nrho yog tus lej lossis tus lej. Yog tias qhov sib npaug sib npaug yog 0 (txawm tias sib npaug), 1 cov khoom hauv cov ntaub ntawv yuav tsum tag nrho rau tus lej sib npaug. Yog tias qhov sib npaug sib npaug yog 1 (khib sib npaug), 1 cov khoom hauv cov ntaub ntawv yuav tsum tag nrho rau tus lej khib. Thaum qhov sib npaug sib npaug sib phim cov ntaub ntawv, UART paub tias kev sib kis tsis muaj qhov yuam kev. Tab sis yog tias qhov sib npaug me ntsis yog 0, thiab tag nrho yog khib; lossis qhov sib npaug sib npaug yog 1, thiab tag nrho yog txawm tias, UART paub tias cov khoom hauv cov ntaub ntawv tau hloov pauv.

NIAJ HNUB QHOV TSEEB

o teeb tsa qhov kawg ntawm cov ntaub ntawv pob, xa UART tsav cov ntaub ntawv xa kab los ntawm qhov hluav taws xob qis mus rau qhov hluav taws xob siab tsawg kawg yog ob ntu me ntsis.

Kauj Ruam 10: KAUJ RUAM UART TRANSMISSION

1. Kev xa UART tau txais cov ntaub ntawv ua ke los ntawm cov tsheb npav:

Kauj Ruam 11: Duab Xa UART Tau Txais Cov Ntaub Ntawv Ua Ke Los Ntawm Cov Tsheb Npav

Duab Xa UART Tau Txais Cov Ntaub Ntawv Ua Ke Los Ntawm Cov Tsheb Npav
Duab Xa UART Tau Txais Cov Ntaub Ntawv Ua Ke Los Ntawm Cov Tsheb Npav

Kauj Ruam 12: 2. Kev Tshaj Tawm UART Ntxiv Pib Pib, Parity Bit, thiab Stop Bit (s) rau Cov Ntaub Ntawv:

2. Kev Tshaj Tawm UART Ntxiv Pib Pib, Parity Bit, thiab Stop Bit (s) rau Cov Ntaub Ntawv
2. Kev Tshaj Tawm UART Ntxiv Pib Pib, Parity Bit, thiab Stop Bit (s) rau Cov Ntaub Ntawv

Kauj Ruam 13: 3. Tag Nrho Cov Pob Tau Xa Los Ntawm Kev Xa UART mus rau Qhov Tau Txais UART. Qhov Tau Txais UART Piv Txwv Cov Kab Kab Lus ntawm Tus Txheej Txheem Ua Ntej Baud Tus Qauv:

3. Cov Pob Pob Tag Nrho Xa Los Ntawm Kev Xa UART mus rau Qhov Tau Txais UART. Qhov Tau Txais UART Piv Txwv Cov Kab Kab Lus ntawm Tus Txheej Txheem Ua Ntej Baud Tus Qauv
3. Cov Pob Pob Tag Nrho Xa Los Ntawm Kev Xa UART mus rau Qhov Tau Txais UART. Qhov Tau Txais UART Piv Txwv Cov Kab Kab Lus ntawm Tus Txheej Txheem Ua Ntej Baud Tus Qauv

Kauj Ruam 14: 4. Qhov Tau Txais UART Tshem Tawm Qhov Pib Me ntsis, Parity Me ntsis, thiab Nres Me Me Los Ntawm Cov Ntaub Ntawv:

4. Qhov Tau Txais UART Tshem Tawm Pib Pib, Parity Me, thiab Nres Me Me Los Ntawm Cov Ntaub Ntawv
4. Qhov Tau Txais UART Tshem Tawm Pib Pib, Parity Me, thiab Nres Me Me Los Ntawm Cov Ntaub Ntawv

Kauj Ruam 15: 5. Qhov Tau Txais UART hloov pauv cov ntaub ntawv hauv xov tooj rov qab mus rau qhov sib npaug thiab hloov nws mus rau Cov Tsheb Npav ntawm Qhov Tau Txais Kawg:

5. Qhov Tau Txais UART Hloov Cov Ntaub Ntawv Rov Qab Mus Rau Qhov Cuam Tshuam thiab Hloov Nws Mus Rau Cov Tsheb Npav Ntawm Qhov Tau Txais Kawg
5. Qhov Tau Txais UART Hloov Cov Ntaub Ntawv Rov Qab Mus Rau Qhov Cuam Tshuam thiab Hloov Nws Mus Rau Cov Tsheb Npav Ntawm Qhov Tau Txais Kawg

Kauj Ruam 16: Qhov Ua Tau Zoo thiab Qhov Tsis Zoo ntawm UARTS

Tsis muaj txheej txheem kev sib txuas lus zoo tag nrho, tab sis UARTs zoo nkauj heev ntawm qhov lawv ua. Nov yog qee qhov zoo thiab qhov tsis zoo los pab koj txiav txim siab seb lawv puas haum rau qhov xav tau ntawm koj txoj haujlwm:

ADVANTAGES

Tsuas yog siv ob lub xov hlau Tsis muaj lub teeb liab xav tau Muaj qhov sib npaug me ntsis tso cai rau kev txheeb xyuas qhov ua yuam kev Tus qauv ntawm pob ntawv cov ntaub ntawv tuaj yeem hloov pauv tsuav yog ob tog tau teeb tsa rau nws Cov ntaub ntawv zoo thiab dav siv txoj kev DISADVANTAGES

Qhov loj ntawm cov ntaub ntawv thav duab tau txwv rau qhov siab kawg ntawm 9 khoom Tsis txhawb nqa ntau tus qhev lossis ntau tus tswv tswv Lub baud tus nqi ntawm txhua UART yuav tsum tsis pub dhau 10% ntawm ib leeg ntxiv mus rau ntu peb ntawm cov kab lus no, I2C Kev Sib Txuas Lus Sib Tham kom paub txog lwm txoj hauv kev siv cov khoom siv hluav taws xob sib txuas lus. Lossis yog tias koj tseem tsis tau muaj, txheeb xyuas ib feem, Cov hauv paus ntawm SPI Kev Sib Tham Txheej Txheem.

Thiab zoo li ib txwm, qhia rau kuv paub hauv cov lus yog tias koj muaj lus nug lossis lwm yam ntxiv! Yog tias koj nyiam kab lus no thiab xav pom ntau dua li nws, nco ntsoov Ua raws

Hais txog

M. Junaid

Pom zoo: