本人今年四十有四,初学51,照着书本编写了几段程序,可是在keil中老师提示错误,请大神帮忙看看,到底错哪了?
#include<reg52.h>sfr P0M0=0X93;sfr P0M1=0X94;sfr P1M0=0X91;sfr P1M1=0X92;sfr P2M0=0X95;sfr P2M1=0X96;sfr P3M0=0Xb1;sfr P3M1=0Xb2;const unsigned charsg7[16](0x3f,0x06,ox5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71);void ms_delay(unsigned int t){ unsigned int i; for(t;t>0;t--) for(i=100;i>0;i--);} main(){int mun=0;P0M0=0xff;P0M1=0xff; whil(1){P0=seg7(mun);ms_delay(1000);mun++;if(mun>15);mun=0;}}第二个
#include<reg52.h>sfr P0M0=0X93;sfr P0M1=0X94;sfr P1M0=0X91;sfr P1M1=0X92;sfr P2M0=0X95;sfr P2M1=0X96;sfr P3M0=0Xb1;sfr P3M1=0Xb2;define p2 0xff ; void ms_delay(unsigned int t){ unsigned int i; for(t;t>0;t--) for(i=100;i>0;i--) ; } main(){ int mun; P1M1=0x00 ; P1M0=0X00 ; while(1) { switch(mun) { case 0: p2=0xff; break; case 1: p2=0xfe; break; case 2: p2=0xfd; break; case 3: p2=0xfc; break; case 4: p2=0xfb; break; case 5: p2=0xfa; break; case 6: p2=0xf9; break; case 7: p2=0xf8; break; default: p2=0xff; } ms_delay(500); mun++; if(mun>4) mun=0; }
}
还请大神不吝赐教,谢谢。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>