00001
00026
00027
00028 #define SMBvariables SV.SMBvar
00029 #define SMBvar_int SV.SMBint
00030
00031
00032
00033
00034 #define HOST_ADDR 0x10
00035 #define CHARGER_ADDR 0x12
00036 #define BATTERY_ADDR 0x16
00037
00038
00039
00040 #define SMB_M_CMD_CHARGINGCURRENT 0x14
00041 #define SMB_M_CMD_CHARGINGVOLTAGE 0x15
00042
00043
00044 #define SMB_M_CMD_ALARMWARNING 0x16
00045
00046
00047
00048 #define SMBV_MfrAccess 0
00049 #define SMBV_RemCapAlm 1
00050 #define SMBV_RemTimeAlm 2
00051 #define SMBV_BattMode 3
00052 #define SMBV_AtRate 4
00053 #define SMBV_AtRateTTF 5
00054 #define SMBV_AtRateTTE 6
00055 #define SMBV_AtRateOK 7
00056
00057 #define SMBV_Temperature 8
00058 #define SMBV_Voltage 9
00059 #define SMBV_Current 10
00060 #define SMBV_AvgCurrent 11
00061 #define SMBV_MaxError 12
00062 #define SMBV_RelSOC 13
00063 #define SMBV_AbsSOC 14
00064 #define SMBV_RemCap 15
00065
00066 #define SMBV_FullChgCap 16
00067 #define SMBV_RunTTE 17
00068 #define SMBV_AvgTTE 18
00069 #define SMBV_AvgTTF 19
00070 #define SMBV_ChgCurrent 20
00071 #define SMBV_ChgVoltage 21
00072 #define SMBV_BattStatus 22
00073 #define SMBV_CycleCount 23
00074
00075 #define SMBV_DesignCap 24
00076 #define SMBV_DesignVolt 25
00077 #define SMBV_SpecInfo 26
00078 #define SMBV_MfrDate 27
00079 #define SMBV_SerialNo 28
00080
00081 #define SMBV_MfrName 32
00082 #define SMBV_DeviceName 33
00083 #define SMBV_DeviceChem 34
00084 #define SMBV_MfrData 35
00085 #define SMBV_Opt5 0x2F
00086 #define SMBV_Opt4 0x3C
00087 #define SMBV_Opt3 0x3D
00088 #define SMBV_Opt2 0x3E
00089 #define SMBV_Opt1 0x3F
00090
00091
00092
00093
00094 #define lobyte 0
00095 #define hibyte 1
00096
00097
00098
00099 #define TWRX_BLKCNT 2
00100 #define TWRX_CMD 3
00101 #define TWRX_MEM 4
00102 #define TWRX_OFFSET 5
00103 #define TWRX_LOADDR 6
00104 #define TWRX_HIADDR 7
00105 #define TWRX_SIZE 8
00106 #define TWRX_DATA 9
00107
00108
00109
00110
00111
00112
00113 #define CHARGE_CONTROLLER_ENABLED 0x01
00114 #define PRIMARY_BATTERY 0x02
00115 #define ALARM_MODE 0x20
00116 #define CHARGER_MODE 0x40
00117 #define CAPACITY_MODE 0x80
00118
00119
00120 #define INTERNAL_CHARGE_CONTROLLER 0x01
00121 #define PRIMARY_BATTERY_SUPPORT 0x02
00122 #define CONDITION_FLAG 0x80
00123
00124
00125
00126
00127
00128
00129
00130 #define OVER_CHARGED_ALARM 0x80
00131 #define TERMINATE_CHARGE_ALARM 0x40
00132 #define OVER_TEMP_ALARM 0x10
00133 #define TERMINATE_DISCHARGE_ALARM 0x08
00134 #define REMAINING_CAPACITY_ALARM 0x02
00135 #define REMAINING_TIME_ALARM 0x01
00136
00137
00138
00139 #define INITIALIZED 0x80
00140 #define DISCHARGING 0x40
00141 #define FULLY_CHARGED 0x20
00142 #define FULLY_DISCHARGED 0x10
00143
00144
00145 #define SMBerr_OK 0x00 // r/w The Smart Battery processed the function code without detecting any errors.
00146 #define SMBerr_Busy 0x01 // r/w The Smart Battery is unable to process the function code at this time.
00147 #define SMBerr_ReservedCommand 0x02 // r/w The Smart Battery detected an attempt to read or write to a function code
00148
00149
00150 #define SMBerr_UnsuptdCommand 0x03 // r/w The Smart Battery does not support this function code which is
00151
00152 #define SMBerr_AccessDenied 0x04 // w The Smart Battery detected an attempt to write to a read-only function code.
00153 #define SMBerr_OverUnderflow 0x05 // r/w The Smart Battery detected a data overflow or under flow.
00154 #define SMBerr_BadSize 0x06 // w The Smart Battery detected an attempt to write to a function code with
00155
00156 #define SMBerr_UnknownError 0x07 // r/w The Smart Battery detected an unidentifiable error.
00157