Pic 12F675... No Blinky
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Pic 12F675... No Blinky

    I've been at this for hours. Please help.

    Running on Windows 7 Ultimate

    PBP 2.45, Microcode Studio Plus 2.1.0.7, MPLAB IDE 6.50, PICStart Plus

    Microcode is configured for PBP compiler, MPASM Assembler and PICStart Plus Programmer

    Everything seems happy. This has all worked before. I know it's me. :-P


    Define OSCCAL_1K 1 ' Calibrate internal oscillator

    LED Con 0 ' Alias GPIO.0 to LED

    ANSEL = 0 ' Set all digital
    CMCON = 7 ' Analog comparators off

    mainloop:
    Low LED ' Turn on LED connected to GPIO.0
    Pause 500 ' Delay for .5 seconds
    High LED ' Turn off LED connected to GPIO.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to mainloop and blink LED forever

    End
    I copied this code from the forum as well as trying several others. Nothing seems to work.

    From Microcode, I hit "Compile and Program". It opens MPLAB. I enable the programmer, wait, and hit the program button.
    MPLAB pops up a configuration warning:

    "Configuration Memory has not been updated. Press "Yes" to accept the current configuration or "No" to abort the operation.

    I don't know how to update the configuration so I've been hitting "yes".

    The PICStart "programming" light comes on and seems to program.

    Another Pop-up... "Calibration Memory Not Programmed"... "Calibration Memory is already programmed."

    I hit ok.

    "Programming/Verification completed successfully!"

    I pull the PIC and insert it into the breadboard.

    No joy.

    Breadboard:

    Vdd +5v
    Vss Common
    GPIO.3 (Pin 4) connected to +5 through 1k resistor
    GPIO.0 (Pin 7) connected to LED to 270 ohm resistor to common.

    LED orientation checked.

    I reinstalled all software using "Administrator". Everything seems ok. Where am I going wrong?

    Please help. THANK YOU!

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,606

    Default Re: Pic 12F675... No Blinky

    a pic pgm is incomplete if you ignore the config fuses for your chip
    90% of novice issues start there

    look here http://www.picbasic.co.uk/forum/content.php?r=256
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    Oct 2009
    Posts
    595

    Default Re: Pic 12F675... No Blinky

    Try adding the following at the start of the code to set the config up

    Code:
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
    You may have to comment out the config settings in the 12F675.INC file in the PBP directory

    Code:
    ;****************************************************************
    ;*  12F675.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2005 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 08/31/05                                        *
    ;*  Version   : 2.46a                                           *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M12F675.INC'	; PM header
            device  pic12F675, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 12F675, r = dec, w = -302
            INCLUDE "P12F675.INC"	; MPASM  Header
            ; __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST
    Last edited by Scampy; - 8th January 2019 at 01:35.

  4. #4
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Re: Pic 12F675... No Blinky

    Thank you for the replies. I'll make the changes and get back.

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  5. #5
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default Re: Pic 12F675... No Blinky

    GPIO.0 is also ICSPDAT. I'd try moving the LED to another pin like GP2 and adjust your code to suit. Don't try this on GPIO.1 as you need that for programming also.

    I don't think LED con 0 sets up GPIO.0 as the LED pin rather it gives you a constant number of 0. You can alias the GPIO pin but in the interests of simplicity GPIO.0 = 1 and conversely GPIO.0 = 0 should work.

    Good luck.

    Full disclosure: I'm not a very good programmer but it's just something I see.

  6. #6

    Default Re: Pic 12F675... No Blinky

    Try LED VAR GPIO.0. VAR and the full pin name always worked for me.

  7. #7
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Re: Pic 12F675... No Blinky

    Ok, this works...


    Define OSCCAL_1K 1 ' Calibrate internal oscillator

    LED Con 0 ' Alias GPIO.0 to LED

    ANSEL = 0 ' Set all digital
    CMCON = 7 ' Analog comparators off

    mainloop:
    Low LED ' Turn on LED connected to GPIO.0
    Pause 500 ' Delay for .5 seconds
    High LED ' Turn off LED connected to GPIO.0
    Pause 500 ' Delay for .5 seconds

    Goto mainloop ' Go back to mainloop and blink LED forever

    End

    I also used "LED Con 5" and "LED Con 2". All worked fine.

    I would like to know exactly what this line does: "Define OSCCAL_1K 1 ' Calibrate internal oscillator" The comment is saying that we are calibrating the internal oscillator. Are we calibrating it, or are we setting the speed of the internal oscillator to 1K? I've searched for answers but haven't produced any results yet. I'm just not familiar with this and would really like to know.

    I do not intend to use ICSP so not worried about that. Thank you for the help all... this gets me off the ground and puts some energy back into the project. I just could not figure out what of the many pieces of hardware, software and program, was holding me up.

    Thank you!

    Ross

  8. #8
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Re: Pic 12F675... No Blinky

    Quote Originally Posted by rossfree View Post

    "Define OSCCAL_1K 1 ' Calibrate internal oscillator" The comment is saying that we are calibrating the internal oscillator. Are we calibrating it, or are we setting the speed of the internal oscillator to 1K?
    Ok... I found reference to it in the PBP Manual. Never mind. :-P

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  9. #9
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default Re: Pic 12F675... No Blinky

    I'd like to see you change the toggle time and see if blink rate changes. I'm just curious.

  10. #10
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Re: Pic 12F675... No Blinky

    Yes, changing the pause statements to be longer or shorter does change the "blink" rate.

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

Similar Threads

  1. Replies: 3
    Last Post: - 15th April 2015, 04:58
  2. My first Blinky!
    By nomad in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th September 2007, 17:29
  3. inputs on 12F675 (or for that matter any PIC)
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th April 2007, 19:43
  4. PIC 12F675 RF use
    By cooksydesign in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd September 2006, 15:06
  5. Pic 12F675
    By sherm in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th March 2003, 13:04

Members who have read this thread : 23

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts