problem with pic16f88

Thread Starter

emkaypic

Joined May 11, 2013
1
Hey guys, i have been having a problem with my PIC16F88. since i am new to programming micro-controllers, i wanted to start with a simple led blinking program. i wrote the following code inside mikroc and built it.
Rich (BB code):
    void main() {
        
       ANSEL = 0;
       TRISA = 0;          
       
      do {
        PORTA = 0x00;       
        Delay_ms(1000);    
        PORTA = 0xFF;       
        Delay_ms(1000);    
      } while(1);          
    }
I programmed the device using pickit 3 and it works fine. But when i connect an LED (with resistor) to any of PORTA pins, rather than blinking, the led stays on. The funny part is, even PORTB turns the LED on(was supposed to be floating).
I wonder if there is a specific issue that makes all the ports high(think this is what is happening).
 

upand_at_them

Joined May 15, 2010
940
Where are your configuration (fuse) bits? You don't specify what oscillator you are using. This could be throwing off the delay calculations.

Also, don't leave port pins floating. If they're inputs they should be tied high or low.
 

ErnieM

Joined Apr 24, 2011
8,377
Something is way off. Make a schematic, and triple check it is what you are actually doing.

If you still think you wiring matches your schematic, post it here and we'll look.
 
Top