Power Control (PCON) Register


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Power Control (PCON) Register

    I have a situation where I need to skip over part of a program if a MCLR reset has occurred. The device is 16F1823. MCLRE is enabled on. The manual says a MCLR reset can be differentiated from a power on reset by observing the bits in the PCON register. The code I tried works some of the time, but is inconsistent and ultra sensitive to noise and grounding conditions. The code section:

    Code:
            if PCON.3 = 0 then      'when mclr reset has occurred
            PCON.3 = 1              'set mclr flag
            goto current            'jump over data display
            endif
    Question: Is the PCON register accessible by PBP? Should asm be used for this task instead?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Power Control (PCON) Register

    In answer to own question, of course PCON is accessible by PBP, all registers are. I tried asm and it makes no difference, the sensitivity to noise is still there. The circuit does work some of the time, so this is most likely a hardware issue. I'll keep working on it.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Power Control (PCON) Register

    The following code modification fixes the problem. The idea is a double set of the MCLR reset flag. Electrical noise tends to disrupt the initial condition of the MCLR bit so a double set is needed:

    Code:
            if PCON.1 = 0 then      'when por reset has occurred
            PCON.3 = 1              'set mclr flag
            PCON.1 = 1              'set por flag
            endif
    
            if PCON.3 = 0 then      'when mclr reset has occurred
            PCON.3 = 1              'set mclr flag
            goto current            'jump over data display
            endif
    This is working nearly 100% of the time, unless the noise environment is very,very severe.
    The fix is posted here for future reference.
    Last edited by Dick Ivers; - 29th March 2013 at 23:17.

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


    Did you find this post helpful? Yes | No

    Default Re: Power Control (PCON) Register

    I'm just curious as to what machine is making so much electrical noise that it's affecting your circuit?

    Is it time for a new power supply or a few capacitors and a coil?

    Are there electrical issues in your other devices?

    Like I said, just curious.

  5. #5
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: Power Control (PCON) Register

    Thanks Dick, I am now using this info to control a field of solar micros to stow with central power control -- RCON.1

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Power Control (PCON) Register

    AV1
    The system is brushless dc motor control. My project is an energy meter in series with the battery power line. The motor controller generates lots of electrical noise, especially during the startup phase of motor operation.

    SUNFLOWER
    I'm glad the PCON tactic is working for you.

Similar Threads

  1. Power multiple electronics from 1 power source
    By koossa in forum Off Topic
    Replies: 2
    Last Post: - 2nd September 2010, 08:49
  2. How do I give a radio control car autonomous control
    By Kenjones1935 in forum General
    Replies: 190
    Last Post: - 17th January 2010, 15:40
  3. CCP vs power control PWM
    By luminas in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th September 2008, 03:09
  4. Replies: 4
    Last Post: - 16th May 2008, 14:35
  5. How do I to set one bit in a register?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th February 2006, 08:43

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