60s countdown program for single chip microcomputer in C language

Publisher:EnigmaticSoulLatest update time:2015-07-08 Source: 51heiKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
#include
#define uchar unsigned char
sbit P13=P1^3;
sbit P14=P1^4;
uchar c,i,a=60,z;
flying code Numcode[]={0XC0,//;0
                0XF9,//;1
                0XA4,//;2
                0XB0,//;3
                0X99,//;4
                0X92,//;5
                0X82,//;6
                0XF8,//;7
                0X80,//;8
                0X90,//;9
};
 void delay(z)
{ while(z--);
}
void main()
{TMOD=1;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
c=0;
i=0;
EA=1;
ET0=1;
TR0=1;
while(1)
 { if(c==20)
  { c=0;
  a--;}
  if(a>=0)
  {i=a/10;
P13=1;
  P0=Numcode[i];
P14=0;
   delay(20);
 P14=1;
   i=a%10;
  
    P0=Numcode[i];
  P13=0;
  delay(10);}
 
 else
 {a=60;}
}
}
void timer0() interrupt 1
 {TH0=(65536-50000)/256;
  TL0=(65536-50000)%256;
  c++;
  }
Keywords:MCU Reference address:60s countdown program for single chip microcomputer in C language

Previous article:Based on C8051f020 Wu Weibiao animation LCD control display
Next article:High and low priority interrupt application examples

Recommended ReadingLatest update time:2024-11-16 16:17

PIC microcontroller AD conversion (example analysis)
AD conversion is analog-to-digital conversion. As the name implies, it converts analog signals into digital signals. It mainly includes integral type, successive approximation type, parallel comparison type/serial parallel type, Σ-Δ modulation type, capacitor array successive comparison type and voltage-frequency conv
[Microcontroller]
PIC microcontroller AD conversion (example analysis)
Serial data interaction between Linux system and 51 single chip microcomputer
// The following is for linux IO INPUT AND OUT PUT Reference code Please refer to the website for details. It is very detailed. The function code and the problem test are extracted from the following website. Thanks for the function resources they provided. You can first look at the function model and method. I think
[Microcontroller]
Design of retargetable embedded integrated development platform
introduction        The development of embedded application software is different from that of general computer software. Due to resource constraints, embedded software development generally requires cross-development on a dedicated development platform. At the same time, since the development of embedded systems an
[Microcontroller]
Design of retargetable embedded integrated development platform
Five experiences in MCU software programming
Experience 1: Use "software trap + program password" to deal with the flying of PC pointer When the CPU is disturbed by external factors, sometimes the PC pointer will fly to another program segment, or jump to a blank segment. In fact, if the PC pointer flies to a blank segment, it is easy to deal with. Just se
[Microcontroller]
Characteristics and applications of wireless data transmitters with embedded microcontrollers
Overview AT86RF401 is a RF wireless data transmitter with an AVR RISC microcontroller integrated in the single-chip computer. The output frequency range is 250-450MHz, the maximum output power is +6dBm, and the emissivity is 10Kband. The chip is embedded with an AVR RISC microcontroller, 2KB (1K×16b) Flash program m
[Microcontroller]
Characteristics and applications of wireless data transmitters with embedded microcontrollers
Design of automatic target spray control system based on AVR microcontroller
1. Introduction As we all know, China's pesticide production technology is at the international advanced level, but the current situation of China's plant protection machinery and pesticide use technology is seriously backward and is extremely disproportionate to China's rapidly developing pesticide level. It has ser
[Microcontroller]
Design of automatic target spray control system based on AVR microcontroller
How to learn single chip microcomputer well
  1. Introduction   Many MCU beginners always say when they communicate with me that I am a MCU beginner now, how can I learn MCU faster, is there a market for learning MCU? For this question, I will talk about how I learn MCU, how to get started, how to become proficient, and my own ideas about the whole process.
[Microcontroller]
The difference between data, idata, xdata, pdata and code in MCU
Many MCU beginners and even some experienced engineers have never understood what data, idata, xdata, pdata, and code are. Recently, I saw an article about the problems of data, idata, xdata, pdata, and code in Keil, and I would like to share it with you! In terms of data storage type, the 8051 series microcontrol
[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号