problem with pic16f88

Discussion in 'Embedded Systems and Microcontrollers' started by emkaypic, May 11, 2013.

  1. emkaypic

    Thread Starter New Member

    May 11, 2013
    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.
    Code ( (Unknown Language)):
    2.     void main() {
    4.        ANSEL = 0;
    5.        TRISA = 0;          
    7.       do {
    8.         PORTA = 0x00;      
    9.         Delay_ms(1000);    
    10.         PORTA = 0xFF;      
    11.         Delay_ms(1000);    
    12.       } while(1);          
    13.     }
    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).
  2. upand_at_them

    Senior Member

    May 15, 2010
    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.
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    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.
  4. Ian Rogers

    Active Member

    Dec 12, 2012
    On the other forum you mentioned that you started on the pic16f877a... Sure this isn't still selected as the target?