PIC单片机定时器1的使用方法
扫描二维码
随时随地手机看文章
#include #define uchar unsigned char void init() void interrupt time0()
#define uint unsigned int
__CONFIG(0x3B31);
void init();
uint intnum;
void main()
{
init();
while(1)
{
/*if(intnum==20)
{
intnum=0;
RD0=!RD0;
}*/
}
}
{
TRISD=0;
PORTD=0;
INTCON=0xc0;
PIE1=0x01;
TMR1L=(65536-50000)%256;
TMR1H=(65536-50000)/256;
T1CON=0x21;
}
{
TMR1IF=0;
TMR1L=(65536-50000)%256;
TMR1H=(65536-50000)/256;
RD0=!RD0;//intnum++;
}