本帖最后由 philzhao 于 2013-1-16 21:34 编辑
#include<pic.h>//16f877a
__CONFIG(0x1832);//晶体是11。0592
#define uint unsigned int
#define uchar unsigned char
uchar result;
uchar num;
void init()
{
TRISB=0xff;
TRISC=0x00;
PORTB=0xff;
PORTC=0x00;
OPTION_REG=0x07;
INTCON=0xa0;
TMR0=61;
}
void interrupt time0()
{
T0IF=0;
TMR0=61;
num++;
}
void delay()
{
while(num>=60)
{
num=0;
}
}
void main()
{
init();
while(1)
{
PORTC=0xff;
delay();
PORTC=0x00;
}
} |