|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
|
|
|
|
|
extern SysConf g_sys_conf;
|
|
|
|
|
|
|
|
|
|
modbus_t * g_modbus; //Modbus TCP
|
|
|
|
|
modbus_t * g_modbus = NULL; //Modbus TCP
|
|
|
|
|
|
|
|
|
|
bool PLCDevice::init_plc(PLCDevice* PLCptr)
|
|
|
|
|
{
|
|
|
|
@ -29,8 +29,11 @@ bool PLCDevice::init_plc(PLCDevice* PLCptr)
|
|
|
|
|
}
|
|
|
|
|
bool PLCDevice::disconnect_plc(void)
|
|
|
|
|
{
|
|
|
|
|
modbus_close(g_modbus);
|
|
|
|
|
modbus_free(g_modbus);
|
|
|
|
|
if(g_modbus)
|
|
|
|
|
{
|
|
|
|
|
modbus_close(g_modbus);
|
|
|
|
|
modbus_free(g_modbus);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
int PLCDevice::write_bit_2_plc(int addr, int value)
|
|
|
|
|