Getting Started - Profibus, OPC, ...
This How-To aims at describing how to set up one PC for usage of Profibus and OPC stuff together with
CS. Before starting have a look at the HOW-TOs
Getting Started - Basic Level,
Getting Started - Medium Level and
Getting Started - Advanced Level. This HOW-TOs assumes the usage of Profibus and OPC products from
Beckhoff.
This HOW-TO assumes TwinCAT I/O v2.10 and TwinCAT OPC server v4.1.
Installation of Profibus and OPC products
- Install and register the TwinCAT I/O software from Beckhoff.
- Install and register the TwinCAT OPC server software from Beckhoff.
- If the TwinCAT software is used from a non-administrator account later, it might be a good idea to grant "modify" access rights to the folder, where you installed the software.
- Install a Profibus master card PCI FC3101 from Beckhoff.
- Install a LabVIEW DSC Runtime system from National Instruments.
- If the NI software is used from a non-administrator account later:
- it might be a good idea to grant "modify" access rights to the folder, where you installed the software.
- start the DSC Runtime system once with administrator rights.
- include the folder of the binary of the DSC runtime system in the environment variable PATH.
Configuration of Profibus hardware
- Set up the Profibus hardware (master, couplers (with terminals) and cable). Please refer to the documentation of Profibus devices and hardware as well as literature on how Profibus works.
- Start the TwinCAT system manager
- In "I/O - Configuration" -> "I/O Devices" do "Scan Devices": You should find your "Profibus Master (FC31xx)"
- In "Profibus Master (FC31xx)" do "Scan Boxes": You should find all Profibus bus couplers that are correctly configured (see manual) and connected to the "Profibus Master (FC31xx)" via a Profibus cable.
Configuration of a TwinCAT task
- In the TwinCAT system manager, add a task on the list of tasks
- Create all I/O variables you intend to use
- Link all I/O variables to proper I/O of the field bus terminals (take care of the correct data types)
- Right-Click on "Inputs" and "Outputs" and do "Recalc addresses"
- Click on your task and on the right do select
- "Auto start"
- "I/O at task begin"
- "Create symbols"
(Re-)Start of a TwinCAT system
- On the menu bar symbols press
- "Generate mappings"
- "Check configuration"
- "Activate configuration"
- "Set/Reset TwinCAT to Run Mode"
- Watch the logger output. You should see a message like "TCIO (300) 24-Oct-06 1:53:00 PM 989 ms Profibus Master (FC31xx): Slave 92 in data exchange mode".
- You can check the functionality of the TwinCAT system by reading or writing to/from I/O by using the "Online" feature of the TwinCAT system for your task.
Configuration of OPC server
- As user with administrator rights (sorry) start the "TwinCAT OPC Configurator".
- Right-click on "I/O Devices" and select "New".
- Enter a name of the device by hand (like "myTestServer").
- In "AutoCfg" select "5 - Upload symbolic from ADS-device"
- In "Ads port" enter port number "301" (default port of ADS service of a TwinCAT task).
- Select "Apply"
- Save the settings (File->Save or CTRL+S) and acknowledge everything
- Restart the TwinCAT system
- Now you should be able to see all the variables of your task of the TwinCAT system from an OPC client, like the "Shared Variable Manager" of LabVIEW or the "TcOpcClient.exe" of TwinCAT.
- In order for automated startup of the TwinCAT system and the OPC server, do the following
- Open the TwinCAT system manager
- On the left, click on "SYSTEM Configuration"
- On the right, select "Boot Settings"
- Select "Auto Boot" into "Run Mode" (if prompted for a password, you probably have to give user name and pwd for an account with administrator rights on that PC).
- As an alternative to step a) - d) you may try the following
- Right click on the TwinCat item in the task bar and choose properties
- Select "system"
- Select Autoboot enable, activate auto logon, and enter the right username and password
- It has been reported, that in rare cases the registering of the OPC Server fails. In that case run the "RegisterInProcServer.BAT" and the "RegisterServer.BAT" in the "..\TwinCAT\OPC\Server4" folder.
Configuration of LabVIEW DSC engine
LabVIEW >= 8.20
It is NOT (!!!!!!!!) recommended to configure Shared Variables from a LabVIEW project. Instead, they should be created dynamically using the DSCIntProc class. Please refer to the
Database and DSC-SharedVariable Tools for more details.
LabVIEW 7.1
- Start the "Tag Configuration Editor" of the LabVIEW DSC runtime system.
- Using the import Wizard, import all OPC items from the TwinCAT OPC server.
- Eventually, you want to edit the tags (logging, tag group, ...)
- Start the "Tag Monitor" and try that you can talk to the hardware.
--
DietrichBeck - 01 Feb 2008