2025-12-30 07:21:11 +00:00
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
#include "stdbool.h"
|
|
|
|
|
|
#include "cmsis_os.h"
|
|
|
|
|
|
//extern void delay_us(uint32_t us);
|
|
|
|
|
|
#include "stdlib.h"
|
|
|
|
|
|
#include "math.h"
|
2026-03-17 02:35:31 +00:00
|
|
|
|
#include "stdio.h"
|
|
|
|
|
|
#include "string.h "
|
2025-12-30 07:21:11 +00:00
|
|
|
|
//#include "MBM.H"
|
2026-03-17 02:35:31 +00:00
|
|
|
|
|
|
|
|
|
|
//#define DebugLog
|
|
|
|
|
|
#ifdef DebugLog
|
|
|
|
|
|
#define Debuglog(format, ...) \
|
|
|
|
|
|
printf("[%s:%d->%s] " format"\r\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__)
|
|
|
|
|
|
#else
|
|
|
|
|
|
#define Debuglog(format, ...)
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#define VOFA
|
|
|
|
|
|
#ifdef VOFA
|
|
|
|
|
|
#define pfp(format, ...) \
|
|
|
|
|
|
printf(format, ##__VA_ARGS__)
|
|
|
|
|
|
#else
|
|
|
|
|
|
#define pfp(info)
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define Typestr(format, ...) \
|
|
|
|
|
|
sprintf(StateString,format"/0", ##__VA_ARGS__ );
|
|
|
|
|
|
|
|
|
|
|
|
extern char StateString[40];
|
|
|
|
|
|
|
|
|
|
|
|
extern osSemaphoreId ArmRunFinish;
|
|
|
|
|
|
extern osSemaphoreId SampleRunFinish;
|
|
|
|
|
|
|
2025-12-30 07:21:11 +00:00
|
|
|
|
extern void MAX6675_Init(void);
|
|
|
|
|
|
extern void BIOS_GPIO_Init( void );
|
|
|
|
|
|
extern void BIOS_TIM8_Init( void );
|
|
|
|
|
|
extern void BIOS_TIM5_Init( void );
|
|
|
|
|
|
extern void USARTHMIInit( void );
|
|
|
|
|
|
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern void TIM3_CH1_CTRL(uint16_t ARRValue, uint16_t CCRValue );
|
|
|
|
|
|
extern void TIM3_CH1_CMD( _Bool CMD );
|
|
|
|
|
|
extern void TIM3_CH1_DIR( _Bool CMD );
|
2025-12-30 07:21:11 +00:00
|
|
|
|
extern void TIM3_IECMD( _Bool CMD );
|
|
|
|
|
|
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern void TIM2_CH2_CTRL(uint16_t ARRValue, uint16_t CCRValue );
|
|
|
|
|
|
extern void TIM2_CH2_CMD( _Bool CMD );
|
|
|
|
|
|
extern void TIM2_CH2_DIR( _Bool CMD );
|
|
|
|
|
|
extern void TIM2_IECMD( _Bool CMD );
|
|
|
|
|
|
|
|
|
|
|
|
extern void TIM5_CH3_CTRL(uint16_t ARRValue, uint16_t CCRValue );
|
|
|
|
|
|
extern void TIM5_CH3_CMD( _Bool CMD );
|
|
|
|
|
|
extern void TIM5_CH3_DIR( _Bool CMD );
|
|
|
|
|
|
extern void TIM5_IECMD( _Bool CMD );
|
2025-12-30 07:21:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum enumPumpSelect
|
|
|
|
|
|
{
|
|
|
|
|
|
M1 = 0,
|
|
|
|
|
|
M2,
|
|
|
|
|
|
M3,
|
|
|
|
|
|
M4,
|
|
|
|
|
|
M5,
|
|
|
|
|
|
M6,
|
|
|
|
|
|
M7,
|
|
|
|
|
|
pumpMax
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
extern enum enumPumpSelect PumpSelect[pumpMax];
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern void MODBUS_Init( uint8_t MBAddress );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern float SpeedSet[pumpMax]; // <09><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>p/s
|
|
|
|
|
|
extern int32_t CoordinateSet[pumpMax]; // Ŀ<><C4BF>λ<EFBFBD><CEBB>
|
|
|
|
|
|
extern _Bool TaskisRunning[pumpMax]; // <09><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
|
extern _Bool IdelEn[pumpMax]; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
|
|
|
|
|
|
2025-12-30 07:21:11 +00:00
|
|
|
|
extern volatile uint32_t PluseCount[7u]; //
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern int32_t CoordinatePosition[pumpMax]; // ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>ʵʱλ<CAB1><CEBB>
|
|
|
|
|
|
|
2025-12-30 07:21:11 +00:00
|
|
|
|
extern void SolidValve_H2SO4( uint8_t channel, _Bool state );
|
|
|
|
|
|
extern void AirValve_Pump(_Bool state);
|
|
|
|
|
|
extern void StandardValve_Pump( _Bool state);
|
|
|
|
|
|
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern void MotorZero_Init( enum enumPumpSelect Select);
|
2025-12-30 07:21:11 +00:00
|
|
|
|
extern void MotorCTRLInitiate( void );
|
2026-03-17 02:35:31 +00:00
|
|
|
|
extern _Bool FindZero[pumpMax];
|
2025-12-30 07:21:11 +00:00
|
|
|
|
|
|
|
|
|
|
extern float Temperature[6];
|
|
|
|
|
|
#include "stdio.h"
|
|
|
|
|
|
#include "string.h"
|
|
|
|
|
|
#include "math.h"
|
|
|
|
|
|
extern void DataPrint(uint8_t *buf, uint8_t len);
|
|
|
|
|
|
extern osSemaphoreId semDataBack;
|
|
|
|
|
|
extern uint8_t DataInbuf[60u];
|
|
|
|
|
|
|
|
|
|
|
|
struct Pset {
|
|
|
|
|
|
uint16_t CRC_Head; // CRCУ<43><D0A3>ͷ
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t PowerSet[6];
|
|
|
|
|
|
uint16_t HeatTimeSet[6];
|
|
|
|
|
|
uint16_t LimitTemp[6];
|
|
|
|
|
|
int16_t PowerComp[6];
|
|
|
|
|
|
uint16_t AirTimeOutSet;
|
|
|
|
|
|
uint16_t WashTimeOutSet;
|
|
|
|
|
|
uint16_t WeightSet[6];
|
|
|
|
|
|
float WeightComp[6];
|
|
|
|
|
|
float WeightSlopeSet[6];
|
|
|
|
|
|
float H2SO4SlopeSet[6];
|
|
|
|
|
|
uint16_t CRC_Tail; // CRCУ<43><D0A3>β
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern struct Pset Set;
|
|
|
|
|
|
extern void FM24Init(void);
|
|
|
|
|
|
extern void FM24_Write(uint16_t addr, uint8_t *data, uint8_t len);
|
|
|
|
|
|
extern void FM24_Read(uint16_t addr, uint8_t *data, uint8_t len);
|
|
|
|
|
|
#define RW_Set 0x0200u
|
|
|
|
|
|
#define CRCHead 0xAA55u
|
|
|
|
|
|
#define CRCEnd 0x5AA5u
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|