From b8f018f37e2b6a64114c1da032f687010c9a5366 Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期五, 28 七月 2023 11:36:40 +0800 Subject: [PATCH] fix PLC function for 0701 device --- Inc/GlobalDef.h | 72 +++++++++++++++++++++++++++--------- 1 files changed, 54 insertions(+), 18 deletions(-) diff --git a/Inc/GlobalDef.h b/Inc/GlobalDef.h index e724690..e5a0d6d 100644 --- a/Inc/GlobalDef.h +++ b/Inc/GlobalDef.h @@ -16,6 +16,11 @@ 4 //New Master 16 in16 out V1.2 5 //Slave 8 in 8 out V1.2 */ + + +#define DefaultUart1Baud 230400 +#define DefaultUart2Baud 1000000 + enum enBOARD_TYPE { BOARD_UNKNOWN =0, @@ -29,23 +34,55 @@ BOARD_V4_SLAVE, //8 New V4 Slave 8 in 8 o BOARD_V42_MASTER, //9 New V4.2 Master 16 in16 o BOARD_V42_SLAVE, //10 New V4.2 Slave 8 in 8 o + + BOARD_V30_MINI =11, //11 Mini Board + BOARD_V45_NET = 13, + BOARD_EXT_FP0 = 14, + BOARD_V50_RADIO_16 = 15, + BOARD_V50_RADIO_8 = 16, + }; -#define BOARD_TYPE 2 +#define BOARD_TYPE 7 +#define BOARD_VER 1 -extern int GetBoardType(void); +#if (BOARD_TYPE == 11) +#define XLAT_FREQ 12 +#elif (BOARD_TYPE == 14) +#define XLAT_FREQ 12 +#else +#define XLAT_FREQ 8 +#endif +#define GetBoardType() (BOARD_TYPE) + +#if ( BOARD_TYPE == 1) +#define DINPUT 4 +#define DOUTPUT 4 +#elif (BOARD_TYPE == 2 || BOARD_TYPE == 4 || BOARD_TYPE == 6 || BOARD_TYPE == 8 || BOARD_TYPE == 10 || BOARD_TYPE == 11 || BOARD_TYPE == 16) +#define DINPUT 8 +#define DOUTPUT 8 +#elif BOARD_TYPE == 3 || BOARD_TYPE == 5 || BOARD_TYPE == 7 || BOARD_TYPE == 9 || BOARD_TYPE == 13 || BOARD_TYPE == 15 +#define DINPUT 16 +#define DOUTPUT 16 +#elif BOARD_TYPE == 14 +#define DINPUT 0 +#define DOUTPUT 6 +#else +#define DINPUT 0 +#define DOUTPUT 0 +#endif extern volatile int PendSvCount; typedef struct tagUartStat { - volatile int Inited; - volatile int RecvBytes; volatile int SendBytes; - volatile int Sending; - volatile int Recving; - volatile int UseAltRecvBuf; - volatile int IntCount; + volatile int RecvBytes; + volatile char bInited; + volatile char bSending; + volatile char bRecving; + volatile char bUseAltRecvBuf; + volatile int IRQCount; volatile int RXNECount; volatile int TXECount; volatile int PECount; @@ -71,32 +108,31 @@ extern stUartStat Uart1Stat; extern stUartStat Uart2Stat; -extern const unsigned int DefaultUart1Baud; extern unsigned int Uart1Baud; extern unsigned int Uart2Baud; extern unsigned char Uart1RecvBuf1[128]; extern int Uart1RecvBuf1DataLen; -extern unsigned char Uart1RecvBuf2[128]; -extern int Uart1RecvBuf2DataLen; +//extern unsigned char Uart1RecvBuf2[128]; +//extern int Uart1RecvBuf2DataLen; extern unsigned char Uart2RecvBuf1[128]; extern int Uart2RecvBuf1DataLen; -extern unsigned char Uart2RecvBuf2[128]; -extern int Uart2RecvBuf2DataLen; +//extern unsigned char Uart2RecvBuf2[128]; +//extern int Uart2RecvBuf2DataLen; extern volatile int Uart1BaudGot; extern volatile int Uart1BaudFirstGot; -extern volatile int Uart2BaudGot; -extern volatile int Uart2BaudFirstGot; +//extern volatile int Uart2BaudGot; +//extern volatile int Uart2BaudFirstGot; -extern volatile int Uart1DmaInts; -extern volatile int Uart2DmaInts; +//extern volatile int Uart1DmaInts; +//extern volatile int Uart2DmaInts; struct stSysConfig{ int bInited:1; int bConfiged:1; - int bMaster:1; + int bKBusMaster:1; }; -- Gitblit v1.9.1