Hi guys well had some time to continue with this , changes to proposed cct are the voltage small in that the voltage divider has 27k to supply and 15k to ground to give voltage in to porta.0 of 2.8 - 1.4v , and languer was right in that a 150R for R12 was need to to be able to drive to ground to fully turn on the Pch mosfet

Problem is setup the ACD section for the 16F1825/29 chips and are not sure if i am doing it correctly , and have gone on what i read in the chip data

Also i not sure what results i should get when looking at the value it reads and how it relates so some help with how it is calculated

As can be seen from the code comments for each part this is what i am expecting
at the moment my debug write result to eeprom is giving a value of 3 ?? so something is not right

cheers

Sheldon

Code:
' ---------- Gets a Voltage reading on Port1.0 --------- 
 
 ' Note:  - Application circuit has a 3.3v voltage reg fitted so could use VDD as Vref in ASCON1 register
 '        - have used the ADC Fixed Voltage Ref Modual in 16F1825.
 '        - PortA.0 ia also used as Digital Output of Power LED active low via Pch - Mosfet
 '        - Supply Voltage input range is 8.1V - 3.5V to Voltage divider ( Vsupply --> 27k -|- 15K -- GND)  giving ADC input on PORTA.0 = 2.8 - 1.4V
 '                                                                       (                PortA.0        )
 
 Get_volts :
  
  ADCON0 =  %00000001           ' bit 7 -N/A , Bit 6-2 = ADC chan Sel /Tempature output /FVR output = AN0 sel = 00000 ,
                                ' Bit 1 - Go/_done status flag - 1 = Go do ADC / 0 = Done ADC , Bit 0 = Enable ADC = 1  / 0 = Disable ADC
  
  ADCON1 =  %10100011           ' bit 7 = 1 ADFM ( ADRESH, ADRESL - right justify ).Bit 6-4 ADCS = 010 - Fosc/32 conversion clock 
                                ' Bit3 - N/A , Bit2 = 0 (Vref- is connected to Vss) , Bit1-0 = 11 - Vref+ connected to FVR Modual 
  
  FVRCON  = %10000010           ' Bit 7 =1 enable Fixed Voltage Ref Modual, Bit 6 = VRef ready bit =1 always ok on 16F1825, Bit 5 - Temp indicator 1= enable/0 = disable
                                ' Bit 4 = Temp Indicator Range Sel 0=Vout -Low range / 1= Vout -High range , Bit 3-2 = 00( DAC Fixed volt sel )
                                ' Bit 1-0 = 10 - ADC Fixed Vref of 2.048v
  
  pauseus 10                    ' allow Vref to stablise - ??? - not required for the 16F1825/29 ??                                   
  
  ANSELA =  %00000001           ' Set Port A.0 - Analoge I/O  , 0 = Digital  1 = Analog
  TRISA  =  %00001001           ' setup Port A.0 input=1,output=0 for I/O pins ( Note RA3 - is input only (digital)- refer spec)
  
  adcin  0, ADval               ' Read PortA.0 value into variable , this applies the fixed voltage ref (via ADCON0,ADCON1,FVRCON)
                                ' to comparitor and ADC pin selected and gives result   ???
  
   write $01 ,ADval.byte0       ' debug of voltage measurement - lower byte 
   write $02 ,ADval.byte1       ' debug of voltage measurement - upper byte 
   
     If ADval <= 1024 then      ' Have no idea of the value its going to get ??  , but if below value of 1.6V ( 4.5v Vsupply) then set Power low values
           Pulse_off  = 500     ' Set Pulse_off duration to 500us to signal power low to IR_RX 
           Flash_rate =  10     ' Set Power Led toggle to fast rate to show low power  
        Else 
           Pulse_off  = 276     ' Set Pulse_off duration to 300us( adj) to signal NOT power low to IR_RX 
           Flash_rate = 100     ' Set Power Led toggle to Normal rate to show NOT low power   
     endif   
      
                                ' Restore PortA.0 to digital . ACD OFF etc 
   ADCON0 =  %00000000          ' Set ADC to Disable  - Bit 0 = Enable ADC = 1  / 0 = Disable ADC
   ANSELA =  %00000000          ' Set Port A.0 = 0 Digital, 0 = Digital  1 = Analog
   TRISA  =  %00001000          ' setup Port A.0 input=1,output=0 for I/O pins ( Note RA3 - is input only (digital)- refer spec) 
 
 return