啥情況 我對著師傅的一摸一樣 就是錯 把數(shù)組去掉就沒問題了
#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 數(shù)碼管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 '}'
目標未創(chuàng)建
|