修复输出电平
This commit is contained in:
parent
e046637625
commit
0df7ea6350
@ -19,8 +19,8 @@ typedef enum
|
|||||||
|
|
||||||
#define IAP_ADDRESS 0x0000
|
#define IAP_ADDRESS 0x0000
|
||||||
|
|
||||||
#define LED_ON P16 = 1
|
#define LED_ON P16 = 0
|
||||||
#define LED_OFF P16 = 0
|
#define LED_OFF P16 = 1
|
||||||
|
|
||||||
#define WT_30M 0x80
|
#define WT_30M 0x80
|
||||||
#define WT_24M 0x81
|
#define WT_24M 0x81
|
||||||
@ -187,7 +187,7 @@ float xdata CurrentError = 0;
|
|||||||
float xdata AdjVoltage = 0; // 调节电压
|
float xdata AdjVoltage = 0; // 调节电压
|
||||||
float xdata CompensationValue = 0; // 补偿系数
|
float xdata CompensationValue = 0; // 补偿系数
|
||||||
float xdata OutGain = 0; // 输出增益调节
|
float xdata OutGain = 0; // 输出增益调节
|
||||||
|
float xdata LoadRes = 0;
|
||||||
// new
|
// new
|
||||||
OUTSTATE_t xdata OutPutState;
|
OUTSTATE_t xdata OutPutState;
|
||||||
unsigned int xdata InitTimeCnt,ErrTimeCnt;
|
unsigned int xdata InitTimeCnt,ErrTimeCnt;
|
||||||
@ -376,6 +376,7 @@ void OutPutCtrl(void)
|
|||||||
{
|
{
|
||||||
OutCurrent = 0;
|
OutCurrent = 0;
|
||||||
}
|
}
|
||||||
|
LoadRes = (float)OutVoltage / (OutCurrent/100);
|
||||||
if (OutCurrent > TargetCurrent + 10)
|
if (OutCurrent > TargetCurrent + 10)
|
||||||
{
|
{
|
||||||
if (OutputVol > 100)
|
if (OutputVol > 100)
|
||||||
@ -399,10 +400,10 @@ void OutPutCtrl(void)
|
|||||||
{
|
{
|
||||||
LED_OFF;
|
LED_OFF;
|
||||||
}
|
}
|
||||||
if (OutCurrent > 30000)
|
if (OutCurrent > 10000)
|
||||||
{
|
{
|
||||||
ErrTimeCnt++;
|
ErrTimeCnt++;
|
||||||
if (ErrTimeCnt > 50)//500ms
|
if (ErrTimeCnt > 10)//100ms
|
||||||
{
|
{
|
||||||
OutPutState = OUT_ERR;
|
OutPutState = OUT_ERR;
|
||||||
}
|
}
|
||||||
@ -1622,8 +1623,8 @@ void UartSendData(void)
|
|||||||
SendBuffer[0] = 0x55;
|
SendBuffer[0] = 0x55;
|
||||||
SendBuffer[1] = 0xAA;
|
SendBuffer[1] = 0xAA;
|
||||||
|
|
||||||
SendBuffer[2] = RunTime >> 8; // 运行时间H
|
SendBuffer[2] = (unsigned int)LoadRes >> 8; // 运行时间H
|
||||||
SendBuffer[3] = RunTime; // 运行时间L
|
SendBuffer[3] = (unsigned int)LoadRes; // 运行时间L
|
||||||
SendBuffer[4] = InitError >> 8; // 输入电压H
|
SendBuffer[4] = InitError >> 8; // 输入电压H
|
||||||
SendBuffer[5] = InitError; // 输入电压L
|
SendBuffer[5] = InitError; // 输入电压L
|
||||||
SendBuffer[6] = OutVoltage >> 8; // 输出电压H
|
SendBuffer[6] = OutVoltage >> 8; // 输出电压H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user