Menu

SDCC PIC16F877 NOT BLINK LED

Help
2009-03-06
2013-03-12
  • Ronan CIMADURE

    Ronan CIMADURE - 2009-03-06

    Hi my message is so simple .

    I develop a app with sdcc (sept 29 2008) and test the result on GPSIM .
    I use PIKLAB IDE 0.15.3
    But when I program , NOTHING

    So I try to verify my pic , with a hello word . But .. it didn't work
    I use a .hex on the net , and the led blink , so the problem is not my pic , my JDM serial programmer, ..or my led

    //THE CODE
    #include <pic16f877.h>

    void delay_ms(long ms)
    {
        long i;
        while (ms--)
            for (i=0; i < 330; i++)
                ;
    }

    void main()
    {
    TRISA = 0x00;
    while(1)
        {
            RA0 = 0;
            RA1 = 0;
            delay_ms(250);
            RA0 = 0;
            RA1 = 0;
            delay_ms(250);
        }
    }

    THK before .

     
    • kein0r

      kein0r - 2009-03-06

      not 100% sure but, the A Port on your device is used together with the ADC. See the adc section in the datasheet how to initialize the port for digital output. On some devices this can also be set in configuration registers so double check them also.

       
      • kein0r

        kein0r - 2009-03-06

        and check the watchdog configuration in config regs

         
    • Raphael Neider

      Raphael Neider - 2009-03-06

      As we all know, blinky traditionally sets some pin *low* (RAn = 0), waits a bit (delay_ms), sets the same pin(s) *low* (RAn = 0) again, and waits again (delay_ms) ...

      Try assigning RA0 = 1; RA1 = 1; the second time through!

      Good luck,
      Raphael

      PS: The hint about initialization of ADC and config bits is still valid.

       
    • Ronan CIMADURE

      Ronan CIMADURE - 2009-03-06

      Thank I will check that

      there is an error in the code , yes the the second time , RA1 and RA0 are =1

      this is the simple test, in the real , I put ALL PORTS on output TRISA to TRISD , and   toggle PORTA to PORTD , 

      I ll check the watchdog

      thk

       
    • Ronan CIMADURE

      Ronan CIMADURE - 2009-03-10

      Heyyyyy ,  thank for the help now I can test my tach :-)
      I just have to configure the __CONFIGure BITS ( _WDT_OFF )
      Vive SDCC

       

Log in to post a comment.