16F684 AtoD problem


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Try commenting out these lines
    Code:
    ADCON1=%01110000
    
    PORTA=$00
    
    ADCON0=%00000001
    I think they may be causing a conflict.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default No luck

    Still no luck.The Analog channel pulls up before ADCIN command therefore something must be wrong with register configs.
    very frustrating!

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Sorry for all the confusion, here is some tested code.
    I have it running right now.
    Code:
    <html>
    <head></head>
    <body><!--StartFragment--><pre><code><font color="#00FF00"><b><i>'16F684 ADCIN TEST
    
    </i></b></font><font color="#008000">@  __config _INTRC_OSC_NOCLKOUT &amp; _WDT_ON &amp; _MCLRE_OFF &amp; _CP_OFF
    
    </font><font color="#0000FF"><b>DEFINE </b></font><font color="#FF0000">ADC_BITS </font>8 <font color="#00FF00"><b><i>' Set number of bits in result
    </i></b></font><font color="#0000FF"><b>DEFINE </b></font><font color="#FF0000">ADC_CLOCK </font>3 <font color="#00FF00"><b><i>' Set clock source (3=rc)
    </i></b></font><font color="#0000FF"><b>DEFINE </b></font><font color="#FF0000">ADC_SAMPLEUS </font>50 <font color="#00FF00"><b><i>' Set sampling time in uS
    </i></b></font><font color="#FF0000">TRISA</font>=%00000001
    <font color="#FF0000">ANSEL</font>=%00000001
    <font color="#FF0000">ADX</font>	<font color="#0000FF"><b>VAR</b></font>	<font color="#0000FF"><b>BYTE
    </b></font><font color="#FF0000">START</font>:
    <font color="#0000FF"><b>HIGH </b></font><font color="#FF0000">PORTC</font>.4
    <font color="#0000FF"><b>PAUSE </b></font>250
    <font color="#0000FF"><b>LOW </b></font><font color="#FF0000">PORTC</font>.4
    <font color="#0000FF"><b>ADCIN </b></font>0, <font color="#FF0000">ADX
    </font><font color="#0000FF"><b>PAUSE </b></font>250
    <font color="#0000FF"><b>SEROUT2 </b></font><font color="#FF0000">PORTC</font>.5, 17197, [<font color="#0000FF"><b>DEC </b></font><font color="#FF0000">ADX</font>, $d, $a]
    <font color="#0000FF"><b>GOTO </b></font><font color="#FF0000">START
    </font></code></pre><!--EndFragment--></body>
    </html>
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 20:48
  2. 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
  3. 877A AtoD config problem?
    By ttease in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st April 2007, 16:57
  4. 16F684 ADC problem
    By markedwards in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th August 2006, 06:51
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

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