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

  1. Install and register the TwinCAT I/O software from Beckhoff.
  2. Install and register the TwinCAT OPC server software from Beckhoff.
  3. 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.
  4. Install a Profibus master card PCI FC3101 from Beckhoff.
  5. Install a LabVIEW DSC Runtime system from National Instruments.
  6. If the NI software is used from a non-administrator account later:
    1. it might be a good idea to grant "modify" access rights to the folder, where you installed the software.
    2. start the DSC Runtime system once with administrator rights.
    3. include the folder of the binary of the DSC runtime system in the environment variable PATH.

Configuration of Profibus hardware

  1. 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.
  2. Start the TwinCAT system manager
  3. In "I/O - Configuration" -> "I/O Devices" do "Scan Devices": You should find your "Profibus Master (FC31xx)"
  4. 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

  1. In the TwinCAT system manager, add a task on the list of tasks
  2. Create all I/O variables you intend to use
  3. Link all I/O variables to proper I/O of the field bus terminals (take care of the correct data types)
  4. Right-Click on "Inputs" and "Outputs" and do "Recalc addresses"
  5. Click on your task and on the right do select
    1. "Auto start"
    2. "I/O at task begin"
    3. "Create symbols"

(Re-)Start of a TwinCAT system

  1. On the menu bar symbols press
    1. "Generate mappings"
    2. "Check configuration"
    3. "Activate configuration"
    4. "Set/Reset TwinCAT to Run Mode"
  2. 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".
  3. 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

  1. As user with administrator rights (sorry) start the "TwinCAT OPC Configurator".
  2. Right-click on "I/O Devices" and select "New".
  3. Enter a name of the device by hand (like "myTestServer").
  4. In "AutoCfg" select "5 - Upload symbolic from ADS-device"
  5. In "Ads port" enter port number "301" (default port of ADS service of a TwinCAT task).
  6. Select "Apply"
  7. Save the settings (File->Save or CTRL+S) and acknowledge everything
  8. Restart the TwinCAT system
  9. 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.
  10. In order for automated startup of the TwinCAT system and the OPC server, do the following
    1. Open the TwinCAT system manager
    2. On the left, click on "SYSTEM Configuration"
    3. On the right, select "Boot Settings"
    4. 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).
    5. As an alternative to step a) - d) you may try the following
      1. Right click on the TwinCat item in the task bar and choose properties
      2. Select "system"
      3. Select Autoboot enable, activate auto logon, and enter the right username and password
  11. 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

  1. Start the "Tag Configuration Editor" of the LabVIEW DSC runtime system.
  2. Using the import Wizard, import all OPC items from the TwinCAT OPC server.
  3. Eventually, you want to edit the tags (logging, tag group, ...)
  4. Start the "Tag Monitor" and try that you can talk to the hardware.

-- DietrichBeck - 01 Feb 2008

Topic revision: r8 - 2008-02-01, DietrichBeck
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)