在protues仿真中数码管不能正确显示,请帮我看看有什么错误,
#include<reg52.h>#defineuintunsignedint#defineucharunsignedcharsbitP20=P3^0;sbitP21=P...
#include <reg52.h>#define uint unsigned int#define uchar unsigned charsbit P20=P3^0;sbit P21=P3^1;sbit P22=P3^2;sbit P23=P3^3;uchar count;uchar countq,countb,counts,countg;const uchar tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,}; /*显示0~9*/void delay(){ uint i,j; for(i=0;i<256;i++) for(j=0;j<256;j++);}void int0() interrupt 0 using 1{ count++; if (count==10000) count=9999; }void int1() interrupt 2 using 2{ if (count!=0000) {count--;} }void main(void){ IT0=1; IT1=1; EX0=1; EX1=1; EA=1; PX1=1; while(1) { countq=count/1000; countb=count%1000/100; counts=count%100/10; countg=count%10; P1=tab[countq]; P23=1; delay(); P23=0; P1=tab[countb]; P22=1; delay(); P22=0; P1=tab[counts]; P21=1; delay(); P21=0; P1=tab[countg]; P20=1; delay(); P20=0; }}
急,能帮帮我吗 展开
急,能帮帮我吗 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询