An 8x8 dot matrix display technology driven by 74hc138 and 74hc595

With STC89C52, 74hc138 drive column, 74hc595 drive line, 8x8 dot matrix display problem.

Best answer:

The basic structure of the program given by the title is correct. It is slightly embarrassing. The enable of HC138 is not turned on. The key is that the blanking is not good enough, resulting in overlapping afterglow and the display is fuzzy.

After adjustment, it can work normally, and the simulation screen showing the arrow and the heart is as follows.

An 8x8 dot matrix display technology driven by 74hc138 and 74hc595

The procedure for successful debugging is as follows:

//======================================================

#include

#define uint unsigned int

#define uchar unsigned char

Sbit H_shcp = P1^3; //HC595 chip

Sbit H_stcp = P1^4;

Sbit H_oe = P1^5;

Sbit H_ds = P1^6;

Sbit HC138_G = P3^1; //HC138 chip

Uchar data_j[] = {0x00,0x00,0x18,0x3c,0x5a,0x18,0x18,0x00}; //arrow

Uchar data_t[] = {0x00,0x66,0x99,0x81,0x81,0x42,0x24,0x18};

//------------------------------------------------ ------------------

Void delaxms(uint xms)

{

Uint i, j;

For(i = xms; i 》 0; i--) for(j = 118; j 》 0; j--);

}

//------------------------------------------------ ------------------

Void sendbyte_H(uchar aa) //Using HC595 output

{

Uchar z;

For(z = 0; z " 8; z++) { // loop 8 times into the data

H_shcp = 0;

H_ds = aa & 0x01; //Data low is sent to HC595 data line

H_shcp = 1; // rising edge input data

Aa 》》= 1; //Shift right

}

H_stcp = 0;

H_stcp = 1; // rising edge makes data parallel output

}

//------------------------------------------------ ------------------

Void main()

{

Uint i, r;

While(1) {

For(r = 30; r 》 0; r--) { //Show arrow

For(i = 0; i " 8; i++) {

HC138_G = 1; //Close 138, turn off the display

sendbyte_H(data_j[i]); //output arrow information

P1 = 0xd8 | i; //newline

HC138_G = 0; //Open the display

Delaxms(5); //displayed time

} }

For(r = 10; r 》 0; r--) { //Show blank

For(i = 0; i " 8; i++) {

HC138_G = 1; //Close 138, turn off the display

sendbyte_H(0); //output 0

P1 = 0xd8 | i; //newline

HC138_G = 0; //Open the display

Delaxms(5); //displayed time

} }

For(r = 30; r 》 0; r--) { //Show the heart

For(i = 0; i " 8; i++) {

HC138_G = 1; //Close 138, turn off the display

sendbyte_H(data_t[i]); //output arrow information

P1 = 0xd8 | i; //newline

HC138_G = 0; //Open the display

Delaxms(5); //displayed time

} }

For(r = 10; r 》 0; r--) { //Show blank

For(i = 0; i " 8; i++) {

HC138_G = 1; //Close 138, turn off the display

sendbyte_H(0); //output 0

P1 = 0xd8 | i; //newline

HC138_G = 0; //Open the display

Delaxms(5); //displayed time

} } }

}

Piezo Ceramic Element

Piezo Ceramic Sounding Plate,Full Range Piezo Ceramic Buzzer Element,Piezoelectric Ceramic Diaphragm

NINGBO SANCO ELECTRONICS CO., LTD. , https://www.sancobuzzer.com

Posted on