Can an led be controlled by analog pin?


Closed Thread
Results 1 to 7 of 7

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Ok, so there are 4 analog pins, they are all in analog mode.

    You are using 2 of them for analog input and want to use 1 for digital output.
    That leaves 1 analog pin unaccounted for.

    Is that one an OUTPUT too?
    It makes a big difference.

    If not, and it's just not being used, then you can use HIGH and LOW like normal on the pin with the LED.

    If that other pin is also an output, you'll need to use a variable as a Latch (holding reg) to fix the R-M-W issue.
    <br>
    DT

  2. #2
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Ok, so there are 4 analog pins, they are all in analog mode.

    You are using 2 of them for analog input and want to use 1 for digital output.
    That leaves 1 analog pin unaccounted for.

    Is that one an OUTPUT too?
    It makes a big difference.

    If not, and it's just not being used, then you can use HIGH and LOW like normal on the pin with the LED.

    If that other pin is also an output, you'll need to use a variable as a Latch (holding reg) to fix the R-M-W issue.
    <br>
    Yes, TRISA =011X
    A.0 is only used for an LCD output for testing, and is normally necessary. I can live without it.

    Thanks
    James
    James

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


    Did you find this post helpful? Yes | No

    Thumbs up

    Yes, TRISA =011X
    Ah Ha! Makes perfect sense now.

    You're "good to go".

    Cheers,
    DT

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  3. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07

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