diff --git a/MAC/APL/StsMisc/src/Makefile.am b/MAC/APL/StsMisc/src/Makefile.am
index 77cc4eab125a400a3a7d4f75bf4b4c48582b1057..c9bd838f42a0827d6d72720cd590f3879eabf589 100644
--- a/MAC/APL/StsMisc/src/Makefile.am
+++ b/MAC/APL/StsMisc/src/Makefile.am
@@ -1,12 +1,7 @@
-bin_PROGRAMS	      =	ModBusRead ModBusWrite
-
-ModbusRead_SOURCES		= ModbusRead.cc
-ModbusRead_LDADD		= 
-ModbusRead_DEPENDENCIES		= $(LOFAR_DEPEND)
-
-ModBusWrite_SOURCES		= ModbusWrite.cc
-ModBusWrite_LDADD		=
-ModBusWrite_DEPENDENCIES	= $(LOFAR_DEPEND)
+bin_PROGRAMS	      =	ModBusRead 
 
+ModBusRead_SOURCES		= ModBusRead.cc
+ModBusRead_LDADD		= 
+ModBusRead_DEPENDENCIES		= $(LOFAR_DEPEND)
 
 include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/StsMisc/src/Makefile.in b/MAC/APL/StsMisc/src/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..f4b4a9108346eb217be272f3d3701573d764597e
--- /dev/null
+++ b/MAC/APL/StsMisc/src/Makefile.in
@@ -0,0 +1,767 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Some common rules.
+
+SOURCES = $(ModBusRead_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = ModBusRead$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.common
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/autoconf_share/am_rpm_init.m4 \
+	$(top_srcdir)/autoconf_share/lofar_docxx.m4 \
+	$(top_srcdir)/autoconf_share/lofar_external.m4 \
+	$(top_srcdir)/autoconf_share/lofar_general.m4 \
+	$(top_srcdir)/autoconf_share/lofar_init.m4 \
+	$(top_srcdir)/autoconf_share/lofar_internal.m4 \
+	$(top_srcdir)/autoconf_share/lofar_logger.m4 \
+	$(top_srcdir)/autoconf_share/lofar_qatools.m4 \
+	$(top_srcdir)/autoconf_share/lofar_shmem.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_ModBusRead_OBJECTS = ModBusRead.$(OBJEXT)
+ModBusRead_OBJECTS = $(am_ModBusRead_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ModBusRead_SOURCES)
+DIST_SOURCES = $(ModBusRead_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AR_FLAGS = @AR_FLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCPP = @DOCPP@
+DOCPPFLAGS = @DOCPPFLAGS@
+DOXYGEN = @DOXYGEN@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+HAVE_COMMON_FALSE = @HAVE_COMMON_FALSE@
+HAVE_COMMON_TRUE = @HAVE_COMMON_TRUE@
+HAVE_DOCPP_FALSE = @HAVE_DOCPP_FALSE@
+HAVE_DOCPP_TRUE = @HAVE_DOCPP_TRUE@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_LOG4CPLUS_FALSE = @HAVE_LOG4CPLUS_FALSE@
+HAVE_LOG4CPLUS_TRUE = @HAVE_LOG4CPLUS_TRUE@
+HAVE_SHMEM_FALSE = @HAVE_SHMEM_FALSE@
+HAVE_SHMEM_TRUE = @HAVE_SHMEM_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOFARROOT = @LOFARROOT@
+LOFAR_DEPEND = @LOFAR_DEPEND@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MAKE_RPMS = @MAKE_RPMS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+RPMBUILD_PROG = @RPMBUILD_PROG@
+RPM_ARGS = @RPM_ARGS@
+RPM_CONFIGURE_ARGS = @RPM_CONFIGURE_ARGS@
+RPM_DIR = @RPM_DIR@
+RPM_PROG = @RPM_PROG@
+RPM_RELEASE = @RPM_RELEASE@
+RPM_TARBALL = @RPM_TARBALL@
+RPM_TARGET = @RPM_TARGET@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+YACC = @YACC@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+docpp_found = @docpp_found@
+doxygen_dot_found = @doxygen_dot_found@
+doxygen_found = @doxygen_found@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lofar_compiler = @lofar_compiler@
+lofar_doctool = @lofar_doctool@
+lofar_root = @lofar_root@
+lofar_root_libdir = @lofar_root_libdir@
+lofar_sharedir = @lofar_sharedir@
+lofar_top_srcdir = @lofar_top_srcdir@
+lofar_use_root = @lofar_use_root@
+lofar_variant = @lofar_variant@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+ModBusRead_SOURCES = ModBusRead.cc
+ModBusRead_LDADD = 
+ModBusRead_DEPENDENCIES = $(LOFAR_DEPEND)
+#CLEANFILES += tca.* .inslog* *.cc *.h $(top_builddir)/pure_cache docxxhtml/* *.log docxx_hdrs.names
+DISTCLEANFILES = \
+      pkgext\
+      pkgextcppflags\
+      pkgextcxxflags\
+      pkgextobjs\
+      lofar_config.old-h\
+      lofar_config.h-pkg\
+      lofar_config.h\
+      .doxygenrc \
+      *.spec \
+      *.err
+
+
+# Rules for building documentation using doxygen or doc++.
+# Default output directory is docxxhtml.
+DOCDIR := docxxhtml
+
+#
+#
+# Target to be able to do a system build.
+# By default it does a check, but no install.
+WITH_CLEAN = 0
+WITH_INSTALL = 0
+WITH_CHECK = 1
+CHECKTOOL = 
+
+# Define the default variables to export to the test scripts.
+TESTS_ENVIRONMENT = LOFARROOT="$(LOFARROOT)" \
+                    lofar_sharedir="$(lofar_sharedir)" \
+                    prefix="$(prefix)" \
+                    top_srcdir="$(top_srcdir)" \
+                    srcdir="$(srcdir)" \
+		    CHECKTOOLPROGS="$(CHECKTOOLPROGS)" \
+		    MPIBIN="$(MPIBIN)" \
+		    AIPSPP="$(AIPSPP)"
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+ModBusRead$(EXEEXT): $(ModBusRead_OBJECTS) $(ModBusRead_DEPENDENCIES) 
+	@rm -f ModBusRead$(EXEEXT)
+	$(CXXLINK) $(ModBusRead_LDFLAGS) $(ModBusRead_OBJECTS) $(ModBusRead_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ModBusRead.Po@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/..
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-info-am
+
+
+# CLEANFILES cannot delete directories, therefore use target clean-generic.
+clean-generic:
+	-rm -rf ti_files
+	-rm -f tca.*
+	-rm -f .inslog*
+	-rm -f *.log
+	-rm -f *.i
+	-rm -f *.s
+	-rm -f src/*.h
+	-rm -f *.hh
+	-rm -f *.cc
+	-rm -f *.cs_cc
+	-rm -f doxygen.cfg
+	-rm -rf $(top_builddir)/pure_cache
+	-rm -rf docxxhtml
+
+# Rule to delete all files generated by bootstrap.
+# This is sometimes needed when switching to another version of autotools.
+confclean: pkgclean
+pkgclean: distclean
+	  -rm -rf $(srcdir)/autom4te.cache
+	  -rm -f $(srcdir)/config.*
+	  -rm -f $(srcdir)/{configure,aclocal.m4,depcomp,install-sh,ltmain.sh}
+	  -rm -f $(srcdir)/{Makefile.in,missing,mkinstalldirs}
+	  -rm -f $(srcdir)/{Makefile.common,autoconf_share,lofarconf}
+
+# Make the rpm if possible.
+# Note:
+# MAKE_RPMS is set by lofar_init and possibly overwritten by lofar_general.
+# Older package releases include Makefile.common from $lofar_sharedir
+# with the effect that the include is handled by make.
+# Newer releases (as of 1-11-2005) include Makefile.common from $top_srcdir
+# with the effect that the include is handled by automake.
+# To be compatible with older releases, it was decided that the MAKE_RPMS
+# should be handled by make, hence the blank before endif. Otherwise
+# automake complains about an endif without an if.
+ ifeq "$(MAKE_RPMS)" "true"
+   rpm: dist @RPM_TARGET@
+   $(RPM_TARGET): $(DISTFILES)
+	${MAKE} dist
+	-mkdir -p $(RPM_DIR)/SRPMS
+	-mkdir -p `dirname $(RPM_TARGET)`
+	$(RPM_PROG) $(RPM_ARGS) $(RPM_TARBALL)
+	@echo Congratulations, $(RPM_TARGET) "(and friends)" should now exist.
+ endif
+# Put the phony target outside the if, otherwise automake gives
+# warnings if a .PHONY is also defined in the Makefile.am.
+.PHONY: rpm
+
+# Only preprocess the file.
+%.i: %.cc
+	$(CXX) -E $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< > $@
+%.i: %.c
+	$(CC) -E $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< > $@
+
+# Only compile (but not assemble) the file.
+%.s: %.cc
+	$(CXX) -S $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $<
+%.s: %.c
+	$(CC) -S $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $<
+
+# Rules for preprocessing idl files.
+# There should be a corresponding .cc file in the source directory
+# including the .cs_cc file.
+%.cs_cc: %.idl
+	$(IDLCXX) $(IDLFLAGS) $(AM_IDLFLAGS) $<
+	echo '#include "$*_c.cc"' >  $*.cs_cc
+	echo '#include "$*_s.cc"' >> $*.cs_cc
+
+# Rules for preprocessing Qt sources.
+%.moc.cc: %.h
+	$(QT_DIR)/bin/moc $< -o $@
+
+# Rule to build all test programs.
+test: $(check_PROGRAMS)
+
+# Rule to build and run one or more test programs.
+# The programs to build/run must be defined in the PGM variable.
+checkrun:
+	@if [ "$(PGM)" = "" ] ; then \
+	   echo "Error: use as: make (mem)checkrun PGM=testprogram"; \
+	 else \
+	   curwd=`pwd`; \
+	   bcurwd=`basename $$curwd`; \
+	   if [ "$$bcurwd" != test ]; then \
+	     echo "Error: run (mem)checkrun in test directory"; \
+	   else \
+	     PGMB=; \
+	     PGMT=; \
+	     for PGMVAR in $(PGM) ; \
+	     do \
+	       grep "^ *$${PGMVAR}_SOURCES" $(srcdir)/Makefile.am >& /dev/null; \
+	       if [ $$? = 0 ]; then \
+	         PGMB="$$PGMB $$PGMVAR"; \
+	       fi; \
+	       PGMTST=$$PGMVAR; \
+	       if [ -f $(srcdir)/$${PGMVAR}.sh ] ; then \
+	         PGMTST=$(srcdir)/$${PGMVAR}.sh; \
+	       elif [ -f $(srcdir)/$${PGMVAR}_test.sh ] ; then \
+	         PGMTST=$(srcdir)/$${PGMVAR}_test.sh; \
+	       fi; \
+	       PGMT="$$PGMT $$PGMTST"; \
+	     done; \
+	     echo "make check CHECKTOOL='$(CHECKTOOL)' check_PROGRAMS='$$PGMB' TESTS='$$PGMT'"; \
+	     make check CHECKTOOL="$(CHECKTOOL)" check_PROGRAMS="$$PGMB" TESTS="$$PGMT"; \
+	   fi \
+	 fi
+
+# Rule to run test programs using valgrind's memcheck tool.
+memcheck:
+	@$(RM) `find . -name "*.valgrind.*"`
+	make check CHECKTOOL='valgrind --tool=memcheck --num-callers=50 --leak-check=yes --track-fds=yes --log-file=[PROGNAME].valgrind'
+	@vgfils=`find . -name "*.valgrind.*"`; \
+	vgfils=`echo $$vgfils`; \
+	nrvg=`echo "$$vgfils" | wc -w`; \
+	nrvg=`echo $$nrvg`; \
+	if [ "$$nrvg" != 0  -a  "$$nrvg" != "" ]; then \
+	  echo ''; \
+	  echo "memcheck error summary from $$nrvg *.valgrind.* file(s)"; \
+	  echo '--------------------------------------------------'; \
+	  (grep "ERROR SUMMARY: " `echo $$vgfils` | grep -v " 0 errors ") || echo "No memory check errors"; \
+	  (grep "definitely lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No definite memory leaks"; \
+	  (grep "possibly lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No possible memory leaks"; \
+	  (grep " open file descriptor " `echo $$vgfils` | grep -v "descriptor [012]:") || echo "No file descriptor leaks"; \
+	fi
+
+# Rule to build and run memcheck for one or more test programs.
+# The programs to build/run must be defined in the PGM variable.
+memcheckrun:
+	$(RM) `find . -name "*.valgrind.*"`
+	make checkrun CHECKTOOL='valgrind --tool=memcheck --num-callers=50 --leak-check=yes --track-fds=yes --log-file=[PROGNAME].valgrind' PGM="$(PGM)"
+	@vgfils=`find . -name "*.valgrind.*"`; \
+	vgfils=`echo $$vgfils`; \
+	nrvg=`echo "$$vgfils" | wc -w`; \
+	nrvg=`echo $$nrvg`; \
+	if [ "$$nrvg" != 0  -a  "$$nrvg" != "" ]; then \
+	  echo ''; \
+	  echo "memcheckrun error summary from $$nrvg *.valgrind.* file(s)"; \
+	  echo '-----------------------------------------------------'; \
+	  (grep "ERROR SUMMARY: " `echo $$vgfils` | grep -v " 0 errors ") || echo "No memory check errors"; \
+	  (grep "definitely lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No definite memory leaks"; \
+	  (grep "possibly lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No possible memory leaks"; \
+	  (grep " open file descriptor " `echo $$vgfils` | grep -v "descriptor [012]:") || echo "No file descriptor leaks"; \
+	fi
+
+doc:
+	@if [ "$(lofar_doctool)" = "doxygen" ] ; then \
+	  cp $(top_builddir)/.doxygenrc doxygen.cfg ; \
+	  projnm=`(cd $(srcdir) && pwd) | sed -e "s%.*/LOFAR/%%"` ; \
+	  echo "PROJECT_NAME = $$projnm" >> doxygen.cfg ; \
+	  echo "INPUT = $(srcdir)" >> doxygen.cfg ; \
+	  echo "RECURSIVE = YES" >> doxygen.cfg ; \
+	  echo "HTML_OUTPUT = $(DOCDIR)" >> doxygen.cfg ; \
+	  echo "EXCLUDE = $(srcdir)/build $(srcdir)/test $(srcdir)/demo" >> doxygen.cfg; \
+          echo "GENERATE_TAGFILE = `basename $$projnm`.tag" >> doxygen.cfg ; \
+	  $(DOXYGEN) doxygen.cfg ; \
+	else \
+	  if [ "$(lofar_doctool)" = "docpp" ] ; then \
+	    $(DOCPP) $(DOCPPFLAGS) --dir $(DOCDIR) `find $(srcdir) -name "*.h" -print` ; \
+	  else \
+	    echo "Error: No documentation tool configured" ; \
+	  fi \
+	fi
+
+docthis:
+	@if [ "$(lofar_doctool)" = "doxygen" ] ; then \
+	  cp $(top_builddir)/.doxygenrc doxygen.cfg ; \
+	  projnm=`(cd $(srcdir) && pwd) | sed -e "s%.*/LOFAR/%%"` ; \
+	  echo "PROJECT_NAME = $$projnm" >> doxygen.cfg ; \
+	  echo "INPUT = $(srcdir)/src" >> doxygen.cfg ; \
+	  echo "RECURSIVE = NO" >> doxygen.cfg ; \
+	  echo "HTML_OUTPUT = $(DOCDIR)" >> doxygen.cfg ; \
+	  $(DOXYGEN) doxygen.cfg ; \
+	else \
+	  if [ "$(lofar_doctool)" = "docpp" ] ; then \
+	    $(DOCPP) $(DOCPPFLAGS) --dir $(DOCDIR) $(srcdir)/*.h ; \
+	  else \
+	    echo "Error: No documentation tool configured" ; \
+	  fi \
+	fi
+build_system:
+	@if test 2 -eq $(WITH_CLEAN); then \
+	  $(MAKE) cleandist ; \
+	  ../../lofarconf; \
+	fi; \
+	if test 1 -eq $(WITH_CLEAN); then \
+	  $(MAKE) clean ; \
+	fi; \
+	$(MAKE); \
+	if test 1 -eq $(WITH_CHECK); then \
+	  $(MAKE) check CHECKTOOL="$(CHECKTOOL)"; \
+	fi; \
+	if test 1 -eq $(WITH_INSTALL); then \
+	  $(MAKE) install ; \
+	fi;
+
+# Show the important make variables.
+show:
+	@echo "CXX      = $(CXX)";
+	@echo "   `$(CXX) --version | head -1`";
+	@echo "CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS)";
+	@echo "CXXFLAGS = $(AM_CXXFLAGS) $(CXXFLAGS)";
+	@echo "LDFLAGS  = $(AM_LDFLAGS) $(LDFLAGS)";
+	@echo "LIBS     = $(LIBS)";
+	@echo "MPIBIN   = $(MPIBIN)";
+	@echo "AIPSPP   = $(AIPSPP)";
+	@echo "prefix   = $(prefix)";
+
+help:
+	@echo "make targets";
+	@echo "------------";
+	@echo "show              show important make variables";
+	@echo "pgm               build test program pgm (in test directory)";
+	@echo "test              build all test programs";
+	@echo "check             build, run, and check all test programs";
+	@echo "check CHECKTOOL=  check test programs with a checktool (like valgrind)";
+	@echo "memcheck          check CHECKTOOL='valgrind --tool=memcheck"
+	@echo "                    --num-callers=50 --leak-check=yes --track-fds=yes'"
+	@echo "checkrun PGM=     build, run, and check given test program(s)";
+	@echo "memcheckrun PGM=  build, run, and memcheck given test program(s)";
+	@echo ""
+	@echo "file.o            make object file (in src or test directory)";
+	@echo "file.i            make preprocessed file";
+	@echo "file.s            make assembly file";
+	@echo "clean             remove object files, etc."
+	@echo "distclean         remove almost everything; requires a new lofarconf";
+	@echo "pkgclean          distclean and remove files generated by bootstrap";
+	@echo "                    requires a new bootstrap and lofarconf";
+	@echo "install           install package in $(prefix)";
+	@echo "dist              make a distribution";
+	@echo "distcheck         make and check a distribution";
+	@echo "rpm               make an rpm";
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/MAC/APL/StsMisc/src/ModBusRead.cc b/MAC/APL/StsMisc/src/ModBusRead.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7f90f7c0c50aaeb98afe3b1e28398d904aafd24c
--- /dev/null
+++ b/MAC/APL/StsMisc/src/ModBusRead.cc
@@ -0,0 +1,256 @@
+//ModBusRead.am
+
+#include <time.h>
+#include <lofar_config.h>
+#include <Common/LofarTypedefs.h>
+#include <Common/Net/Socket.h>
+#include <Common/hexdump.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <netdb.h>
+
+
+using namespace LOFAR;
+using namespace std;
+
+double setpoint = 17;
+
+int RTH4;
+
+int open_connection (const string& hostname, int portnr) {
+
+	int mySocket = socket(AF_INET, SOCK_STREAM, 0);
+	struct sockaddr_in  itsTCPAddr;
+	memset (&itsTCPAddr, 0, sizeof(itsTCPAddr));
+	itsTCPAddr.sin_family = AF_INET;
+
+	unsigned int IPbytes;
+
+	// try if hostname is hard ip address
+	if ((IPbytes = inet_addr(hostname.c_str())) == INADDR_NONE) {
+		
+		// No, try to resolve the name
+		struct hostent*       hostEnt;        // server host entry
+		if (!(hostEnt = gethostbyname(hostname.c_str()))) {
+                           
+			return (-2);
+		}
+
+
+		// Check type
+		if (hostEnt->h_addrtype != AF_INET) {
+			return (-3);
+		}
+     
+		memcpy (&IPbytes, hostEnt->h_addr, sizeof (IPbytes));
+	}
+	memcpy ((char*) &itsTCPAddr.sin_addr.s_addr, (char*) &IPbytes, sizeof(IPbytes));
+
+	itsTCPAddr.sin_port = htons(portnr);
+	
+	int result = connect(mySocket, (struct sockaddr *)&itsTCPAddr, sizeof(struct sockaddr_in));
+	return (mySocket);
+	
+}
+
+
+
+struct StuurUitlezen {			// (14 int8s) Declare Modbus_TCP struct type
+	short TransactionIdentifier;			// = 2 int8s
+
+	short ProtocolIdentifier;			// = 2 int8s
+	short Length;					// = 2 int8s
+	int8  UnitIdentifier;				// = 1 int8
+
+//  -modbus				= 6 int8s (telt unit identifier mee anders 5)
+        int8 Function3;						//:15 = 1 int8s 
+        short ReferenceNumber;					// = 2 int8s
+        short WordCount;					// = 2 int8s
+
+} StuurUitlezen_t;
+
+
+///////////////////////////////////////////////////////////////////////
+
+#pragma pack(1)
+struct StuurUitpt {		// (14 int8s) Declare Modbus_TCP struct type
+
+	short TransactionIdentifie;				// = 2 int8s
+	short ProtocolIdentifie;				// = 2 int8s
+	short Lengt;						// = 2 int8s
+	int8  UnitIdentifie;					// = 1 int8
+
+//  -modbus			= 6 int8s (telt unit identifier mee anders 5)
+	int8 Functio;						//:15 = 1 int8s 
+	int8 ByteCount;						// = 1 int8
+	short T1;						// = 2 int8s
+	short T2;						// = 2 int8s
+	short T3;						// = 2 int8s
+	short T4;						// = 2 int8s
+	short T5;						// = 2 int8s
+	short T6;						// = 2 int8s
+	short T7;						// = 2 int8s
+	char Data[22];					// = rest data 22 int8s over
+
+
+} StuurUitpt_t;
+
+/////////////////////////////////////////////////////////////////////////
+
+
+int main() {
+
+/////////////herhalen van het geheel///////////////////////////////////////
+while(1) {
+
+	int	readConnection  = open_connection("10.151.218.1", 502);
+	int	writeConnection = open_connection("10.151.218.2", 502);
+
+	struct StuurUitlezen demand;
+
+		demand.TransactionIdentifier = htons(0);
+		demand.ProtocolIdentifier = htons(0);
+		demand.Length = htons(8); //moeten 4 bits zijn
+		demand.UnitIdentifier = 01;
+		demand.Function3 = 3;
+		demand.ReferenceNumber = 0;
+		demand.WordCount = htons(18);
+
+		int result = send(readConnection, (char*)&demand, sizeof(demand), 0);
+
+
+		struct StuurUitpt receiv;
+		recv(readConnection, (char*)&receiv, sizeof(receiv), 0); // NB ignoring result
+
+		hexdump ((char*)&receiv, sizeof(receiv));
+
+
+		short HT1 = htons(receiv.T1);
+		short HT2 = htons(receiv.T2);
+		short HT3 = htons(receiv.T3);
+		short HT4 = htons(receiv.T4);
+		short HT5 = htons(receiv.T5);
+		short HT6 = htons(receiv.T6);
+		short HT7 = htons(receiv.T7);
+
+		
+		double RT1 = (HT1 / 327.5) - 50;
+		double RT2 = (HT2 / 327.5) - 50;
+		double RT3 = (HT3 / 327.5) - 50;
+		double RT4 = (HT4 / 327.5) - 50;
+		double RT5 = (HT5 / 327.5) - 50;
+		double RT6 = (HT6 / 327.5) - 50;
+		double RT7 = (HT7 / 327.5) - 50;
+
+		fprintf(stderr,"RT1: %3.2f\n"  , RT1);
+		fprintf(stderr,"RT2: %3.2f\n"  , RT2);
+		fprintf(stderr,"RT3: %3.2f\n"  , RT3);
+		fprintf(stderr,"RT4: %3.2f\n"  , RT4);
+		fprintf(stderr,"RT5: %3.2f\n"  , RT5);
+		fprintf(stderr,"RT6: %3.2f\n"  , RT6);
+		fprintf(stderr,"RT7: %3.2f\n\n", RT7);
+
+// naar file schrijven
+
+FILE	*fp;
+
+	fp = fopen("temperaturen.txt", "a");
+	char dateStr [9];
+	char timeStr [9];
+//	_strdate( dateStr);
+//	_strtime( timeStr);
+	fprintf(fp, "%s - ", dateStr);
+	fprintf(fp, "%s ", timeStr);
+	fprintf(fp, "%3.2f ", RT1);
+	fprintf(fp, "%3.2f ", RT2);
+	fprintf(fp, "%3.2f ", RT3);
+	fprintf(fp, "%3.2f ", RT4);
+	fprintf(fp, "%3.2f ", RT5);
+	fprintf(fp, "%3.2f ", RT6);
+	fprintf(fp, "%3.2f\n", RT7);
+	fclose(fp);
+
+
+		//Temperatuur is uitgelezen. vanaf hier gaan we uitschrijven.
+
+
+		double MaxTemp = setpoint + 0.3;
+		double MinTemp = setpoint - 0.3;
+
+/*
+er word nog maar in 1 kabinet geregeld
+
+		int RTH1;
+		int RTH2;
+		int RTH3;
+		int RTH4;
+		int RTH5;
+		int RTH6;
+		int RTH7;
+
+
+		if (RT1 > MaxTemp) { RTH1 = 1; };
+		if (RT2 > MaxTemp) { RTH2 = 1; };
+		if (RT3 > MaxTemp) { RTH3 = 1; };
+		if (RT4 > MaxTemp) { RTH4 = 1; };
+		if (RT5 > MaxTemp) { RTH5 = 1; };
+		if (RT6 > MaxTemp) { RTH6 = 1; };
+		if (RT7 > MaxTemp) { RTH7 = 1; };
+
+		if (RT1 < MinTemp) { RTH1 = 0; };
+		if (RT2 < MinTemp) { RTH2 = 0; };
+		if (RT3 < MinTemp) { RTH3 = 0; };
+		if (RT4 < MinTemp) { RTH4 = 0; };
+		if (RT5 < MinTemp) { RTH5 = 0; };
+		if (RT6 < MinTemp) { RTH6 = 0; };
+		if (RT7 < MinTemp) { RTH7 = 0; };
+*/
+		int RTH4;
+		if (RT4 > MaxTemp) { RTH4 = 7; };
+		if (RT4 < MinTemp) { RTH4 = 4; };
+
+
+
+
+		struct Modbus_TCP {		// (14 int8s) Declare Modbus_TCP struct type
+		
+			short TransactionIdentifiers;		// = 2 int8s
+			short ProtocolIdentifiers;		// = 2 int8s
+			short Lengths;				// = 2 int8s
+			int8  UnitIdentifiers;			// = 1 int8
+
+		//  -modbus		= 8 int8s (telt unit identifier mee anders 7)
+			int8 FunctionForceMultipleCoilss;	//:15 = 1 int8s 
+			short ReferenceNumbers;			// = 2 int8s
+			short BitCounts;			// = 2 int8s
+			int8 ByteCounts;			// = 1 int8
+			int8 Datas;				// = 1 int8
+
+		} command;
+
+
+
+//		Modbus_TCP command;
+
+		command.TransactionIdentifiers = htons(0);
+		command.ProtocolIdentifiers = htons(0);
+		command.Lengths = htons(8); //moeten 4 bits zijn
+		command.UnitIdentifiers = 01;
+		command.FunctionForceMultipleCoilss = 15;
+		command.ReferenceNumbers = htons(16);
+		command.BitCounts = htons(6);
+		command.ByteCounts = 01;
+//		command.Datas = RTH1+(RTH2*2)+(RTH3*4)+(RTH4*8)+(RTH5*16)+(RTH6*32)+(RTH6*64);
+		command.Datas = RTH4;
+		result = send(writeConnection, (char*)&command, sizeof(command), 0);
+
+		sleep (60); //wacht 1 minuut
+
+	close(readConnection);
+	close(writeConnection);
+
+	} //while
+
+	return 0;
+
+}
diff --git a/MAC/APL/StsMisc/src/ModBusRead.log_prop b/MAC/APL/StsMisc/src/ModBusRead.log_prop
new file mode 100644
index 0000000000000000000000000000000000000000..0ea5ae250165827faa16dafdc22b590996f28db9
--- /dev/null
+++ b/MAC/APL/StsMisc/src/ModBusRead.log_prop
@@ -0,0 +1,12 @@
+# Property file to be use with the demo program testLogger.
+
+# Configure the rootLogger
+log4cplus.rootLogger=DEBUG, STDOUT
+# Define the STDOUT appender
+log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
+log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
+log4cplus.appender.STDOUT.layout.ConversionPattern=%-5p [%x]%c{3} - %m%n
+
+# Define foo at level TRACE4
+#log4cplus.logger.TRC.foo=TRACE4
+