啥情况 我对着师傅的一摸一样 就是错 把数组去掉就没问题了
#include<reg52.h>
typedef unsigned char u8;
typedef unsigned int u16;
sbit seg_sel=P1^5;
sbit bit_sel=P1^4;
#define DATA P0
u8 seg_tab[]={0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90}
void main(void){
P0=0Xff;
P1=0xff;
seg_sel=0;
bit_sel=0;
while(1){
bit_sel=1;
DATA=0x80;
bit_sel=0;
seg_sel=1;
DATA=seg_tab[1];
seg_sel=0;
}
}
错误
Build target '目标 1'
compiling 数码管3.c...
事牍?.c(10): error C141: syntax error near 'void'
事牍?.c(10): error C141: syntax error near '{'
事牍?.c(11): error C231: 'P0': redefinition
事牍?.c(11): error C231: 'P0': redefinition
事牍?.c(12): error C231: 'P1': redefinition
事牍?.c(12): error C231: 'P1': redefinition
事牍?.c(13): error C231: 'seg_sel': redefinition
事牍?.c(13): error C231: 'seg_sel': redefinition
事牍?.c(14): error C231: 'bit_sel': redefinition
事牍?.c(14): error C231: 'bit_sel': redefinition
事牍?.c(15): error C141: syntax error near 'while'
事牍?.c(15): error C141: syntax error near '1'
事牍?.c(16): error C279: 'bit_sel': multiple initialization
事牍?.c(16): error C231: 'bit_sel': redefinition
事牍?.c(16): error C231: 'bit_sel': redefinition
事牍?.c(17): error C279: 'P0': multiple initialization
事牍?.c(17): error C231: 'P0': redefinition
事牍?.c(17): error C231: 'P0': redefinition
事牍?.c(18): error C279: 'bit_sel': multiple initialization
事牍?.c(18): error C231: 'bit_sel': redefinition
事牍?.c(18): error C231: 'bit_sel': redefinition
事牍?.c(19): error C279: 'seg_sel': multiple initialization
事牍?.c(19): error C231: 'seg_sel': redefinition
事牍?.c(19): error C231: 'seg_sel': redefinition
事牍?.c(20): error C279: 'P0': multiple initialization
事牍?.c(20): error C231: 'P0': redefinition
事牍?.c(20): error C231: 'P0': redefinition
事牍?.c(21): error C279: 'seg_sel': multiple initialization
事牍?.c(21): error C231: 'seg_sel': redefinition
事牍?.c(21): error C231: 'seg_sel': redefinition
事牍?.c(22): error C141: syntax error near '}'
目标未创建
|