knrt.net
当前位置:首页 >> C51单片机程序 >>

C51单片机程序

#include #define uchar unsigned char #define uint unsigned int sbit LED = P1^0; uchar T_Count = 0; void main() { TMOD = 0x01; TH0 = (65535-5000)/256; TL0 = (65535-5000)%256; IE = 0x82; TR0 = 1; while(1); } void LED_Flash() inte...

#include#define uchar unsigned charuchar tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00}; //0到9uchar num,cnt,disn;uchar keyval,disk;uchar led[]={1,2,3,4};void dealdat(uchar a){led[0]=0;led[1]=0;led[2]=0;led[3]=0...

您好: 完全可以,不用修改程序,C52只是多了一个定时器和多了一点存储空间,如果你程序在C51上能运行,那在C52上当然也能运行。

以下是四位数码管可调时带秒闪烁的c51单片机电子钟程序(c语言)。 /**** 本程序中,晶振为12MHz, ****/ /**** 时间控制采用定时中断控制方式。 ****/ /**** 模式和时间调整采用查询方式。 ****/ #include sbit P20=P2^0;//分个位控制端 sbit P21...

#includeunsigned char code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40};//0-9unsigned char time,sec=30,scanled;unsigned char disdat[6]={1,2,3,4,5,6};sbit keys=P1^0;sbit keyc=P1^1;sbit fmq=P3^0;void t1isr() ...

#include #define uint unsigned int #define uchar unsigned char sbit spk=P3^0; sbit k0=P3^2; sbit k1=P3^7; sbit k2=P3^6; sbit red1=P0^0; sbit yellow1=P0^1; sbit green1=P0^2; sbit red2=P0^3; sbit yellow2=P0^4; sbit green2=P0^5; u...

TH0 = 0xf6; //T0定时器初值 -2303 TL0 = 0xff; TH1 = 0xfd; //波特率9600 TL1 = 0xfd; TMOD = 0x21; //定时器0位模式1,定时器2位模式2 PCON = 0x00; //波特率不加倍 WDCON = 0x00; //清狗 SCON = 0x50; //串口0工作与模式1,启动接收 SCON1 = ...

#include"reg52.h" sbit Buzz = P1^6; sbit ADDR0 = P1^0; sbit ADDR1 = P1^1; sbit ADDR2 = P1^2; sbit ADDR3 = P1^3; sbit ENLED = P1^4; bit flagoff = 0; bit flagon = 1; bit Startinterval = 0; bit flag1s = 0; bit flag2s,flag3s,flag4s...

LED BIT P1.0 KEY BIT P1.4 SPEAKER BIT P1.7 LOWCNT EQU 30H ORG 0000H LJMP MAIN ORG 0030H MAIN: MOV LOWCNT,#0 LOOP: JB KEY,LOOP1 SETB LED JNB KEY,$ INC LOWCNT MOV A,LOWCNT CJNE A,#8,LOOP1 MOV LOWCNT,#0 LCALL FMQ SJMP LOOP LOOP1: ...

你的这个中断函数里面有个wihle(1).那么进入中断函数后,一直会在wihle(1)里面死循环。

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com