2025-09-28 09:17:22 +00:00
/**************** (C) COPYRIGHT 2023 ɽ<> <C9BD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܿƼ <DCBF> <C6BC> <EFBFBD> <EFBFBD> <EFBFBD> ˾ *******************
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : Kaiser
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ¼ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :
* <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef _APPDEF_H_
# define _APPDEF_H_
# include "BSP.H"
union floattouint16_t { // 32λ<32> <CEBB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> Ϊ16λ<36> <CEBB> <EFBFBD> <EFBFBD>
float f ;
uint32_t u32 ;
uint16_t u16 [ 2 ] ;
uint8_t u8 [ 4 ] ;
} ;
extern union floattouint16_t FtU ;
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern void
delay_us ( uint32_t us ) ;
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern void ModbusPoll ( const void * parg ) ;
extern void MODBUS_Init ( uint8_t MBAddress ) ;
extern uint16_t usRegInputBuf [ ] ;
extern uint16_t usRegHoldingBuf [ ] ;
extern uint8_t ucRegDiscBuf [ ] ;
extern uint8_t ucRegCoilsBuf [ ] ;
# define RegCoilsBufRead(addr) ((ucRegCoilsBuf[(addr) / 8u]) & (0x01 << ((addr) % 8)))
# define RegCoilsBufRst(addr) ((ucRegCoilsBuf[(addr) / 8u]) &= (~(0x01 << ((addr) % 8))))
# define RegCoilsBufSet(addr) ((ucRegCoilsBuf[(addr) / 8u]) |= (0x01 << ((addr) % 8)))
# define RegDiscBufRead(addr) ((ucRegCoilsBuf[(addr) / 8u]) & (0x01 << ((addr) % 8)))
# define RegDiscBufRst(addr) ((ucRegDiscBuf[(addr) / 8u]) &= (~(0x01 << ((addr) % 8))))
# define RegDiscBufSet(addr) ((ucRegDiscBuf[(addr) / 8u]) |= (0x01 << ((addr) % 8)))
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern void delay_us ( uint32_t us ) ;
2026-03-17 02:33:04 +00:00
2025-09-28 09:17:22 +00:00
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern void GPIO_InPutset ( void ) ;
extern uint8_t InstrumentTypeRead ( void ) ;
extern bool SafeCheck ( void ) ;
extern void INIT_CS555X ( void ) ;
extern void AD7190_Init ( void ) ;
extern void AD7190_ReadVoltage ( void ) ;
extern void WeightCtrl_Init ( void ) ;
2026-03-17 02:33:04 +00:00
extern uint8_t pageNum ;
2025-09-28 09:17:22 +00:00
struct uCalibrateWeight {
double WeightSlope ; // б <> <D0B1>
2026-03-17 02:33:04 +00:00
double WeightZero ; // <20> <> <EFBFBD> <EFBFBD>
2025-09-28 09:17:22 +00:00
} ;
extern struct uCalibrateWeight CalibrateWeight ;
extern struct uCalibrateWeight CalibrateWeight2 ;
extern uint32_t HX711Data ; // ԭʼ <D4AD> <CABC> <EFBFBD> <EFBFBD>
extern uint32_t HX711Zero ; // ԭʼ <D4AD> <CABC> <EFBFBD> <EFBFBD>
extern float WeightData ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2026-03-17 02:33:04 +00:00
extern double WeightData2 ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
extern double ADvalue2filter ;
extern double WeightZeroOld ;
extern double WeightData2Finally ;
extern float Temperature ;
2025-09-28 09:17:22 +00:00
extern void MAX6675_Init ( void ) ;
extern void USARTHMIInit ( void ) ;
extern void BIOS_USART2_Init ( uint32_t baudrate ) ;
extern void USART2Print ( uint8_t * buffer , uint8_t lenth ) ;
extern void AC_CTRL_Init ( void ) ;
extern void Pump_OutCmd ( bool NewState ) ;
/******************************** <20> <> <EFBFBD> <EFBFBD> ˵<EFBFBD> <CBB5> *************************************
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
struct Pset {
uint16_t CRC_Head ; // CRCУ <43> <D0A3> ͷ
uint8_t AutoTimeStop ; // <20> Զ<EFBFBD> ͣ<EFBFBD> <CDA3> ʱ<EFBFBD> <CAB1>
uint8_t AutoWeightChange ; // <20> Զ<EFBFBD> ͣ<EFBFBD> <CDA3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
uint8_t TempSet ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ¶<EFBFBD>
uint8_t TimeStop ; // ͣ<> <CDA3> ʱ<EFBFBD> <CAB1>
uint8_t AutoStyle ; // ͣ<> <CDA3> <EFBFBD> <EFBFBD> ʽ <20> Զ<EFBFBD>
uint8_t FastStyle ; // <20> <> <EFBFBD> <EFBFBD> ģʽ <20> <> <EFBFBD> <EFBFBD>
uint8_t FilterQ ; // <20> ˲<EFBFBD> <CBB2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
uint8_t SensorQ ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
uint8_t HoldTime ; // <20> ȶ<EFBFBD> ʱ<EFBFBD> <CAB1>
uint8_t RuBianLiang ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
uint8_t RuBianTime ; // <20> <> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <CAB1>
uint8_t ZeroTrack ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
float TempDelta ; // У <D0A3> ¶Ȳ<C2B6>
float WeightSet ; // У <D0A3> <D7BC> <EFBFBD> <EFBFBD>
uint32_t BaudRate ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
bool SW0 ; // <20> Զ<EFBFBD> <D4B6> 忪<EFBFBD> <E5BFAA> 1
bool SW1 ; // <20> Զ<EFBFBD> <D4B6> 忪<EFBFBD> <E5BFAA> 2
bool SW2 ; // <20> Զ<EFBFBD> <D4B6> 忪<EFBFBD> <E5BFAA> 3
2026-03-17 02:33:04 +00:00
uint8_t PercentType ; // <20> <> ˮ<EFBFBD> <CBAE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2025-09-28 09:17:22 +00:00
uint8_t Title [ 32 ] ; // <20> <> <EFBFBD> <EFBFBD>
uint8_t TitleOne [ 32 ] ; // <20> <> <EFBFBD> <EFBFBD> 1
uint8_t TitleTwo [ 32 ] ; // <20> <> <EFBFBD> <EFBFBD> 2
uint8_t TitleThree [ 32 ] ; // <20> <> <EFBFBD> <EFBFBD> 3
uint8_t UserName [ 16 ] ; // <20> û<EFBFBD> <C3BB> <EFBFBD>
uint8_t UserPwd [ 16 ] ; // <20> <> <EFBFBD> <EFBFBD>
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 CalibrateWeight2Set 0x0140u
# define RW_Set 0x0200u
2026-03-17 02:33:04 +00:00
# define CRCHead 0x5A5Au
2025-09-28 09:17:22 +00:00
// #define RW_WeightSlope 0x0104u
// #define RW_WeightZero 0x0108u
// #define RW_ColorHSV_A 0x010Cu
// #define RW_ColorHSV_B 0x0110u
// #define RW_ColorHSV_C 0x0114u
// #define RW_ColorHSV_D 0x0118u
// #define RW_BackADCLimit 0x011Cu
// #define RW_RunStop 0x0120u
// #define RW_CRC_End 0x0180u
# define CRCEnd 0xAA55u
extern void BIOS_NVIC_Init ( void ) ;
extern bool weightChanging ;
# endif
/******** (C) COPYRIGHT 2023 ɽ<> <C9BD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܿƼ <DCBF> <C6BC> <EFBFBD> <EFBFBD> <EFBFBD> ˾ **** End Of File ********/