16F88 Analog In


Results 1 to 12 of 12

Thread: 16F88 Analog In

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    In theory, you shouldn't take care of ADCONx too much when using ADCIN as the DEFINEs should take care of it for you. The only one thing you might need to set is the Right-Justified results when you use 10Bits resolution. This said, i'm not an ADCIN user.

    try those settings...
    Code:
    	Define OSC 4
    	Define ADC_BITS 8 	' Set number of bits in result
    	Define ADC_CLOCK 3 	' Set clock source (3=rc)
    	Define ADC_SAMPLEUS 50 	' Set sampling time in uSec
    
    	CMCON = 7 		' Disable analog comparator
    	ANSEL = %01000000 	' set AN6 (RB7) as analog, others to digital
    	ADCON1.7 = 1		' Right justified results... duh... really needed in 8 bits???
    
    	adval VAR BYTE
    
            PAUSE 500 ' lcd settle time
    
    loop: 	
    	ADCIN 6, adval 				' Read channel 6 (RB7)
    	Lcdout $fe, 1,"Value: ", DEC adval 	' Clear the LCD and show result
    	Pause 250				' wait a litlle bit
    	Goto loop 				' Do it forever
    Notice that your analog source impedance must be lower than 10K
    Last edited by mister_e; - 24th March 2008 at 16:49.
    Steve

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

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. analog data acquisition with 16f88
    By dru_x in forum Code Examples
    Replies: 3
    Last Post: - 29th January 2008, 13:38
  3. 16f88 - pin RA4 as analog input
    By savnik in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 15th December 2006, 13:55
  4. Anyone Got a 16F88 to Work in Analog?
    By thunderstrike44 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st August 2004, 22:34
  5. 16F88 reading Analog Input
    By thunderstrike44 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2004, 22:41

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