Can't access Port A with PBP on 16F870.


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2013
    Posts
    1,079

    Default Can't access Port A with PBP on 16F870.

    Hello. I'm doing certain project, where I needed enough pins to interface with keyboard and so on. So I've decided to use PIC16F870. I have no problems working with Port B and Port C, but can't get the Port A to work either as TTL input or output. I've tried TRISA=0, TRISA=1, to set it as output or input but no luck - still does not works. I even tried to insert the assembly code for setting port A as digital input,m as in datasheet of 16f870, it made a huge mess to program, still does not worked. Any ideas? wiring is correct, I've double checked.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default Re: Can't access Port A with PBP on 16F870.

    Try setting the pins to digital, ADCON1 = 7.

  3. #3
    Join Date
    Oct 2011
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: Can't access Port A with PBP on 16F870.

    When the PIC starts up port A is analogue. To change this to digital you have to set the ADCON1 register.
    To make all port A digital you would include the line

    ADCON1 = %00000110

    Section 10 of the datasheet 'Analog-to-digital converter' explains this.
    Phil

  4. #4
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Can't access Port A with PBP on 16F870.

    Thanks, it works now.

Similar Threads

  1. A (possibly) odd way to access a port
    By andywpg in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th November 2012, 21:36
  2. Problem Programming 16F870 when adding ON INTERRUPT
    By dream- in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th March 2011, 07:56
  3. Access array in PBP and .asm
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th September 2008, 00:35
  4. Help needed with 16F870 ADC
    By srob in forum mel PIC BASIC
    Replies: 1
    Last Post: - 10th May 2008, 13:14
  5. Second serial port access ( Hserin2 )
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2007, 18:01

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