Digital Out on an A/D pin safe ?
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    96

    Default Digital Out on an A/D pin safe ?

    To keep it short, I'm replacing a legacy PIC with a modern one (16C711 to 16F819) in a old project. I need a Digital Out on pin RA3 (no input, A or D), but the A/D config table will not allow the mix of A/D to digital I/O I used on the previous 16c711.

    Sooo, if I have the ADCON1 setting to have an A/D on RA3 (and RA0 & RA1 in my case) but have TrisA set to Digital Out on RA3 will I cause any problems for the PIC while driving the pin as digital out?

    I've used PIC A/D's heaps in the past but alway kept the digital functions well apart from the analogue.

    Cheers,
    Martin

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Safe? ... No.
    Doable ... Yes.

    You can set TRIS for a pin to output when that pin is in analog mode.
    But even though you only want to use that pin for output, it's the reading of the pin that's a problem.

    When a pin is in Analog mode, it always reads a Digital 0.
    And anytime you write to any of the other pins on the same PORT, the CPU does a Read-Modify-Write of the whole PORT.
    So it reads the output pin as 0, and writes that value back to the pin, regardless of what the original state was.

    So essentially, you can use THAT Pin for digital output, but then you can't use any of the other pins on that PORT for digital output.
    Digital input or analog is fine on the other pins.
    <br>
    DT

  3. #3
    Join Date
    Nov 2008
    Posts
    96

    Default

    Ah ha... That fits with what I found by experiment later on, I just thought I'd go and try it. Because I use another PortA pin to run the E line to the LCD continuously the pin in question doesn't work. I guess from what you explain it does work briefly, but only until I toggle the LCD E pin again.

    Oh well, off to cut some PCB tracks....

    Martin

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. Digital inputs are some pin NOT working (PIC18F458)
    By san6302 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2008, 06:50
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  5. A/D versus Digital I/O
    By dallennn in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th November 2006, 04:31

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