ML5238

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main_def.h Source File

main_def.h

00001 /*****************************************************************************
00002     main_def.h
00003 
00004     Copyright (C) 2013 LAPIS Semiconductor Co., Ltd.
00005     All rights reserved.
00006 
00007     LAPIS Semiconductor shall not be liable for any direct, indirect, 
00008     consequential or incidental damages arising from using or modifying this 
00009     program.
00010 
00011     History
00012     2013.02.20  ver.3.00
00013     2012.11.20  ver.2.00
00014     2012.09.13  ver.1.00
00015 ******************************************************************************/
00016 #ifndef _MAIN_DEF_H_
00017 #define _MAIN_DEF_H_
00018 
00019 #define CELL_NUM_MAX                    (16u)
00020 #define THERMISTOR_NUM_MAX              (8u)
00021 #define T_END                           (85u+40u+1u)
00022 
00023 
00024 #define SET_FLAG        (0x01u)
00025 #define CLR_FLAG        (0x00u)
00026 
00027 #define ST_NORMAL                       (0x0000u)
00028 #define ST_OVRCHRG_VOL                  (0x0001u)
00029 #define ST_OVRDISCHRG_VOL               (0x0002u)
00030 #define ST_OVRCHRG_DISCHRG_VOL          (0x0004u)
00031 #define ST_SHORT_CUR                    (0x0008u)
00032 
00033 #define ST_CHRG_CUR                     (0x0010u)
00034 #define ST_DISCHRG_CUR                  (0x0020u)
00035 #define ST_OVRCHRG_CUR                  (0x0040u)
00036 #define ST_OVRDISCHRG_CUR               (0x0080u)
00037 
00038 #define ST_TOTAL_CHRG                   (0x0100u)
00039 #define ST_CELLDIFF_CHRG                (0x0200u)
00040 #define ST_PSAVE                        (0x0400u)
00041 #define ST_PDOWN                        (0x0800u)
00042 
00043 #define ST_UDR_TEMPE_CHRG               (0x1000u)
00044 #define ST_UDR_TEMPE_DISCHRG            (0x2000u)
00045 #define ST_OVR_TEMPE_CHRG               (0x4000u)
00046 #define ST_OVR_TEMPE_DISCHRG            (0x8000u)
00047 #define ST_TEMPE_DETECT                 (ST_OVR_TEMPE_DISCHRG|ST_UDR_TEMPE_DISCHRG)
00048 
00049 #define UART_SEND_BUF_SZ                (40u)
00050 
00051 #define STX (0x02u)
00052 
00053 #define MAIN_R_OK               (0)
00054 #define MAIN_R_ERR_PARAM        (-1)
00055 
00056 #define MAIN_EEPROM_ADR         (0x0200u)   //Top Addr
00057 #define MAIN_EEPROM_SIZE        (0x0060u)   //size of one data
00058 #define MAIN_EEPROM_TIMES_ADR   (0x002Cu)   //Times Addr
00059 #define MAIN_EEPROM_ENERGY_ADR  (0x0058u)   //Enegy Addr
00060 #define MAIN_EEPROM_PAGE_SIZE   (10u)
00061 
00062 #define GAIN10_SUB          (1u)            //(Vim1-Vim0)/VR-0.1
00063 #define GAIN50_SUB          (5u)            //(Vim1-Vim0)/VR-0.5
00064 #define GAIN10F             (100u-GAIN10_SUB)           //x10(Fixed)-0.1
00065 #define GAIN50F             (500u-GAIN50_SUB)           //x50(Fixed)-0.5
00066 
00067 #define ST_EEP_ABNRDATA     (2u)
00068 #define ST_EEP_ALL_ERASE    (1u)
00069 #define ST_EEP_OK           (0u)
00070 
00071 #define EEP_INS_ABNRDATA        ((unsigned char*)"x")
00072 #define EEP_INS_ALL_ERASE       ((unsigned char*)"y")
00073 #define EEP_INS_OK              ((unsigned char*)"z")                           //CopyParamEEPROM()= EEP_R_NODATA, EEP_R_DATADIFF, EEP_ALL_ERASE
00074 
00075 //using drv_ctrl_flag
00076 #define DRVST_ON_BIT    (0x80u)
00077 #define DRVST_OFF_BIT   (0x40u)
00078 
00079 #define VREF_VAL            (3300u)
00080 
00081 #endif /*_MAIN_DEF_H_*/