Teknic ClearCore无法连接Kinco GL070E HMI通信问题求助
Teknic ClearCore 与 Kinco GL070E HMI 通信对接问题
问题现状
针对该通信对接问题已持续调试近3周,暂未找到可行落地方案,核心需求为通过任意可行方式将Teknic ClearCore控制器的运行数据输出至Kinco GL070E型号HMI。
调试阶段先后验证两类主流通信方案:
- RS232串口直连通信
- 以太网Modbus总线通信
实测发现Tools40 Modbus库与ClearCore设备存在底层兼容性问题,全参数匹配情况下始终无法建立稳定正常的通信链路。
调试过程参考了3份公开的开源项目文档、实操教程资料,按规则不提供外链跳转。
当前在用测试代码
因多日迭代调试未做代码整理,现有代码逻辑较为杂乱,当前烧录运行的测试代码如下:
#include "ClearCore.h" // Defines the analog input to control commanded velocity #define Estop ConnectorDI8 //Estop #define counter ConnectorIO2 //induction3 // Select the baud rate to match the target device. #define baudRate 9600 int count = 0; int d = 1; int x = 0; int r = 0; void setup() { // Put your setup code here, it will only run once: // Sets up serial communication and waits up to 5 seconds for a port to open. // Serial communication is not required for this example to run. Serial.begin(baudRate); uint32_t timeout = 5000; uint32_t startTime = millis(); while (!Serial && millis() - startTime < timeout) { continue; } //Configure Serial communication to HMI. // Configure COM-0 for RS-232 mode. ConnectorCOM0.Mode(Connector::RS232); // Set the data baud rate. ConnectorCOM0.Speed(9600); // (Optional) Set the data frame parity. ConnectorCOM0.Parity(SerialBase::PARITY_E); // (Optional) Set each data frame to use 2 stop bits. ConnectorCOM0.StopBits(2); // (Optional) Enable flow control. //ConnectorCOM0.FlowControl(true); // Open the serial port to enable data transmission. ConnectorCOM0.PortOpen(); } void loop() { /****Reset circuit***************************************************************************************************/ if (ConnectorIO1.State()==HIGH && r == 1) { digitalWrite(IO0, true); delay(300); r = 0; } /****Estop circuit***************************************************************************************************/ while (ConnectorDI8.State()==LOW) { r = 1; digitalWrite(IO0, false); } if (r==0) { Serial0.write(count); Serial.println(count); /****COUNTER*****************************************************************************************/ if (ConnectorIO2.State() == HIGH) { count++; } } }
内容的提问来源于stack exchange,提问作者Logan
相关产品推荐
相关产品推荐

