用的PIC是PIC16F684,程序如下:
#include<pic.h>
#define uchar unsigned char
#define uint unsigned int
__CONFIG(0xF2C4);
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
void main()
{ OSCCON = 0x70;
uchar i;
TRISA=0x00;
TRISC=0x00;
while(1)
{
PORTA=0X3F;
PORTC=0X3F;
delay(200);
PORTA=0X00;
PORTC=0X00;
}
}
实现的功能是让其指定的LED闪烁。因为PORTA及C只有RA0-RA5,RC0-RC5,其中,RA3不能为输出。所以,全亮时PORTA=0x37,PORTC=0X3F.但是我在软件防真时,PORTA=0X38,portc=0x3c.
为什么?
不明白你说什么,PIC用MPLAB,不是用KEILC,再说赋值你那是二进制,我这是16进制,是一样,