pic16f88 is not putting out

  • Nick

    Nick - 2011-10-18

    I am very new to sdcc, just loaded the newest snapshot on Arch Linux system, have it working with picprog as the programmer.   I put together the following test code.  Really simply, I intended to make RB1 go on and off periodically.   Sdcc is compiling to hex, the program is loading onto the PIC (I know this because clock pin RA6 is now I/O due to configuration), I am using regulated 5v supply…  Powered, the chip is showing low voltage at all PORTB pins.  So, what simple thing am I missing?  I wonder if it has something to do with the delay- as the internal clock of the PIC is configured to run at 31.25 kHz.  Might I have to change delay parameters, or is the problem something else entirely?  I appreciate any and all help, and thanks to all!  Here is the code:

    #include "pic16f88.h"

    __code char __at 0x2007 __CONFIG = _INTRC_IO; //Internal RC, RA6/7 I/O

    void delay(long ms)
    long i;

    while (ms-)
    for (i=0;i<330;i++);

    void main(void)

    TRISB = 0;

    for (;;)
    PORTB = 0x02;
    PORTB = 0x00;

  • Diego Herranz

    Diego Herranz - 2011-10-18

    Try with this:

    __code char __at 0x2007 __CONFIG = _INTRC_IO & _WDT_OFF; //Internal RC, RA6/7 I/O, WDT OFF

    WDT was enabled, so it could be resetting the PIC.

    Maybe you should configure every CONFIG bit (CONFIG1 and CONFIG2 words) because there might be more things like the WDT that could cause problems. Something like this (using the config bits you want):

    __code char __at 0x2007 __CONFIG1 = _INTRC_IO & _WDT_OFF & … & …;
    __code char __at 0x2008 __CONFIG2 = _IESO_OFF & _FCMEN_OFF;

    Let us know if it works now.

  • Diego Herranz

    Diego Herranz - 2011-10-18

    Anyway, I think that delay is too big. Try with delay(25) or even delay(2).


Log in to post a comment.