Scaling ADC Result to a Set Range


Closed Thread
Results 1 to 40 of 45

Hybrid View

  1. #1

    Default Scaling ADC Result to a Set Range

    I'm using a trim pot to control a motor's speed via PWM on a PIC16F1825 but instead of the usual 0-100% duty cycles (corresponding to 0-255 from the ADCIN function with 8-bit resolution) I want to scale the adjustment of the duty to be around a set value. For example, if I determine that the typical duty cycle I want to provide in my application is 75% then I'd like to use the trim pot to adjust the value from 50-100% with 75% being the middle point of the pot. I can do this on an Arduino with the Map function but I can't seem to figure out how to do that similarly with PBP. Any guidance offered would be much appreciated.

    Code:
    #DEFINE USE_LCD_FOR_DEBUG   ; comment out for non-debug use
    
    ' ***************************************************************
    ' Pin Connections
    ' ***************************************************************
    
    ' Vdd      -> pin 1         -> +5V   
    ' RC4/Tx   -> pin 6         -> EUSART transmit (LCD)
    ' RC2      -> pin 8         -> Port motor direction signal (motor 2)
    ' RC1/CCP4 -> pin 9         -> Port motor PWM output (motor 2)
    ' RC0      -> pin 10        -> Stbd motor direction signal (motor 1)
    ' RA2/CCP3 -> pin 11        -> Stbd motor PWM output (motor 1)
    ' RA1      -> pin 12        -> trim pot input
    ' Vss      -> pin 14        -> GND
       
    DEFINE OSC 16               ; Set oscillator 16Mhz
    
    DEFINE ADC_BITS      8      ; Set number of bits in result
    DEFINE ADC_SAMPLEUS  50     ; Set sampling time in uS (was 5)
    DEFINE ADC_CLOCK     3      ; Set clock source (3=rc)
    
    DEFINE HSER_TXSTA   20h     ; Set transmit status and control register
    DEFINE HSER_BAUD    2400    ; Set baud rate
    
    ' ***************************************************************
    ' Device Fuses
    ' ***************************************************************
    
    #CONFIG
       __config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF
       __config _CONFIG2, _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF
    #ENDCONFIG
    
    ' ***************************************************************
    ' Initialization
    ' ***************************************************************
    
    OSCCON    = %01111000       ; 16MHz internal osc
    
    APFCON0.2 = 0               ; Tx on RC4 for LCD display
    BAUDCON.4 = 1               ; Transmit inverted data to the Tx pin
    
    FVRCON    = 0               ; Fixed Voltage Reference is disabled
    ANSELA    = %00000010       ; Analog on PORTA.1 (AN1) only
    ADCON0    = %00000101       ; ADC (analog-to-digital) is enabled on AN1 (RA1) only
    ADCON1.7  = 0               ; Left-justified results in 8-bits
    TRISA     = %00000010	    ; Make all pins output except for RA1 (trim pot input)
    
    ANSELC = 0                  ; Digital only for all PortC pins
    TRISC  = 0                  ; Make all PORTC pins output
    
    MOTOR_1_DIR    VAR PORTC.0  ; Alias PORTC.0 as "MOTOR_1_DIR"
    MOTOR_1_PWM    VAR PORTA.2  ; Alias PORTA.2 as "MOTOR_1_PWM"
    MOTOR_2_DIR    VAR PORTC.2  ; Alias PORTC.2 as "MOTOR_2_DIR"
    MOTOR_2_PWM    VAR PORTC.1  ; Alias PORTC.1 as "MOTOR_2_PWM"
     
    #IFDEF USE_LCD_FOR_DEBUG
        LCD_INST   CON 254       ' instruction
        LCD_CLR    CON 1         ' Clear screen
        LCD_L1     CON 128       ' LCD line 1
        LCD_L2     CON 192       ' LCD line 2
    #ENDIF
    
    ' ***************************************************************
    ' Set up registers for PWM on CCP3 & CCP4
    ' ***************************************************************
    
    CCP3CON = %00001100         ; Use CCP3 in PWM mode
    CCP4CON = %00001100         ; Use CCP4 in PWM mode
    
    ' Use Mister E's PICMultiCalc_1.3.1.exe application (Windows only)   
    ' to determine prescaler and PR2 values for given OSC frequency (e.g. 16Mhz)
    ' and duty cycle (use 100% to see highest actual value)
                           
    T2CON   = %00000101         ; Timer2 on with 1:4 prescaler
    PR2     = 62                ; For 16Mhz OSC the desired output freq of 15,873Hz is
                                ; achieved with this PR2 value (8-bit resolution
                                ; with 1:4 prescaler)
                                
                                ; PWM freq must be ~ 16-20kHz to reduce noise
    
    PreSpinVal  CON 17          ; value to subtract from MinDuty for motor spin up 
    MinDuty     CON 75          ; 75 when max duty = 252 (8-bit resolution)
    ;SpinUpPause CON 17          ; Pause during motor spin up
    SpinUpPause VAR BYTE        ; Pause during motor spin up
    SpinUpPause = 99
    #IFDEF USE_LCD_FOR_DEBUG
        SpinUpPause = 17        ; Less pause is needed when using LCD
    #ENDIF
    MaxDuty     VAR WORD        ; According to Darrel:
                                ;   MaxDuty = (PR2 + 1) * 4
    
    MaxDuty = (PR2 + 1) * 4     ; 252 but with prescaler resolution it's actually 250
    
    DutyVar     VAR WORD        ; temp variable to store duty variable for CCP3/4
    MotorRPM    VAR BYTE    
    
    adcVal      VAR BYTE        ; stores ADCIN results  
                                                                  
    ' ***************************************************************
    ' Set default values
    ' ***************************************************************
    
    ADCIN 1, adcVal             ' Read channel 1 to adval
    MotorRPM = adcVal           ' (set speed for motors to spin up to)
    
    ' TODO: want to use trim pot to adjust motor speed but only within a
    '       a certain range; midpoint of the pot should be the typical speed
    '       observed from 'The Tholian Web' and the min/max adjustment accordingly
    '       (i.e. max is 100% duty cycle but if mid is 75% then min would be 50%)
    
    LOW MOTOR_1_DIR             ' Set stbd motor (motor 1) to fwd (CW)
    LOW MOTOR_2_DIR             ' Set port motor (motor 2) to fwd (CCW)
    
    ' Spin up motors to saved value of _MotorRPM
    ' (Below a value of 'MinDuty', the motors don't move at all)
    FOR DutyVar = (MinDuty - PreSpinVal) to MotorRPM
        'DutyVar4  = i
    
        CCP3CON.4 = DutyVar.0
        CCP3CON.5 = DutyVar.1
        CCPR3L    = DutyVar >> 2
    
        CCP4CON.4 = DutyVar.0
        CCP4CON.5 = DutyVar.1
        CCPR4L    = DutyVar >> 2 
                
        pause SpinUpPause
    
    #IFDEF USE_LCD_FOR_DEBUG
        HSEROUT [LCD_INST, LCD_CLR]
        pause 5
        HSEROUT ["RPM=", DEC DutyVar, "       ", 13, 10] ' Send text followed by carriage return and linefeed
    #ENDIF
    NEXT DutyVar
    
    #IFDEF USE_LCD_FOR_DEBUG
        HSEROUT [LCD_INST, LCD_CLR]
        pause 5
        HSEROUT ["RPM=", DEC MotorRPM, "       ", 13, 10] ' Send text followed by carriage return and linefeed
    #ENDIF
    
    Main:
        ' Check if motor RPM has changed
        ADCIN 1, adcVal        ' Read channel 0 to adval
    
    #IFDEF USE_LCD_FOR_DEBUG
        HSEROUT [LCD_INST, LCD_CLR]
        pause 5
        HSEROUT ["adcVal=", DEC adcVal, "       ", 13, 10] ' Send text followed by carriage return and linefeed
    #ENDIF
    
    ' TODO: only change motor speed if reading is changed by +/- 2 since the 
    '       value can change by +/- 1.
    '    If (adcVal - prevVal) > 1 Then
    '        gosub ChngMotorHPWM
    '    EndIf
     
     GOTO Main
    
    ChngMotorHPWM:
        DutyVar  = MotorRPM
    
        CCP3CON.4 = DutyVar.0
        CCP3CON.5 = DutyVar.1
        CCPR3L    = DutyVar >> 2
    
        CCP4CON.4 = DutyVar.0
        CCP4CON.5 = DutyVar.1
        CCPR4L    = DutyVar >> 2
        
        RETURN

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    Hi,

    You can try this idea. It will never go under 50% using 125 as a constant. Then divide your adcin by 2 this variable will be 0 to 127

    Duty = 125 + adcin/2
    Last edited by mark_s; - 25th October 2015 at 23:39.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    Quote Originally Posted by mark_s View Post
    Hi,

    You can try this idea. It will never go under 50% using 125 as a constant. Then divide your adcin by 2 this variable will be 0 to 127

    Duty = 125 + adcin/2
    Thanks Mark. Did you choose 125 because it's half of the max duty value with the prescaler and PR2 I have above?

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    Yes, because you said you were using 8 bit pwm. You can change that to fit your needs.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    On another note, I observed that with ADCIN the readings fluctuate quite a lot and I only want to change the motor speed if the value has 'really' changed (i.e. by me). I tried this code and while it yields a rock-solid value, it doesn't go to 0: the readings go from 1-255. Any ideas why?

    Code:
    ' PIC 16F1825 with a 10k pot attached to AN1 (the data sheet says this is the maximum impedance allowed)
    
    #DEFINE USE_LCD_FOR_DEBUG   ; comment out for non-debug use
    
    ' Vdd      -> pin 1         -> +5V   
    ' RC4/Tx   -> pin 6         -> EUSART transmit (LCD)
    ' RA1      -> pin 12        -> trim pot input
    ' Vss      -> pin 14        -> GND
       
    DEFINE OSC 16               ; Set oscillator 16Mhz
    
    DEFINE ADC_BITS      8      ; Set number of bits in result
    DEFINE ADC_SAMPLEUS  50     ; Set sampling time in uS (was 5)
    DEFINE ADC_CLOCK     3      ; Set clock source (3=rc)
    
    DEFINE HSER_TXSTA   20h     ; Set transmit status and control register
    DEFINE HSER_BAUD    2400    ; Set baud rate
    
                                   
    ' ***************************************************************
    ' Device Fuses
    ' ***************************************************************
    
    #CONFIG
       __config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF
       __config _CONFIG2, _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF
    #ENDCONFIG
    
    ' ***************************************************************
    ' Initialization
    ' ***************************************************************
    
    OSCCON    = %01111000       ; 16MHz internal osc
    
    APFCON0.2 = 0               ; Tx on RC4 for LCD display
    APFCON0.7 = 0               ; Rx on RC5
    
    BAUDCON.4 = 1               ; Transmit inverted data to the Tx pin
    
    ANSELC    = 0               ; Digital only for all PortC pins
    TRISC     = 0               ; Make all PORTC pins output
    
    TRISA     = %00000010	    ; Make all pins output except for RA1 (trim pot input)
    ANSELA    = %00000010       ; Analog on PORTA.1 (AN1) only
    
    FVRCON    = 0               ; Fixed Voltage Reference is disabled
    ADCON0    = %00000101       ; ADC (analog-to-digital) is enabled on AN1 (RA1) only
    PAUSEUS 20                  ; wait for the analog switch 'glitch' to die down
    ADCON1.7  = 0               ; Left-justified results in 8-bits
    
    #IFDEF USE_LCD_FOR_DEBUG
        LCD_INST   CON 254       ' instruction
        LCD_CLR    CON 1         ' Clear screen
        LCD_L1     CON 128       ' LCD line 1
        LCD_L2     CON 192       ' LCD line 2
    #ENDIF
    
    ADCInVal       VAR BYTE      ; stores ADCIN result read from trim pot
                                                               
    Main:
        gosub Do_ADC
        pause 100
        #IFDEF USE_LCD_FOR_DEBUG
            ' DO SOMETHING HERE
            HSEROUT [LCD_INST, LCD_CLR]
            pause 5
            HSEROUT ["ADC val=", DEC ADCInVal, "       ", 13, 10] ; Send text followed by carriage return and linefeed
        #ENDIF
     
    GOTO Main
    
    Do_ADC:
        PAUSEUS 50              ' Wait for A/D channel acquisition time
        ADCON0.1 = 1            ' Start conversion
        
        WHILE ADCON0.1          ' Wait for it to complete
        WEND
    
        ADCInVal = ADRESH
    return

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    the voltage to the pot is probably fluxuating small amount....... add a good size cap to wiper arm (1 microfarad +-) to smooth voltage.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,390


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    for what its worth I tried your code cleaned up a bit and slightly changed to suit a 16f1825
    and it works perfectly with nice steady results , could you have a noisy pot or power supply ?


    Code:
    '****************************************************************
    '*  Name    : Nacelle_Steady-On_Lights_12F1840_16Mhz_Int.pbp    *
    '*  Author  : Ross A. Waddell                                   *
    '*  Notice  : Copyright (c) 2016                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 02/02/2016                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : Steady-on nacelle engine lights (TOS Enterprise)  *
    '*          :                                                   *
    '****************************************************************
    #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF            
    #ENDCONFIG
     
    OSCCON=$70 
    DEFINE OSC 32
    
    ANSELA    = %00001000        ; Analog on PORTA.4(AN3) only
    
    ADCON1    = %10100000        ; Right-justified results in 10-bits; Fosc/32 as timer;
                                 ; VREF is connected to VDD
    
    TRISA     = %111110	     ' Make all pins input except for RA0 (ser out)
    trisc=   %11011111                            '  ccp1
    
    ADCInVal       VAR WORD      ; stores ADCIN result read from trim pot
    LEDBrVal       VAR WORD
    FadeInPause    CON 25        ; Pause during LED fade in
    
    i              VAR WORD
    
    ' ***************************************************************
    ' Set up PWM on CCP1
    ' ***************************************************************
    
    CCP1CON = %00001100          ; Use CCP1 in PWM mode
    
    ' Set duty cycle registers initially to 0
    CCP1CON.4 = 0
    CCP1CON.5 = 0
    CCPR1L    = 0
     lata.0=1
     pause 2000
    ' ************************
    ' CCP1 uses TMR2
    ' ************************
                           
    T2CON   = %00000110         ; Timer2 on with 1:16 prescaler
    PR2     = 255               ; For 16Mhz OSC the desired output freq of 976.563Hz
                                ; is achieved with this PR2 value (10-bit resolution
                                ; with 1:16 prescaler)
                                
    MaxDuty       VAR WORD      ; According to Darrel:
                                ;   MaxDuty = (PR2 + 1) * 4
    
    MaxDuty = (PR2 + 1) * 4     ; 1024
    MinDuty       CON 0         ; Minimum brightness for this application
    MaxADCVal     CON 1023      ; 255 for 8-bit; 1023 for 10-bit
    compVal       VAR WORD      ; stores last-changed ADC value
    
    
    CounterA      var BYTE		' Just a BYTE Temporary working variable
    DataW         var WORD		' Just a WORD Temporary working variable
    RawData       var WORD [16]	' Array holding ADC Result
    
    
     serout2 PORTA.0,84, ["ready",13,10 ]
    
    
    
    GOSUB DO_ADCIN_Chk
    LEDBrVal = ADCInVal
    compVal = LEDBrVal
    
    FOR i = 0 to LEDBrVal
        CCP1CON.4 = i.0
        CCP1CON.5 = i.1
        CCPR1L    = i >> 2 
                
        pause FadeInPause
    
      
    NEXT i
    
    
    Main:
        GOSUB DO_ADCIN_Chk
        PAUSE 100
    
        IF ADCInVal <> compVal THEN
        
            LEDBrVal = ADCInVal
            compVal = LEDBrVal
            gosub ChngLEDBrightness
        ENDIF
    GOTO Main
    
    '*********** Read ADC or USART Rc inputs *******************************
    Do_ADCIN_Chk:
    '	Stuff 16 Element WORD Array full of ADC values
    '	----------------------------------------------
    	For CounterA=0 to 15
            ADCON0    = %00001101 ' Select Channe3, Turn-On A/D
    	
    		Pauseus 50			     ' Wait for channel to setup
            ADCON0.1 = 1			 ' Start conversion
    		While ADCON0.1=1:Wend	 ' Wait for conversion
    		DataW.HighByte=ADRESH	 ' Read variable from ADC and save
    		DataW.LowByte=ADRESL
    		RawData(CounterA)=DataW
    	Next CounterA
    
    '	Sort ADC Input
    '	--------------
    	CounterA=0
        GetADCSortLoop:
    	If RawData(CounterA+1) < RawData(CounterA) then
    		DataW=RawData(CounterA)
    		RawData(CounterA)=RawData(CounterA+1)
    		RawData(CounterA+1)=DataW
    		If CounterA>0 then CounterA=CounterA-2
    	endif
    	CounterA=CounterA+1
    	If CounterA < 15 then goto GetADCSortLoop
    
    '	Quanticise, discarding top and bottom FOUR elements
    '	----------------------------------------------------
    	DataW=0
    	For CounterA=4 to 11
    		DataW=DataW+RawData(CounterA)
    	Next CounterA
    	ADCInVal=DataW>>3			' Divide Result by EIGHT
    
         serout2 PORTA.0,84, ["adc ",#ADCInVal,13,10 ]
    
    return
    
    
    '*********** Set duty registers ****************************************
    ChngLEDBrightness:
        CCP1CON.4 = LEDBrVal.0
        CCP1CON.5 = LEDBrVal.1
        CCPR1L    = LEDBrVal >> 2
        
    RETURN

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: Scaling ADC Result to a Set Range

    Quote Originally Posted by richard View Post
    for what its worth I tried your code cleaned up a bit and slightly changed to suit a 16f1825
    and it works perfectly with nice steady results , could you have a noisy pot or power supply ?


    Code:
    '****************************************************************
    '*  Name    : Nacelle_Steady-On_Lights_12F1840_16Mhz_Int.pbp    *
    '*  Author  : Ross A. Waddell                                   *
    '*  Notice  : Copyright (c) 2016                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 02/02/2016                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : Steady-on nacelle engine lights (TOS Enterprise)  *
    '*          :                                                   *
    '****************************************************************
    #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF            
    #ENDCONFIG
     
    OSCCON=$70 
    DEFINE OSC 32
    
    ANSELA    = %00001000        ; Analog on PORTA.4(AN3) only
    
    ADCON1    = %10100000        ; Right-justified results in 10-bits; Fosc/32 as timer;
                                 ; VREF is connected to VDD
    
    TRISA     = %111110	     ' Make all pins input except for RA0 (ser out)
    trisc=   %11011111                            '  ccp1
    
    ADCInVal       VAR WORD      ; stores ADCIN result read from trim pot
    LEDBrVal       VAR WORD
    FadeInPause    CON 25        ; Pause during LED fade in
    
    i              VAR WORD
    
    ' ***************************************************************
    ' Set up PWM on CCP1
    ' ***************************************************************
    
    CCP1CON = %00001100          ; Use CCP1 in PWM mode
    
    ' Set duty cycle registers initially to 0
    CCP1CON.4 = 0
    CCP1CON.5 = 0
    CCPR1L    = 0
     lata.0=1
     pause 2000
    ' ************************
    ' CCP1 uses TMR2
    ' ************************
                           
    T2CON   = %00000110         ; Timer2 on with 1:16 prescaler
    PR2     = 255               ; For 16Mhz OSC the desired output freq of 976.563Hz
                                ; is achieved with this PR2 value (10-bit resolution
                                ; with 1:16 prescaler)
                                
    MaxDuty       VAR WORD      ; According to Darrel:
                                ;   MaxDuty = (PR2 + 1) * 4
    
    MaxDuty = (PR2 + 1) * 4     ; 1024
    MinDuty       CON 0         ; Minimum brightness for this application
    MaxADCVal     CON 1023      ; 255 for 8-bit; 1023 for 10-bit
    compVal       VAR WORD      ; stores last-changed ADC value
    
    
    CounterA      var BYTE		' Just a BYTE Temporary working variable
    DataW         var WORD		' Just a WORD Temporary working variable
    RawData       var WORD [16]	' Array holding ADC Result
    
    
     serout2 PORTA.0,84, ["ready",13,10 ]
    
    
    
    GOSUB DO_ADCIN_Chk
    LEDBrVal = ADCInVal
    compVal = LEDBrVal
    
    FOR i = 0 to LEDBrVal
        CCP1CON.4 = i.0
        CCP1CON.5 = i.1
        CCPR1L    = i >> 2 
                
        pause FadeInPause
    
      
    NEXT i
    
    
    Main:
        GOSUB DO_ADCIN_Chk
        PAUSE 100
    
        IF ADCInVal <> compVal THEN
        
            LEDBrVal = ADCInVal
            compVal = LEDBrVal
            gosub ChngLEDBrightness
        ENDIF
    GOTO Main
    
    '*********** Read ADC or USART Rc inputs *******************************
    Do_ADCIN_Chk:
    '	Stuff 16 Element WORD Array full of ADC values
    '	----------------------------------------------
    	For CounterA=0 to 15
            ADCON0    = %00001101 ' Select Channe3, Turn-On A/D
    	
    		Pauseus 50			     ' Wait for channel to setup
            ADCON0.1 = 1			 ' Start conversion
    		While ADCON0.1=1:Wend	 ' Wait for conversion
    		DataW.HighByte=ADRESH	 ' Read variable from ADC and save
    		DataW.LowByte=ADRESL
    		RawData(CounterA)=DataW
    	Next CounterA
    
    '	Sort ADC Input
    '	--------------
    	CounterA=0
        GetADCSortLoop:
    	If RawData(CounterA+1) < RawData(CounterA) then
    		DataW=RawData(CounterA)
    		RawData(CounterA)=RawData(CounterA+1)
    		RawData(CounterA+1)=DataW
    		If CounterA>0 then CounterA=CounterA-2
    	endif
    	CounterA=CounterA+1
    	If CounterA < 15 then goto GetADCSortLoop
    
    '	Quanticise, discarding top and bottom FOUR elements
    '	----------------------------------------------------
    	DataW=0
    	For CounterA=4 to 11
    		DataW=DataW+RawData(CounterA)
    	Next CounterA
    	ADCInVal=DataW>>3			' Divide Result by EIGHT
    
         serout2 PORTA.0,84, ["adc ",#ADCInVal,13,10 ]
    
    return
    
    
    '*********** Set duty registers ****************************************
    ChngLEDBrightness:
        CCP1CON.4 = LEDBrVal.0
        CCP1CON.5 = LEDBrVal.1
        CCPR1L    = LEDBrVal >> 2
        
    RETURN
    The 5V voltage regulator is a linear switching one from Pololu and the voltmeter output looks rock solid. It could be the pot, though - it's a sliding one from Sparkfun. i'll try with a traditional trim pot and see if it behaves any different.

    EDIT: just tried a trim pot that has previously worked fine and the same thing is happening. Am I doing anything wrong with the 10-bit ADC aspect? Could it be the PIC itself?
    Last edited by RossWaddell; - 18th February 2016 at 02:11.

Similar Threads

  1. Replies: 4
    Last Post: - 27th January 2015, 15:34
  2. Replies: 4
    Last Post: - 30th May 2012, 08:28
  3. Converting 10bit ADC result to 8 bit
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 5th March 2012, 20:38
  4. strange A2D 5V scaling result - 16F819
    By Max Power in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th April 2010, 02:28
  5. Scaling ADC values
    By purkolator in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th November 2007, 05:14

Members who have read this thread : 1

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