Cov txheej txheem:

Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller: 5 Kauj Ruam
Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller: 5 Kauj Ruam

Video: Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller: 5 Kauj Ruam

Video: Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller: 5 Kauj Ruam
Video: 3 HMONG TV Lus tshaj txog kabmob-19 nyob xeev MN (05/08/2021). 2024, Kaum ib hlis
Anonim
Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller
Sib cuam tshuam 7-Segment Zaub Nrog Hloov Sau Npe Siv CloudX Microcontroller

Hauv qhov haujlwm no peb tab tom tshaj tawm kev qhia yuav ua li cas cuam tshuam xya ntu ntu LED zaub nrog CloudX microcontroller. Xya ntu lus qhia tau siv hauv ntau qhov system thiab cov ntawv thov kev lag luam uas qhov ntau ntawm cov khoom tsim tawm los qhia tau paub ua ntej. Basic 1 tus lej xya ntu ntu tuaj yeem qhia tus lej ntawm 0-9 thiab ob peb tus cim. 7 ntu qhia yog ntau hom sib txawv; tshwj xeeb tshaj yog lawv sib txawv ntawm tus lej/tus cim nws tuaj yeem tso tawm. Yeej yog 7 ntu zaub yog ib chav nyob, uas tuaj yeem tso tawm tsuas yog 1 tus lej lossis 1 tus cim. Ntau tus lej tau tshwm los ntawm kev sib tshooj ib leeg 7 ntu qhia ua ke los tsim 2 tus lej, 3 tus lej lossis 4 tus lej 7 ntu tso saib. Nws nyob ntsiag to yooj yim rau kev sib tham CloudX thiab 7 Segment zaub ua ke! Cia pib kawm ntawv.

Kauj Ruam 1: HC595 Hloov Npe

HC595 Hloov Chaw Sau Npe
HC595 Hloov Chaw Sau Npe

74h595 ib

74HC595 suav nrog 8 -ntsis hloov pauv rau npe thiab khaws cia rau npe nrog peb -xeev kev ua haujlwm sib luag. Nws hloov cov lus nkag mus rau hauv cov khoom sib luag kom koj tuaj yeem txuag IO cov chaw nres nkoj ntawm MCU. 74HC595 tau siv dav los qhia ntau yam LEDs thiab tsav ntau qhov me me ntu nthuav qhia. "Peb-xeev" hais txog qhov tseeb tias koj tuaj yeem teeb tsa tus pin li siab, qis lossis "siab impedance." Nrog cov ntaub ntawv latching, cov zis tam sim yuav tsis cuam tshuam thaum hloov pauv; nrog cov ntaub ntawv tso tawm, koj tuaj yeem cascade 74HC595s yooj yim dua. Pins ntawm 74HC595 thiab lawv lub luag haujlwm: Q0-Q7: 8-ntsis cov ntaub ntawv sib luag tso zis pins, tuaj yeem tswj 8 LEDs lossis 8 pins ntawm 7-ntu tso saib ncaj qha. Q7 ': Series tso tawm tus pin, txuas nrog DS ntawm lwm 74HC595 txuas ntau 74HC595s hauv kab MR: Pib dua tus pin, ua haujlwm ntawm qib qis; ntawm no nws txuas ncaj qha rau 5V. SH: Lub sijhawm ua ntu zus nkag ntawm kev hloov npe. Ntawm qhov nce nce ntxiv, cov ntaub ntawv hauv cov npe hloov pauv txav mus los ib me ntsis, piv txwv li cov ntaub ntawv hauv Q1 txav mus rau Q2, thiab lwm yam. Thaum nyob ntawm ntug ntog, cov ntaub ntawv hauv kev hloov pauv npe tseem tsis hloov pauv. ST: Lub sijhawm ua ntu zus nkag ntawm kev tso npe cia. Ntawm qhov nce nce, cov ntaub ntawv hauv cov npe hloov pauv txav mus rau hauv lub cim xeeb sau npe. OE: Output pab tus pin, ua haujlwm qis, txuas nrog GND. Ds: Cov ntaub ntawv xov tooj nkag tus pin VCC: Cov khoom siv hluav taws xob zoo GND: Hauv av Ntawm no yog kev hloov pauv () ua haujlwm, uas los nrog CloudX IDE. Cias sau tus lej nruab nrab ntawm 0 thiab 255 thiab daim ntawv tso npe cia tuaj yeem hloov nws mus rau hauv 8-ntsis binary tus lej thiab tso nws ua ke. Qhov no tso cai rau koj yooj yim tswj 8 tus pin ntawm 7-ntu zaub thiab tsim cov qauv uas koj xav tau.

Kauj ruam 2: 7 SEGMENT

7 SEGMENT
7 SEGMENT
7 SEGMENT
7 SEGMENT

Cia peb pib qhov kev qhia. Peb tab tom yuav siv CloudX M633 thiab qib pib xya ntu nrog cov lej zauv. Koj tuaj yeem txheeb xyuas ntu ntawm cov zaub nrog kev pab ntawm daim duab saum toj no.

Qhov kev faib ua xya ntu no muaj tag nrho ntawm 8 LEDs rau tus lej raws li qhia hauv daim duab saum toj no, xya LED rau txhua ntu thiab ib qho rau cov lej zauv.

Raws li koj tuaj yeem pom muaj 10 tus pin nyob rau hauv tag nrho. Koj tuaj yeem pom ob tus pin npe com, raws li tau qhia hauv daim duab qhia chaw ntawm txhua lub cathode (- pins) ntawm LEDs tau txuas nrog ob tus pin no. Peb hu cov 2 tus pin li cathodes ntau thiab cov lus zoo li no hu ua Common Cathode 7 ntu qhia. Muaj qee qhov xya ntu qhia uas muaj cov anodes ntau dua li siv cov cathode. Tsuas yog qhov sib txawv rau cov lus qhia anode yog txhua qhov anodes (+ pins) txuas nrog ua ke thiab lawv tau paub tias yog Common Anode 7 ntu qhia. Sib nrug los ntawm 2 com pins, muaj 8 lwm tus pin npe A, B, C, D, E, F, G thiab DP. Raws li koj tuaj yeem pom hauv daim duab, cov pins no yog anodes (+ pins) ntawm cov coj ntu ntawm cov cathode pom ib txwm muaj (hauv cov xwm txheej ntawm anodes pom cov pins no yuav yog cathodes)

Kauj Ruam 3: Cov Cheeb Tsam Xav Tau

Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
Cheeb Tsam Xav Tau
  • CloudX M633
  • CloudX SoftCard
  • V3 Usb Cable
  • HC595 Hloov npe
  • jumper cov xov hlau
  • Cov qhob cij
  • 7 Qeb zaub
  • 330 ohm tiv thaiv

Kauj ruam 4: SETUP

Teem caij
Teem caij

Txuas 7-Segment zaub thiab 74HC595 hloov npe rau CloudX M633:

Txuas Vcc tus pin ntawm 74HC595 rau 5V tus pin ntawm CloudX.

Txuas GND thiab OE pins ntawm 74HC595 rau GND tus pin ntawm CloudX.

Txuas DS lossis SER tus pin ntawm 74HC595 rau tus lej digital 2 ntawm CloudX.

Txuas SHCP lossis SRCLK tus pin ntawm 74HC595 rau tus lej digital 1 ntawm CloudX.

Txuas STCP lossis RCLK tus pin ntawm 74HC595 rau tus lej digital 3 ntawm CloudX.

Txuas Q0-Q6 lossis QA-QG tus pin ntawm 74HC595 txhawm rau pin A-G ntawm 7-ntu zaub.

Txuas Q7 lossis QH tus pin ntawm 74HC595 rau tus pin DP ntawm 7-ntu zaub.

Txuas ntau cov cathode pins (tus pin 3 thiab 8 ntawm daim duab) ntawm 7-ntu zaub rau Gnd tus pin ntawm CloudX.

Kauj ruam 5: Code

#suav nrog

#suav nrog

ChangeValue (tus nqi tsis tau kos npe) {

hloov (tus nqi) {rooj plaub 0: rov qab 0x3f; rooj plaub 1: rov qab 0x06; rooj plaub 2: rov qab 0x5b; rooj plaub 3: rov qab 0x4f; rooj plaub 4: rov qab 0x66; rooj plaub 5: rov qab 0x6d; rooj plaub 6: rov qab 0x7d; rooj plaub 7: rov qab 0x07; rooj plaub 8: rov qab 0x7f; rooj plaub 9: rov qab 0x6f; }}

teeb tsa () {

HC595_setting (2, 1, 3);

rov () {

rau (char i = 0; i

Pom zoo: