Setting GPIO and TRISIO


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Setting GPIO and TRISIO

    Is that close?
    You have got it!

    Is it necessary to set the gpio.0 or gpio.6 to 0 to make sure they turn off at start up?
    No, since Led1 and Led2 has been declared as alias of gpio.0 and gpio.6. So if you want set them to zero just state Led1=0 : Led2=0.

    Cheers

    Al.
    Last edited by aratti; - 10th March 2011 at 21:43.
    All progress began with an idea

  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Setting GPIO and TRISIO

    Also... don't overlook the fact that GPIO.3 can only be an INPUT. It defaults to MCLR or "Master Clear with internal pull-up". This means it will reset the chip whenever it goes low.

    In order to make it a normal input pin you MUST change the "Configuration Word Register" bit 5. This register can ONLY be defined once at the time of programming. I think some refer to it as the "FUSE bits" or "configuration fuses" This special register can only be changed each time you program the chip and is not change-able during runtime of your program.

    I think I lost a few hairs and much sleep trying to understand the details of configuring PIC's and the registers. I now keep the .pdf of what ever chip I am working with open and refer to it often as I am defining the functionality of my chip and the various I/O pins, analog, comparators, pulse width modulation, etc, etc.

    I hope this helps and is not too basic for your level.

    In the beginning I tried to use GPIO.3 as a normal input and could not for the life of me figure out why it kept resetting my program...

    regards
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

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