lmichals80
New Member
Hello everyone,
Being I am a newbie, and I have searched this and other forums without success, I will try posting in hopes to not get verbally abused too badly. I am having a problem intializing the PIC program I guess. I am running a simple LED flash program, but when I first give the PIC power, the program runs about 4-5 times as slow. if I pull out the Vdd wire from the breadboard and plug it back in the program runs at normal speed. I am assuming this is a config word issue or something with the POR but have tried different options with no results. (PWTE on and off with and without BOR on and off, MCLR on and bridging to the Vdd) with no luck. Here is my setup:
Power supply: DC regulated power supply or 9v battery, fed through an LM317T voltage regulator to produce 5V tested with a multimeter(I have also tested with a strait connection from the power supply set at 5V with the same results)
compiler: mikcroC
PIC Programmer: Microchip PICkit 2
PIC: 16f886
Settings:
clock 4mhz, HS osc on, WDT off, LVP off
Code:
void main(void){
osccon = 0x60;
ansel = 0;
trisb = 0x00;
portb = 0x00;
while (1) {
portb = 0xff;
delay_ms(500);
portb = 0x00;
delay_ms(500);
}
}
Initally I started with a function, but ruled that out as the cause. (it appears to be a totally different problem with putting delays in the function) I realize the format is bad, but it does function when I pull and replace the wire. Any help would be greatly appreciated!!!
Thanks,
Luke
Being I am a newbie, and I have searched this and other forums without success, I will try posting in hopes to not get verbally abused too badly. I am having a problem intializing the PIC program I guess. I am running a simple LED flash program, but when I first give the PIC power, the program runs about 4-5 times as slow. if I pull out the Vdd wire from the breadboard and plug it back in the program runs at normal speed. I am assuming this is a config word issue or something with the POR but have tried different options with no results. (PWTE on and off with and without BOR on and off, MCLR on and bridging to the Vdd) with no luck. Here is my setup:
Power supply: DC regulated power supply or 9v battery, fed through an LM317T voltage regulator to produce 5V tested with a multimeter(I have also tested with a strait connection from the power supply set at 5V with the same results)
compiler: mikcroC
PIC Programmer: Microchip PICkit 2
PIC: 16f886
Settings:
clock 4mhz, HS osc on, WDT off, LVP off
Code:
void main(void){
osccon = 0x60;
ansel = 0;
trisb = 0x00;
portb = 0x00;
while (1) {
portb = 0xff;
delay_ms(500);
portb = 0x00;
delay_ms(500);
}
}
Initally I started with a function, but ruled that out as the cause. (it appears to be a totally different problem with putting delays in the function) I realize the format is bad, but it does function when I pull and replace the wire. Any help would be greatly appreciated!!!
Thanks,
Luke