Hello,
Im new to PIc programming and as a part of the interest to flash some projects onto pic's, I bought a PICkit2 programmer. So now Im trying to learn how to write programs on my own in Hi-tech C. Im using MPlab 8.53 and hi-tech PICC 9.7 modules and a PIC16F628A chip and the internal OSC. The problem I am facing is that I can flash my 16F628 well enough and blink my led's but it acts totally wierd.
The port A led's blink 2 times, then the port B blinks Twice and whole repeats..
However if I change the delay to _delay(1000), it doesnt blink at all.. and _delay_ms(100) gives unidetified errors.. how do I fix the delay problems??
Im new to PIc programming and as a part of the interest to flash some projects onto pic's, I bought a PICkit2 programmer. So now Im trying to learn how to write programs on my own in Hi-tech C. Im using MPlab 8.53 and hi-tech PICC 9.7 modules and a PIC16F628A chip and the internal OSC. The problem I am facing is that I can flash my 16F628 well enough and blink my led's but it acts totally wierd.
Rich (BB code):
#include <HTC.H>
#define _XTAL_FREQ 20000000
__CONFIG(INTIO & WDTDIS & PWRTDIS & BORDIS & LVPDIS );
void main()
{
TRISA=0;
TRISB=0;
unsigned char i=0;
while (1)
{
i=0;
while (i<2){
PORTA = 0xFF;
_delay(100000);
_delay(100000);
PORTA = 0x00;
_delay(100000);
_delay(100000);
i=i+1;
}
i=0;
while (i<2){
PORTB = 0xFF;
_delay(100000);
PORTB = 0x00;
_delay(100000);
i=i+1;
}
PORTB = 0x00;
}
}
However if I change the delay to _delay(1000), it doesnt blink at all.. and _delay_ms(100) gives unidetified errors.. how do I fix the delay problems??
Last edited: