analog and digital


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default analog and digital

    Hi all

    Is it possible to write a program using a pin in both analog and digital one at a time.
    Meaning: I would like to implement two loop, one loop uses a porta.0 analog mode and another loop using the same pin in digital mode.
    I would switch between the two using and switch, so I only one of the two.

    Example:
    if PortB.0 = high then
    ADCON1 = %10000010
    'use PortA.0 in analog mode
    endif

    if PortB.0 = Low then
    ADCON1 = %10000000
    'use PortA.0 in digital mode
    endif

    K

  2. #2
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Wink sure

    Of course you can. Better than loop, you may want to use interrupts to detect switch activity. Such external interrupt (INTF) or RB port onchange interrupt (RBIF). Don't forget TRIS & PORT settings.
    "Beethoven had his critics too, see if you can name 3 of them"

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. Analog to digital phone line
    By blue2006 in forum General
    Replies: 4
    Last Post: - 13th April 2008, 14:13
  3. PortA analog and digital IO
    By krohtech in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th November 2007, 02:25
  4. Replies: 2
    Last Post: - 14th April 2006, 09:42
  5. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32

Members who have read this thread : 1

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