Random output upon TRISIO setup on '683


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1

    Default Random output upon TRISIO setup on '683

    I'm getting random outputs on a GPIO after setting TRISIO on a 12F6883 PIC. Sometimes it initializes as a 0, other times as a 1.

    Is there any way, other than setting it AFTER the fact, in ensuring it comes up in one state or the other? I don't want the initial pulse either, if I need to set it after the fact.

    Thanks,

    picster

  2. #2
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default resistors

    Hi
    Let's say you want the PIC to start with all pins in a predefined state. The TRISIO reg is always set as inport at Power on Reset and Brown out Reset (datasheet page 10) so.....

    1 Design the your hardware with 4.7k to 10k pull-down resistors on all IOs that you want to start with LOW level and put pull-up on all IOs that you want to start with High level. Because the TRISIO is set to %111111 all IOs at startup are inports and very high impedance. With no resistors they are floating and that is bad.

    2 Set the GPIO reg to correct settings

    3 Kick the TRISIO reg to make the pins in/outputs as your like.

    This way the pic will start same every time and there are no extra pulses anywhere. The resistor values can differ from design to design but they are a good start.

  3. #3


    Did you find this post helpful? Yes | No

    Default resistors...

    I'll give writing to it,THEN setting TRISIO a try... I tried modifying TRISIO within the program previously and it gave me an error at compile time - I'm not sure why.

    The high impedance state shouldn't have mattered for me - I was driving a reed relay (diode protected) with an active high, so it should have acted like a pull-down resistor at power-up time.

    picster

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    You will always have random OUTPUT state at power on ...

    So, just Write

    GPIO = % xxxxxxxx

    BEFORE setting your Tris Register ...

    and do not forget your inputs will be floating for some ms at startup ( hardware pull up or down resistors to place, i.e. when driving Mosfets ...)

    Alain

    EDIT : +1 with Sinoteq, then !!!
    ************************************************** ***********************
    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 " !!!
    *****************************************

  5. #5


    Did you find this post helpful? Yes | No

    Default Worked like a charm

    Thanks guys, it worked like a charm. I'll have to add that to the mental archives for a standard approach.

    picster

Similar Threads

  1. Random Numbers
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 18th December 2008, 08:47
  2. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 19:50
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44

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