# plcd.conf - plcd daemon configuration file example.
#
# This example is derived from my home laboratory experiments.
# I use one Lincon with three boards and Modbus/TCP to acquire
# data from it.
#
# Grisha Sitkarev, <sitkarev@unixkomi.ru>

user nobody
group nogroup
#loglevel daemon.info
loglevel warn
priority 50
connectorconfig connector.conf
cyclemsec 100
retrytimer 0

<piserver>

	# pi server's name
	name modbus
	# what side does pi server represents master or slave
	side master
	# byteorder of the pi server image
	byteorder be
	# socket to connect to
	socket /var/run/modbusd/modbusd.sock
	# timeout in milliseconds
	timeout 1000
	# size of I image
	inputs 64
	# size of Q image
	outputs 64

	<parameters>
		# Parameters description is given in the following format:
		# ([output|out]|[input|in]) <name> (bool|int|float) (offset)[.(bit)] [value]

		I input0 bool 0.0
		I input1 bool 0.1
		I input2 bool 0.2
		I input3 bool 0.3
		I input4 bool 0.4
		I input5 bool 0.5
		I input6 bool 0.6
		I input7 bool 0.7
		I input8 bool 1.0
		I input9 bool 1.1
		I input10 bool 1.2
		I input11 bool 1.3
		I input12 bool 1.4
		I input13 bool 1.5
		I input14 bool 1.6
		I input15 bool 1.7

		I ireg0 int 2 120
		I ireg1 int 4 256
		I ireg2 int 6 0xff
		I ireg3 int 8 128

		I read_msec	int 10
		I write_msec int 12
		I cycle_msec int 14
		I min_msec	int 16
		I max_msec	int 18
		I last_msec	int 20
		
		Q coil0 bool 0.0 0
		Q coil1 bool 0.1 0
		Q coil2 bool 0.2 0
		Q coil3 bool 0.3 0
		Q coil4 bool 0.4 0
		Q coil5 bool 0.5 0
		Q coil6 bool 0.6 0
		Q coil7 bool 0.7 0

		Q coil8 bool 1.0 off
		Q coil9 bool 1.1 off
		Q coil10 bool 1.2 off
		Q coil11 bool 1.3 off
		Q coil12 bool 1.4 off
		Q coil13 bool 1.5 off
		Q coil14 bool 1.6 off
		Q coil15 bool 1.7 off

		Q hreg0 int 2
		Q hreg1 int 4
		Q hreg2 int 6
		Q hreg3 int 8
	
	</parameters>

</piserver>

<piserver>

	name lincon
	side slave
	byteorder native
	socket /var/run/lincond/lincond.sock
	inputs 512
	outputs 512
	timeout 1000

	# My Lincon has AI8 (i87017) board DIO8 (I-8055) board
	# and AO4 (i87024) board.
	# Below you can se how do i map it all to parameters.
	<parameters>

		I ai0 INT 0
		I ai1 INT 4
		I ai2 INT 8
		I ai3 INT 12
		I ai4 INT 16
		I ai5 INT 20
		I ai6 INT 24
		I ai7 INT 28
		I in0 BOOL 32.0
		I in1 BOOL 32.1
		I in2 BOOL 32.2
		I in3 BOOL 32.3
		I in4 BOOL 32.4
		I in5 BOOL 32.5
		I in6 BOOL 32.6
		I in7 BOOL 32.7

		Q ao0 INT 0
		Q ao1 INT 4
		Q ao2 INT 8
		Q ao3 INT 12
		Q out0 BOOL 16.0
		Q out1 BOOL 16.1
		Q out2 BOOL 16.2
		Q out3 BOOL 16.3
		Q out4 BOOL 16.4
		Q out5 BOOL 16.5
		Q out6 BOOL 16.6
		Q out7 BOOL 16.7

	</parameters>

</piserver>


