Power up reset


Closed Thread
Results 1 to 7 of 7

Thread: Power up reset

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Hi Acetronics,

    My current port configuration setup:

    '*** PIC16F886 CONFIGURATION *************************

    OSCCON = %01100000

    ANSEL = %00000011
    TRISA = %11111111

    ANSELH = %00000000
    TRISB = %00000000

    TRISC = %11111111

    So I should look at adding PORTx = 0 before the TRISx register to clear the port register?

    Is this good programming practice (newbe question)?

    I have pull-down resistors on the input but not on the outputs, so I can look at adding those.

  2. #2
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ShawnB View Post
    So I should look at adding PORTx = 0 before the TRISx register to clear the port register?

    Is this good programming practice (newbe question)?

    I have pull-down resistors on the input but not on the outputs, so I can look at adding those.
    By all means clear the ports before changing TRISx. The MC data sheet on this part defines the port pins as UNDEFINED after power-up.

    It is definitely good programming practice, even on parts where the data sheet says the pins should be in the state you think you want.

    Output pull downs are probably the way to go, just make sure you have enough current to drive them, and they take enough current to actually pull down the input they drive.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by ShawnB View Post

    So I should look at adding PORTx = 0 before the TRISx register to clear the port register?

    Is this good programming practice (newbe question)?

    I have pull-down resistors on the input but not on the outputs, so I can look at adding those.
    Hi, Shawn

    Clearing PORTx is not the way ...

    but you must set PORTx to get a SAFE and KNOWN state at your Program start ...

    so, if you have a PNP transistor driving something ... it's driving port initial state MUST be a "1" state with a Pullup resistor ... for the transistor NOT to conduct.

    I already had the "gag" with an electronic ignition :

    @ Power UP the guy had programmed a CLEAR Port.

    and after he had preset the Port pin to 1 ... as the transistor driven was a PNP ...


    so, When turning the contact Key ... often an explosion occured in a cylinder : not so good , hey ???

    The Good practice is to ensure a SAFE initial state ... processor placed or not.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  3. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  4. PIC power backup with "super capacitor"
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 24th January 2007, 23:51
  5. 12 Servo's together does not seem to work, Power problem
    By macx75 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th December 2006, 19:30

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