Cov txheej txheem:

KEYPAD Nrog 7 XEEM Siv CLOUDX MICROCONTROLLER: 4 Kauj Ruam
KEYPAD Nrog 7 XEEM Siv CLOUDX MICROCONTROLLER: 4 Kauj Ruam

Video: KEYPAD Nrog 7 XEEM Siv CLOUDX MICROCONTROLLER: 4 Kauj Ruam

Video: KEYPAD Nrog 7 XEEM Siv CLOUDX MICROCONTROLLER: 4 Kauj Ruam
Video: Lub Zog Nruab Nrog (Hmong Dubbed) 2024, Hlis ntuj nqeg
Anonim
KEYPAD Nrog 7 QHOV TSEEB siv CLOUDX MICROCONTROLLER
KEYPAD Nrog 7 QHOV TSEEB siv CLOUDX MICROCONTROLLER

Txog qhov haujlwm no, peb yuav lees txais cov lej nkag los ntawm Matrix Keypad thiab tom qab ntawd tso tawm nws ntawm xya-ntu ntu Cov Qauv. Txij li 8 LEDs tau sau lo lus A rau G thiab DP (rau tus lej cim zauv), yog tias koj xav qhia tus lej 6, ces koj yuav siv tam sim no rau ntu A, C, D, EF thiab G. Yog li ntawd 6 sib npaug 0b01111101 (DP), G, F, E, D, C, B, A) hauv binary thiab 0x7D hauv Hexadecimal.

Kauj Ruam 1: Cov ntaub ntawv

Cov ntaub ntawv
Cov ntaub ntawv
Cov ntaub ntawv
Cov ntaub ntawv
Cov ntaub ntawv
Cov ntaub ntawv
  1. CLOUDX MICROCONTROLLER
  2. CLOUDX SOFTCARD
  3. 7 SEGMENT
  4. JUMPER WIRE
  5. V3 kab
  6. 4x3 KEV
  7. 330 hmo
  8. 10K tiv thaiv

Koj tuaj yeem xaj koj qhov lus teb ntawm no

Kauj ruam 2: TSEEB KOJ HARDWARE

Ua raws cov kauj ruam no:

txuas rau:

Pin A ntawm ntu rau pin1 ntawm CloudX

Pin B ntawm ntu rau pin2 ntawm CloudX

Pin DP ntawm ntu rau pin3 ntawm CloudX

Pin C ntawm ntu rau pin4 ntawm CloudX

Pin D ntawm ntu rau pin5 ntawm CloudX

Pin E ntawm ntu rau pin6 ntawm CloudX

Pin F ntawm ntu rau pin7 ntawm CloudX

Pin G ntawm ntu rau pin9 ntawm CloudX

txuas cov cathode tus pin rau GND

Tus pinA ntawm tus lej khawm kab txuas tau txuas nrog 10k resistor thiab rau tus pin12 ntawm microcontroller.

Tus pinB ntawm tus lej khawm kab txuas tau txuas nrog 10k resistor thiab rau pin13 ntawm microcontroller.

Tus pinC ntawm tus lej khawm kab txuas tau txuas nrog 10k resistor thiab rau pin14 ntawm lub microcontroller.

Tus pinD ntawm tus lej khawm kab txuas tau txuas nrog 10k resistor thiab rau pin15 ntawm microcontroller.

Thiab qhov kawg ntawm tus tiv thaiv tau txuas ua ke rau GND.

Tus pin1 ntawm tus keypad Row tus pin tau txuas nrog tus pin10 ntawm microcontroller.

Tus pin2 ntawm tus keypad Row tus pin tau txuas nrog tus pin11 ntawm lub microcontroller.

Tus pin3 ntawm tus keypad Row tus pin tau txuas nrog tus pin12 ntawm lub microcontroller.

Kauj ruam 3: CODING

Luam cov cai no rau koj li CloudX IDE.

#include #include #include #define NumberOfRows 4 #define NumberOfColumns 3 char KeypadCharacters [NumberOfRows] [NumberOfColumns] = {'1', '2', '3', '4', '5', '6', '7 ',' 8 ',' 9 ','*',' 0 ','#'}; // teeb tsa ntawm Keypad's Keys char RowPins [NumberOfRows] = {12, 13, 14, 15}; char ColumnsPins [NumberOfColumns] = {9, 10, 11}; tus yuam sij; // Hloov chaw ntawm kev tsim kaum cais cais sib txawv char, peb tsim ib pawg rau pab pawg lawv tsis kos npe char seg = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; teeb tsa () {// teeb tsa ntawm no Keypad_setting (PULLDOWNROW, RowPins, ColumnPins, NumberOfRows, NumberOfColumns, KeypadCharacters); // pib Keypad nrog cov ntaub ntawv no // Segment_setting (CCathode, NumberOfDigit, segmentScanPins, segmentDataPins); portMode (1, NTAWV); // teeb tsa digital I/O chaw nres nkoj 1 ua OUTPUT portWrite (1, OFF_ALL); // clear/tua qhov chaw nres nkoj 1 loop () {// Qhov program ntawm no

Cov yuam sij = getKey (); // tshawb xyuas qhov tseem ceeb Xovxwm ntawm Keypad

yog (Keys! = 0) portWrite (1, seg [Keys - 48]); // sau Ntsiab Lus Nias ntawm 7-ntu

}

}

Kauj Ruam 4: Qhia tawm nrog peb

Qhia tawm nrog peb koj qhov Kev Ua tiav ntawm no

Pom zoo: