Stupid question


Closed Thread
Results 1 to 16 of 16

Thread: Stupid question

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52

    Default Stupid question

    Hi folks,

    I've got a 12f675 with a very simple piece of code to flash 2 leds. It won't start. THere's power, it programs fine and everything appears to be fine - except.

    Do I need to put some kind of define at the top to tell it specifically to not use MCLR?
    This is what I've got at the top:

    @ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

    CMCON = 7
    ANSEL = 0

    The compile fails at the define.

    It's something dumb, it always is......
    Gary

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    May be it is the space at the prot ect_off

    Ioannis

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    What error message do you have?
    Warning[207]: Found label after column 1. (device)
    Error[122] : Illegal opcode (pic12F675)
    if so, you need to change your syntax to use MPASM one.

    this should be something like..
    Code:
        @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    Further reference : http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default stupid question continued

    No errors when compiling. It looks as if the chip isn't starting. Help? (Also, this forum changes Caps. Makes the code look like the variables are whacked....

    @ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

    'Output variables and port assignment.
    Output GPIO.1
    Led1 var GPIO.1
    low led1

    output GPIO.2
    Led2 var GPIO.2
    low led2

    pause 50

    loop:
    high led1
    pause 500
    low led1
    pause 100
    high led2
    pause 500
    low led2
    pause 100

    goto loop

    end

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    To each their own, but I have better luck modifying the *.inc file for the configs.

    One thing I do not see is "DEFINE OSC 4" at the top of your code. If it is there then this is a good reason to use the CODE brackets and post your whole code.

    Try this
    Code:
    DEFINE OSC 4
    
    ANSEL=%00000000
    CMCON=7
    
    LOOP:
    
    HIGH GPIO.2
    PAUSE 100
    LOW GPIO.2
    PAUSE 100
    
    GOTO LOOP
    When you have a problem like this go basic.. no variables, one piece of hardware and so on.

    This is my 12F675.inc set up
    Code:
     NOLIST
        ifdef PM_USED
            LIST
            include 'M12F675.INC'	; PM header
            device  pic12F675, intrc_osc, wdt_on, pwrt_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 & _PWRTE_ON & _MCLRE_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    Are you using PM or MPASM?
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Dave,

    I have tried both assemblers. I had things working just fine on another PC, and since I've re-installed, nothing seems to work, even opening any of the other files for completed projects. When I put in lines like:
    device pic12F675, intrc_osc, wdt_on, pwrt_on, mclr_on, protect_off
    I get errors, "cannot overwrite" and other strange things, like it doesn't like the comma or the space. I will try your suggestion this evening and see where that leads.

    Gary

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Meriachee View Post
    Hi folks,

    I've got a 12f675 with a very simple piece of code to flash 2 leds. It won't start. THere's power, it programs fine and everything appears to be fine - except.

    Do I need to put some kind of define at the top to tell it specifically to not use MCLR?
    This is what I've got at the top:

    @ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

    CMCON = 7
    ANSEL = 0

    The compile fails at the define.

    It's something dumb, it always is......
    Gary
    At least it compiles now.

    Awhile back someone had a similar problem. After 40 post the problem was solved - bad port on computer. http://www.picbasic.co.uk/forum/showthread.php?t=6160

    Being that everything worked on one machine but not another and the simple test did not work, I think I would now look at the machine.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Stupid simple question.....
    By chien_fu in forum mel PIC BASIC
    Replies: 18
    Last Post: - 23rd February 2010, 13:21
  2. Replies: 2
    Last Post: - 7th October 2009, 00:06
  3. Stupid question about LCDOUT
    By Glenn in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 7th October 2008, 21:37
  4. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  5. Stupid array question
    By RUBiksCUbe in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 4th September 2006, 16:03

Members who have read this thread : 0

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