Super simple basketball counter

Publisher:悠闲之旅Latest update time:2020-02-27 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The actual picture of the basketball counter is as follows:
 
The schematic diagram and PCB diagram drawn by Altium Designer are as follows:
 

The simulation schematic is as follows

The microcontroller source program is as follows:

#include

#include

#define uchar unsigned char

#define uint unsigned int

#define out P0

sbit RS=P2^0;

sbit RW=P2^1;

sbit E=P2^2;

void lcd_initial(void);

void check_busy(void);

void write_command(uchar com);

void write_data(uchar dat);

void string(flyer name ,flyer *s);

void delay(uint);

flying i;

void main(void)

{

  lcd_initial();

  while(1)

  {

        write_command(0x06);

    string(0x82,"Name:HONG JIE");

        write_command(0x04);

        string(0xce,"987654321:QQ");


        for(i=0;i<40;i++)

       {     

              write_command(0x1c);

              delay(50);

       }



        }

}

void delay(uint j)

{

  fly i=250;

  for(;j>0;j--)

  {

    while(--i);

        i=249;

        while(--i);

        i=250;

        }

}

void check_busy(void)

{

  flying dt;

  do

  {

    dt=0xff;

        E=0;

        RS=0;

        RW=1;

        E=1;

        dt=out;

        }while(dt&0x80);

        E=0;

}

void write_command(uchar com)

{

  check_busy();

  E=0;

  RS=0;

  RW=0;

  out=com;

  E=1;

  _nop_();

  E=0;

  delay(1);

}

void write_data(uchar data)

{

  check_busy();

  E=0;

  RS=1;

  RW=0;

  out=that;

  E=1;

  _nop_();

  E=0;

  delay(1);

}

void lcd_initial(void)

{

  write_command(0x38);

  write_command(0x0c);

  write_command(0x06);

  write_command(0x01);

  delay(1);

}

void string(float name, float *s)

{

  write_command(ad);

  while(*s>0)

  {

    write_data(*s++);

        delay(100);

        }

}


Reference address:Super simple basketball counter

Previous article:51 Learning process - Chapter 2 The use of keil software and running lights
Next article:51 MCU fan driver source program

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

c51 ultra long time delay program 1 hour to 1000... hours
;;////////////////////////////////////////////////////////////////////;; ;; c51 ultra-long time delay program from 1 hour to 1000... hours. ;;19:44 2007-3-10;; ;;6MHZ crystal oscillator is 100ms;if the crystal oscillator is 12mhz, it is 50ms;enter a timer interrupt;; ;;You use timer interrupt 0 mode 1, enter an interr
[Microcontroller]
Design of solar charging system based on C8051F920 microcontroller
In today's world of energy shortages and increasingly serious environmental pollution, how to effectively utilize clean solar energy is becoming an energy strategy for sustainable development in various countries. At present, most lighting equipment still uses traditional energy for lighting, so making full use of sol
[Microcontroller]
Design of solar charging system based on C8051F920 microcontroller
The first step of microcontroller - 51 microcontroller
As the saying goes: "The first step of genius is XX diapers." Haha! That's too far. However, what we are talking about today may indeed be the first microcontroller that most embedded engineers or electronics enthusiasts come into contact with - the 51 microcontroller. The picture shows the electronic production
[Microcontroller]
The first step of microcontroller - 51 microcontroller
51 MCU Introduction - Buzzer and Relay
We will introduce the buzzer and relay in detail based on the title: (implemented on the basis of basic control of LED lights) ULN2003 Darlington Transistor and 74HC573 Latch The internal structure of the Darlington transistor: There is a NOT gate inside. If you input 1, it will output 0, and if you input 0, it wi
[Microcontroller]
51 MCU Introduction - Buzzer and Relay
Design of dormitory fire-proof and anti-theft intelligent alarm system using 51 microcontroller
0 Preface Nowadays, in school dormitories, accidents such as students’ valuables being stolen and fires caused by students’ mistakes often occur. These are “big problems” that have been plaguing students, staff, and the school security office. Traditional preventive measures have great disadvantages. For example, when
[Microcontroller]
Design of dormitory fire-proof and anti-theft intelligent alarm system using 51 microcontroller
How to quickly switch from 51 to MSP430
           As a beginner who wants to learn MSP430 microcontroller, or you have just switched to electronic hardware embedded development, if you have completed the basic electronics course and want to master MSP430 microcontroller as soon as possible, but are struggling with how to break into the MSP430 lear
[Microcontroller]
Multifunctional electronic clock design based on 51 microcontroller
Design tasks: 1. Design task: Use microcontroller, clock chip DS1302, temperature sensor DS18B20, 1602 LCD, etc. to realize the display of date, time and temperature, which is a simple perpetual calendar. 2. Design requirements (1) Accurate timing can be achieved through DS1302, the time is adjustable and displayed on
[Microcontroller]
Multifunctional electronic clock design based on 51 microcontroller
51 single chip microcomputer realizes key-to-key addition and subtraction program
************************************************************************/ /********Key counting 0-99 long press continuous addition or subtraction experiment******************/ /********Press K1 to add one, continue to add one after a certain time, after adding to 99, pressing K1 is invalid*******/ /********Press
[Microcontroller]
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号