PIC12F675引脚变化问题
#include <pic.h>#include<pic12f6x.h>
#include <math.h>
int i;
int x;
int y;
int mm;
intk0;
intk1;
intk2;
intk5;
main()
{
OSCCAL=0X40;
INTCON=0X00;
CMCON=0X00;
WPU=0X00;
IOCB=0X00;
TRISIO=0x08;
GPIO=0;
TMR0=0;
T0IF=0;
GIE=1;
T0IE=1;
OPTION=0x07;
k2=0;
GPIO1=1;
while(1)
{
}
}
void interrupt INTS()
{
di();
if(T0IF)TMR0INT();
ei();
}
TMR0INT()
{
k2=(~k2);
GPIO2=k2;
TMR0=0x00;
T0IF=0;
}
我本想让GPIO1为高电平的,但结果不是. 675 是带比较器和AD 的,因此如果要当作数字IO使用,必须关闭比较器和AD,COMCON = 0X07;ANSEL = 0
页:
[1]