Questions about using the A to D


Results 1 to 19 of 19

Threaded View

  1. #11
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Question A to D reading confusion

    (A/D threads merged - Robert)



    Hi All!
    So I have my PIC doing the A to D conversion and the reading is strange! With a volt meter I know the voltage is .441 volts. This should give a value of 362. The value I get is 582 which would be for .710 volts! Now I am completely lost as to why the results are not what is expected. Can anyone explain what I am doing wrong?

    Thanks, Ed

    '************************************************* ****************
    '* Name: XXXXSPEEDT2.bas *
    '* Author: Ed Cannady *
    '* Notice: Copyright (c) 2011 *
    '* : All Rights Reserved *
    '* Date: 8/29/2014 *
    '* Version: 1.0 *
    '* Notes: For a 18F1320 and MS4515 *
    '************************************************* *****************

    Define OSC 20
    Define LOADER_USED 1
    Include "Modedefs.bas"
    include "hpwm10L.pbp" ' For future calculations
    ENABLE DEBUG

    #CONFIG
    __CONFIG _CONFIG1H, _HS_OSC_1H & _FSCM_OFF_1H
    __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_8K_2H
    __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_27_2L
    __CONFIG _CONFIG3H, _MCLRE_OFF_3H
    __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L
    __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
    __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
    __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
    __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
    __CONFIG _CONFIG7H, _EBTRB_OFF_7H
    #ENDCONFIG


    Define ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 100

    ADCON1 = %11101111
    TRISB = %11111111

    VOLTS VAR WORD ' Volts reading

    VOLTS = 0 ' Start with a Volts value of zero

    GETVOLTS:

    ADCIN 4, VOLTS
    VOLTS = VOLTS/10

    GOTO GETVOLTS
    Last edited by Demon; - 4th October 2014 at 21:35.

Similar Threads

  1. PicKit 2 Questions
    By dmairspotter in forum General
    Replies: 3
    Last Post: - 11th November 2007, 21:10
  2. 2 questions
    By Archangel in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st December 2006, 02:47
  3. Serial questions
    By Armando Herjim in forum Serial
    Replies: 0
    Last Post: - 29th June 2006, 19:49
  4. New with questions
    By Terke in forum General
    Replies: 5
    Last Post: - 6th December 2005, 06:35
  5. Questions?
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd June 2005, 14:44

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