PortA analog and digital IO


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Kurt. The easiest thing to do is set all of the ports to digital. When you use the ADCIN command, it will convert the particular port to analog. I put these lines on the top of almost all of my 16F819 programs.
    OSCCON = $60 'set int osc to 4mhz
    ADCON1 = 7 ' set all inputs to digital. adcin command will convert to analog
    @ DEVICE MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_ON
    X VAR BYTE

    START:
    ADCIN 0,X ' read pot on ANA0 & place value in x

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Oh yeah. Don't forget to set the TRIS registers to enable the port as an input.
    TRISA = %00000001 'set RA0 to input

  3. #3
    Join Date
    Sep 2007
    Posts
    50


    Did you find this post helpful? Yes | No

    Smile Thank You...

    Thanks so much for all the help!

    I knew this analog stuff would be easier then I had feared. Come to think of it everything I have attempted to do with the PIC and PBP have been easier that I initially feared. I can’t believe how easy it is to build fairly complex projects. I am going to attempt to tackle RS485 and DMX later this year or early next January.

    Best Regards,

    Kurt
    KrohTech

    “Good by and thanks for all the fish!”

Similar Threads

  1. analog and digital
    By lerameur in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th June 2008, 02:40
  2. 16F877a PORTA ADC and digital help
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th February 2008, 18:44
  3. Replies: 2
    Last Post: - 14th April 2006, 09:42
  4. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32
  5. Partial Digital PORTA?
    By actionplus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th March 2004, 06:47

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