fix cc mode

This commit is contained in:
YiChin
2020-06-01 16:09:32 +08:00
parent 5c949be67c
commit 653c2059e2
4 changed files with 14 additions and 12 deletions
@@ -231,9 +231,9 @@ static void CC_Vscan(CCMode *CC){
deltaV = -1 * (deltaI / 1000); //-5 * deltaI / 5000 //pV=> 5nV
Vset = Vset + deltaV; //[5nV]
if((CC->Charge == 0) && (Vset <= Vmin)){
if(Vset <= Vmin){
Vset = Vmin;
}else if((CC->Charge == 1) && (Vset >= Vmax)){
}else if(Vset >= Vmax){
Vset = Vmax;
}
}
@@ -244,9 +244,9 @@ static void CC_Vscan(CCMode *CC){
deltaV = -1 * (deltaI / 1000); //-5 * deltaI / 5000 //pV=> 5nV
Vset = Vset + deltaV; //[5nV]
if((CC->Charge == 0) && (Vset <= Vmin)){
if(Vset <= Vmin){
Vset = Vmin;
}else if((CC->Charge == 1) && (Vset >= Vmax)){
}else if(Vset >= Vmax){
Vset = Vmax;
}
}
@@ -375,8 +375,8 @@ CCMode * InitCCMode(){
ret->Done = 0;
ret->value = INSTRUCTION.ConstantCurrent;
ret->VMax = INSTRUCTION.VoltLimit + DAC_ZERO;
ret->VMin = DAC_ZERO - INSTRUCTION.VoltLimit;
ret->VMax = INSTRUCTION.MaxVolt;
ret->VMin = INSTRUCTION.MinVolt;
ret->_Transform2RealnA = &_Transform2RealnA;
ret->MeasureVolt = 0;
ret->Vset = 0;
@@ -5,8 +5,8 @@
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 6
#define VERSION_DATE_DAY 1
#define VERSION_DATE_HOUR 12
#define VERSION_DATE_MINUTE 47
#define VERSION_DATE_HOUR 16
#define VERSION_DATE_MINUTE 9
// this is NOT the version hash !!
// it's the last version hash
@@ -954,8 +954,9 @@ static void update_ZM_instruction(uint8 *ins) {
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
INSTRUCTION.SampleRate = 15;
INSTRUCTION.Charge = ins[3]; //0:discharge 1:charge
INSTRUCTION.VoltLimit = ((uint16_t) ins[4] << 8) | ((uint16_t) ins[5]);
INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[6])<<24 | (uint32_t) (ins[7])<<16 | (uint32_t) (ins[8])<<8 | (uint32_t) (ins[9]) );
INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[4])<<24 | (uint32_t) (ins[5])<<16 | (uint32_t) (ins[6])<<8 | (uint32_t) (ins[7]) );
INSTRUCTION.MaxVolt = ((uint16_t) ins[8] << 8) | ((uint16_t) ins[9]);
INSTRUCTION.MinVolt = ((uint16_t) ins[10] << 8) | ((uint16_t) ins[11]);
INSTRUCTION.NotifyRate = 1000;
/*******************************************************
@@ -1216,9 +1217,10 @@ static void update_ZM_instruction(uint8 *ins) {
case VIS_CC_ZERO:{
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
INSTRUCTION.SampleRate = 15;
INSTRUCTION.Charge = 0x00;
INSTRUCTION.VoltLimit = 0x61A8;
INSTRUCTION.Charge = 0x01;
INSTRUCTION.ConstantCurrent = 0x00;
INSTRUCTION.MaxVolt = 0xC350;
INSTRUCTION.MinVolt = 0x0000;
INSTRUCTION.NotifyRate = 1000;
// uint8 *ins;