Adc For 16f88


Closed Thread
Results 1 to 12 of 12

Thread: Adc For 16f88

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    971


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    to show simultaneous conversion of two ADC channels, AN0 and AN1 on LCD.
    My code
    Code:
        DEFINE  ADC_BITS        10   
        DEFINE  ADC_CLOCK       3     
        DEFINE  ADC_SAMPLEUS    50    	
    
        adval   VAR WORD			
        adval1  VAR WORD			
    	
        ANSEL = %00000011
        CMCON = 7                      
        TRISA = %00000011		         
        ADCON0 = %11001001            
        ADCON1 = %10000000                    	          	     
        
        INCLUDE "LCDbar_INC.bas"       
     
    loop: 	
        ADCIN 0, adval				
        adval = (adval */ 500)>>2		    
        ADCIN 1, adval1				
        adval1 = (adval1 */ 500)>>2		   
        LCDOut $fe,1,"L:" 
        @ BARgraph  _adval,  1,   2,    16,   100, lines    
        LCDOut $fe,$C0,"R:" 
        @ BARgraph  _adval1,  2,   2,    16,   100, lines        
        PAUSE 300
        GoTo loop
    Try above code. You may need to pause between the 2 adcin statements.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Not sure that would help, i would suggest to check the analog source impedance first. Must meet the datasheet requirement. You could still increase the ADC_SAMPLEUS and or check what you maths will do.

    As your maximum value range is 100... why not using a 8 Bit conversion instead?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Stable Adc Reading Routine
    By gebillpap in forum General
    Replies: 27
    Last Post: - 13th May 2015, 03:18
  2. 10 bit ADC display on LCD using 16f873
    By pr2don in forum mel PIC BASIC
    Replies: 3
    Last Post: - 6th March 2010, 19:29
  3. Can't get ADC to loop
    By TravisM in forum mel PIC BASIC
    Replies: 2
    Last Post: - 11th October 2009, 16:33
  4. ADC value with 2 decimals on an LCD
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2005, 16:54
  5. 12F675 ADC 'Issues'
    By harrisondp in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2005, 02:55

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