Can't get the simplest of programs to run using internal osc and just toggling a pin


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    May 2011
    Posts
    42

    Default Can't get the simplest of programs to run using internal osc and just toggling a pin

    Here is the code. It will not toggle the pin. I have to be missing something painfully obvious. I am hoping somebody will spot it immediately and while making me feel dumb, save me another 17 days of head banging. It started on a circuit board but I have moved it to a breadboard with nothing but 2 "AA" batteries powering the PIC and checking the pins with a multi-meter. Thanks.

    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _IOSCFS_4MHZ & _CP_OFF & _PWRTE_OFF & _IOSCFS_4MHZ & _BOR_OFF

    #ENDCONFIG


    include "alldigital.pbp"
    trisio.5 = 0
    trisio.0 = 0

    DEFINE OSC 4
    do
    'serout2 gpio.5, 396, ["M"]
    high 0
    pause 1000
    low 0
    pause 1000
    loop
    end

  2. #2
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    Sorry. I should have put the PIC in. It is a 12HV615. I have Darrel's ALLDIGITAL file in the same folder as the project folder and everything compiles and acts normally. I have also tried more than one of the same PIC but don't have a different model 8 pin PIC to try.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    Hello,

    What pic chip are you using?

    You may have to set the oscon register to make the internal oscillator function.

    Also your "high 0" and "low 0" statements should be changed to High gpio.0 and Low gpio.0
    Last edited by mark_s; - 13th May 2014 at 22:43. Reason: wrong port

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    Ok, I see that the pic12hv614 has no oscon register and is done in the configuration

  5. #5
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    I have tried doing gpio.0 as well with no better result. This cut and paste is just the latest thing I have tried out of desperation. Not that it is right but I have numerous other programs that I just us "High 4" and it works. Thank you for your time in looking at this.

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    When you compile, does ALLDIGITAL suggest lines to be added to your code?

    Robert

  7. #7
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    No, it didn't. Nothing was out of the ordinary as far as I could tell. It didn't before I added the alldigital file to the folder but I did it anyway just in case. I am completely baffled.

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    See if this will work.

    Code:
    #CONFIG
     __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _IOSCFS_4MHZ & _CP_OFF & _PWRTE_OFF & _IOSCFS_4MHZ & _BOR_OFF
    
     #ENDCONFIG
    
    DEFINE OSC 4 ' keep above your code and registers settings
    Adcon0 = 0 'disable adc
    ANSEL = 0 'gpio all digital
    TRISIO = 0 'all outputs except gpio3
    
     
     do
     'serout2 gpio.5, 396, ["M"]
     high 0
     pause 1000
     low 0
     pause 1000
     loop
     end
    Yes, I forgot the High/Low 0 statements are from the old Basic Stamp days.

  9. #9
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    No dice. I have tried yet another PIC to make sure I didn't damage the last two and tried a different programmer in the event that was damaged (1 in a million, I know). My gut is that I am missing something oscillator related but cannot figure out what. Thanks for the look at what I have.

  10. #10
    Join Date
    Oct 2011
    Location
    East Coast USA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    Do you have !MCLR tied high? I see it disabled in the config, but it's worth a try.
    Last edited by xpa999; - 14th May 2014 at 17:04.

  11. #11
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Can't get the simplest of programs to run using internal osc and just toggling a

    I found an issue and correcting it seems to correct the issue. However, I am left a little confused as to what is going on. I am using MC Studio 5.0.0.5 with Melabs programmer v4.51 on a computer running Windows 8.1. Everything appears to program fine but the PIC doesn't work. I tried using my netbook which I typically only use when on a job site to compile and program the same code and it works fine (MC studio 5.0.0.0 and programmer 4.32 and Windows 7 starter). I don't know if it is MC studio that is causing the problem or the programmer software but there appears to be some issue. Unfortunately, I don't have time to look into it right now because I am a day and a half behind because of this issue. Thank you all for your help.

Similar Threads

  1. Programs and Verifies, but won't run
    By rsfutch in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th July 2013, 18:46
  2. PIC programs, resonator resonates, but does not run code.
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th August 2012, 01:47
  3. PULSOUT versus toggling a pin
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th January 2010, 15:59
  4. Internal OSC, how to?
    By PICante in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 7th January 2008, 00:03
  5. Internal Osc help
    By BobK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th January 2007, 20:50

Members who have read this thread : 1

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