英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 16520|回复: 1
打印 上一主题 下一主题

c编译器的问题!

[复制链接]
跳转到指定楼层
1#
发表于 2009-4-18 14:33:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用的是mplab ide 6.60+HT-PIC v8.01PL3 我编了个简单的time0定时中断程序,但是中断服务程序怎么无法进行编译,就是中断服务程序无法生成汇编代码。我用HT-PIC v8.01PL3 自带的timer0.c例子也不行。

#include <pic.h>

/*
* Example code for using timer0 on a 17C756
* Just sets up a 1 second interrupt and increments a variable
*/

/*
* Calculate preload value for one second timer
*/

#define PERIOD 1000000  // period in uS - one second here
#define XTAL 4000000  // crystal frequency - 4MHz
#define ICLK (XTAL/4) // crystal is divided by four
#define SCALE 16  // prescale by 16 - check for overflow!

#define PRELOAD PERIOD*ICLK/SCALE/1000000

unsigned long seconds; // second count

/* service routine for timer 0 interrupt */

void interrupt
timer0_isr(void) @ 0x10
{
seconds++;
TMR0 += -PRELOAD; // re-load timer

// no need to clear T0IF - the hardware did it
}

main()
{
// initialize timer 0;

T0STA = 0b01000;  // prescale by 16
T0CS = 1;   // select internal clock
TMR0 = -PRELOAD; // preload timer
T0IE = 1;   // enable timer interrupt
GLINTD = 0;   // enable global interrupts

for(;;)
  continue;  // let interrupt do its job
}
2#
 楼主| 发表于 2009-4-18 14:33:21 | 只看该作者
可以
config ---〉select device 17c756

或 #include"pic177xx.h"
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-5-2 11:15 , Processed in 0.051991 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表