MCLR RESET on a PIC24HJ128GP502


+ Reply to Thread
Page 1 of 4 123 ... LastLast
Results 1 to 15 of 52

Thread: MCLR RESET on a PIC24HJ128GP5022201 days old

  1. #1
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default MCLR RESET on a PIC24HJ128GP502

    For the past couple of days Iíve been working on getting a PIC24HJ128GP502 up and going. I want to use this PIC for the 12 bit ADC.

    After struggling through the fuse configurations, oscillator settings, Vcap, pull-up on MCCLR, etc., I have it blinking a LED and timing correctly using the internal RC oscillator.

    I want to use the MCLR pin in my application to re-start the program. But try as I might I canít find a way to get it to work. My search of the data sheet etc. has not turned up any procedure for enabling or disabling MCLR.

    Could this be an anomaly in the 24 compiler?

    Any suggestions would be greatly appreciated.

    Thanks,
    Dennis


    DEVICE = 24HJ128GP502

    CONFIG FBS = BWRP_WRPROTECT_OFF, BSS_SMALL_FLASH_STD, RBS_SMALL_BOOT_RAM
    CONFIG FSS = SWRP_WRPROTECT_OFF, SSS_STRD_LARGE_SEC_CODE, RSS_SMALL_SEC_RAM
    CONFIG FGS = GWRP_OFF, GSS_OFF
    CONFIG FOSCSEL = FNOSC_FRC, IESO_OFF
    CONFIG FOSC = POSCMD_NONE, OSCIOFNC_OFF, IOL1WAY_OFF, FCKSM_CSDCMD
    CONFIG FWDT = WDTPOST_PS1, WDTPRE_PR32, WINDIS_OFF, FWDTEN_OFF
    CONFIG FPOR = FPWRT_PWR1, ALTI2C_OFF
    CONFIG FICD = ICS_PGD1, JTAGEN_OFF

    DECLARE XTAL = 8

    DIM Led AS PORTB.7
    DIM i AS BYTE

    Start:

    FOR i = 1 TO 1000
    HIGH Led
    DELAYMS 500
    LOW Led
    DELAYMS 500
    NEXT

    END

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,465
    Thumbs Up
    Received: 305
    Given: 145
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    The PIC24H series devices have an internal 7.37MHz oscillator, so declaring the Xtal as 8MHz is going to make timings incorrect.

    I always use this configuration if not implementing the PLL to boost the frequency, and I guarantee that bringing the MCLR pin to ground will reset the device:

    Code:
        Device = 24HJ128GP502
        Declare Xtal = 7.37
    
        Config FBS = BWRP_WRPROTECT_OFF, BSS_NO_FLASH, BSS_NO_BOOT_CODE
        Config FSS = SWRP_WRPROTECT_OFF, SSS_NO_FLASH, RSS_NO_SEC_RAM
        Config FGS = GWRP_OFF, GCP_OFF
        Config FOSCSEL = FNOSC_FRC, IESO_OFF
        Config FOSC = POSCMD_NONE, OSCIOFNC_ON, IOL1WAY_OFF, FCKSM_CSDCMD
        Config FWDT = WDTPOST_PS256, WINDIS_OFF, FWDTEN_OFF
        Config FPOR = FPWRT_PWR128, ALTI2C_OFF
        Config FICD = ICS_PGD1, JTAGEN_OFF

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by Les View Post
    The PIC24H series devices have an internal 7.37MHz oscillator, so declaring the Xtal as 8MHz is going to make timings incorrect.

    I always use this configuration if not implementing the PLL to boost the frequency, and I guarantee that bringing the MCLR pin to ground will reset the device:

    Code:
        Device = 24HJ128GP502
        Declare Xtal = 7.37
    
        Config FBS = BWRP_WRPROTECT_OFF, BSS_NO_FLASH, BSS_NO_BOOT_CODE
        Config FSS = SWRP_WRPROTECT_OFF, SSS_NO_FLASH, RSS_NO_SEC_RAM
        Config FGS = GWRP_OFF, GCP_OFF
        Config FOSCSEL = FNOSC_FRC, IESO_OFF
        Config FOSC = POSCMD_NONE, OSCIOFNC_ON, IOL1WAY_OFF, FCKSM_CSDCMD
        Config FWDT = WDTPOST_PS256, WINDIS_OFF, FWDTEN_OFF
        Config FPOR = FPWRT_PWR128, ALTI2C_OFF
        Config FICD = ICS_PGD1, JTAGEN_OFF


    Les,

    As instructed I copied and pasted your code and still no success. Your code programmed faster which is probably due to having the flash and boot options turned off.

    I can achieve a reset using an extra pin and a "goto" the following ASM Subroutine I found on the Forum:

    @ goto 0

    I will continue to search for a solution.

    There may be something in my circuit causing the problem. I'm using a 9 Volt power supply (ultimately 12 V on the vehicle) regulated to 5.1 Volts by a 7805 because I will be using a 5 Volt accelerometer and a 5 Volt, 4 digit, 7 segment display driven by transistors connected to pins on the PIC. I then use a voltage divider to reduce the regulated 5.1 Volts down to 3.3 Volts for the PIC and another divider to reduce the (potential of) 5.1 Volts to 3.5 Volts from the output on the accelerometer to the ADC module on the PIC.

    The end result of my project will be an instrument to measure the "G" force of acceleration and bracking of a vehicle. The brevity of the code presented is just for testing a few modules on the PIC and compiler before I prototype the project. I have this running on a PIC16F887 but want higher resolution and better math opportunities.

    FYI: I also noticed that the Fuse Configurator MK2 for this PIC has an extra fuse "GCP" which shows up twice and "GSS" which is applicable but shows up twice - I also noticed in your code that you used "BSS" twice.

    Thanks,
    Dennis
    Last edited by myeeplacee; 19th January 2014 at 20:21.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by myeeplacee View Post
    Les,

    FYI: I also noticed that the Fuse Configurator MK2 for this PIC has an extra fuse "GCP" which shows up twice and "GSS" which is applicable but shows up twice - I also noticed in your code that you used "BSS" twice.
    This statement is based on my study of Pages 274-276 of Data sheet DS70293G

    I am new at this and have been known to be wrong and/or misinformed in the past, so please help me better understand areas where I am misinformed.

    Thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,377
    Thumbs Up
    Received: 48
    Given: 39
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    You say you use a potential divider to get the 3.3V for the PIC. This worries me a little, how are you stopping load variations from the PIC dragging your 3.3 V down?

    Charlie

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Charlie,

    The circuit appears to be the issue, not the program and you may have hit the nail on the head relative to voltage variations.

    FYI: I am a 72 year old, 2nd year high school drop out retiree (Printer by trade, like Ben Franklin) and decided to self-educate myself in electronics beginning about this time last year. (Got a lot of time on my hands and enjoy a challenge) At that time I didn't have a clue about electronics. I discovered the world of PICs about 6 months ago. My previous programming experience was in the late '70s/early '80s working with a basic interpreter running MS DOS (way before Windows) on a mini computer with a 80MB, 5 disc array hard drive (about the size of a LP sterio record) and 14k of RAM. Nothing since then till now. I have a lot to learn and a long journey ahead of me. The 16Fs have been rather forgiving of my mistakes but the 24s are a bit more finicky.

    My attempt with the voltage divider was to choose a resistor combination that would allow for the maximum amp draw of the circuit and give me something in the area of 3.3 to 3.5 volts. I do see variation in the voltage. At times it drops as low as 2.9V. The MCLR pin is now functioning but a new issue has developed. While running my final program in a loop and blinking a LED the circuit will hang up then start again on its own. Momentarily grounding the MCLR pin will restart the program and it will run for a minute or so and hang again. My thinking at this time is that the internal oscillator is dropping out and re-starting. Perhaps being caused by the fluctuating voltage and/or incorrect Vcap capacitor. I need both 5V and 3.3V in my project, any suggestions on how to achieve this would be appreciated.

    A couple of things that are probably contributing to the problem:
    1.) I do not have the correct value/type of capacitor for the Vcap pin so I subbed for that, correct ones are on order.
    2.) My debugging is being done on breadboard which is sure to have a lot of stray capacitance in the jumper wires and poor connections, etc.

    I am open to any and all comments and suggestions which would be appreciated.

    Thanks,
    Dennis
    Last edited by myeeplacee; 20th January 2014 at 13:30.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by myeeplacee View Post

    The circuit appears to be the issue, not the program and you may have hit the nail on the head relative to voltage variations.
    MY BAD! ! !

    In my final program, which I have been debugging, I am using one of the pins to branch to another section of program if the pin is HIGH. On my breadboard I failed to add a pull down resistor to this pin and the GOTO statement was randomly sending the program to a branch that has no components attached. This had the appearance of the program hanging up.

    Upon adding a 5.1k resistor to pull down this pin the hang-up problem was solved and everything now appears to be OK to proceed to a prototype.

    As to the 3.3V, I am still open to suggestions for a better way to achieve my objective of a dual Vdd voltage of 3.3 and 5.0 because when I add the display things may go south again.

    Many Thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Les,

    Your guarantee that your fuses would work was absolutely correct.

    If you have been following my narrative you are aware that all of my problems have been related to taking shortcuts with my circuit.

    Lessons I hopefully learned:
    1.) Read the data sheet.
    2.) No short cuts.
    3.) Don't jump to the Forum too quickly unless you enjoy eating CROW.

    Many thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,377
    Thumbs Up
    Received: 48
    Given: 39
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Hi Dennis

    Glad you are making progress; we've all been there (and some of us keep on going there time after time....). I suggest you get a 3.3V regulator and drive that from your 9V. It is tempting to try and run a 3.3V regulator from 5V but it doesn't seem so easy - the minimum input voltage is normally above 5V.

    I used to work on a mainframe (ICL 1904A) with 8MB multi-platter discs, how things have changed. I would chew the fat longer but I'm at work and things are pretty busy.

    Charlie

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    831
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    966.48 MB

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by charliecoultas View Post
    Hi Dennis

    Glad you are making progress; we've all been there (and some of us keep on going there time after time....). I suggest you get a 3.3V regulator and drive that from your 9V. It is tempting to try and run a 3.3V regulator from 5V but it doesn't seem so easy - the minimum input voltage is normally above 5V.
    Charlie
    I don't think there is any need to have 9V to get a regulated 3.3V out, there are many low dropout regulators that will work with only marginally more than the 3.3V.

    5V is handy as an input since it is widely available on phone chargers and USB on computers. I don't know what your power requirements are but I often use an MCP1703 (250mA) which is a nice regulator.

    Also there are quite a few displays now that run on 3.3V and going with one of those would save the hassle of having different voltage levels.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Member Alan R.'s Avatar
    Join Date
    Jan 2005
    Posts
    376
    Thumbs Up
    Received: 4
    Given: 5
    Total Downloaded
    330.57 MB

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    An MCP1703 is an excellent choice here since it can be used in the final 12V version:
    • Input Operating Voltage Range: 2.7V to16.0V

    Also the Dropout Voltage is low enough that you will get 3.3V with as little as about 4Volts input:
    • Low Dropout Voltage, 625 mV typical @ 250 mA

    I use these all the time at work for small sensor/microcontroller test boards.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by SimonJA View Post
    I don't think there is any need to have 9V to get a regulated 3.3V out, there are many low dropout regulators that will work with only marginally more than the 3.3V.

    5V is handy as an input since it is widely available on phone chargers and USB on computers. I don't know what your power requirements are but I often use an MCP1703 (250mA) which is a nice regulator.

    Also there are quite a few displays now that run on 3.3V and going with one of those would save the hassle of having different voltage levels.
    I appreciate the feedback - My reason for the 5V display is that I am the proud owner of 5 of them. (Bought before I had a clue) The final will be running off the 12V system in one of my Hot-Rods, I'm presently using a 9V adapter for de-bugging. I will be going with a 3.3V regulator in the final.

    Thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #13
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by Alan R. View Post
    An MCP1703 is an excellent choice here since it can be used in the final 12V version:
    ē Input Operating Voltage Range: 2.7V to16.0V

    Also the Dropout Voltage is low enough that you will get 3.3V with as little as about 4Volts input:
    ē Low Dropout Voltage, 625 mV typical @ 250 mA

    I use these all the time at work for small sensor/microcontroller test boards.
    Alan,

    Your feedback confirms my decision to go this route. Prior to reading your post I ordered several of the 3.3V regulators but not the exact one you suggested. What I have coming will take up to 15V and output 3.3V up to 900ma.

    Thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #14
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by charliecoultas View Post
    Hi Dennis

    Glad you are making progress; we've all been there (and some of us keep on going there time after time....). I suggest you get a 3.3V regulator and drive that from your 9V. It is tempting to try and run a 3.3V regulator from 5V but it doesn't seem so easy - the minimum input voltage is normally above 5V.

    I used to work on a mainframe (ICL 1904A) with 8MB multi-platter discs, how things have changed. I would chew the fat longer but I'm at work and things are pretty busy.

    Charlie
    Charlie,

    Changes have certainly come forth. I remember telling my daughter sometime back that the only real thing she could count on is "Change". Even my occupation as a Printer is going by the wayside. When I started in that industry it ranked #6 in the US, being exceeded by automotive, food and the likes. It has been brought to it's knees by technological developments over the years.

    Your suggestion to go with a 3.3V regulator prompted me to order some of them. However since I will finally be in a 12-15V automotive system I went with one that can take 15V.

    I may try the voltage divider just to see the results of it. My thinking says it should work because the MCU has a Voltage regulator on it that, I believe, drops the 3.3V to 2.8V for the internal workings of the PIC.

    Many thanks,
    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #15
    myeeplacee
    Guest myeeplacee's Avatar

    0 Not allowed!

    Default Re: MCLR RESET on a PIC24HJ128GP502

    Quote Originally Posted by myeeplacee View Post

    I may try the voltage divider just to see the results of it. My thinking says it should work because the MCU has a Voltage regulator on it that, I believe, drops the 3.3V to 2.8V for the internal workings of the PIC.
    Correction - Upon re-reading the data sheet the on-board regulator regulates the internal PIC voltage from 3 to 4V supply down to 2.5V for the PIC.

    Dennis

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. Microchip Microstick woes with PIC24HJ128GP502
      By John Drew in forum The Lounge
      Replies: 22
      Last Post: 12th May 2014, 14:11
    2. Button usage on a PIC24HJ128GP502
      By myeeplacee in forum Proton 24
      Replies: 2
      Last Post: 30th January 2014, 23:30
    3. Remote MCLR reset
      By pic-ignorant in forum The Lounge
      Replies: 15
      Last Post: 1st December 2011, 12:27
    4. Mclr
      By pic-ignorant in forum The Lounge
      Replies: 17
      Last Post: 18th November 2008, 20:55
    5. [SOLVED !] Can you self reset a PIC by connecting IO pin to MCLR?
      By rpm26 in forum Proton Plus Compiler v3
      Replies: 7
      Last Post: 31st December 2005, 13:59

    Tags for this Thread

    Posting Permissions

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