You must turn off analog module and comparator.by adding this code we can turn off these module.
Adcon1=0x07;
Cmcon=0x07;
- - - Updated - - -
void main() {
Adcon1=0x07;
Cmcon=0x07;
TRISD=0x00; // TRISD OUTPUT
while(1){
portd=1;
delay_ms(500);
portd=0;
delay_ms(500); }
}
I don't know C very well but your code looks OK, my thoughts on this is what about the configuration word? You should ensure that the watchdog timer is off and you could also try HS mode instead of XT mode in the crystal configuration bits.
i use xt 4mhz crystal and i try long time and no solution.
the problem is. i make simple loop. on and off an led with 500ms delay . it work in simulation .
but in my circuit it's take about 10sec to flashing led. :?:
Hi,
The 16F877A does not have any internal oscillators, only external ones.
If the led is flashing very slowly with the crystal removed, its just by chance / random oscillations.
We need a FULL schematic to give a better diagnosis, the one provided doesn't even show the errant LED!
Brian.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?