|
|
@ -7,12 +7,6 @@ |
|
|
|
/// @info YOU CAN CHANGE OR ADD THE DEFINE IF YOU NEED
|
|
|
|
/// @info 整个嵌入式项目的入口 首先是确认电路板 然后确认cpu 芯片型号 然后确认编译器 之后是软件框架 最后是应用程序
|
|
|
|
/// @info bsp_CONFIG 为其他头文件的始祖 TYPE_BOARD_xx
|
|
|
|
///-------------------------------------------------------------------------
|
|
|
|
/// @version 1.1
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20180308
|
|
|
|
/// @note
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
/// @version 5.1
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20200301
|
|
|
@ -44,24 +38,21 @@ |
|
|
|
#ifndef _BSP_CONFIG_H |
|
|
|
#define _BSP_CONFIG_H |
|
|
|
|
|
|
|
#include <INTRINS.H> |
|
|
|
#include <intrins.h> |
|
|
|
#include "../bsp/bsp_config_const.h" |
|
|
|
#include "../clib/type.h" |
|
|
|
#include "../clib/bit.h" |
|
|
|
|
|
|
|
|
|
|
|
//STEP 1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>TYPE_UASER_BOARD SELECT
|
|
|
|
#define TYPE_UASER_BOARD TYPE_BOARD_WEIGH_0B |
|
|
|
#define TYPE_UASER_BOARD TYPE_BOARD_BFY_V4_SOP |
|
|
|
//STEP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<YPE_UASER_BOARD SELECT End
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//STEP 2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>TYPE_UASER_BOARD CONFIG
|
|
|
|
#if(TYPE_UASER_BOARD == TYPE_BOARD_WEIGH_0B) |
|
|
|
#include <intrins.h> |
|
|
|
#include "../cpu/stc_stc8hxx.h" |
|
|
|
#if(TYPE_UASER_BOARD == TYPE_BOARD_BFY_V4_SOP) |
|
|
|
#include "../cpu/stc_stc8h.h" |
|
|
|
#include "../cpu/stc_macro.h" |
|
|
|
|
|
|
|
//基本配置(工作频率、时钟、看门狗、字节序)
|
|
|
@ -72,40 +63,74 @@ |
|
|
|
#define D_sys_Jiffies TYPE_JIFFIES_10MS |
|
|
|
#define D_WDT_STATUS TYPE_WDT_DISABLE //如果配置为enable,请在bsp_config.c中设置wdt溢出时间
|
|
|
|
#define D_MCU_ENDIAN TYPE_MCU_BIGENDIAN |
|
|
|
#define D_CODE_ENCRYPTION_TYPE TYPE_ENCRYPTION_ENABLE //是否代码加密
|
|
|
|
#define D_CODE_ENCRYPTION_TYPE TYPE_ENCRYPTION_DISABLE //是否代码加密
|
|
|
|
#define D_MCU_NAME "STC8H8K64U" |
|
|
|
|
|
|
|
|
|
|
|
#define D_MCU_NAME "STC8H3K48S4" |
|
|
|
//存储器特殊参数地址配置
|
|
|
|
#define D_MCU_SPEC_PARAM_CHIPID 0xBFF9 |
|
|
|
#define MSP_ID_LEN 7 |
|
|
|
#define D_MCU_SPEC_PARAM_ID_IN_RAM 0x00F1 |
|
|
|
#define D_MCU_SPEC_PARAM_ID_IN_ROM 0xFDF9 |
|
|
|
#define D_MCU_SPEC_PARAM_ID_IN_CHIPID 0xFDE0 |
|
|
|
#define ID_ADDR_IN_RAM ((char idata*)(D_MCU_SPEC_PARAM_ID_IN_RAM + 0x00)) |
|
|
|
#define ID_ADDR_IN_ROM ((char code*)(D_MCU_SPEC_PARAM_ID_IN_ROM + 0x00)) |
|
|
|
#define ID_ADDR_IN_CHIPID ((unsigned char volatile xdata*)(D_MCU_SPEC_PARAM_ID_IN_CHIPID + 0x00)) |
|
|
|
|
|
|
|
//...其他参数
|
|
|
|
|
|
|
|
//串口配置
|
|
|
|
#define D_uart0_BRT BRT_115200 |
|
|
|
#define D_uart0_SBIT SBIT_1 |
|
|
|
#define D_PIN_UART0 PIN_UART0_Rxd_30_Txd_31 |
|
|
|
#define D_PIN_UART0 PIN_UART0_Rxd_30_Txd_31 //RXD, TXD
|
|
|
|
#define D_uart2_BRT BRT_115200 |
|
|
|
#define D_PIN_UART2 PIN_UART2_Rxd_46_Txd_47 //RXD2_2, TXD2_2
|
|
|
|
#define D_uart3_BRT BRT_115200 |
|
|
|
#define D_PIN_UART3 PIN_UART3_Rxd_50_Txd_51 //RXD3_2, TXD3_2
|
|
|
|
#define D_uart4_BRT BRT_115200 |
|
|
|
#define D_PIN_UART4 PIN_UART4_Rxd_02_Txd_03 //RXD4, TXD4
|
|
|
|
|
|
|
|
//485配置
|
|
|
|
#define D_UART0_485_TYPE TYPE_485_SLAVER //UART0启用485
|
|
|
|
#define D_UART0_485_SLAVER_ID_BROADCAST 0xFF //485从机总是响应0xFF消息
|
|
|
|
#define D_UART0_485_SLAVER_ID 0x01 //板卡作为485从机 slaverId
|
|
|
|
#define D_UART0_485_TX() P55 = 1; |
|
|
|
#define D_UART0_485_RX() P55 = 0; |
|
|
|
#define D_UART4_485_TYPE TYPE_485_SLAVER //UART4启用485
|
|
|
|
#define D_UART4_485_SLAVER_ID_BROADCAST 0xFF //485从机总是响应0xFF消息
|
|
|
|
#define D_UART4_485_SLAVER_ID 0x01 //板卡作为485从机 slaverId
|
|
|
|
#define D_UART4_485_TX() P01 = 1; P00=1; |
|
|
|
#define D_UART4_485_RX() P01 = 0; P00=0; |
|
|
|
#define D_UART0_485_TYPE TYPE_485_NONE //UART0不启用485
|
|
|
|
#define D_UART2_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
|
|
#define D_UART3_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
|
|
#define D_UART4_485_TYPE TYPE_485_NONE //UART2不启用485
|
|
|
|
#define D_UART3_485_TYPE TYPE_485_NONE //UART3不启用485
|
|
|
|
|
|
|
|
//MODBUS协议配置
|
|
|
|
#define D_MODBUS_ENABLE //MODBS启用开关,如果不使用modbus,可以注释掉本行
|
|
|
|
//#define D_MODBUS_ENABLE //MODBS启用开关,如果不使用modbus,可以注释掉本行
|
|
|
|
#define D_MODBUS_SPLIT_ENTRY L1_modbus_split //modbus切割函数,在tpc_modbus.c中实现,依据实际情况修改
|
|
|
|
#define D_MODBUS_REG_MAX_NUM 32 //每次最多读取/写入的寄存器数量,此处的数量要注意和 D_tp_handle_x_len 对应
|
|
|
|
|
|
|
|
//外设定义
|
|
|
|
#define LED0 P17 //D4
|
|
|
|
#define LED1 P54 //D4
|
|
|
|
#define LED0 P23 //LED5
|
|
|
|
//Button LED
|
|
|
|
//0 1 2 3 4 5 6
|
|
|
|
//13 12 11 10 9 8 7
|
|
|
|
#define BLED0 P42 //NET9
|
|
|
|
#define BLED1 P41 //NET10
|
|
|
|
#define BLED2 P37 //NET11
|
|
|
|
#define BLED3 P35 //NET12
|
|
|
|
#define BLED4 P16 //NET13
|
|
|
|
#define BLED5 P15 //NET14
|
|
|
|
#define BLED6 P14 //NET15
|
|
|
|
#define BLED7 P47 //NET16
|
|
|
|
#define BLED8 P11 //NET17
|
|
|
|
#define BLED9 P26 //NET18
|
|
|
|
#define BLED10 P25 //NET19
|
|
|
|
#define BLED11 P21 //NET20
|
|
|
|
#define BLED12 P44 //NET21
|
|
|
|
#define BLED13 P22 //NET22
|
|
|
|
//K->Key, R->ROW, C->COL
|
|
|
|
#define KR1 P36 //NET1
|
|
|
|
#define KR2 P17 //NET2
|
|
|
|
#define KR3 P06 //NET3
|
|
|
|
#define KR4 P43 //NET4
|
|
|
|
#define KC1 P10 //NET5
|
|
|
|
#define KC2 P07 //NET6
|
|
|
|
#define KC3 P13 //NET7
|
|
|
|
#define KC4 P20 //NET8
|
|
|
|
|
|
|
|
//EEP存储地址定义
|
|
|
|
#define D_EEP_SECTOR_SIZE 0x200 //每个扇区0x200==512bytes
|
|
|
@ -156,8 +181,8 @@ |
|
|
|
#define D_SERVE_TIMER3 interrupt 19 |
|
|
|
#define D_SERVE_TIMER4 interrupt 20 |
|
|
|
#define D_SERVE_CMP interrupt 21 |
|
|
|
#define D_SERVE_PWM interrupt 22 |
|
|
|
#define D_SERVE_PWMFD interrupt 23 |
|
|
|
// #define D_SERVE_PWM interrupt 22
|
|
|
|
// #define D_SERVE_PWMFD interrupt 23
|
|
|
|
#define D_SERVE_I2C interrupt 24 |
|
|
|
#endif |
|
|
|
//STEP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<IRQ Config End
|
|
|
|