PIC18f2423 two 12bit adc input problems


Results 1 to 7 of 7

Threaded View

  1. #1
    Brandon's Avatar
    Brandon Guest

    Default PIC18f2423 two 12bit adc input problems

    Hi all,

    I got some pic18F2423 chips so I could monitor two pots on two pins at 12bit.
    Everything ALMOST works. I can't seem to get the second adc (porta.1) to work.
    It is not the pots, if i siwtch them porta.1 stays dead, or i should say, outputs whatever is on porta.0.

    Any help would be great, i am sure it is a newbie queston


    'pic18f2423 with 12bit adc

    define OSC 20
    DEFINE ADC_BITS 12 'SETS NUMBER OF BITS IN RESULTS 8,10,12
    DEFINE ADC_CLOCK 3 'SETS CLOCK SOURCE (RC = 3)
    DEFINE ADC_SAMPLEUS 50 'SETS SAMPLING TIME IN MICROSECONDS
    ADCON2.7 = 1 'right justify port a
    W0 Var WORD
    W1 Var WORD
    b0 Var w0.Byte0 'high byte of word w0
    b1 Var w0.Byte1 'low byte of word w0
    b2 Var w1.Byte0 'high byte of word w1
    b3 Var w1.Byte1 'low byte of word w1
    include "modedefs.bas"

    loop:
    ADCIN PORTA.0,W0
    pauseus 100
    ADCIN PORTA.1,W1
    pauseus 100
    LOW 0 'turn off led for testing
    SEROUT PORTB.3, T9600, ["T"] 'TILT
    SEROUT PORTB.3, T9600, [#w0,10]
    HIGH 0'turn on led for testing
    SEROUT PORTB.3, T9600, ["P"] 'PAN
    SEROUT PORTB.3, T9600, [#w1,10]

    goto loop

    end
    Attached Files Attached Files

Similar Threads

  1. ADC input using a current transformer?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th May 2009, 22:13
  2. PIC18F2423, ADC problem
    By mistergh in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th March 2009, 01:31
  3. Problems with ADC
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2009, 17:34
  4. PIC18F2423 ADC Need Help
    By Lockerbee1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd July 2007, 22:00
  5. Replies: 2
    Last Post: - 17th February 2006, 09:52

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