#include "msp430x14x.h"
void Init(void);
interrupt [ADC_VECTOR]void ADC12(void);
unsigned int Result;
unsigned int Table[4][10] = { {0x040,0x0BC,0x138,0x1B4,0x230,0x2AC,0x328,0x3A4,0x420,0x49C},
{0x518,0x594,0x610,0x68C,0x708,0x784,0x800,0x87C,0x8F8,0x974},
{0x9F0,0xA6C,0xAE8,0xB64,0xBE0,0xC5C,0xC08,0xD54,0xDD0,0xE4C},
{0xEC8,0xF44,0xFC0,0xFFF}};
void main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
P4DIR = 0xFF;
P5DIR = 0xFF;
Init();
_EINT();
ADC12CTL0 |= ENC + ADC12SC;
while(1);
}
void Init(void)
{
P6SEL |= 0x01;
ADC12CTL0 &= ~ENC;
ADC12CTL0 = ADC12ON + SHT0_2 + REFON + REF2_5V;
ADC12CTL1 = SHP + CONSEQ_2;
ADC12MCTL0 = SREF_0;
ADC12IE |= BIT0;
}
interrupt[ADC_VECTOR]void ADC12(void)
{
unsigned char seg_7[10] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
unsigned char seg_8[10] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10};
unsigned int i,j;
ADC12CTL0 &= ~ENC;
for(i=0;i<4;i++)
{
for(i=0;i<10;i++)
{
if(ADC12MEM0 <= Table
[j])
goto xxx;
}
xxx:{P4OUT = seg_7[j];
p5OUT = seg_8;
}
ADC12CTL0 |= ENC + ADC12SC;
}
}
全部代码如上,
interrupt [ADC_VECTOR]void ADC12(void);
这行报错,Error[Pe077]: this declaration has no storage class or type specifier E:workspace 1main.c 45
到底是什么原因呢?
希望高手指教
此帖出自小平头技术问答
一周热门 更多>