All the components are supplied in particular hardware and software configurations appropriate for the application. Modifications to hardware or software configurations other than those described in the documentation are not permitted, and nullify the liability of Beckhoff Automation GmbH & Co. KG. Personnel qualification This description is only intended for trained specialists in control, automation and drive engineering who are familiar with the applicable national standards.
Foreword Notes on information security The products of Beckhoff Automation GmbH & Co. KG (Beckhoff), insofar as they can be accessed online, are equipped with security functions that support the secure operation of plants, systems, machines and networks. Despite the security functions, the creation, implementation and constant updating of a holistic security concept for the operation are necessary to protect the respective plant, system, machine and networks against cyber threats.
The TwinCAT SMTP Server is used to send emails with TwinCAT via ADS. TwinCAT SMTP Overview [} 17] SMS library: The TwinCAT SMS library is used to send SMS messages from TwinCAT via GSM modem. TwinCAT SMS Overview [} 40] Version: 1.4 TF6350...
The following section describes how to install the TwinCAT 3 Function for Windows-based operating systems. ü The TwinCAT 3 Function setup file was downloaded from the Beckhoff website. 1. Run the setup file as administrator. To do this, select the command Run as administrator in the context menu of the file.
Page 10
Installation 3. Enter your user data. 4. If you want to install the full version of the TwinCAT 3 Function, select Complete as installation type. If you want to install the TwinCAT 3 Function components separately, select Custom. Version: 1.4 TF6350...
Page 11
Installation 5. Select Next, then Install to start the installation. ð A dialog box informs you that the TwinCAT system must be stopped to proceed with the installation. 6. Confirm the dialog with Yes. TF6350 Version: 1.4...
• Software upgrade Downloading the setup file The CAB installation files for Windows CE are part of the TF6350 SMS SMTP setup. Therefore you only need to download one setup file from www.beckhoff.com which contains binaries for Windows XP, Windows 7 and Windows CE (x86 and ARM).
Page 13
Disk\TwinCAT\Functions\TF6350-SMS-SMTP Software upgrade If you already have a version of TF6350 installed on your Windows CE device, you need to perform the following steps on the Windows CE device to upgrade to a newer version: • Open the CE Explorer by clicking on Start --> Run and entering "explorer"...
TwinCAT 3 development environment (XAE). Licensing the full version of a TwinCAT 3 Function A description of the procedure to license a full version can be found in the Beckhoff Information System in the documentation "TwinCAT 3 Licensing". Licensing the 7-day test version of a TwinCAT 3 Function A 7-day test version cannot be enabled for a TwinCAT 3 license dongle.
Page 15
8. Enter the code exactly as it is displayed and confirm the entry. 9. Confirm the subsequent dialog, which indicates the successful activation. ð In the tabular overview of licenses, the license status now indicates the expiry date of the license. TF6350 Version: 1.4...
Page 16
Installation 10. Restart the TwinCAT system. ð The 7-day trial version is enabled. Version: 1.4 TF6350...
The function blocks, which are described in the chapter obsolete are obsolete. Their usage is depri- cated. Please use the function blocks FB_SmtpV3 and FB_SmtpV3_Full which should provide the same functionality. Requirements Development environment Target system PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_Smtp Version: 1.4 TF6350...
At least one recipient must be entered. However, it is also possible to enter multiple addresses. These must be separated by a semicolon. The string is limited to 255 characters. TF6350 Version: 1.4...
Page 20
The maximum amount of characters, that can be used in a message, is 510.725 - you have 1275 characters for From, To, Cc, Bcc and Subject. Requirements Development environment Target system type PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_Smtp Version: 1.4 TF6350...
Page 21
AmsNetID on which the TwinCAT SMTP server is running. sSmtpServer: name or IP of the SMTP server to be reached. sUsername: user name of the SMTP server to be reached. sPassword: password for the SMTP server to be reached. TF6350 Version: 1.4...
Page 22
The length can be specified by the LEN operator. bExecute: the function block is enabled by a rising edge at this input variable. sAttachments: list of attachments (path and file name) to be sent. tTimeout: the allowed maximum time to execute a command. Version: 1.4 TF6350...
Page 24
Make sure, that you don't use \o within byte-arrays. Otherwise the Message will be cut. The maximum amount of characters, that can be used in a message, is 510.725 - you have 1275 characters for From, To, Cc, Bcc and Subject. Version: 1.4 TF6350...
Page 25
sAttachments : ARRAY [0..32] OF STRING; (* Different attachments *) bExecute : BOOL; (* Trigger flag *) tTimeout : TIME := T#20s; (* Communication timeout *) END_VAR sNetId: AmsNetID on which the TwinCAT SMTP server runs. sSmtpServer: Name or IP of the SMTP server. TF6350 Version: 1.4...
Page 26
(e.g. "Mail sent at: Thu, 23 Mar 2006 02:31:44 -0800"). The address of the string can be determined with the ADR operator. cbMessage: Length of the email text. The length can be determined through the LEN operator. Version: 1.4 TF6350...
Page 27
The maximum amount of characters, that can be used in a message, is 510.725 - you have 1275 characters for From, To, Cc, Bcc and Subject. Requirements Development environment Target system type PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_Smtp 4.2.1.3.3 FB_SmtpAttach TF6350 Version: 1.4...
Page 28
Mar 2006 02:31:44 -0800"). The address of the string can be determined with the ADR operator. cbMessage: Length of the e-mail text. The length can be determined through the LEN operator. bExecute: The function block is activated by a rising edge at this input. Version: 1.4 TF6350...
Page 29
The block sends a byte stream to a remote ADS device via ADS. The TwinCAT ADS Smtp service must be running on the remote ADS device, so that the byte stream can be received and processed into an e-mail. Once the byte stream has been processed the e-mail is sent. TF6350 Version: 1.4...
Page 30
Length of the e-mail text. The length can be determined through the LEN operator. bExecute: The function block is activated by a rising edge at this input. tTimeout: Maximum time allowed for the execution of the command. Version: 1.4 TF6350...
An email is sent after triggering the variable bStart. ToDo: configure the mail server address and credentials. Download Sample1 TC3 project Program variables PROGRAM MAIN fbSendMail: FB_SmtpV3; sMessage: STRING := 'Hello Beckhoff'; R_Edge: R_TRIG; bStart: BOOL; bBusy: BOOL; bError: BOOL; nErrID: UDINT;...
General system information • What kind of hardware is being used on the computer running TF6350 SMS/SMTP? ◦ Beckhoff IPC or Embedded PC: Which product number does the PC have? ◦ Which Operating System image version is currently installed on that computer? Product-related system information •...
• WebMail Provider (e.g. GMAIL, Hotmail, GMX) • Please provide the SMTP logfile (see 2. of the troubleshooting list) • Please provide an exact description of the environment in which the product TF6350 SMS/SMTP is being used ◦ Where is the computer running TF6350 SMS/SMTP located? ◦...
The following table describes the possible error codes, returned by the WSAGetLastError function. The errors are sorted in alphabetical order. Some error codes that are defined in Winsock2.h are not returned. They are not included in the list. TF6350 Version: 1.4...
Page 36
Socket type not supported.The support for the specified socket type does not exist in UPPORT this address family. For example, the optional type SOCK_RAW might be selected in a 10044 socket call, and the implementation does not support SOCK_RAW sockets at all. Version: 1.4 TF6350...
Page 37
Socket is already connected.A connect request was made on an already-connected 10056 socket. Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence. TF6350 Version: 1.4...
Page 38
Nonauthoritative host not found.This is usually a temporary error during host name 11002 resolution and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful. Version: 1.4 TF6350...
Page 39
SUCCESS and does not provide an extended error code. Can indicate a service provider implementation error. Requirements Development environment Target system type PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_Smtp TF6350 Version: 1.4...
The SendSMS function block allows an SMS to be sent via a connected GSM modem. The function block is based on the 'Serial Communication' library. Because the block only communicates via the ComBuffer structure in the 'Serial Communication' library, instances can be formed, and it can be applied to every kind of serial interface. Version: 1.4 TF6350...
Page 41
These structures, and their usage, are described in more detail in the documentation for the ‘ Serial Communication' library.The SendSMS block is here connected to a SendString or ReceiveString block. Requirements Development environment Target system type PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_Sms TF6350 Version: 1.4...
stLibVersion_Tc2_SMS_SMTP : ST_LibVersion; END_VAR ST_LibVersion To compare the existing version to a required version the function F_CmpLibVersion (defined in Tc2_System library) is offered. Compare versions All other possibilities known from TwinCAT2 libraries to query a library version are obsolete! Version: 1.4 TF6350...
Samples 5.2.1 Sending an SMS via the Beckhoff 4G stick The installed 4G stick is connected as a virtual serial interface, through which the PLC can connect via ADS. By calling the function block "SendSMS" the SMS is sent to a recipient.
Sending a Test SMS using a Mobile Telephone To find out whether the SIM card is correctly configured, it can be inserted into an ordinary mobile phone and used to send an SMS. It should not be necessary to enter a PIN number here. Version: 1.4 TF6350...
Page 45
The lamp flashes if the modem is connected to a network. If the lamp is continuously illuminated, the fault finding section should be consulted in the Westermo manual. Requirements Development environment Target system type PLC libraries to be linked TwinCAT v3.0.0 PC or CX (x86) Tc2_ TF6350 Version: 1.4...
Page 47
The router is not active. 0x50B 1291 0x9811050B ROUTERERR_FRAGMENTBOXFULL The mailbox has reached the maximum number for fragmented messages. 0x50C 1292 0x9811050C ROUTERERR_FRAGMENTTIMEOUT A fragment timeout has occurred. 0x50D 1293 0x9811050D ROUTERERR_TOBEREMOVED The port is removed. General ADS error codes TF6350 Version: 1.4...
Page 48
License not valid for this system ID. 0x732 1842 0x98110732 ADSERR_DEVICE_LICENSEDEMODENIED Demo license prohibited. 0x733 1843 0x98110733 ADSERR_DEVICE_INVALIDFNCID Invalid function ID. 0x734 1844 0x98110734 ADSERR_DEVICE_OUTOFRANGE Outside the valid range. 0x735 1845 0x98110735 ADSERR_DEVICE_INVALIDALIGNMENT Invalid alignment. 0x736 1846 0x98110736 ADSERR_DEVICE_LICENSEPLATFORM Invalid platform level. Version: 1.4 TF6350...
Page 49
Example: successful processing, but with a negative or in- complete result. 0x0000_0203 S_PENDING No error. Example: successful processing, but no result is available yet. 0x0000_0256 S_WATCHDOG_TIMEOUT No error. Example: successful processing, but a timeout occurred. TCP Winsock error codes TF6350 Version: 1.4...
Please contact your Beckhoff branch office or representative for local support and service on Beckhoff products! The addresses of Beckhoff's branch offices and representatives round the world can be found on her internet pages: https://www.beckhoff.com You will also find further documentation for Beckhoff components there.
Need help?
Do you have a question about the TF6350 and is the answer not in the manual?
Questions and answers