求助简单的51单片机端口问题
刚开始学数码管显示,为什么直接定义端口高低电平会出错?程序代码:
#include<stc15.h> #include<intrins.h> #include<gpio.h> #define uchar unsigned char #define uint unsigned int #include<Delay.c> uchar code SEG[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71,0x00}; uchar code scan_bit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; //λѡ£¬Î»¿ØÖÆÂ룬¿ØÖÆÄ3¸öêyÂë1üμÄááÃe uchar data Dis_buf[]={0,1,2,3,4,5,6,7}; //ÏÔê¾»o3åÇø void main() { P2^0=0; P2^1=0; uint i; gpio(); while(1) { for(i=0;i<8;i++) { P0=SEG[Dis_buf[i]]; Delayxms(100); } } }
错误信息如下:
test.c(14): error C141: syntax error near '='
test.c(15): error C141: syntax error near '='
test.c(16): error C141: syntax error near 'unsigned'
test.c(16): error C202: 'i': undefined identifier
test.c(20): error C202: 'i': undefined identifier
test.c(22): error C202: 'i': undefined identifier
我看到书上这样定义也行的啊