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


    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?

  2. #2
    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!

  3. #3
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Sorry. I did post a link to the datasheet. The exact chip is a PIC16F627. The datasheet doesnt mention ADCON anywhere so i assume it doesnt have it. Ive tried setting CMCON. I took a look again at the datasheet and tried a few values. Ive now found one that seems to work properly. From what i can see, all of porta is working as expected now.

    While testing ALL pins ive noticed another problem. RB0 wont turn off. Im sure this is because its a special pin but i cant see what to do with it.

    In that first link RA4 isnt a problem because its an input anyway.

    Ive attached the full code so far as requested. Everything seems to work except RB0
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    HAHA. I found the problem. When i set all the pins low i put "portb.2" instead of "portb.0".

    Everythings working now The circuit can control mains bulbs and/or LEDs with brightness control.

    Im sure your all thinking "THANK GOD. Finally". I would like to thank everyone who has helped me with this. It looked really simple when i first started but if it wasnt for the people on this forum i would be hitting my head on the table right now.

    Ive just got a few bits of code to add and cleanup then it should be done but im sure i can handle those myself

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


    Did you find this post helpful? Yes | No

    Default

    When i set all the pins low i put "portb.2" instead of "portb.0".
    I hate it when that happens
    Good job
    Dave
    Always wear safety glasses while programming.

  7. #7


    Did you find this post helpful? Yes | No

    Default cmcon=7 strikes again

    lol i have when that happens too!

Similar Threads

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