CX-Server Lite User Manual

CX-Server Lite User Manual

OMRON

Getting Started with CX-Server Lite

be driven programmatically, and any graphical controls need to be driven directly (e.g. the value can be read by the program from the communications control, and then written to a graphical control). This is because graphical controls can only connect

directly

to a communications control on the same Visual Basic form.

Other Features

The following sections provide a brief overview of some of the more advanced features available in CX-Server Lite.

Event Driven Routines

Many of the script examples in this manual use asynchronous communications, that is communications are carried out on demand without synchronisation with the rest of the system.

Asynchronous communications can be easily used to quickly create solutions that are easy to understand. As a solution grows however, asynchronous communications can prove inefficient and produce unpredictable updating, which is difficult to debug because multiple scripts may be demanding the same data at the same time.

The CX-Server Communications Control provides facilities for synchronous communications, that is communications and data updating are synchronised. The

GetData

and

StopData

script commands (see Appendix B for full details) control the generation of

OnData

events on regular intervals, which can be used to efficiently drive multiple controls, and is easier to debug.

Example:

1, 2, 3…

1. Add an

OMRON CX-Server Communications Control

and two standard

Command Buttons

.

2. Double click the communications control to add the following script.

Note the script is in the Event

OnData

:

Private Sub Comms1_OnData(ByVal PLC As String, ByVal

Point As String, ByVal Value As Variant, ByVal

BadQuality As Boolean)

If (Point = "MyPointName") Then

'Data is from this point

Cells(1, 1) = Value

End If

End Sub

Every time

OnData

is called with data from the point

MyPointName

the value is written to the cell A1.

Page 19

OMRON

Getting Started with CX-Server Lite

3. Double click the Command Buttons to add the following script:

Private Sub CommandButton1_Click()

Comms1.GetData("MyPLC", "MyPointName", 1.0, 0)

End Sub

Private Sub CommandButton2_Click()

Comms1.StopData("MyPLC", "MyPointName)

End Sub

Run the application. Click CommandButton1 to start creating OnData events every second.

Note the cell A1 updating. Click CommandButton2 to stop the updating.

Page 20

OMRON

Getting Started with CX-Server Lite

Advanced Properties

When working with Visual Basic the advanced properties dialog is normally displayed on the right of the work form, although it can be docked in any position. In Excel it is opened by right clicking on an object and selecting the Properties option from the popup menu. The dialog allows you to scan through all the available options. Some options require you to enter specific information, others provide a choice of entries from a drop down menu.

From the drop down menu at the top of the dialog select the object to be edited. This will display the full range of options available for that object, which can then be viewed either

Alphabetically or Categorised. A full list of the options and their settings and ranges for the CX-

Server Lite objects can be found in Appendix A – Component Properties.

Page 21

OMRON

Getting Started with CX-Server Lite

Project Tree

Like Explorer the Project Tree provides a graphical representation of you application. In Visual

Basic it is displayed to the right of the work form while in Excel it is shown on the left of the code sheet.

By expanding the tree you can see all your associated files and work sheets. It is possible to open any number of work sheets by simply double- clicking on them. Having multiple work sheets open in this way enables you to copy and paste between them saving you valuable time rewriting sections of code that already exist, and more importantly are known to work.

Controlling ActiveX Objects

A number of objects can be grouped together such as the 7 segment display and the spin buttons by selecting the objects you want to group while holding down the ‘Shift’ key as you select each object. When you have selected all the objects, right click on an object and select the ‘Group’ option from the drop down menu. Note however that objects must be ungrouped before their parameters can be edited.

Other drawing commands such as Bring to Front, Send to Back, Cut, Copy, Past etc. follow the standard windows conventions and are selected from the toolbar and/or drop down menus.

Page 22

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project