pic16f684的定时中断问题
时间:10-02
整理:3721RD
点击:
想请教下,我写的定时中断哪里有问题,为什么程序写到板子上没有现象。求大神帮忙看下,很着急。谢谢!
程序为:#include<pic.h>
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0x3B21);
void init();
uint intnum;
void main()
{
init();
while(1);
}
void init()
{
TRISC=0x00;//设置C为输出口
PORTC=0x00;
INTCON=0xC0;
PIE1=0x01;
TMR1L=(65536-50000)%256;
TMR1H=(65536-50000)/256;
T1CON=0x01;
}
void interrupt time1()
{
TMR1IF=0;
TMR1L=(65536-50000)%256;//设置初始值
TMR1H=(65536-50000)/256;
//RC3=1;
RC3=!RC3;//intnum++;//将io口取反
}
程序为:#include<pic.h>
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0x3B21);
void init();
uint intnum;
void main()
{
init();
while(1);
}
void init()
{
TRISC=0x00;//设置C为输出口
PORTC=0x00;
INTCON=0xC0;
PIE1=0x01;
TMR1L=(65536-50000)%256;
TMR1H=(65536-50000)/256;
T1CON=0x01;
}
void interrupt time1()
{
TMR1IF=0;
TMR1L=(65536-50000)%256;//设置初始值
TMR1H=(65536-50000)/256;
//RC3=1;
RC3=!RC3;//intnum++;//将io口取反
}
已退回1积分