Program design of 4 × 4 matrix key based on AT89S51

Connect the 4 & TImes; 4 matrix keyboard with the parallel port P1 of AT89S51, with P3.0-P3.3
As the input line, use P3.4-P3.7 as the output line; display the serial number "0-9" of the digital buttons on the digital tube, and display 0 on the other buttons.

Principle analysis: Each key of the 4X4 matrix keyboard has its row value and column value. When the row value of each key is low and the column value is high, the key is not pressed. When judging whether a button is pressed, first let this row pass low level, then scan each column to judge whether it is pressed (column value to pass the high level), if it is pressed, then the power of this column At this time, it will become low level; if this column is low level during scanning, it means that a button is pressed in this column, and the row value is determined every time before judging the column value, so that you can know in the end Which button was pressed.

Basic process: Set the first line low level-> scan each column (set to high level), determine whether it is 0-> determine whether there is a key press-> set the second line low level-> Scan the second column ... (so loop to the fourth row and start over from the first row)

Compilation environment: KEIL C51 V3
Simulation software: proteus 7.4
SCM type: AT89C52

Digital tube type: 7seg-mpx1-cc (cc-common negative digital tube)

Keyboard type: keyboard-samllcalc

The program on the microcontroller is as follows:

#include "reg52.h"

char code table [] = {0x3f, 0x06, 0x5b, 0x4f, 0x66,

0x6d, 0x7d, 0x07, 0x7f, 0x6f};

sbit row1 = P3 ^ 4;

sbit row2 = P3 ^ 5;

sbit row3 = P3 ^ 6;

sbit row4 = P3 ^ 7;

int temp;

int key;

// void delay500ms ();

void delay20ms ();

void main ()

{

P1 = table [0];

while (1)

{

P3 = 0xff;

row1 = 0;

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

delay20ms ();

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

switch (temp)

{

case 0x0e:

key = 7;

break;

case 0x0d:

key = 8;

break;

case 0x0b:

key = 9;

case 0x07:

key = 0;

}

P1 = table [key];

}

}

P3 = 0xff;

row2 = 0;

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

delay20ms ();

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

switch (temp)

{

case 0x0e:

key = 4;

break;

case 0x0d:

key = 5;

break;

case 0x0b:

key = 6;

break;

case 0x07:

key = 0;

}

P1 = table [key];

}

}

P3 = 0xff;

row3 = 0;

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

delay20ms ();

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

switch (temp)

{

case 0x0e:

key = 1;

break;

case 0x0d:

key = 2;

break;

case 0x0b:

key = 3;

break;

case 0x07:

key = 0;

break;

}

}

P1 = table [key];

}

P3 = 0xff;

row4 = 0;

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

delay20ms ();

temp = P3;

temp = temp & 0x0f;

if (temp! = 0x0f)

{

switch (temp)

{

case 0x0e:

key = 0;

break;

case 0x0d:

key = 0;

break;

case 0x0b:

key = 0;

break;

case 0x07:

key = 0;

break;

}

}

P1 = table [key];

}

}

}

/ *

void delay500ms ()

{

int i, j, k;

for (i = 0; i 《10/2; i ++)

{

for (j = 0; j 《180; j ++)

{

for (k = 0; k "200; k ++)

{

}

}

}

} * /

void delay20ms ()

{

int i, j;

for (i = 0; i 《36; i ++)

{

for (j = 0; j 《200; j ++)

{

}

}

}

The core part of the circuit diagram is as follows:


Program design of 4 × 4 matrix key based on AT89S51

Feeder Parts

SMT Feeder types,

1. different smt machines with different smt feeders, but different model of the same brand machine can use the same feeder,like Panasonic Feeder.


2. Base on the size and types of components, smt feeder could be divided into three types : Tube feeder; Tray Feeder; Bulk Feeder.
Tape feeders with the different size such as 8mm, 16mm, 24mm, 32mm, 44mm, 56mm etc.


3. Base on the feeder condition, smt feeder also could be divided into four types: original new SMT feeder parts, used original SMT feeder parts, imitation/copy new SMT feeder parts, imitation/copy used SMT feeder parts,



Original feeder is made by original smt machine production manufacturers. Due to the large demand for smt feeder, currently there are many copy new feeders parts. Our feeders quality is also very great and looking forward to your cooperation!

Feeder Parts,Smt Feeder Parts,Panasonic Feeder Parts,Parts For Panasonic Feeder

Shenzhen Keith Electronic Equipment Co., Ltd. , https://www.aismtks.com