@Klebwax:
Da freut man sich natürlich über die positive Rückmeldung, vielen Dank:

Ich habe deine Idee mal umgesetzt:

Code:
/* 
  File:   main.c
  Date:   11.05.2020
  Author: Bernd Sirozynski
 
  Idee von Klebwax umgesetzt:
   
 */


// PIC10F322 Configuration Bit Settings

// 'C' source line config statements

// CONFIG
#pragma config FOSC = INTOSC    // Oscillator Selection bits (INTOSC oscillator: CLKIN function disabled)
#pragma config BOREN = OFF      // Brown-out Reset Enable (Brown-out Reset disabled)
#pragma config WDTE = OFF       // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = ON       // Power-up Timer Enable bit (PWRT enabled)
#pragma config MCLRE = OFF      // MCLR Pin Function Select bit (MCLR pin function is digital input, MCLR internally tied to VDD)
#pragma config CP = OFF         // Code Protection bit (Program memory code protection is disabled)
#pragma config LVP = OFF        // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming)
#pragma config LPBOR = OFF      // Brown-out Reset Selection bits (BOR disabled)
#pragma config BORV = LO        // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config WRT = OFF        // Flash Memory Self-Write Protection (Write protection off)

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

#include <xc.h>

typedef unsigned short U16;   /* 16 Bit ohne Vorzeichen */
typedef unsigned long  U32;   /* 32 Bit ohne Vorzeichen */

// LED 1 connected to pin RA0
#define LED1_ON  LATA0=1 
#define LED1_OFF LATA0=0

// LED 2 connected to pin RA1
#define LED2_ON  LATA1=1 
#define LED2_OFF LATA1=0

U32 value;       // wird zur Berechnung benötigt 32 Bit Wert
U16 mV_Value;    // umgerechneter Wert in Millivolt

void main(void) 
{ 
  TRISA = 0x00;   /* all pins to output */ 
  
  // internal fixed voltage reference
  // set first the FREN Bit before changing the gain bits
  // see errata sheet
  FVREN = 1;  // Fixed Voltage Reference is enabled
  
  ADFVR1=1;  // set 2,048 Volt Reference
  
  // init the ADC
  ADCON = (0x07 << 5)  // conversion clock =FOSC/64
        + (0x07 << 2)  // select Fixed Voltage Reference  
        + (0x01 << 0); // ADC enable
   
    
  nWPUEN = 0;    // enable global pullups 
  WPUA   = 8;    // pullup only on RA3/MCLR
  
  while (1)
  {
        
    GO_nDONE = 1;       // start ADU conversion 
    while (GO_nDONE) ;  // wait until adu ready
  
    value  = (U32)(2048) << 8;    // constant 32 Bit = 524.288
    value /= ADRES;               // durch den ADU Wert teilen
    mV_Value = (U16)value;        

    // Auswertung der LiPo Spannung
    if (mV_Value < 3000) // kleiner 3 Volt
    {
      LED1_OFF;
      LED2_OFF;
    } else if (mV_Value < 4200)  // grosser 3 Volt aber kleiner 4,2 Volt
    {
      LED1_ON;
      LED2_OFF;
    } else  // >= 4,2 Volt
    {
      LED1_ON;
      LED2_ON;
    }

  } // while 

} // main