CPC Utility C

From LEXWiKi

Revision as of 13:45, 15 February 2022 by Nico (Talk | contribs)
Jump to: navigation, search

Contents

CPC Utility Download

Source file: CPC_Utility_C#_Src_x86 CPC_Utility_C#_Src_x64

Binary file: CPC_Utility_C#_Bin_x86 CPC_Utility_C#_Bin_x64

How to Use The Utility

CPC Utility Main Window

Image:Start.jpg

1. Setting Button
Open "Setting Window".
2. Battery Setting Button
Open "Battery Setting Window".
* Kindly notice that you have to set I2C Address in setting window before open battery setting window.
3. Recently Voltage Value
Utility will detect the recent voltage value and show in the edit box when start to monitor.
4. Period Voltage Value
Utility will detect and show the period voltage value when start "under low voltage detect". If "under low voltage detect" doesn't execute, period voltage value will be hidden.
5. Operation Mode
6. Battery Type
Show the battery type you set.
* If disable "under low voltage detect", battery type will be hidden.
7. Start Button
Press this button will start to monitor and show battery information on utility main window.
* Kindly notice that you have to set I2C Address in setting window before starting to monitor.


CPC Utility Setting Window

Image:Setting1.jpg

1. I2C Address
Default is "B6".
2. Submit Button
Press this button when finish selecting I2C address, then CPC Basic Setting section and CPC Monitor Setting section will be enable to set(like the picture below).



Image:CPCSetting2.jpg

3. Delay Main Power On
Set delay time which CPC turn on computer .
4. OS Delay Off
Set delay time which CPC turn off computer.
5. Main Power Delay
Set delay time of power supply after computer is turned off.
6. Load Default Button
Press thie button will load default value of CPC basic setting section.
* In CPC basic setting section, the initial value are read from registers.
7. Read Register Button
Press this button will read the value from register.
8. Set Button
Press this button to set when finish selecting what you want to set in CPC basic setting section. After press the button, CPC basic setting section will be disable.



Image:Setting3.jpg

9. Reset Button
Press the button to enable CPC basic setting section and set again.
10. Recent Battery Value Check Frequency
The value is check frequency when starting to monitor.
* The range of check frequency is between 5 to 60 seconds.
11. Start on Boot
If enable this function, the utility will execute when the OS boot.
12. Confirm Button
If finish to set CPC Monitor Setting section, press this button and the information will be set.
13. Cancel Button



CPC Utility Battery Setting Window

Image:BatteryUnderVoltageSetting1.jpg

1. Disable Under Low Voltage Detect
If select this option, you don't have to set other things in the battery setting window. Besides, Period Voltage and Battery Type are also be hidden in main window when starting to monitor.
2. Battery Type
3. Submit Button
If finish to select battery type, then press it to set and enable other options below(like the picture below).



Image:BatteryUnderVoltageSetting2.jpg

4. Battery Low Voltage
Set a voltage value as a criteria. If CPC detect the period voltage value is smaller than this criteria ten times, computer will be turned off.
5. ACC Active
Set time to detect under low voltage.
6. Under Low Voltage Warning
Show a warning message when period voltage is smaller than battery low voltage you set.
7. Read Register Button
Press this button will read the value from register
* In CPC battery setting window, the initial value are read from registers.
8. Confirm Button
If finish to set CPC Battery Setting section, press this button and the information will be set.
9. Cancel Button



Introdution(Part of Define const)

//Battery Type
public const Int32 Battery_12V = 0x11;
public const Int32 Battery_24V = 0x22;
public const Int32 Battery_None = 0xFF;
//ACC Status
public const Int32 ACC_Low = 0x11;
public const Int32 ACC_High = 0x22;

Introdution(Part of Setting)

  • Parts of yellow block in below tables are registers' default value.

Setting Main Power On

public static void SettingPowerOn(Int32 SlavAddr, Int32 bValue)
{
	bValue=OptionToASCII(bValue);
	WriteI2CByte(SlavAddr,0x12,bValue);
}

Image:Setting_Power_On.png

Setting OS Delay Off

public static void SettingOSDelayOff(Int32 SlavAddr, Int32 bValue)
{
    if(bValue==16)
        bValue=90;   //option of "infinite", have to write ascii code "Z" to register
    else
        bValue=OptionToASCII(bValue);
    WriteI2CByte(SlavAddr,0x15,bValue);
}

Image:OS_Delay_Off.png

Setting Power Off

public static void SettingPowerOff(Int32 SlavAddr, Int32 bValue)
{
    bValue=OptionToASCII(bValue);
    WriteI2CByte(SlavAddr,0x17,bValue);
}

Image:Main_Power_Off.png

Setting Low Voltage Level

public static void SettingLowVoltage(Int32 SlavAddr, Int32 bValue)
{
	bValue=OptionToASCII(bValue);
	WriteI2CByte(SlavAddr,0x19,bValue);
}

Image:Low_Voltage.png

Setting Battery Type

public static void SettingBatteryType(Int32 SlavAddr, Int32 bBatteryType)
{
	bBatteryType=(bBatteryType)?Define.Battery_24V:Define.Battery_12V;
	WriteI2CByte(SlavAddr,0x1A,bBatteryType);
}

Setting Low Voltage Detect

public static void SettingLowVoltDetect(Int32 SlavAddr, Int32 bAccStatus)
{
	bAccStatus=(bAccStatus)?Define.ACC_High:Define.ACC_Low;
	WriteI2CByte(SlavAddr,0x1B,bAccStatus);
}

Introdution(Part of Read)

Read Power On

public static Int32 ReadPowerOn(Int32 SlavAddr)
{
	int Data;

	Data=ReadI2CByte(SlavAddr,0x12);
	Data=ASCIIToOption(Data);

	return Data;
}

Image:Setting_Power_On.png

Read OS Delay Off

public static Int32 ReadOSDelayOff(Int32 SlavAddr)
{
    Int32 Data;
    Data = ReadI2CByte(SlavAddr, 0x15);
    if (Data == 90)
      Data = 16;     //option of infinite
    else
      Data = ASCIIToOption(Data);   //remove the option of A
   return Data;
}

Image:OS_Delay_Off.png

Read Power Off

public static Int32 ReadPowerOff(Int32 SlavAddr)
{
	int Data;
	Data=ReadI2CByte(SlavAddr,0x17);
	Data=ASCIIToOption(Data)-1;   //remove the option of A
	return Data;
}

Image:Main_Power_Off.png

Read Low Voltage

public static Int32 ReadLowVoltage(Int32 SlavAddr)
{
	int Data;
	Data=ReadI2CByte(SlavAddr,0x19);
	Data=ASCIIToOption(Data);
	return Data;
}

Image:Low_Voltage.png

Read Battery Type

public static Int32 ReadBatteryType(Int32 SlavAddr)
{
   Int32 iBatteryType;

   iBatteryType = ReadI2CByte(SlavAddr, 0x1A);
   switch (iBatteryType)
   {
      case Define.Battery_12V:
      {
         iBatteryType = Define.Option_12V;
         break;
      }
      case Define.Battery_24V:
      {
         iBatteryType = Define.Option_24V;
         break;
      }
      default:
      {
         iBatteryType = Define.Option_None;
         break;
      }
   }
   return iBatteryType;
}

ReadLowVoltDetectTiming

public static Int32 ReadLowVoltDetectTiming(Int32 SlavAddr)
{
	Int32 iAccStatus;
	iAccStatus=ReadI2CByte(SlavAddr,0x1B);
	iAccStatus=(iAccStatus==Define.ACC_Low)?0:1;

	return iAccStatus;
}

Convert Voltage

public static void VoltageConvert(ref float Voltage)
{
    Voltage=(float)((Voltage*4)/1023*3.3*10);
}

Read Instant AD Value

public static float ReadInstantADValue(Int32 SlavAddr)
{
	float Data;
	Data=(float)ReadI2CByte(SlavAddr,0x30);
	VoltageConvert(ref Data);
	return Data;
}

Read Period AD Value

public static float ReadPeriodADValue(Int32 SlavAddr)
{
	float Data;

	Data=(float)ReadI2CByte(SlavAddr,0x31);
	VoltageConvert(ref Data);
	return Data;
}

ReadOperationMode

public static Int32 ReadOperationMode(Int32 SlavAddr)   //ReadDIP_SWSetting bit1
{
	Int32 Data;

	Data=ReadI2CByte(SlavAddr,0x32);
	Data=(Data>>1) & 0x01;             //Auto mode: 0x0. Manual mode:0x1 

	return Data;
}

Read ACC Status

public static Int32 ReadAccStatus(Int32 SlavAddr)   //ReadDIP_SWSetting bit4
{
	Int32 Data;
	Data=ReadI2CByte(SlavAddr,0x32);
	Data=(Data>>4) & 0x01;            //ACC Low: 0x0. ACC High: 0x1

	return Data;
}
Personal tools