[update] fix CC mode

This commit is contained in:
Roy
2021-01-25 10:18:40 +08:00
parent 5cc2d878be
commit f151d5a74d
3 changed files with 24 additions and 4 deletions
@@ -23,7 +23,7 @@ static void CC_Vscan(void *WM){
Vset = 0;
if(CC->_charge == 0){
CC->_Iset *= -1;
CC->_Iset = INSTRUCTION.constantCurrent * 200 * (-1); //[50pA] //controller UI 15000uA => Elite 1500000 => 1500000 * 10 * 1000 / 50 [50pA];
}
Iin = CC->_measureCurrent * 20; //[50pA] nA => 50pA
@@ -45,6 +45,13 @@ static void CC_Vscan(void *WM){
Vset = Vset + deltaV; //[5nV]
if (Vset >= 1100000000) { // 5.5V
Vset = 1100000000;
} else if (Vset <= -1000000000) { //-5V
Vset = -1000000000;
}
if(Vset <= CC->_Vmin){
Vset = CC->_Vmin;
}else if(Vset >= CC->_Vmax){
@@ -72,6 +79,12 @@ static void CC_Vscan(void *WM){
Vset = Vset + deltaV; //[5nV]
if (Vset >= 1100000000) { // 5.5V
Vset = 1100000000;
} else if (Vset <= -1000000000) { //-5V
Vset = -1000000000;
}
if(Vset <= CC->_Vmin){
Vset = CC->_Vmin;
}else if(Vset >= CC->_Vmax){
@@ -19,6 +19,13 @@ static uint16_t OneWayVoltScan() {
Vout = Vout + DeltaVout;
}
if (Vout >= 1100000000) { //1100000000 = 5.5V
Vout = 1100000000;
} else if (Vout <= -1000000000) { //-1000000000 = -5V
Vout = -1000000000;
}
INSTRUCTION.VoltConstant = Vout / 40000 + 25000; //5nV=>usercode
DACOutCode = Usercode_Correction_to_DAC(INSTRUCTION.VoutGainLevel, INSTRUCTION.VoltConstant);
DAC_outputV(DACOutCode);
@@ -4,9 +4,9 @@
#define VERSION_DATE_YEAR 21
#define VERSION_DATE_MONTH 1
#define VERSION_DATE_DAY 5
#define VERSION_DATE_HOUR 11
#define VERSION_DATE_MINUTE 8
#define VERSION_DATE_DAY 25
#define VERSION_DATE_HOUR 10
#define VERSION_DATE_MINUTE 18
// this is NOT the version hash !!
// it's the last version hash