diff --git a/APP_Framework/Applications/control_app/plc_demo/keyence/README.md b/APP_Framework/Applications/control_app/plc_demo/keyence/README.md old mode 100644 new mode 100755 index 547da53c4..7bbf03277 --- a/APP_Framework/Applications/control_app/plc_demo/keyence/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/keyence/README.md @@ -1,4 +1,4 @@ -# KEYENCE 通信测试 +# keyence通信测试 [TOC] @@ -12,11 +12,55 @@ - 存储区ZF区。 +## JSON配方设计 + +* 共测试INT16共1种类型数据,以下为JSON文件解释。 + + - ```json + { + "device_id": 1, //设备ID默认是1,此参数无效 + "device_name": "KV8000", //设备名称,自定义 + "communication_type": 0, //通讯协议类型 0是以太网,1是串口 + "socket_config": { //以太网配置 + "plc_ip": "192.168.250.40", //PLC的IP地址 + "local_ip": "192.168.250.233", //矽达通IP地址设定 + "gateway": "192.168.250.1", //矽达通的网关地址设定 + "netmask": "255.255.255.0", //矽达通子网掩码设定 + "port":502 //端口号设定 + }, + "protocol_type": 3, //通讯协议,3代表modbus-tcp协议 + "read_period": 100, //交互周期ms + "read_item_list": [ + { + "value_name": "ZF0", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3是读 + "start_address": 0, //起始地址 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + }, + { + "value_name": "ZF2", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3/6是读 + "start_address": 2, //起始地址偏移1位 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + } + ] + } + ``` + ## 通信测试 -(1)共测试INT16类型数据。 + (1) 新增1个通信demo,命名为keyence_KV8000.c; -(2)测试ZF区数据。 + (2) 复制样例代码程序到keyence_KV8000.c文件中; -(3)D区数据测试,用功能码03和06,以字为单位读写。如读写ZF1,则配方文件中起始地址则直接写1即可。 + (3) void **ControlKV8000Test**(void) 更改函数名; + (4) PRIV_SHELL_CMD_FUNCTION(**ControKV8000Test**, keyence plc KV8000 Demo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令; + + (5) 剪裁配置完成后,用过烧写器下载至矽达通中,重启后完成测试。 + + + + \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/README.md b/APP_Framework/Applications/control_app/plc_demo/omron/README.md index b7dd8af5e..6f080c669 100755 --- a/APP_Framework/Applications/control_app/plc_demo/omron/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/omron/README.md @@ -1,12 +1,14 @@ -# OMRON_CP1L通信测试 +# OMRON_CP1L/H通信测试 [TOC] ## 通信接线及参数设置 -* 本体无接口,增加CP1W-CIF41网络板卡 - +* CP1L本体无接口,增加CP1W-CIF41网络板卡,CP1H自带网口,采用网线直连的方式 * FINS协议,PLC IP:192.168.250.31,Port:9600 +* ![CP1H](./image/CP1H.jpg) +* ![CP1L](./image/CP1L.jpg) +* ![xidatong](./image/xidatong.jpg) ## 存储区 diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1H.jpg b/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1H.jpg new file mode 100644 index 000000000..97d8a8d32 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1H.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1L.jpg b/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1L.jpg new file mode 100644 index 000000000..1368bb29f Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/omron/image/CP1L.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/image/xidatong.jpg b/APP_Framework/Applications/control_app/plc_demo/omron/image/xidatong.jpg new file mode 100644 index 000000000..0b130b592 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/omron/image/xidatong.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/test_recipe_CP1H.json b/APP_Framework/Applications/control_app/plc_demo/omron/json/test_recipe_CP1H.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/omron/test_recipe_CP1H.json rename to APP_Framework/Applications/control_app/plc_demo/omron/json/test_recipe_CP1H.json diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/test_recipe_CP1L.json b/APP_Framework/Applications/control_app/plc_demo/omron/json/test_recipe_CP1L.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/omron/test_recipe_CP1L.json rename to APP_Framework/Applications/control_app/plc_demo/omron/json/test_recipe_CP1L.json diff --git a/APP_Framework/Applications/control_app/plc_demo/schneider/README.md b/APP_Framework/Applications/control_app/plc_demo/schneider/README.md old mode 100644 new mode 100755 index 46f0558bf..d054136d0 --- a/APP_Framework/Applications/control_app/plc_demo/schneider/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/schneider/README.md @@ -1,21 +1,65 @@ -# SCHNEIDER M241通信测试 +# SCHNEIDER M241L通信测试 [TOC] ## 通信接线及参数设置 * 串口 - * M241支持2路485串口,本次采用的是serial2。波特率:9600,数据位:8位,停止位:1位,校验:偶校验 +* M241支持2路485串口,本次采用的是serial2。波特率:9600,数据位:8位,停止位:1位,校验:偶校验 ## 存储区 - 存储区MW区。 +## JSON配方设计 + +* 共测试BOOL,INT16共2种类型数据,以下为JSON文件解释。 + + - ```json + { + "device_id": 1, //设备ID默认是1,此参数无效 + "device_name": "m241", //设备名称,自定义 + "communication_type": 1, //通讯协议类型 0是以太网,1是串口 + "serial_config": { //串口配置 + "station": 1, //站号 + "baud_rate": 9600, //波特率 + "data_bits": 8, //数据位 + "stop_bits": 1, //停止位 + "check_mode": 3 //1无校验,2校验,3偶校验 + }, + "protocol_type": 3, //通讯协议,3代表modbus-tcp协议 + "read_period": 100, //交互周期ms + "read_item_list": [ + { + "value_name": "MW0", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3是读 + "start_address": 0, //起始地址 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + }, + { + "value_name": "MW1", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3是读 + "start_address": 1, //起始地址偏移1位 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + } + ] + } + ``` + ## 通信测试 -(1)共测试INT16共1种类型数据。 + (1) 新增1个通信demo,命名为schneider_m241.c; -(2)测试MW区数据。 + (2) 复制样例代码程序到schneider_m241.c文件中; -(3)MW区数据测试,用功能码03,以字为单位读取。如读MW100,则配方文件中起始地址则直接写100即可。 + (3) void **ControlSCHNEIDERM241Test**(void) 更改函数名; + (4) PRIV_SHELL_CMD_FUNCTION(**ControlM241Test**, **Schneider M241 Demo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令; + + (5) 剪裁配置完成后,用过烧写器下载至矽达通中,重启后完成测试。 + + + + \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/schneider/m241_recipe.json b/APP_Framework/Applications/control_app/plc_demo/schneider/json/m241_recipe.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/schneider/m241_recipe.json rename to APP_Framework/Applications/control_app/plc_demo/schneider/json/m241_recipe.json diff --git a/APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json b/APP_Framework/Applications/control_app/plc_demo/siemens/json/test_recipe_S7_1512.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json rename to APP_Framework/Applications/control_app/plc_demo/siemens/json/test_recipe_S7_1512.json diff --git a/APP_Framework/Applications/control_app/plc_demo/xinje/README.md b/APP_Framework/Applications/control_app/plc_demo/xinje/README.md old mode 100644 new mode 100755 index bd9d268a9..c2c58dc4b --- a/APP_Framework/Applications/control_app/plc_demo/xinje/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/xinje/README.md @@ -1,4 +1,4 @@ -# XINJIE 通信测试 +# XINJE通信测试 [TOC] @@ -12,12 +12,55 @@ - 存储区M、D区。 +## JSON配方设计 + +* 共测试BOOL,INT16共2种类型数据,以下为JSON文件解释。 + + - ```json + { + "device_id": 1, //设备ID默认是1,此参数无效 + "device_name": "XDH", //设备名称,自定义 + "communication_type": 0, //通讯协议类型 0是以太网,1是串口 + "socket_config": { //以太网配置 + "plc_ip": "192.168.250.32", //PLC的IP地址 + "local_ip": "192.168.250.233", //矽达通IP地址设定 + "gateway": "192.168.250.1", //矽达通的网关地址设定 + "netmask": "255.255.255.0", //矽达通子网掩码设定 + "port":502 //端口号设定 + }, + "protocol_type": 3, //通讯协议,3代表modbus-tcp协议 + "read_period": 100, //交互周期ms + "read_item_list": [ + { + "value_name": "MW0", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3是读 + "start_address": 0, //起始地址 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + }, + { + "value_name": "MW1", //变量名称,自定义 + "value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9 + "function_code": 3, //功能码。3是读 + "start_address": 1, //起始地址偏移1位 + "data_length": 1 //BOOL长度,默认是1,代表读取1个BOOL长度 + } + ] + } + ``` + ## 通信测试 -(1)共测试BOOL,INT16共2种类型数据。 + (1) 新增1个通信demo,命名为xinje_xdh.c; -(2)测试M区及D区数据。 + (2) 复制样例代码程序到xinje_xdh.c文件中; -(3)D区数据测试,用功能码03和06,以字为单位读写。如读写D500,则配方文件中起始地址则直接写500即可。 + (3) void **ControlXINJEXDHTest**(void) 更改函数名; -(4)M区数据测试,用功能码01和05,以位为单位读写。如读写M19,则配方文件中起始地址则直接写19即可。 + (4) PRIV_SHELL_CMD_FUNCTION(**ControlXINJEXDHTest**, **Omron Plc Cp1l Demo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令; + + (5) 剪裁配置完成后,用过烧写器下载至矽达通中,重启后完成测试。 + + + + diff --git a/APP_Framework/Applications/control_app/plc_demo/xinje/test_recipe_xdh_60t4-e.json b/APP_Framework/Applications/control_app/plc_demo/xinje/json/test_recipe_xdh_60t4-e.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/xinje/test_recipe_xdh_60t4-e.json rename to APP_Framework/Applications/control_app/plc_demo/xinje/json/test_recipe_xdh_60t4-e.json diff --git a/APP_Framework/Applications/control_app/plc_demo/xinje/test_recipe_xsdh-60a32-e.json b/APP_Framework/Applications/control_app/plc_demo/xinje/json/test_recipe_xsdh-60a32-e.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/xinje/test_recipe_xsdh-60a32-e.json rename to APP_Framework/Applications/control_app/plc_demo/xinje/json/test_recipe_xsdh-60a32-e.json diff --git a/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/include/connect_usart.h b/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/include/connect_usart.h index 8e277da82..d2edcf29c 100644 --- a/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/include/connect_usart.h +++ b/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/include/connect_usart.h @@ -49,9 +49,9 @@ struct UsartHwCfg #define FCG_TMR0_CLK FCG_Fcg2PeriphClockCmd #define FCG_DMA_CLK FCG_Fcg0PeriphClockCmd -#define KERNEL_CONSOLE_BUS_NAME SERIAL_BUS_NAME_3 -#define KERNEL_CONSOLE_DRV_NAME SERIAL_DRV_NAME_3 -#define KERNEL_CONSOLE_DEVICE_NAME SERIAL_3_DEVICE_NAME_0 +#define KERNEL_CONSOLE_BUS_NAME SERIAL_BUS_NAME_6 +#define KERNEL_CONSOLE_DRV_NAME SERIAL_DRV_NAME_6 +#define KERNEL_CONSOLE_DEVICE_NAME SERIAL_6_DEVICE_NAME_0 int HwUsartInit(void); diff --git a/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/usart/Kconfig b/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/usart/Kconfig index 7f51f8e7b..4427fdf3a 100644 --- a/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/usart/Kconfig +++ b/Ubiquitous/XiZi_IIoT/board/hc32f4a0/third_party_driver/usart/Kconfig @@ -15,7 +15,7 @@ menuconfig BSP_USING_UART3 menuconfig BSP_USING_UART6 bool "Enable USART6" - default n + default y if BSP_USING_UART6 config SERIAL_BUS_NAME_6 string "serial bus 6 name"