您好,今天小源来为大家解答以上的问题。停车场车辆数量统计系统相信很多小伙伴还不知道,现在让我们一起来看看吧!

1、#include "reg51.h" #define uchar unsigned char #define uint unsigned int uchar T0_count; uchar i; unsigned char light[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; void T0_int(void) interrupt 1 { TH0 = 0x4C; //重新装载,50MS定时器初值 TL0 = 0x00; T0_count++; if(T0_count==20) //1S到 { T0_count = 0; P1 = light[i]; i++; if (i>7) i = 0; } } main() { TMOD = 0x01;//定时器0,工作方式1,16位计数 TH0 = 0x4C; //50MS定时器初值 TL0 = 0x00; IE = 0x82; //开总中断,开T0中断 EA = 1; ET0 = 1; TR0 = 1; T0_count = 0; i = 0; loop: goto loop; }求采纳。

本文到这结束,希望上面文章对大家有所帮助。