adcin problem


Closed Thread
Results 1 to 2 of 2

Thread: adcin problem

  1. #1

    Default adcin problem

    Hello Everyone. Up to today, I thought I had a handle on the adcin command using a 12F675. Instead of posting my entire program, I'll just show you the relevant lines:

    X VAR BYTE

    ADCIN 1,X 'read pot
    PAUSE X
    GOTO PLAY

    It takes up to 255 ms to get to play. It works perfect.

    Now, I did this:

    DEFINE ADC_BITS 10 ' Set number of bits in result
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
    X VAR WORD

    ADCIN 1,X
    PAUSE X
    GOTO PLAY

    I believe it should take up to 1024 ms to get to play, but it takes a little over 60,000 (1 minute). I understand a word variable can be a number up to 65,545 but a 10 bit adc reading isn't supposed to be over 1,024. Any ideas? Thank you. - Peter

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Right justify to get the correct value/PAUSE time for 10-bit.
    Code:
    DEFINE ADC_BITS 10 ' Set number of bits in result
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS
    X VAR WORD
    ADCON0.7=1 ' Right justification for 10-bit A/D
    
    ADCIN 1,X
    PAUSE X
    GOTO PLAY
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. ADC or ADCIN "bias" problem?
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2010, 19:39
  2. ADCIN Problem
    By JavPar in forum General
    Replies: 33
    Last Post: - 20th January 2009, 03:36
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. electrical problem adcin
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th March 2007, 22:52
  5. weird 12F629/675 problem
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th October 2004, 01:08

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