﻿<?xml version="1.0" encoding="utf-8"?>
<DeviceDescription xmlns="http://www.3s-software.com/schemas/DeviceDescription-1.0.xsd" xmlns:ts="http://www.3s-software.com/schemas/TargetSettings-0.1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Types namespace="localTypes">
    <RangeType basetype="std:BYTE" name="SlaveID"> 
	  <Min>1</Min>
	  <Max>247</Max>
	  <Default>1</Default>
	</RangeType>
	<RangeType basetype="std:WORD" name="Timeout"> 
	  <Min>2</Min>
	  <Max>65535</Max>
	  <Default>100</Default>
	</RangeType>
  </Types> 

  <Strings namespace="local">
    <Language lang="en">
      <String identifier="ModelName">ModbusRtuSlave</String>  
      <String identifier="DeviceDescription"></String>
      <String identifier="VendorName">HCFA</String>
      <String identifier="typedescription">HCFA modbus RTU slave</String>
    </Language>
  </Strings>
  
  <Device hideInCatalogue="false">  
    <DeviceIdentification>
      <Type>32821</Type>
      <Id>16c7 0001</Id>  
      <Version>1.0.0.1</Version>   
    </DeviceIdentification>
    <DeviceInfo>
      <Name name="local:ModelName">ModbusRtuSlave</Name>  
      <Description name="local:DeviceDescription">HCFA modbus RTU slave</Description>
      <Vendor name="local:VendorName">HCFA</Vendor>
      <OrderNumber>-</OrderNumber>  	 
    </DeviceInfo>
	
    <!--Child Connector Description,child connectors should always be defined as slot and the slot count must be 1--> 	  
    <Connector connectorId="1" moduleType="32821" interface="Local.MBRTUMaster" role="child" explicit="false" hostpath="-1">
      <InterfaceName name="local:MBRTUMaster">ModbusSlave</InterfaceName>
      <Slot count="1" allowEmpty="false"></Slot>   	  
    </Connector> 
	 
    <!-- I/O channel added for modbus RTU slave --> 		 
    <Connector connectorId="2" moduleType="32830" interface="Local.MBRTUSlave" role="parent" explicit="false" hostpath="1">
	  <InterfaceName name="local:MBRTUSlave">ModbusChManager</InterfaceName>
	  <Var max="50" />
	  <HostParameterSet> 
	    <Parameter ParameterId="41100" type="localTypes:SlaveID">
          <Attributes offlineaccess="readwrite" onlineaccess="read" download="true" functional="false" />
          <Default>1</Default>
          <Name name="local:Parameter.SlaveID">SlaveID</Name>
          <Description name="local:Parameter.SlaveID">Address of modbus rtu slave</Description>
        </Parameter>
		<Parameter ParameterId="41101" type="localTypes:Timeout">
          <Attributes offlineaccess="readwrite" onlineaccess="read" download="true" functional="false" />
          <Default>100</Default>
          <Name name="local:Parameter.ResponseTimeout">ResponseTimeout</Name>
		  <Unit name="local:Parameter.ResponseTimeout">ms</Unit>
          <Description name="local:Parameter.ResponseTimeout">Slave response timeout</Description>
        </Parameter> 
	  </HostParameterSet> 
	  <DriverInfo needsBusCycle="false">
	    <RequiredLib libname="HCFAModbusLib" placeholderlib="HCFAModbusLib" vendor="HCFA" version="1.0.0.0">
	      <FBInstance basename="$(DeviceName)" fbname="MODBUSRTU_SlaveDiag"> 
		    <Initialize methodName="Initialize"/> 
		    <!--methodname为空时则调用功能块实例本身-->
		    <CyclicCall methodname="" task="#buscycletask" whentocall="beforeWriteOutputs" /> 
		  </FBInstance>
	    </RequiredLib>
	  </DriverInfo>
    </Connector> 	
  </Device>
 
</DeviceDescription>
