Cov txheej txheem:

Keypad Nrog LCD Siv CloudX Microcontroller: 4 Kauj Ruam
Keypad Nrog LCD Siv CloudX Microcontroller: 4 Kauj Ruam

Video: Keypad Nrog LCD Siv CloudX Microcontroller: 4 Kauj Ruam

Video: Keypad Nrog LCD Siv CloudX Microcontroller: 4 Kauj Ruam
Video: Qhia Hle & Hloov Màn Hình LCD Laptop | Siv Laptop Tsis Yuav LCD 2024, Hlis ntuj nqeg
Anonim
Keypad Nrog LCD Siv CloudX Microcontroller
Keypad Nrog LCD Siv CloudX Microcontroller

Txog qhov haujlwm no, peb yuav lees txais cov ntaub ntawv los ntawm Matrix Keypad thiab tom qab ntawd tso tawm ntawm lub LCD

Qauv.

Kauj Ruam 1: YUAV TSUM TAU

QHOV TSEEM CEEB
QHOV TSEEM CEEB
QHOV TSEEM CEEB
QHOV TSEEM CEEB
QHOV TSEEM CEEB
QHOV TSEEM CEEB
  • CLOUDX MICROCONTROLLER
  • CLOUDX SOFTCARD
  • V3 USB CORD
  • LCD 16 x 2
  • KEYPAD 4 x 4
  • VARIABLE RESISTOR (103)
  • JUMPER WIRE

Koj tuaj yeem tau txais koj cov khoom ntawm no

Kauj ruam 2: teeb tsa koj li HARDWARE

Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE
Teem koj li HARDWARE

thawj kauj ruam:

LCD txuas: peb yuav siv cov ntaub ntawv 4 - cov ntaub ntawv 7 tus pin, sau npe xaiv tus pin, pab tus pin.

  • txuas RS tus pin rau tus pin 1 ntawm Microcontroller
  • txuas EN tus pin rau tus pin2 ntawm Microcontroller
  • txuas D4 tus pin rau tus pin 3 ntawm Microcontroller
  • txuas D5 tus pin rau tus pin 4 ntawm Microcontroller
  • txuas D6 tus pin rau tus pin5 ntawm Microcontroller
  • txuas D7 tus pin rau tus pin6 ntawm Microcontroller
  • txuas Vss thiab coj tus lej tsis zoo rau GND
  • txuas Vdd thiab coj tus pin zoo rau 5v
  • txuas qhov sib txawv resistor nruab nrab tus pin rau VE (sib piv V). thiab lwm tus pin rau 5v thiab GND.

Kauj ruam thib ob:

Kev sib txuas ntawm cov keyboard: peb tab tom siv pullDown resistor rau cov khawm khawm khawm.

  • Tus pin1 ntawm tus lej xov tooj ntawm tus lej txuas tau txuas nrog 10k tus tiv thaiv thiab rau tus pin11 ntawm lub microcontroller.
  • Tus pin2 ntawm tus lej xov tooj kab txuas tau txuas nrog 10k resistor thiab rau pin12 ntawm lub microcontroller.
  • Tus pin3 ntawm tus lej xov tooj kab txuas tau txuas nrog 10k resistor thiab rau pin13 ntawm lub microcontroller.
  • Tus pin4 ntawm tus lej xov tooj kab txuas tau txuas nrog 10k resistor thiab rau pin14 ntawm lub 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 pin7 ntawm lub microcontroller.
  • Tus pin2 ntawm tus keypad Row tus pin tau txuas nrog tus pin8 ntawm lub microcontroller.
  • Tus pin3 ntawm tus keypad Row tus pin tau txuas nrog tus pin9 ntawm lub microcontroller.
  • Tus pin4 ntawm tus keypad Row tus pin tau txuas nrog tus pin10 ntawm microcontroller

Tom qab ua tiav nws, cia mus rau coding.

yog tias koj xav rub tawm CloudX IDE nyem ntawm no

Kauj ruam 3: CODING

Luam cov cai no rau koj li CloudX IDE.

#include #include #include

#define NumberOfRows 4 // teeb tsa tus lej ROWS rau Keypad

#define NumberOfColumns 4 // teeb tsa tus lej COLUMNS rau Keypad char KeypadCharacters [NumberOfRows] [NumberOfColumns] = {'1', '2', '3', 'A', '4', '5', '6', 'B', '7', '8', '9', 'C', '*', '0', '#', 'D'}; // teeb tsa ntawm Keypad's Keys char RowPins [NumberOfRows] = {7, 8, 9, 10}; // Keypad's Row Pins to CloudX char ColumnsPins [NumberOfColumns] = {11, 12, 13, 14}; // Keypad's Column Pins char Keys; // khaws Keypad tso tawm ntawm no teeb tsa () {// teeb tsa no Lcd_setting (1, 2, 3, 4, 5, 6); Lcd_cmd (cursorOff); Lcd_cmd (meej);

Keypad_setting (PULLDOWNCOL, RowPins, ColumnPins, NumberOfRows, NumberOfColumns, KeypadCharacters); // pib Keypad nrog cov ntaub ntawv no

rov () {

// Qhov program ntawm no thaum (Keys == 0) // yog tias tsis muaj Tus Kheej Nyem rau txhawm rau txheeb xyuas qhov Ntsuas Nyem Keys = Keypad_getKey (); // yog tias Lub Ntsiab yog Nyem ntsaws cov ntaub ntawv tseem ceeb rau hauv cov yuam sij Lcd_writeCP (Keys); // Tso tus yuam sij Nias ntawm LCD Tus Cursor Txoj Haujlwm Tam Sim No = 0; // Ntshiab Cov Ntsiab Lus ntawm Cov Yuam Sij Hloov pauv}}

Kauj Ruam 4: Qhia Rau Peb

Koj puas tau ua tiav?

yog tias koj ua tiav nws qhia nws rau peb ntawm no

Pom zoo: