Microcontroller Timer Program

Source: Internet
Author: User

# Include "typedef. H"
# Include "digitaltube. H"
# Include "interrupt. H"

Sbit led0 = P0 ^ 0; // set bandwidth limit to µ¥ bandwidth limit» úµäp0 limit to μäµúbandwidth bandwidth»
Sbit led1 = P0 ^ 1; // é ù ã µ {µ¥ {}» úµäp0 ~úµäµú?¶ þ î»
Sbit led = P0; // P0 ~ú
Sint Index = 0; // ****************
Sint Ss = 0;
Sint Mm = 0;
Sint HH = 0;
Uchar num;

// Ê ý â ë ü ×öä£
Const uchar char_index [3] = {0xdf, 0xbf, 0x7f };
Const uchar char_modle [16] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99,0x92,0x82, 0xf8, 0x80, 0x90,0x88,0x83, 0xc6, 0xa1, 0x86, 0x8e };
Const uchar char_dot [1] = {0x7f };

Void delayms (uint XMS)
{
Uint I, J;
For (I = XMS; I> 0; I --)
{
For (j = 110; j> 0; j --)
{
}
}
}

Void t0_time () interrupt 1
{
Th0 = (65536-45872)/256;
Tl0 = (65536-45872) % 256;
Num ++;

If (num = 20)
{
Num = 0;
Led1 = ~ Led1;

Index = 0;
// **************
If (Ss = 60)
// Zookeeper
{
Ss = 0;
If (Mm = 60 ){
// · Ööó
Mm = 0;

If (HH = 12)
// Ð ¡ê ±
{
HH = 0;
} Else
{
HH ++;
}
} Else {
MM ++;
}
} Else {
SS ++;
}

}
}

Void main (){

Uchar AA = 0xfe;
Uchar BB = 0xef;
Uint II = 0, JJ = 0, KK = 0, LL = 0;

// ¨ ± Æ ÷
Tmod = 0x01;
Th0 = (65536-45872)/256;
Tl0 = (65536-45872) % 256;
Ea = 1;
Et0 = 1;
Tr0 = 1;

While (1)
{
///*
// For (II = 0; II <50; II ++)
{
Lightdigled (char_index [0], char_dot [Index]);
// ×Ó± ß µúgou» ö öµã
Delayms (1 );
Lightdigled (char_index [0], char_modle [HH % 0x10]);
// ×Ó± ß µúgou» ö öê ±öó
Delayms (1 );
Lightdigled (char_index [1], char_modle [mm/10]);
// Öð ¼ ä
Delayms (1 );

Lightdigled (char_index [2], char_modle [mm % 10]);
// Ó ò ± ß äçoröö
Delayms (1 );
}

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.