Using 74hc138 and 74hc595 to drive 8x8 dot matrix display

Publisher:SparklingMoonLatest update time:2018-05-08 Source: eefocusKeywords:74hc138  74hc595 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Use STC89C52, 74hc138 to drive the columns, 74hc595 to drive the rows , 8x8 dot matrix display problem. Want to display arrows, ....... Reward points
: 30 Solved time: 2010-12-10 08:58
//= ...


Using 74hc138 and 74hc595 to drive 8x8 dot matrix display - Non-famous blogger - Electronic Information Corner

The successfully debugged program 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}; //heart
//------------------------------------------------------------------
void delaxms(uint xms)
{
    uint i, j;
    for(i = xms; i > 0; i--) for(j = 118; j > 0; j--);
}
//------------------------------------------------------------------
void sendbyte_H(uchar aa) //output using HC595

    uchar z;
    for(z = 0; z < 8; z++) { //loop 8 times to move in data
      H_shcp = 0;
      H_ds = aa & 0x01; //The low bit of data is sent to the HC595 data line
      H_shcp = 1; //Rising edge input data
      aa >>= 1; //Shift right one bit
    }
    H_stcp = 0;
    H_stcp = 1; //Rising edge makes data output in parallel
}
//------------------------------------------------------------------
void main()
{
    uint i, r;
    while(1) {
      for(r = 30; r > 0; r--) { //Display arrow
        for(i = 0; i < 8; i++) {
          HC138_G = 1; //Turn off 138, turn off display
          sendbyte_H(data_j[i]); //Output arrow information
          P1 = 0xd8 | i; //Wrap
          HC138_G = 0; //Turn on display
          delaxms(5); //Display time
      } }
      for(r = 10; r > 0; r--) { //Display blank
        for(i = 0; i < 8; i++) {
          HC138_G = 1; //Turn off 138, turn off display
          sendbyte_H(0); //Output 0
          P1 = 0xd8 | i; //Wrap
          HC138_G = 0; //Turn on display
          delaxms(5); //Display time
      } }
      for(r = 30; r > 0; r--) { //Display heart
        for(i = 0; i < 8; i++) {
          HC138_G = 1; //Turn off 138, turn off display
          sendbyte_H(data_t[i]); //Output arrow information
          P1 = 0xd8 | i; //Wrap
          HC138_G = 0; //Turn on display
          delaxms(5); //Display time
      } }
      for(r = 10; r > 0; r--) { //Display blank
        for(i = 0; i < 8; i++) {
          HC138_G = 1; //Turn off 138, turn off display
          sendbyte_H(0); //Output 0
          P1 = 0xd8 | i; //line break
          HC138_G = 0; //turn on display
          delaxms(5); //display time
    } } }
}


Keywords:74hc138  74hc595 Reference address:Using 74hc138 and 74hc595 to drive 8x8 dot matrix display

Previous article:Use 51 single chip microcomputer as signal generator to output four frequency square waves at the same time
Next article:Usage of 51 MCU table lookup instructions

Recommended ReadingLatest update time:2024-11-16 14:28

51 MCU + 74HC595 drive digital tube program
Here is the circuit diagram: Complete source code and drawings download address: http://www.51hei.com/bbs/dpj-20392-1.html The following is the program for the 51 microcontroller to drive the 74hc595 chip:      #include reg52.h //Include the header file of 51 MCU #include stdio.h #define uint unsigned int #d
[Microcontroller]
51 MCU + 74HC595 drive digital tube program
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号