注册 登录
编程论坛 单片机编程

KILL C开发环境下,出现的错误

qq236533067 发布于 2011-06-01 11:10, 916 次点击
程序代码:
#include "common.h"
#include "seg7.h"
#include "int.h"
long x;
char y=0;
void isr_ex0(void)interrupt 0  //外部中断0
{
     y++;
     if(y%2!=0)
      (
        disp_u16(0);
        while(1);
    )
        

}
void isr_t0(void) interrupt 1         //定时器终端0
{
    static unsigned char counter = 0;
    counter++;//定时器0每次溢出,counter加1
    if (counter == 10)//每溢出10次(500ms)
    {
        x=x+1;
        counter = 0;//counter清零,计算下10次溢出
    }
    TH0 = (65536 - 50000) / 256;//设置TH0初值
    TL0 = (65536 - 50000) % 256;//设置TL0初值
}                              
void isr_ex1(void)interrupt 2      //外部中断
{}
void isr_t1(void)interrupt 3           //定时中断1
{   
    disp_u16((u16)x);
    disp_fresh();
    TH1=(65536-8333)/256;
    TL1=(65536-8333)%256;
}
void isr_serial(void)interrupt 4    //串行口中断
{}
错误:INT.C(11): error C141: syntax error near ';'
INT.C(13): error C141: syntax error near ')'所有程序打包上传了
只有本站会员才能查看附件,请 登录
2 回复
#2
软编小虫2011-06-07 22:59
我晕。。。。。
是你的INT.C文件中出错了。
INT.C中的isr_ex0()函数中的IF之下的语句本来是个复合语句,只能用“{ 。。。}”大括号,而非是“(。。。。)”中括号。
#3
samuelchen2011-06-12 20:42
TH定时为什么一定要用这种形式呢,
TH0 = (65536 - 50000) / 256;//设置TH0初值
TL0 = (65536 - 50000) % 256;//设置TL0初值
印象中定时方法有好多的。
1