this article I'll test the new Wago PLC controller series PFC200, model number 750-8202 /025-002. PFC200



Substantially, downloading the Codesys ISO image and installing it into the Raspberry SD card, it's possible to transform your PI into a PLC controller. And it's for free! (you can buy the "fully licensed version for 35€, anyway the demo version run fully featured for 2 hours).

So I though to realize a cheap fully working distributed architecture where:

  • Raspberry PI= PLC Controller (Codesys 3.5 SP
  • Arduino Mega 2560= 1st remote I/O
  • Arduino Uno=  2nd remote I/O
  • Modbus TCP/IP: communication protocol

CoDeSys+ Raspberry+ArduinoLogo+Banner-Modbus= (PLC + remote I/O) 

In this article I'll describe how to use an ANY data type as pointer input in a simple subroutine in Simatic Step 7 v.5.5. ANY parameter type, according to Simatic on-line help, is a 10 byte length with the following structure:

ANY Definition

Recently I've been involved into a PLC development environment not equipped to physical memory storage area such as Merker, DB, %T,... In that project, I had to acquire a 32 bit single precision floating point variable from remote I/O located not directly as REAL but as 2 WORDS: respectively  LSW ( Least Significant Word) and MSW (Most Significant Word). Then, starting from the floating definition (Wikipedia):

 IEEE753 32Single Wiki

     31------------------------MSW-------------------16 + 15----------------------LSW------------------------0

As I think a lot of people involved into the automation world  know , Siemens always shown a kind of "adversity" to equip its products with not-native Siemens protocols. One of these, born on far 1979 but still common, is the Modbus protocol for networks TCP/IP. Anyway, available from few years, Siemens release its on licensed-library in order to use Modbus TCP communication into the PN type CPU (300, 400, 400H), into the CP (343, 443) or into the CPU-PN equipped ET200S. Recently I had the possibility to test this library developing an application (S7-317 2PN/DP)  who needs to run as Modbus Master (Client) reading / writings data to some relay controller (Areva) in order to control an hydroelectric power plant. Then I though to wrote this tutorial as a memo for some future similar jobs. Wish it'll be useful you too.

Into this article I'll explain hot to implement to modbus TCP Client (Master) functionality into a CPU S7-315 2PN/DP firmware 3.2. Here follow hardware and software needed coponents:

  • Software S7 Open Modbus TCP CPU PN Single License cod.2XV9450-1MB02 v.1.3 (for details take a look at)
  • Software Simatic Step 7 v.5.5 service pack 3
  • CPU S7 315 2PN/DP cod 6ES7315-2EH14-0AB0 + MMC (512kb is enough)