Using the SysLibFile.lib and the WagoLibFtp.lib for file access Application note



Similar documents
Transmitting s in a local network with a WAGO CONTROLLER Application note

Remote Connection to a WAGO using a High-Speed Internet connection Application note

Connect Ethernet-Controller to TO-PASS web portal via GPRS-Router Application note

Ethernet/IP Comms between a WAGO and a Mettler Toledo JAGXTREME Terminal Application note

Transmitting s with the WAGO IPC Application note

Using the WAGO PROFINET Coupler as Remote I/O with a Siemens S7 PLC

WAGO-I/O-SYSTEM in ABB robot control systems Application note

Application note. A103202, English Version 1.0.1

WAGO PFC 750-8xx Interface to Horner HMI Application note

Using library WagoLibMySQL to communicate with MySQL-Databases Application note

Accessing EtherNet/IP Network Variables in a WAGO with a ControlLogix PLC Application note

Ethernet PFC Sending Application note

Sending / receiving SMS using a GSM modem Application note

Transmitting s with the library "WagoLibMail_02.lib" Application note

Configuration a Profibus-DP node using Step7 and WAGO-I/O components Application note

WAGO-I/O-SYSTEM. Using library WagoLibMSSQL_03.lib in CoDeSys 2.3 for interface to Microsoft SQL Server 200x. Application Note

WAGO PFC as a MODBUS MASTER Application note

Application Note. WAGO EtherNet/IP Communications with a CompactLogix PLC Using Explicit Messaging. A500620e, English Version: 1.0.

EtherNet/IP communications between a WAGO PFC and a SICK IVC-2D Camera Application note

Using library WagoLibHttp_02.lib to communicate with remote web server Application note

Modular I/O System Quick Start for WAGO-I/O-IPC /000-xxx Features

WAGO Software CODESYS Library WagoLibDiagnosticIDs.lib for accessing the internal diagnostics protocol

Modular I/O System ETHERNET StarterKit Quick Start ETHERNET Fieldbus Controller

Manual. Source Control. TwinCAT 3. Version Date

THE KNX IP CONTROLLER. Taking Proven Technology to the Next Level

emobility WAGO Leading the Charge

Manual TC3 PLC HMI. TwinCAT 3. Version: Date: Order No.: TF1800

µtasker Document FTP Client

Secure TCP/IP connection Description for UMG 604, UMG 605, UMG 508, UMG 509, UMG 511 and UMG 512

NEC Express5800 Series NEC ESMPRO AlertManager User's Guide

Meter Proxy Quick Start Guide

2010 Ing. Punzenberger COPA-DATA GmbH. All rights reserved.

Network Monitoring User Guide Pulse Appliance

Accounting Manager. User Guide A31003-P1030-U

DPS Telecom Your Partners in Network Alarm Management

Manual. TC3 FTP Client. TwinCAT 3. Version Date Order No TF6300

MDS. Measured Data Server Online Measurement Network. Properties and Benefits »»» »»»» ProduCt information

TICO-EN. TiXML-Console TICO. User Manual V

Validity 1. Improvements in STEP 7 2. Improvements in WinCC 3. Simatic. Readme. Readme

Amcrest 960H DVR Quick Start Guide

Managing the System Event Log

Documentation for. KL2602 and KL2622. Two-channel Relay Output Terminals for 230 V AC / 30 V DC. Version: 1.4 Date:

Features Reference. About Unified Communication System. Before Using This Machine. Starting a Meeting. What You Can Do During the Meeting

EasyMP Monitor Operation Guide Ver.4.40

SMS Database System Quick Start. [Version 1.0.3]

Quectel Cellular Engine

EXTENDED FILE SYSTEM FOR FMD AND NANO-10 PLC

Version 1.0 Revision MODBUS/TCP Ethernet Communication Interface API for the Intelligent Instrumentation WinCE Platform SETUP MANUAL

xepi 2 Installation Guide Diagnostic Unit and Configuration Interface Doc. Version 4.0 English

Tera Term Telnet. Introduction

Brake module AX5021. Documentation. Please read this document carefully before installing and commissioning the brake module!

Dotworkz NVR Series User Manual. Rev 1.26

PRODUCT GUIDE N u c l e u s D a t a R e c o v e r y. C o m P r i v a t e L i m i t e d

SeMSy III Failover Server

Connect the Host to attach to Fast Ethernet switch port Fa0/2. Configure the host as shown in the topology diagram above.

User Manual. Page 2 of 38

Setup Soft PLC Technical handbook

Event Notification Module TM

IP Office 4.2 Embedded Voic Mailbox

Planning Maintenance for Complex Networks

SIMATIC NET. CP AS-Interface Master B C. Preface Contents. Technical Description and Installation Instructions Interface to the User Program

Beckhoff TwinCAT The Windows Control and Automation Technology. TwinCAT NC PTP Examples

Quick DDNS Quick Start Guide

Expat kiss_fft gsoap smartgwt Linux Qt md5 zlig log 4cpp sqlite gcc/g++/libc/libc++ gwt

PTPhoneManager II. User guide

Table of Contents. Safety Warnings..3. Introduction.. 4. Host-side Remote Desktop Connection.. 5. Setting Date and Time... 7

Marco A. M. de Melo & Fernando S. P. Gonçalves MANAGER

IP Office Embedded Voic Mailbox User Guide

IP Office Embedded Voic User Guide (IP Office Mode)

Using RAID Admin and Disk Utility

EasyMP Monitor Operation Guide Ver.4.50

Service Managed Gateway TM. How to Configure a T1/E1 Connection

Oracle WebLogic Server

USER MANUAL GUIMGR Graphical User Interface Manager for FRM301/FRM401 Media Racks

Backing Up and Restoring Data

BX7000 Multi-Access Gateway Getting Started Guide

Using Microsoft Windows Authentication for Microsoft SQL Server Connections in Data Archive

Polycom RSS 4000 / RealPresence Capture Server 1.6 and RealPresence Media Manager 6.6

RSA ACE/Agent 5.2 for UNIX Installation and Configuration Guide

Basic File Recording

Transferring Media Between K2 Summit 3G Media Server Systems with the K2 Dyno S Replay Controller in Live Replay Environments

VMware vcenter Discovered Machines Import Tool User's Guide Version for vcenter Configuration Manager 5.3

INTEGRATION GUIDE. General Radius Config

File Management Utility User Guide

EasyMP Monitor Operation Guide Ver.4.53

AN4108 Application note

EXTENDED FILE SYSTEM FOR F-SERIES PLC

Virtual CD v10. Network Management Server Manual. H+H Software GmbH

SA-9600 Surface Area Software Manual

B0. Network Video Recorder HOLNVR04100 HOLNVR04200 HOLNVR04400 Quick Start Guide

Chapter 1: Planning Maintenance for Complex Networks. TSHOOT v6 Chapter , Cisco Systems, Inc. All rights reserved.

Validity 1. Improvements in STEP 7 2. Improvements in WinCC 3 SIMATIC. Readme. Programming and Operating Manual

HowTo. Planning table online

Alignment and Couplings

BMR-Tool Kieback&Peter GmbH & Co. KG

MDM Mass Configuration Tool User s Manual

Getting Started with ESXi Embedded

Configuration Guide for SQL Server This document explains the steps to configure LepideAuditor Suite to add and audit SQL Server.

Standard diagnostic and configuration interface for Beckhoff Industrial PCs

Safety information. MSX-Box. ADDI-DATA GmbH Airpark Business Center Airport Boulevard B Rheinmünster Germany

Transcription:

Using the SysLibFile.lib and the WagoLibFtp.lib for file access, English Version 1.0.0

2 General Copyright 2006 by WAGO Kontakttechnik GmbH & Co. KG All rights reserved. WAGO Kontakttechnik GmbH & Co. KG Hansastraße 27 D-32423 Minden Phone: +49 (0) 571/8 87 0 Fax: +49 (0) 571/8 87 1 69 E-Mail: info@wago.com Web: http://www.wago.com Technical Support Phone: +49 (0) 571/8 87 5 55 Fax: +49 (0) 571/8 87 85 55 E-Mail: support@wago.com Every conceivable measure has been taken to ensure the correctness and completeness of this documentation. However, as errors can never be fully excluded we would appreciate any information or ideas at any time. We wish to point out that the software and hardware terms as well as the trademarks of companies used and/or mentioned in the present manual are generally trademark or patent protected. 114100

Table of Contents 3 TABLE OF CONTENTS 1 Important comments...4 1.1 Legal principles...4 1.1.1 Copyright...4 1.1.2 Personnel qualification...4 1.1.3 Intended use...4 1.1 Range of validity...5 1.2 Symbols...5 2 Description...6 2.1 Reference Material...6 3 Writing files...6 4 Sending files via ftp...7 5 Examples...9 5.1 Write data into file and send it via ftp...9 5.2 Converting data...10 5.2.1 Data visualization...11 5.2.2 Reading a CSV file...12

4 Important comments 1 Important comments 1.1 Legal principles 1.1.1 Copyright To ensure fast installation and start-up of the units described in this manual, we strongly recommend that the following information and explanation is carefully read and adhered to. This manual is copyrighted, together with all figures and illustrations contained therein. Any use of this manual which infringes the copyright provisions stipulated herein, is not permitted. Reproduction, translation and electronic and phototechnical archiving and amendments require the written consent of WAGO Kontakttechnik GmbH & Co. KG. Non-observance will entail the right of claims for damages. 1.1.2 Personnel qualification 1.1.3 Intended use The use of the product detailed in this manual is exclusively geared to specialists having qualifications in PLC programming, electrical specialists or persons instructed by electrical specialists who are also familiar with the valid standards. WAGO Kontakttechnik GmbH & Co. KG declines all liability resulting from improper action and damage to WAGO products and third party products due to nonobservance of the information contained in this manual. For each individual application, the components supplied are to work with a dedicated hardware and software configuration. Modifications are only admitted within the framework of the possibilities documented in the manuals. All other changes to the hardware and/or software and the non-conforming use of the components entail the exclusion of liability on part of WAGO Kontakttechnik GmbH & Co. KG. Please direct any requirements pertaining to a modified and/or new hardware or software configuration directly to WAGO Kontakttechnik GmbH & Co. KG.

Important comments 5 1.2 Range of validity 1.3 Symbols This application note is based on the stated hardware and software of the specific manufacturer as well as the correspondent documentation. This application note is therefore only valid for the described installation. New hardware and software versions may need to be handled differently. Please note the detailed description in the specific manuals. Danger Always observe this information to protect persons from injury. Warning Always observe this information to prevent damage to the device. Attention Marginal conditions must always be observed to ensure smooth operation. ESD (Electrostatic Discharge) Warning of damage to the components by electrostatic discharge. Observe the precautionary measure for handling components at risk. Note Routines or advice for efficient use of the device and software optimisation. More information References to additional literature, manuals, data sheets and INTERNET pages

6 Description 2 Description This document illustrates how to use the SysLibFile.lib and the WagoLibFtp.lib libraries in a WAGO 750-841 Ethernet Controller. It describes how to write, read, and send a file. 2.1 Reference Material The following hardware and software components were used to develop and test this application note: Assigned hardware components Producer Type Ethernet-Controller WAGO 750-841 SysLibFile.lib 3S WagoLibFtp.lib WAGO 3 Writing files - Using the SysLibFile.lib - This section shows how to write data to a file. The input variable filename specifies the name of the file that will be stored in flash. The writing process is initiated by setting the input variable write to TRUE. The delete_file input can be used to delete the file. The output variables file_ok and file_empty specify whether the file closed successfully or whether the file was deleted.

Sending files via ftp 7 To write a file there are three basic steps: 1. open a file 2. write to the file 3. close the file When the input variable write is set to TRUE, the function SysFileOpen is called, which opens the file. It requires the filename and the access mode ( a, r, w, or rw ) for inputs. If the file does not already exist, it creates a new one. The return value is a file number that is used by other file functions. In the next step, the function SysFileWrite is called. This function needs the file number (returned from SysFileOpen ), the address of the data (in this example ADR(bytearray)), and the number of bytes to write. The file is then closed with the function SysFileClose. This function needs the file number from SysFileOpen. The return value file_ok is TRUE if it s successful and FALSE if an error occurs. Note These functions are blocking instructions, therefore, it is strongly recommended to execute file-operations in a separate task. When the input variable delete_file is set TRUE, the function SysFileDelete is called. This function needs the input variable filename and returns the status in file_empty. This output variable returns TRUE if the file was successfully deleted and FALSE if an error occurred. 4 Sending files via ftp - Using the WagoLibFtp.lib - This section illustrates how to send a file via FTP. The file_send_read function block shown below internally uses the FTP_CLIENT function block, which is part of the WagoLibFtp.lib library. The input variable send starts the transmission of the local file (filename_source) to the server that is specified by ftpserver_ip_adr. The read input is used to read the file back from the remote server and store it on the local flash. The return values file_send and file_read indicate whether the file was sent/read successfully.

8 Sending files via ftp Internally the following occurs in this function block: To send or read a file there are four steps: Open a connection to the Server Open an account on the Server and login Send / Read files Close the ftp connection To open a connection, an instance of the function block FTP_CLIENT is created from WagoLibFtp.lib. The function block is then assigned the destination IP address ( ftpserver_ip_adr = HOST_IP ) and port number ( PORT_NUM ). A connection is initiated with the Action called OPEN. Next the program opens an account (via Action LOGIN ) on the remote server using the inputs USERNAME and PASSWORD. If the controller login is successful, sending/reading is started via the Action PUT / GET. These actions need the source and destination filenames ( filename_source = LPATH ; filename_destination = RPATH ). When the file transfer is complete, the connection is closed via the Action CLOSE.

Examples 9 5 Examples This section illustrates three example programs that use the SysLibFile.lib library for file access. The first example talks more about the function blocks used in section 3 and 4 ( file_write and file_send_read ). The second and third example covers data conversion and reading data from a CSV file. These function blocks can be used as is, or modified to meet your specific application need. 5.1 Write data into file and send it via ftp In this example (filewritesend.pro) a byte array is saved to the local flash drive using the function block called file_write. The filename is specified as an input to the function block. When the write input is set TRUE, the file is saved. If successful, the output file_ok returns TRUE. After the file is saved in flash, it can be sent to the FTP server using the file_send_read function block. This function block requires the following inputs: the local filename, the destination filename, the FTP server s IP address (in this example 10.1.6.200), the username, and password. When the send input is set TRUE, the file is sent. If successful, file_send returns TRUE. This variable is then used to activate the deleting of the file on the local flash drive with the file_write function block. When complete, the original file is saved on the server and the local file is deleted. To copy the file back to the local drive, set the read input of the file_send_read function block to TRUE. 750-841 IP:10.1.6.200, Port 21 Server 750-841 IP: 10.1.6.205 Client example: filewritesend.pro

10 Examples 5.2 Converting data In this advanced example (Datenverarbeitung.pro) an array of a structure (messw: INT; timestamp: DT; ms: TIME) is used to hold measured values. The array is then saved to a file. Because the file_write function block expects an array of bytes, our array must be converted to bytes. For this conversion the function block convert_to_byte is used. The array dataarray contains the measured values and the array result will hold the converted data. Setting start to TRUE starts the conversion. The input variable trenner specifies a separator (e.g. ; ) that separates itemized data. Internally the function block convert_to_byte starts by clearing the array bytearray. A pointer is then set to the beginning of the byte array. Using a loop, a value is read, converted to bytes, and the pointer is set to the new position. The separator is then copied and the pointer is set again. This process continues for all the data. Example: Datenverarbeitung.pro

Examples 11 5.2.1 Data visualization Additionally in the example datenverarb.pro, a visualization is implemented. There are two signal-curves (from the function block measured_value, built by signal-generators in signals ) shown. It is possible to switch between the curves. Furthermore, you can scroll along the data-array and change the resolution. Both signal-curves are references of the visualization signal. You can watch variables of each function block via this visualization placeholder (for more information on visualization placeholders, see CoDeSys online help). example: Datenverarbeitung.pro

12 Examples 5.2.2 Reading a CSV file In this example (CSV_Datei_Lesen.pro) data from a CSV file will be read and stored in an array of type typcsv. One line of data (one data set) consists of a DATE_AND_TIME variable and 5 word parameters. A semicolon separates the values. Each line is terminated with a CR and LF character. The input variable xstart of the function block ReadCSVFile starts the reading process. The variable bseperator is the ASCII value of the seperator character (in this example 59 for the semicolon). In the global variable area of the CoDeSys program, three constants are defined that describe the CSV file.

Examples 13 gc_rawdatasize:uint:=500; gc_parametercount:int:=5; gczeilenexcel:int:=5; gc_rawdatasize is the maximum number of bytes in the file gc_parametercount is the number of parameter values gczeilenexcel is the number of data sets Example: CSV_Datei_Lesen.pro, Datensatz1.csv

WAGO Kontakttechnik GmbH & Co.KG Postfach 2880 D-32385 Minden Hansastraße 27 D-32423 Minden Telefon: 05 71/8 87 0 Telefax: 05 71/8 87 1 69 E-Mail: info@wago.com Internet: http://www.wago.com