#include "msp430F249.h"
#define uchar unsigned char
#define uint unsigned int
#define NUM 16;
long data;
uint new_cap=0;
uint old_cap=0;
uint N1=0;
char tab[]={0xc0,0xf9,0xA4,0XB0,0X99,0X92,0X82,0XF8,0X80,
0X90,0X88,0X83,0XC6,0XA1,0X86,0X8E,0xff};//共阳极数码管
char position[]={0x20,0x10,0x08,0x04,0x02,0x01};
char diff_buf[]={0,0,0,0,0,0};
long diff[16];
char index=0;
void data_to_buf(long data1)
{
char i;
for(i=0;i<6;i++)
{
diff_buf
=data1%10;
data1=data1/10;
}
}
void disp(void)
{
uint i,k;
for(i=0;i<6;i++)
{
P4OUT=tab[data_to_buf];
P5OUT=position;
if(i==3)
P4OUT&=0X7F;
for(k=0;k<600;k++);
P5OUT=0X00;
}
}
void main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
char k1;
BCSCTL2|=SELS;
BCSCTL2=DIVS0+DIVS1;
P1DIR|=0XFD;
P1SEL|=0X02;
P4DIR=0XFF;
TACCTL0=CM_1+CAP+CCIS_0+CCIE;
TACTL=TASSEL_2+MC_2+TAIE;
_EINT();
while(1)
{
if(index==0)
{
data=0;
for(k1=0;k1<16;k1++)
data+=diff[k1];
data=data/NUM;
}
data_to_buf(data);
disp();
}
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A0(void)
{
new_cap=TACCR0;
diff[index]=65535*N1+new_cap-old_cap;
index++;
if(index==16) index=0;
old_cap=new_cap;
N1=0;
}
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A1(void)
{
switch(TAIV)
{
case 2:
break;
case 4:
break;
case 10:
N1++;
}
}
报错
Error[Pe852]: expression must be a pointer to a complete object type E:IAR for msp430 imerAcatchtimerAmain.c 30
求助各位大神,实在是不知怎么改
此帖出自小平头技术问答
一周热门 更多>