Stupid question


Closed Thread
Results 1 to 16 of 16

Thread: Stupid question

  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
    3,838


    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

    Did you by chance get a new machine with Vista?

    http://www.picbasic.co.uk/forum/show...ighlight=vista
    is an interesting thread.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Post Code Brackets

    Hi Gary,
    Quote Originally Posted by Meriachee View Post
    (Also, this forum changes Caps. Makes the code look like the variables are whacked....)
    Quote Originally Posted by mackrackit View Post
    If it is there then this is a good reason to use the CODE brackets and post your whole code.
    To use the “Code Brackets” see the “vB code” Hot button in the “Posting Rules” box at the bottom left of the screen while you are posting.

    It puts the code in the special box that protects the format better that the normal forum posting does...
    Hope that helps,
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

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


    Did you find this post helpful? Yes | No

    Default

    Dave,

    No, it's a relatively brain-ded Dell with XP. That's enough fun for one day I am not surprised that Vista is a whole new can of worms. It probably explains why people just get fed up and go cut the lawn or something.....

    Code brackets. Who knew. (Fortunately for me, I've completely accepted that information going in one side causes something equal in size to leak out the other side - I'm ok with vBulletin changing the case, although it makes it look like PBPro doesn't see the variable.)

    Gary

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


    Did you find this post helpful? Yes | No

    Default

    Ok, I'm going to cut the grass. ( and maybe find an all new and interesting use for the clippings!)

    So, Dave, I built EXACTLY the test code you posted. No more, no less. Using the following:
    MCS 2.3.0
    PBPro 2.47
    MPASM 5.03
    Epic Plus

    Code:
    DEFINE OSC 4
    
    ANSEL=%00000000
    CMCON=7
    
    LOOP:
    
    HIGH GPIO.2
    PAUSE 100
    LOW GPIO.2
    PAUSE 100
    
    GOTO LOOP
    No errors, no warnings. Device programs just fine. Led blinks more or less where and when it should on the programmer. Splash returns with "fat dumb and happy". Insert the chip into the proto board socket, power it up, no run. Verified, tested each and every power feed, ground, led operation, 5v across the chip just as it should be.
    As my boss would say, and with appologies to anybody, wtf.

  11. #11
    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.

  12. #12
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Meriachee View Post
    Ok, I'm going to cut the grass. ( and maybe find an all new and interesting use for the clippings!)

    So, Dave, I built EXACTLY the test code you posted. No more, no less. Using the following:
    MCS 2.3.0
    PBPro 2.47
    MPASM 5.03
    Epic Plus

    Code:
    DEFINE OSC 4
    
    ANSEL=%00000000
    CMCON=7
    
    LOOP:
    
    HIGH GPIO.2
    PAUSE 100
    LOW GPIO.2
    PAUSE 100
    
    GOTO LOOP
    No errors, no warnings. Device programs just fine. Led blinks more or less where and when it should on the programmer. Splash returns with "fat dumb and happy". Insert the chip into the proto board socket, power it up, no run. Verified, tested each and every power feed, ground, led operation, 5v across the chip just as it should be.
    As my boss would say, and with appologies to anybody, wtf.
    Hi Meriachee,
    Go back and re read post 3, from mister_e, Unless you have set the config fuses in code or manualy at program time it will program without them but not run.
    JS
    oh BTW
    The only question which is stupid is the one you are too timid to ask, because it goes unanswered.
    Last edited by Archangel; - 17th July 2007 at 20:42.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  13. #13
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Before you program the PIC, try setting config manually. I.E. select intrc osc,
    and mclr off. Then click the save button, and try programming it. Does it
    work?

    Is there a check mark next to 'Update Configuration From File' & 'Reread File
    Before Programming' under the Options menu?

    This forces the programmer software to reload the new .hex file before
    programming and use the config settings embedded in the .hex file.

    Unless you have a bad PIC, that's all I can imagine that would cause this.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    The nagging possibility that there was a hardware error was never far from me during this line of questioning, and once again, the blasted hardware was at fault.

    Installed the same services on another machine, watched the same routine do more or less the same things, plug the same chip into the socket and lit 'er up. Watching leds blinky blink. (just like they should)

    Thank you to all who responded to my questions, appologies that there never really was anything PIC related at fault. (It's ALWAYS something stuipd)

    Gary

  15. #15
    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
    Thank you to all who responded to my questions, appologies that there never really was anything PIC related at fault. (It's ALWAYS something stuipd)
    I am sure something like this has happened to all of us. I know it has happened to me more than once.
    Dave
    Always wear safety glasses while programming.

  16. #16
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    It happens a lot less to me since I bought some new proto boards!
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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