Some pins dont work


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Some pins dont work

    Hi. Im just running a quick test on some code.

    Code:
    high porta.1
    high porta.2
    high porta.0
    high porta.3
    high portb.0
    high portb.5
    high portb.3
    high portb.4
    I keep getting weird flashing with it unless i comment out porta.2, porta.0 and porta.3 then the other outputs work fine. TrisA is set to %00110000. Im lookng at the datasheet but porta.0 and porta.1 appear to be the exact same type of pin yet 1 works and 1 doesnt. Am i missing something?

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Default

    Hi Master,

    Well, without going back and looking at your other posts, you don't say what chip you are using. If you had a datasheet on the chip you were using you could look and see if it had analog pins on portA and if any of the pins were setup by default to work as a comparator. These features need to be disabled which will then make the pins digital. All of this has been covered soooooooooooo many times on this forum. You should stop and look at all of the stuff that has posted. You would be making a wise investment in your time!

    When looking at the data sheet look for the registers ADCON and CMCON and there might be a few others which have a different name depending on the PIC you are using. This will tell you how to disable them as well as how to configure them for different operations.

    This site is a veritable book on PICs and how to use them as well as troubleshooting problems with PICs and devices attached to them.

    BobK

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I see. I posted a link to the datasheet in my previous post. The pins im having trouble with are all analogue pins but the one that works is also an analogue pin so i dont see why one works and one doesnt.

    I will have a look at configuring them though and hopefully that will help

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Im not exactly the best person for reading datasheets but from what i can see in the porta table aparently the 4 pins with analogue capability are *not* set as analogue by default.

    It actually seems like the problem im having is because it takes longer to turn those 3 outputs on than it does for any of the others. Is that possible?

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive found out whats happening. Its weird though and i dont know how to fix it.

    Code:
    high porta.1 'Turns RA1 on
    high porta.0 'Turns RA0 on *AND* RA1 back off again!

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You should give all info in each thread. Saves the people trying to help time if they do not have to go back and search your old post. I for one will not take the time. A minute or so of your time telling the PIC and posting the whole code will get answers, or at least better answers

    Look at these:
    http://www.picbasic.co.uk/forum/showthread.php?t=562
    http://www.picbasic.co.uk/forum/showthread.php?t=561

    Basically if you want the pin to be digital, tell it. If the pin is to be analog, tell it. Just like setting the TRIS.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. PortA Doesn't Work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 11
    Last Post: - 8th September 2015, 18:41
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. PIC PORT 'special' pins
    By barkerben in forum General
    Replies: 1
    Last Post: - 18th January 2005, 21:40
  4. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03
  5. stopping USART setup
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th December 2003, 19:29

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