ADCIN setup help need


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Hi, I have just browsed through the datasheet, and if I were doing it, I would set the following registers:

    INTCON.7 = 0 'Disable interrupts
    TRISC.1 = 1 'Set PORTC.1 to be an input
    CM1CON0.7 = 0 'Disable Comparator module
    CM2CON0.7 = 0 'Disable Comparator module
    VRCON = 0 'Disable Voltage Reference module
    ADCON0.7 = 0 'Right justify result. Assumes 10 bit AD conversion
    ADCON0.0 = 1 'Enable ADC module
    ANSEL.5 = 1 'Set high impedance buffer on ANS5 (PORTC.1)


    Andy

  2. #2
    Join Date
    Feb 2008
    Posts
    4


    Did you find this post helpful? Yes | No

    Default ADCIN problem fixed

    Thanks Andy,

    While I was waiting for someone to reply, I broused the site and found what I was doing wrong. I always use all the stuff you said, but when I was using the ADCIN command, I was trying to read the port# not the AD channel number. Once I changed from the port# over to the channel number, everything worked perfectly. By the way, can anyone tell me why the ADCIN was working using the portA.0 address and not the channel # all the other times I used ADCIN. Just curious...PortA.0 is the only port that works this way. No other port does it. I can't find out why anywhere.

    Thanks,

    Dan

  3. #3
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Hi Dan,

    It may have been because PORTA.0 was currently at logic low, or as far as PBP is concerned, 0.

    Effectively, you were writing:

    ADCIN 0, Var

    Which would have read from PORTA.0 anyway...

    You could do the same to PORTA.1 if you pulled it high.

    Andy

Similar Threads

  1. ADCIN and PIC18F4331 Arghhhhh !
    By GrandPa in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th December 2010, 21:27
  2. ADCIN - setup of ADCON2
    By Lowell314 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th December 2009, 19:41
  3. ADCIN setup for PIC16F688
    By PixController in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th February 2008, 19:38
  4. Use Button For setup
    By tump in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 21st November 2007, 20:43
  5. help using adcin
    By harryweb in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st January 2006, 08:46

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