Man Eng Mov11.6 Communication Drivers PDF
Man Eng Mov11.6 Communication Drivers PDF
I/O Drivers
Reference Guide
Table Of Contents
1. COMMUNICATION DRIVERS ........................................ 1
1.1. INTRODUCTION ....................................................................... 1
1.1.1. Introduction to Drivers ...................................................................................1
1.1.2. Drivers in Projects ..........................................................................................1
1.1.3. Linking to memory areas................................................................................3
1.1.4. Dynamic Addressing ......................................................................................4
1.1.5. Task Addressing ............................................................................................5
1.1.6. Driver Installation ..........................................................................................6
1.1.7. Driver Communication Configuration File.........................................................7
1.1.8. Driver Duplication ..........................................................................................7
1.1.9. Running Drivers .............................................................................................8
1.1.10. Hardware RS232 Errors................................................................................9
1.2. GENERAL SETTINGS ................................................................ 10
1.2.1. General (Drivers) .........................................................................................10
1.2.2. Debug .........................................................................................................12
1.3. STATION SETTINGS ................................................................ 12
1.3.1. Stations.......................................................................................................12
1.3.2. General (Stations)........................................................................................13
1.3.3. Half Duplex..................................................................................................14
1.3.4. Serial Port Settings (serial drivers only) .........................................................14
1.3.5. Queue Size..................................................................................................15
1.3.6. Timeouts .....................................................................................................15
1.3.7. Bridging Service Settings..............................................................................16
1.3.8. TAPI Settings (serial drivers only) .................................................................18
1.3.9. TCP/IP Settings (ethernet drivers only) .........................................................19
1.3.10. RAS Settings (ethernet drivers only) ...........................................................20
1.3.11. Special TAPI and RAS configurations ...........................................................22
1.4. TASK SETTINGS .................................................................... 22
1.4.1. Tasks ..........................................................................................................22
1.4.2. Static Tasks .................................................................................................23
1.4.3. Dynamic Tasks ............................................................................................25
1.5. IMPORT DEVICE DATABASE ....................................................... 28
1.5.1. Import Device Database...............................................................................28
1.6. API BASIC SCRIPT INTERFACES .................................................. 29
1.6.1. Basic Script Interface Use.............................................................................29
1.6.2. DriverInterface ............................................................................................31
DriverInterface Events ................................................................................... 31
DriverInterface Functions................................................................................ 32
DriverInterface Properties ............................................................................... 41
1.6.3. TaskInterface ..............................................................................................41
TaskInterface Functions.................................................................................. 41
TaskInterface Properties ................................................................................. 48
1.6.4. StationInterface ...........................................................................................55
StationInterface Functions .............................................................................. 55
StationInterface Properties ............................................................................. 59
1.6.5. SerialTAPIHalfDuplexBaseStationInterface ....................................................63
Functions ...................................................................................................... 63
Properties ..................................................................................................... 66
1.6.6. SerialStationInterface...................................................................................68
SerialStationInterface Functions ...................................................................... 68
SerialStationInterface Properties ..................................................................... 69
1.6.7. TAPIStationInterface ....................................................................................76
TAPIStationInterface Functions ........................................................................ 76
TAPIStationInterface Properties ....................................................................... 79
1.6.8. TCPIPStationInterface ..................................................................................85
TCPIPStationInterface Functions ...................................................................... 85
TCPIPStationInterface Properties ..................................................................... 87
1.6.9. RASStationInterface.....................................................................................93
RASStationInterface Functions ........................................................................ 93
RASStationInterface Properties ........................................................................ 95
1.7. ERRORS ............................................................................102
1.7.1. Error Descriptions ................................. Errore. Il segnalibro non è definito.
1.8. ABOUT ............................................................................. 107
1. Communication Drivers
1.1. Introduction
1.1.1. Introduction to Drivers
This section includes a detailed description of the settings to configure in the Supervisor
Communication I/O Drivers used in supervision projects. To access the communication drivers settings,
select Real Time DB and List Comm.Driver from the project explorer, then right click on the driver
name.
The drivers are dynamic libraries (.DLL files) which, based on 'exception-based' logic, transfer the
information received from the connected device's memory areas to the Supervisor memory areas and
vice-versa, according to predefined settings.
By using the Driver's settings you can specify the associations between the field variables and the
Supervisor variables. The system, through the serial port, the fieldbus or the network being used, will
read and write the variables 'from' and 'to' the plant, according to the set modalities.
The thread pooling technology, adopted by the Supervisor drivers, is used for exchanging information
with the field in the most efficient way, by managing automatically optimized communications
according to the effective use of the variables in the project being run.
In fact, only the effectively-in-use variables from the system will be exchanged with the field, leaving
the driver the job of optimizing and making communications more efficient.
The Supervisor Drivers have been enhanced to make Supervisor communication extremely more
powerful and scalable.
Thanks to the common to all driver features, you will be able to get:
1
For instance, when using PLCs the driver will use the communication
protocol provided by the device for exchanging data between the
memory areas of PLC and the Supervisor and vice-versa, according to
the configurations and data associations set in the driver properties
and/or in the variable properties of the Supervisor project.
The driver can read or write in the memory areas and the transmission modalities are determined by
the devices constructors, therefore it is advised to carefully read the instruction provided with the
specific device you wish to connect to.
Carefully read and follow the specifications given by the hardware device
constructors for connecting and associating data between the device and
the Supervisor.
Independent of the protocol and the hardware constructors, the Supervisor drivers allow the
programmer to use the same user interface to configure and setup communications according to the
configuration possibilities provided.
According to the layout above, the driver manages communication protocol at a low level.
1. The driver requires the setting of the main communication parameters by using the
'Station' concepts (the relative parameters need to be set according to whether you are
dealing with serial or network drivers)
2. By means of "Tasks" concept, the driver consents 'indirect' association between the device
addresses and the variables of the Supervisor project to be setup. The tasks offer the
possibility to communicate in data blocks, by setting a variable (or a group of variables) in
association to a device's address (or start address). This way the user can configure links to
the device's memory areas in indirect mode and therefore independently from the project.
3. By using the 'Dynamic Address' concept, the driver consents a direct association of the
memory address in the project's Tag properties. In this way the variable points directly to the
devices address, leaving the driver the job of dynamically creating communication tasks
which will always be optimized.
4. The driver always works with the Supervisor project's "Real time Database" . The
variables are therefore associated directly (Tags property) or indirectly (Tasks). In any case
communication is optimized according the 'Variables in use' concept.
5. The driver's configuration is saved in the appropriate XML files in the project's 'Resources'
folder. The files are based on XML meta-language, as with all the project, for maximum
transparency. The driver's files are:
<driver_name>.drvsettings = files containing the driver's general settings
<driver_name>.dynsettings = files generated upon runtime start with the characteristics of
the calculated dynamic tasks.
2
The Supervisor Drivers are libraries which can also be used independently of the
Supervisor projects, that is, they can also be inserted in other programming
environments which are compatible with the ActiveX technology.
1. Input Area
2. Output Area
3. Flag Area (Internal)
Shared Area variables can be exchanged with the field using Input, Output or Input/Output
independently from the type of area selected.
Link to device
3
A task defines the link between a group of Supervisor's tags and the corresponding memory area of
the device, also specifying the methods to access and manage data.
The Supervisor offers you the possibility to set the driver's communication using two different task
concepts: the 'static' task (usually defined simply as 'task') and the 'dynamic' task.
Dynamic Tasks: these Task are automatically created by the driver at project startup, based on the
links to device's addresses set in the 'Dynamic Address' properties of each single tag. The driver will
manage tags grouping and performances optimization.
Static tasks: these Task are defined by the designer who has the responsibility to define grouping
and communication parameters.
The tag's dynamic address can also be specified by directly typing it in the 'Dynamic' property edit box.
The address syntax is:
For instance:
The 'Minimum Threshold' parameter is set to 5 by default. In this example when the project starts,
the driver dynamically creates the '.dynsettings' XML file in the project's 'Resources' folder, grouping
the tags in 2 dynamic tasks.
In the first task the words from 0 to 3 are read, in the second task (needed because the address of
the next word to be read exceeds 5 bytes distance as indicated by the' Minimum Threshold' parameter)
the words from 12 to 18 are read.
If, however, we set the 'Minimum Threshold' parameter at 20, the driver will dynamically
create one task only by reading from the word 0 to the word 18 at project startup.
The tags associated to the driver in 'dynamic' mode will be automatically managed by default in read-
write mode by the driver. The driver will decide whether to manage only in write or in read-write mode
according to the possibilities offered in the associated device's area. Moreover this setting can be
4
changed in the 'Task property' window or through the '.dynsettings' XML file generated automatically
at the start of the project run. The data in the XML file regarding run type is as follows:
<TypeName> where it is possible to change the default value 1 with the following values:
0 = Input (read only)
1 = Input/Output (read/write)
2 = Output on exception (write only if value has changed)
3 = Output continuous (write anyway)
Important Note: to set a list of tags in the task which should be consecutive
starting from the device address , type in the 'Variables' field the names
of the tags, separated by the ';' character. The ellipse button helps in
selecting the tags from the Real Time database tags' list.
A task created with this procedure can include one or more tags, all of the same data type (i.e all word
or all float) and consecutive in device memory area. The address to specify for the task is the starting
address, corresponding to the first tag in the list.
Only a few drivers allow task creations which include different types of variables (i.e. Byte, Word, etc).
For further information, please consult each driver's manual documentation.
Input This kind of task reads data from the connected device and writes it in the
Supervisor tags. They can also be executed on event. In this case the task will
be executed only when the associated tag is set different from 0. When the
Input task is not executed on event, it will be executed with the polling
technology together with the other input tasks.
Output This kind of task writes the Supervisor Tag data values in the connected device.
The output tasks are executed by the Supervisor with the 'Event-driven'
technology, which means only when there is a data variation in the Supervisor
which needs to be notified to the PLC or to the connected device. The driver
also permits continuous data writing.
Input/Output The input/output tasks are managed in 'polling' mode to keep data read from
the connected device updated, whereas the writing of data is performed on
event only when there is a data change in the Supervisor, by rewriting the
changed data to the connected device. The input/output tasks, however,
always read data from the device first, then write data when necessary.
COM (OLE2) The Supervisor can also manage tasks which have not been configured directly
in the driver, but performed at runtime by the VBA Basic Script. In this case
the tasks are executed by the driver according to script code written by the
user, by executing the read or write tasks in synchronous or asynchronous
mode.
Even though the programmer must be very careful when using Tasks, he/she will however have the
benefit of being able to decide how data is to be exchanged and not the Supervisor.
The communication tasks are executed by tag name only and not by absolute address.
5
Remember that the tasks also allow the COM (Component Object Model)
driver interface to be used for handling or performing any communication task
using VBA scripts.
Project designers may choose which communication driver to insert and configure in their various
applications, simply selecting it from the list provided.
The insertion and setting up of a communication driver is done in Supervisor programming mode,
through the 'Comm. Drivers List' resource from the 'Real Time DB' group in the 'Project Explorer'
window. When activating the 'Add new Comm. Driver' command a dialog window, containing a list of
the drivers available, will display.
The botton window shows important data linked to the selected communication driver:
Once the driver has been inserted, it can be configured through the Supervisor 'Properties Window'.
More than one communication driver can be inserted into a single project, as long as they comply with
the options set on the hardware key.
A new item called the ""Renaming Manager" has been added the Communication Drivers list of features
which allows you to know whether the driver supports the renaming management. Those drivers that
support this management, option set to 'true', consent variables to be displayed with names modified
within their configuration window; and to support apply new name command.
6
1.1.7. Driver Communication Configuration File
When a new communication driver is added to the project, it can be setup to load any existing custom
".drvsettings" configuration file. In this way the driver will be able to obtain the settings initially set by
the programmer if different from those for default.
Whille the Visu+ is being installed all or some of the subfolders indicated in the Visu+ installation folder
will be created and within which there should be driver "drvsettings" configuration files:
[Install Folder]\drvsettings\WinCE\
[Install Folder]\drvsettings\Win32\
[Install Folder]\drvsettings\ClientCE\
[Install Folder]\drvsettings\ClientWin32\
[Install Folder]\drvsettings\ClientJ2SE\
[Install Folder]\drvsettings\ClientJ2ME\
As you can see there are six subfolders, one for each platform that can be selected in the project. In
this way different configuration files can be defined for the same driver according to the platform type
selected. If any of the folders listed above do not exist, they can be added manually.
When a communication driver is added to the project, Visu+ will search for an existing file with the
same driver name and ".drvsettings" extension (i.e."ModbusTCPIP.drvsettings) within the folder
corresponding to the platform selected for the project. If and when the file is found it will be copied
to the project resource folder (the file's date and time will be set with the current date and time). If
the file is not found the driver settings window will open using the default settings.
For instance, if the project has been set with the "Windows CE" platform, and the "Modbus TCPIP"
driver is added, Visu+ will check whether a file named "ModbusTCPIP.drvsettings" exists in the "[Install
Folder]\drvsettings\WinCE \" folder, and if and when found it will be copied to the project resource
folder.
If more than one platform has been enabled in the project, the order of priority with which the
"drvsettings" files will be selected for copying is: WinCE, Win32, ClientCE, ClientWin32, ClientJ2SE,
ClientJ2ME.
In cases when the ".drvsettings" file already exists in the resource folder when inserting a driver, this
file will be left unchanged and therefore not overwritten.
The configuration files created while installing Visu+ may be modified as required.
For instance, you may need to install two or more drivers of the same type to communicate in the
same system environment at the same time but it is not enough to simply set two different Stations
with the same protocol for the device of the same type.
Example: you want the PC, on which the Supervisor is installed, to communicate with two identical
devices on two distinct PC communication channels. To duplicate the Communication Driver you need
to:
1. Duplicate the driver's DLL file which you can find in the "Drivers" folder in the Supervisor
installation folder. The copied file must have a name different from the original one, for instance
the same name plus an increasing index.
2. Create in the "Drivers.xml" file a new block indicating the new .DLL file, just by duplicating the
block of the original file and giving it a new name and description, so that they appear as two
identical drivers but with different names and descriptions on the Supervisor Driver list.
When a driver is duplicated it will result and have all the effects of a new
driver, therefore you will need to provide an additional driver in the license
options. When using two drivers, even though of the same type because
duplicated, the license must be enabled for two communication drivers.
A practical example:
7
You wish to manage a project where two "Modbus Serial" drivers must be used. The following steps
must be carried out:
Dll Duplication
Make a copy of the original "Modbus.dll" in the Supervisor Installation "Drivers" sub-folderand and
call it i.e. "Modbus1.dll".
In this way, when you open the window with the list of available Drivers, you will also find the one you
have just duplicated.
The presentation of a green coloured led on the Status Bar on the Supervision
window's bottom border (if displayed) means that the installed driver is
8
communicating correctly with the field. The red coloured led indicates that there is
a communication error.
Any communication problems (cable, connections, settings, etc.) will generate communication errors
that will be alerted by the driver in the Status Bar and recorded in the Historical Log.
Note: the drivers are independent of the project, and their configurations are saved
in separate appropriated files, which are identified by the ".drvsettings" and
"dynsettings" extensions. This philosophy guarantees that the project is kept intact
when changing PLCs or communication devices.
The driver can be subordinated to the conditions established by the programmer during runtime
execution.
The communication hardware errors are generally due to the following possible causes:
The hardware error messages supplied by the driver relate to the codes emitted on the error register
of the serial UART chip.
When a generic hardware error occurs, the Supervisor reports a number, translated in
binary, you can use to identify the error or errors by confronting each single bit whose
meanings are described in the table below:
1 RX OVER The serial has received more characters than the buffer
capacity can hold
2 OVERRUN The serial has received a character before the previous
one was processed by the system
4 RX PARITY Error in parity, inconsistency between the parity received
and the one set.
8 FRAME Data frame error. The data received does not respect
the set characters (length, stop bit, etc.)
16 BREAK Break Status requested by participant
All the other communication errors depend on the specified protocol, therefore you
need to refer to the indications of that specific driver. The driver error messages are
displayed on the status bar and can be viewed in the Historical Log.
9
1.2. General Settings
1.2.1. General (Drivers)
Some of the properties common to all the communication drivers can be configured on this setting
card.
It is not generally necessary to change any of the default settings.
Wait Time
The pause time, expressed in milliseconds, between the execution of two tasks (data blocks) of
successive communication. It may be necessary to change the default value for devices which need a
wait time between one interrogation and the next (i.e. devices with poor performances). It can be
useful to modify the default value also when it is necessary to lighten the workload of the CPU.
Time-out
The time-out time for executing synchronized tasks. The value is expressed in milliseconds.
Minimum Threshold
This parameter determines the minimum threshold for the fragmenting of data blocks exchanged with
the device. The Supervisor automatically calculates (at project startup) the size and quantity of
dynamic tasks to be created by the driver for dynamic variables (tags with dynamic addresses)
communication.
The Supervisor, in fact, tries to optimize the communication grouping the highest number of data in
the same task. When the data is linked to addresses distanced between each other, this value
determines the distance in bytes which allows the Supervisor to decide whether to create a new task
for the next data block.
Example:
The driver's 'Minimum Threshold' parameter is set to 5 as default. In this example the driver will
dynamically create the '.dynsettings' XML file in the project's 'Resources' folder, and the driver
will generate 2 dynamic tasks.
In the first task the words from 0 to 3 will be read, in the second task (which is necessary because the
next word to be read is to an address which exceeds 5 bytes as indicated by the Minimum Threshold'
parameter) the words from 12 to 17 are read.
If, however, we set the 'Minimum Threshold' parameter at 20, the driver will dynamically create one
task only by reading from the word 0 to the word 18 upon project startup.
Aggregation Limit
This parameter allows you to specify the maximum number of bytes to be aggregated for each dynamic
task. By leaving this parameter to zero the driver will use the maximum value set in the selected
protocol as a maximum limit. Changing this parameter value may be necessary when using devices
which have a lower maximum byte number limit compared to the protocol being used for exchanging
tasks.
Synch.Startup
This option determines the synchronization between the logic and driver communication at the project's
startup.
When this option is set to 'True', the Supervisor will wait until the static input tasks have been
completely executed before processing the project's logic and scripts.
Though this option will cause the project to take longer in starting up, the logic will run with 'updated'
input values ensured.
VBA Interface
Indicates whether the driver supports the COM (Component Object Model) interface. The COM
interface, also defined as OLE2, grants the use of VBA script logic for handling the driver, according to
the methods, the properties and the events described in the appropriated documents.
Polling Time
This parameter, expressed in milliseconds, represents the minimum polling time for executing tasks
for updating data when variables are in use.
10
This value will be obtained by all the Dynamic tasks with the same Polling Time (Not all drivers allow
you to specify a Polling Times for each Dynamic task). As regards to Static tasks, this value is inserted
as the default value in the task's property ("Polling Time") when created. This value can then be
changed through the Static Task's property afterwards.
Setting this value to 0, meaning that the data is updated with the highest velocity possible.
A higher value can be set, for example, when the data does not require rapid updating times.
When this parameter is set to 0, the tasks will not be executed when the tags are
not in use.
Protocol Priority
This box is used for setting the communication thread priority, which is the priority given to the driver's
execution in respect to other Supervisor processes.
The possible values, starting from low to high priority, are:
• Normal
• High
• Very High
• Real Time
Take extreme care not to exceed the CPU workload (CPU at 100%), when changing
the default value (Normal).
It may be useful to try and increase the driver's process priority due to elevated
communication loads. In this case it is advised to set the Wait Time parameter at a
value other than 0, to avoid too many system resources being used.
11
value has changed both in the Device and in the Supervisor, the driver will give priority to Device tag
value. This behaviour can be modified by setting the "Direct Output for Input/Output" property to
'True', so that the changed Supervisor value gets written directly to the Device Tag. This behaviour is
applied to all Tasks of "Input/Output" types.
1.2.2. Debug
Some of the properties concerning the Debug, common to all the communication drivers, can be
configured on this setting card.
It is not usually necessary to change any of the default settings.
Debug Window
Default value = False. When selecting 'true', the driver shows all the diagnostic and debug messages
generated by the driver in the appropriated Debug window (they can also be viewed in the Supervisor
workspace Output bar).
The debug window activation may slow down the task activation and, in
general, the communication speed. We suggest you use this option only
when strictly needed, such as in the debug phase.
Max Entries
Default value = 10000. The value, relating to the maximum number of diagnostic message strings
displayed in the debug window before being recycled, is set in this box. When the default value is left,
the window will keep the last 10,000 message strings displayed.
Log FileName
If no file name is specified here, the driver's diagnostic Log file name will be 'System.log' and it will be
located in ProjectFolder\LOGS folder. To locate it elsewhere, please specify in this box the file name
and path for the driver's diagnostic Log.
The generated file will be a standard text file.
The communication stations allow you to set, like the driver, how communication must be managed,
where each station represents a communication channel towards the configured device.
Add
The "Add" button allows you to insert a new 'station' for the communication driver. When inserting a
new station a window will automatically display for setting the parameters of the communication
required.
Once the station or stations have been inserted you can change or remove them by using the buttons
indicated below.
Edit
12
The 'Edit' button allows you to modify the parameters of a previously inserted station. Therefore you
first need to select the station you wish to modify then use the 'Edit' button or double click on the
station name in the list.
Remove
The "Remove" button allows you to delete a previously inserted station. Therefore you need to first
select the station you wish to modify then use the 'Remove' button.
Test Cable/Comm.
This button allows you to run a communication test with the device. Thanks to this very handy
functionality the driver will attempt communication to verify whether the cables have been connected
correctly and the main communication parameters have been properly set.
The communication test is invoked by reading specific data according to the test
criteria of each single protocol.
Therefore it might be necessary to refer to the specifications indicated by each of
the drivers to see what kind of test is carried out.
For instance, with generic protocols such as Modbus, the test invokes the reading of
a specific Function Code (FC2) which may not necessarily have been implemented
on the connected device.
Please be reminded again that in each case the test only verifies whether the cable
and general parameter configurations have been done correctly, while the correct
association between data in the Supervisor and the device is demanded to the
project designer whether data in the Supervisor and the device have been associated
correctly.
Station Name
Name which identifies the station corresponding to the device with which it is to communicate. The
station name is the one internal the driver.
When more than one station is to be set, each one must have its own name.
Error Threshold
When there are any communication errors, this parameter sets the number or errors to be reached in
order for the Driver to effectively give communication error notification. The internal counter will not
alert any occurrences of communication break-down without re-attempting to retrieve communication
beforehand. When the number of attempts have been reached the driver will give out an error warning.
State/Command Variable (only managed for drivers using driver base library build 250 and
later)
By assigning the name of a numeric variable of the Supervisor (Byte type recommended) to this
property, it is possible to check the communication state with the selected station, to enable/disable
the communication with this station, to start/stop TAPI connections (serial drivers only ) or RAS
connections (Ethernet drivers only ), and to switch between TCP/IP servers (Ethernet drivers only).
See the following table for the meaning of the variable bits. Please note that some bits can only be
used to check the state of the station, while other bits can only be used to set the state of the station
(commands).
• The variable's bit 1 can be used to check and modify the station's Active/Inactive state
• Bits 4, 5, 6 can be used to manage a TAPI connection (serial drivers) or a RAS connection
(Ethernet drivers)
A "State/Command Variable" of type bit can be used if the only information needed is the
communication state (bit 0).
13
Bit 2 Switch the active TCP
(Command) Server
Bit 7 Always 0
(Unused)
Keep Opened
This property is present in serial drivers only. It allows you to establish whether the driver must keep
the communication port open (and therefore always busy) or not. When the value is set to True , the
driver is loaded at the start up of a project run and always keeps the associated communication port
open (busy).
When setting the value to False, the driver closes the communication serial port after every 'Input' or
'Output' operation has been done, thus leaving the port free.
These settings are normally reserved for the expert user and therefore we
recommend that you leave the default settings.
Signal
Selects the signal of the RS232 used to control the direction of transmission. Possible values: None
(default value), RTS e DTR.
The serial is managed by the modem's driver when the station's TAPI settings are used for managing
communications via modem. The settings with which the serial is opened are therefore those defined
in the modem's driver's advanced properties and may be different to those set for the Movicon driver
station ("Serial Port Settings").
14
Port
Default value = 1. Sets the number of the serial port to be used for communicating. I.e. value = 1 for
COM1
Note: you need to make sure that no conflicts occur in Windows when using the
ports. For instance, when installing the Com4 port, you need to make sure that the
assigned address and the IRQ are compactible with the PC's configuration. In order
to do this we advice you use addressable serial cards.
Baud rate
Default value = 9600. Sets the velocity of the serial communication (Baud Rate). The value of the
communication's velocity must correspond to that of the device to be communicated with.
Byte Size
Default value = 8. Sets the amount of bytes required by the communication protocol in use.
Parity
Default value = Even. Sets the parity type required by the communication protocol in use.
Stop Bits
Default value = 1 stop bit. Sets the number of Stop Bits required by the communication protocol in
use.
Flow Control
Default value = None. Sets the data Flow Control type for the type of communication in use. This
property permits the flow of communication data from the connected device's serial port to be
adapted to low level protocol requirements. The default value, 'None', means no flow control,
nevertheless it might be necessary to select a flow control type (i.e. when signalling errors with
code '1').
The options are:
These settings are normally reserved for the expert user and therefore we
recommend that you leave the default settings.
Rx Queue
Sets the quantity of data bytes to be managed by the serial port to buffer values being received. The
default value is used if not specified differently.
Expert users can change this value to adapt to the needs of the system being used.
Tx Queue
Sets the quantity of data bytes to be managed by the serial port to buffer values being transferred.
The default value is used if not specified differently.
Expert users can change this value to adapt to the needs of the system being used.
1.3.6. Timeouts
In this group of settings you need to set the selected station with the configurations inherent in serial
communication time-outs.
15
These settings are generally reserved for expert users and therefore it is
advised to keep the default settings.
Rx Timeout
Default value = 5000. Sets the wait time interval value, in milliseconds. When exceeded, the driver
notifies time-out of communication reception.
The time-out refers to data being received.
Tx Timeout
Default value = 5000. Sets the wait time interval value, in milliseconds. When exceeded, the driver
notifies time-out of communication transmission.
The time-out refers to data being transmitted.
CTS Timeout
Default value = 5000. Sets the wait time interval value, in milliseconds. When exceeded, the driver
will notify communication time-out for the CTS serial parameter.
Sets the time within which each individual write operation must be completed, at low level (Window
API) in the serial port.
DSR Timeout
Default value = 5000. Sets time-out value in milliseconds which will also be notified to the DSR serial
parameter by the driver. This property sets the maximum time-out between the reception of one
character and the next, which will also be the maximum time within which each single read operation
must be completed at low level (Windows API) in the serial port.
Enable
Enables the Bridging Function. When set to True, the driver attends to the specified serial port: when
a remote call is made (i.e. by tele-service), the driver disconnects the Supervisor from the PLC and
connects the modem port with the port connected to the PLC, in transparent mode, until disconnected
by command automatically restoring the Supervisor's communication.
The service is disabled by default.
Port
Here you need to specify the number of the COM serial port the modem is connected to and which is
to be used for the Bridging service.
16
Note: you need to make sure that no conflicts occur in Windows when using ports.
For instance, when installing the Com4 port, you need to make sure that the
assigned address and the IRQ are compactible with the PC's configuration. In order
to do this we advice you use addressable serial cards.
Baudrate
Sets the velocity of the serial communication (Baud Rate). The value of the communication's velocity
must correspond to that of the device to communicate with.
Byte Size
Sets the amount of bytes required by the communication protocol in use.
Parity
Sets the parity type required by the communication protocol in use.
Stop Bits
Sets the number of Stop Bits required by the communication protocol in use.
Flow Control
Sets the data Flow Control type for the type of communication in use. This property permits the flow
of communication data from the connected device's serial port to be adapted to low level protocol
requirements. The default value, 'None', means no flow control, nevertheless it might be necessary
to select a flow control type (i.e. when signalling errors with code '1').
The options are:
Rx Queue
Sets the quantity of data bytes to be managed by the serial port to buffer values being received. The
default value will be used if not specified differently.
Expert users can change this value to adapt it to the needs of the system being used.
Tx Queue
Sets the quantity of data bytes to be managed by the serial port to buffer values being transferred.
The default value will be used if not specified differently.
Expert users can change this value to adapt it to the needs of the system being used.
CD Timeout
Currently not in use. Will be implemented in the near future.
CTS Timeout
Sets the time-out value in milliseconds which will also be notified to the CTS serial parameter by the
driver. This property sets the time within which each single write operation must be completed at low
level (Windows API) in the serial port.
DSR Timeout
Sets time-out value in milliseconds which will also be notified to the DSR serial parameter by the driver.
This property sets the maximum time-out between the reception of one character and the next, which
will also be the maximum time within which each individual read operation must be completed at low
level (Windows API) in the serial port.
Display Dialog
When enabled (=True), it allows the Supervisor to display a dialog window upon connecting in Bridging
to let the local user cancel the connection by remote control.
Disconn.Delay
Sets the delay time in milliseconds from receiving the disconnection signal, to effectively activating the
closure of the bridging connection.
Connection String
Sets the string received from the modem which determines the remote connection request. Upon
receiving this string the driver will activate the bridging service request.
Disconnection String
Sets the string received from the modem which determines the request to disconnect the remote
connection. When receiving the string, the driver will deactivate the bridging service and restore the
driver's communication.
Init String
17
Sets the modem's initialization string (i.e. AT&FS0=1).
OK String
Sets the modem's OK string.
The modem of the PLC Server must be configured ready to receive calls from the Supervisor. The
Supervisor will automatically start a call to the destination modem, for the interested driver stations,
when the tags belonging to those stations go in use.
The serial is managed by the modem's driver when the station's TAPI settings are used for managing
communications via modem. The settings with which the serial is opened are therefore those defined
in the modem's driver's advanced properties and may be different to those set for the Movicon driver
station ("Serial Port Settings").
TAPI functions are enabled only by setting the 'Enable' property value to
True
TAPI connections may behave in different ways when calls fail depending on the settings defined in
the station. The combinations are as follows:
1. In situations using the station's status variable ("State/Command Variable") with the "Dial Only
on Command" property enabled and calls fail, the following behaviour will result:
• The "Bit 1" of the status variable is set at "True" after programmed call attempts
have been made without success
• An error will appear in the historical log describing the reason why the call was
unsuccessful
• The "Bit 1" of the status variable is automatically set at "False" by the driver when
another connection is in command ("Bit 5")
2. In situations using the station's status variable ("State/Command Variable") with the "Dial Only
on Command" property disabled and calls fail, the following behaviour will result:
• The modem will start the call when the station's variables go in use (ie. upon loading
a page)
• The "Bit 1" of the status variable is set at "True" after programmed call attempts
have been made without
• An error will appear in the historical log describing the reason why the was
unsuccessful
• If the "Bit 1" is set at "False" (the station will reactivate), the driver will then try to
call the station again if there are still active tasks towards the station
18
3. In situations without using the station's status variable ("State/Command Variable") and the
call fails, the following behaviour will result:
• The driver will try to connect to the station if there are still active tasks towards that
station. Following attempts are those specified by the "Retries" parameter, then the
connection goes on hold between one group of attempts and the next for the amount
of time specified in the "Retry Hold Time (sec)" parameter
Phone Number
Sets the telephone number of the remote station to be connected to.
You can enter the name of a Supervisor string variable for drivers using driver base library build 250
and later. In this way you can define the phone number to call at runtime, assigning the proper value
to this variable during supervision execution.
Retries
Defines the number of consecutive call attempts (without hold) in cases of connection failure to remote
station. When set at the value "0", only one call attempt will be made, after which it will be put on
hold for the time set in the "Retry Hold Time (sec)" parameter and then only one more call attempt
will be made.
Disconnect After
Sets the time of inactivity, in seconds, before disconnecting. The connection is made as soon as the
interested tags go into use in the project. When the interested tags are not in use, the Supervisor will
disconnect after the set time expires.
Enable
Enables, if set to True, the TAPI functions and calls via modem to the remote device.
Show Dlg
When enabled, the system will display a dialog window to inform the user about the connection in
action and its status.
Dial only on command (only available for drivers using driver base library build 250 and
later)
When this property is enabled, the modem connection will be activated only on command, using the
appropriate bit of the State/Command Variable (bit 5, Open modem connection), and stopped using
the same variable (bit 6, Close modem connection). See "State/Command Variable" for details. This
option is useful when communicating with multiple remote stations using only one modem to call. The
designer can configure a driver station for each remote station, each one with a different phone number
and a different State/Command Variable. At this point the user can connect to one remote station at
a time using the specific State/Command variable. When data exchange with the current remote station
is over, it will stop communications and then connect to another station.
Server Address
Specify the IP address or the name of the server or the network device to be connected to.
Examples: 192.168.0.1; localhost; server1
Server Port
The number of the TCP port of the server or device to be connected to. This value completes the
device's IP address. For instance, the 502 port is always used for the TCP-IP Modbus (as established
by the protocol), but when dealing with other devices please refer to their documentation.
19
Backup Server Address
The backup server IP address or name. If this address is set, the driver will try to connect to the
backup server when unable to communicate with the 'primary' server. This happens in a redundancy
situation at driver level. If communication with the backup server is interrupted, the driver will try to
connect to the primary server again and so forth.
This field can contain the name of one Serve or a list of Servers separated b the ";" character. The
Server list allows more than one Backup Server for the Driver to manage in cyclic mode so that if one
Server should fail the Driver can use the next on the list. When the Driver runs out of backup servers
to use, it will start again with the Main Server.
Use Ping
Enabling this option, the driver will use a ICMP protocol "ping" message to test for the existence of a
Backup Server before attempting to connect to it. This permits faster connectio to the Backup Server
in cases where lists of Servers are very long. The timeout for responding to the "ping" message
corresponds to the value set in the station's "Timeouts\Rx Timeout" field.
The driver's RAS functions allow you to connect the supervision to a remote network via modem in
automatic and transparent mode.
When needing to connect to network devices from remote PCs, the RAS function lets you manage the
network communication protocol after having established the connection with the modem through
accessing a RAS Server, being a PC for accessing the network which can be reached via modem. After
gaining RAS connection, the driver can access to the network.
The modem of the RAS Server must be configured ready to receive calls from the Supervisor. The
Supervisor will automatically start a call to the destination modem, for the interested driver stations,
when the tags belonging to these stations go in use.
20
In this group of settings you need to set, for the selected station, the configuration inherent in the
access parameters to remote devices by means of the RAS functions of the operating system.
RAS functions are enabled by setting the 'Enable' property value to True
only
Dial-up
Permits you to specify the name of one of the RAS Connections set in the operating system. When left
empty, the driver will ask you to enter manually the telephone number, username and password of
the station to be connected to when you try to connect.
The connection will be requested as soon as one of the associated tags goes into use in the running
project.
If no predefined RAS connection has been specified in the Dial-up property, you need to specify a
phone number, a user name and a password to access remote stations.
Phone Number
Sets the telephone number of the remote station to be connected to.
For drivers using driver base library build 250 and later you can specify the name of a Supervisor string
variable here. By doing this you can define the phone number to call at runtime, assigning the right
value to this variable during supervision execution.
User Name
Sets the username for accessing the remote station.
Password
Sets the password for accessing the remote station.
Retries
Sets the maximum number of connection attempts if the first one fails. When this number runs out
and all attempts have failed, an error will be alerted.
Disconnect After
Sets the time of inactivity, in seconds, before disconnecting. The connection is made as soon as the
interested tags go in use in the project. When the interested tags are not in use, the Supervisor
disconnects after the set time expires.
Enable
If set to True, the RAS functions and calls via modem to the remote device are enabled.
Show Dlg
When enabled, the system will display a dialog window to inform the user about the connection in
action and its status.
Dial only on command (only available for drivers using driver base library build 250 and
later)
When enabling this property, the modem connection will be activated only on command, using the
appropriate bit of the State/Command Variable (bit 5, Open modem connection), and stopped using
the same variable (bit 6, Close modem connection). See State/Command Variable for details. This
option is useful in case of communication with multiple remote stations using only one modem to call.
The designer can configure a driver station for each remote station, each one having a different phone
number and a different State/Command Variable. At this point the user can connect to one remote
station at a time using the specific State/Command Variable. When data exchange with the current
remote station is over, the operator can stop communication then connect to a different station.
21
1.3.11. Special TAPI and RAS configurations
RAS and TAPI techniques are used by the driver to manage supervision projects involving remote
control. A number of different system architectures require special care in project design.
1. One remote station and a supervision using only one modem for communication
2. Various remote stations, placed in different areas, and a supervision using only one modem for
communication
3. Various remote stations, located in the same area and connected in a network, and a
supervision using only one modem for communication
1. No special configuration is needed in this case. One station should be defined for the driver
and the call management can be both automatic (the driver starts a call when the tags go in
use) or manual, using the State/Command variable for that station
2. Two or more stations should be defined, each one having its State/Command variable. The
calls to different stations should be managed through the State/Command variable in order to
avoid simultaneous calls to different stations
3. Two or more stations should be defined, each one having its State/Command variable, but only
one station can be used for the RAS or TAPI call. Once the connection has been established for
the "main" station, communication with other stations will be activated using the bit 1 of the
State/Command variable for each station
For further detail about Station settings and State/Command variable see General (Station)
Please remember that the Supervisor offers you the possibility to set the driver's
communication using the 'task' concept or the dynamic tasks concept. The
dynamic tasks are automatically created by the driver at the project startup, based
on the links to device's addresses set in the 'Dynamic Address' properties of each
single tag.
The communication tasks allow 'static' tasks to be assigned to the driver, which will be executed
polling the device provided.
By using the communication technique in tasks, you need to set, in static mode,
the relationship between the Supervisor variables and the device addresses.
Add
The 'Add' button allows you to insert a new static Task for the communication driver. When a new
task is inserted, a window will automatically be displayed to set the requested parameters.
The inserted tasks can be edited or removed afterwards by using the buttons described below.
Edit
The 'Edit' button allows you to change the parameters of existing tasks. You first need to select the
task desired and then use the 'Edit' button or double-click.
Remove
The "Remove" button allows you to delete existing tasks. You first need to select the task desired and
then use the 'Remove' button.
22
1.4.2. Static Tasks
Station
The name which identifies the station corresponds to the device you intend to communicate with. At
least one station must be set for each task.
When more than one station has been defined, you need to select here the station where the task is
to be executed.
Task Name
The name which identifies the task. Any identification string can be used to identify the Task.
Each task must have an unique name.
Variables
Allows you to associate which Supervisor's tag (or tags list) the task is to manage. Using the ellipse
button to the right you can select any tag previously inserted into the project's Real Time Database
or create new tags. These will be added automatically in the project's Real Time Database. The tags
in Variables field must be separated by a ';'character and should be consecutive starting from
the device address set in Device address field.
It is strongly recommended that the variables list includes tags of the same
data type, otherwise unpredictable errors may occur.
A structure tag, whose members have different data types can be used to
address a group of tags, with different data types, with a static task.
The driver automatically calculates the number of bytes to read/write from/to the device starting from
the device address by adding the byte size of each tag present in the 'Variables' Task Property.
The driver will then read or write a byte-aligned, raw buffer whose starting address is the one specified
in the 'Device Address' property, and map it to each tag, according to each tag's offset and size in the
buffer.
Bit Addressing
When accessing bits on the device, all tags in the 'Variables' list must be declared in the Tag Database
as Bit type, otherwise an error will show. The number of bits to be exchanged with the device equals
the number of tags in the 'Variables' list. The starting address is the one specified in the 'Device
Address' property.
Conditional Variable
Allows you to associate a project variable whose status will determine the communication task's
execution condition. By using the ellipse button to the right you will be able to select any tag previously
inserted into the project's Real Time Database or create new ones. These will be added automatically
in the project's Real Time Database.
The variable (of any type) will therefore condition the task's execution: when set to a value other than
zero (><0) the communication task will be executed by the driver.
When the execution of the task has been completed the driver automatically
sets the value of the conditional variable to zero. Therefore this needs to
be taken into account when variables are managed by logic.
Polling Time
This parameter, expressed in milliseconds, determines the minimum polling time of the each single
task's execution for updating data when the variables are in use.
The Polling Time default value, inserted when creating the task, is determined by the value established
in the driver's General properties ("Polling Time"), but can be modified as pleased for each single
task. The value equal to zero means that data will get updated at the highest possible speed.
A higher value can be set, for instance, when data does not require fast updating times.
23
When this parameter is set = 0, the tasks will not be executed when the
variables are not in use.
When this parameter is higher than 0, ALL the project tags that are' not in
use' are read with this frequency, if the task is a read or read/write one.
This may slow the supervision down if many tags are defined in project.
Address offset variable (only available for drivers using driver base library build 250 and
later)
Specify here a tag name of numeric integer type. The tag's value can be modified at runtime and will
be used as an offset +/- with respect to the starting address set for the task. It will be possible to read
in different points of the device memory area (before or after the start address) by changing the
address offset tag value at runtime.
The offset unit depends on the driver and on the address type:
• for addressing method based on bit, an offset value = 1 corresponds to one bit
• for drivers whose addressing method is based on bytes, an offset value = 1 corresponds to
one byte
• for drivers whose addressing method is based on words, an offset value = 1 corresponds to
one word
The user who sets the value for the address offset tag should use meaningful values: i.e. to read the
next word using a Siemens driver the offset value should be set to +2, since the valid addresses for
word tags are only the even values. In cases where the Modbus driver is concerned, the offset value
should be set to +1 since its addressing is based on words.
Caution: also when changing the offset value, the tasks will not be executed immediately
but only when needed. Therefore, for instance, an Exception output task will be executed
with a new offset only when the associated variable's value is modified. So you can check
whether a task has been executed with the conditional variable.
As an example, in order to write the same value in more addresses using the offset tag, you can create
an Unconditional Output task with a conditional variable. The write operation will be executed changing
the value of the offset tag and setting the conditional variable. When reset, the task has been
completed and the offset tag's value can be change to write the following address.
Swap Byte
This selection allows you to swap the bytes in 'word' type data. When doing this the data linked to the
Supervisor and the device will have the 'high' byte swapped over with the 'low' byte and vice-versa,
for each word type data of the task.
Swap Word
This selection allows you to swap the words in 'double words' type data. By doing this the data linked
to the Supervisor and the device will have the 'high' word swapped over with the 'low' word and vice-
versa, for each double word type data of the task.
Type
In this selection you can set the execution type you want to assign to the task.
The options offered are:
Exception This option sets the task as 'Write Only', thus managing data on exception, which
Output means only when there is a data change in the Supervisor.
Unconditional This option sets the task as 'Write Only', thus continuously writing to the device,
Output independently of data changes.
Device Data
24
The parameters of this group refer to addressing the memory areas of the specified device.
Please refer to the documentation of the specific driver and to protocol specifications.
To set 'Dynamic' properties for a tag, select the 'Real Time DB' resource and the 'List Variables' node
in the tree from the Supervisor 'Project Explorer' window. Select the tag of interest, then go to the
'Properties' window and click on the ellipse button to the right of 'Dynamic' property.
The 'Tag Browser' dialog will open, choose the 'Comm Drivers' tab and double click on the most suitable
driver to get the 'Task properties' page.
Select the "Comm. I/O Drivers" tab to view the list of drivers, inserted in the project, with their
predefined dynamic links. You will also find an "Add/Edit..." button, used for opening the "Task
Properties" window for editing the dynamic links, and a "remove" button used for deleting the pre-
selected dynamic link.
25
Task Properties window.
Once the "Tag Browser" window has been opened, you can insert/edit dynamic links in the following
ways:
Keep in mind that the list of a driver's dynamic links displayed in the Tag Browser window is only used
by the programmer as a reminder or for selecting. Once a link has been assigned to the variable it can
be removed from the list without causing any damage to the project. The dynamic link list is saved in
the ".dyndrv" file of the driver in the project's "RESOURCES" folder. If you delete this file, the list of
dynamic links inserted in the "Tag Browser" window up to that moment will no longer be
26
available. Only the dynamic address previously assigned in the variables' "Dynamic" properties will
remain saved.
Station
The name which identifies the station corresponds to the device you intend to communicate with. At
least one station must be set for each task.
When more than one station has been defined, you will need to select the station where the task is to
be executed.
Conditional Variable
Allows you to associate a project variable whose status will determine the communication task's
execution condition. Using the ellipse button to the right you can select any tag previously inserted
into the project's Real Time Database or create new tags which will then be added automatically in the
project's Real Time Database.
The variable (of any type) will therefore condition the task's execution: when set to a value other than
zero (><0) the communication task will be executed by the driver.
When the execution of the task has been completed the driver will automatically set the value of the
conditional variable to zero. Therefore this needs to be taken into account when variables are
managed by logic.
Swap Byte
This selection swaps bytes over in "word" type data. This means that data linked between the
Supervisor and device will be seen with the "high" byte inverted with the "low" byte and vice versa,
for each task word data type.
This property is only available for some drivers.
Swap Word
This selection swaps words over in "double word" data types. This means that data linked between
Supervisor and device will be seen with the "high" word swapped over with the "low" word and vice
versa for each task double word data type.
This property is only available for some drivers.
Type
In this selection you can set the execution type you want to assign to the task. Possible values are:
Exception This option sets the task as 'Write Only', thus managing data on exception, which
Output means only when there is a data change in the Supervisor.
Unconditional This option sets the task as 'Write Only', thus continuously writing to the device,
Output independently of data changes.
#Elements
Specifies the number of elements to be read/written by the driver. Possible values are 0 and 1 only.
If left at zero, the driver automatically calculates the number of elements to be read/written in the
device data area, on the basis of the tag data type. For example, in a WORD area, for a tag whose
data type is word one element is read/written, whereas two elements are read/written for a float tag.
If set to one, only one element is read/written, no matter what the tag data type is. For example, in a
WORD area, only one element (one word) is read/written for a float tag.
27
1.5. Import Device Database
1.5.1. Import Device Database
Thanks to this important feature, you can directly access the database of a PLC or an equivalent data
source of a device to import the desired Tags into the Supervisor project.
When terminating this operation, the project's Real Time Database will automatically fill up, by inserting
all the imported tags, which will be defined as Dynamic Tags in the 'Not Shared' areas, with the
corresponding tag type and with the address already assigned for the device.
When right clicking on the Driver name in the Project explorer window and selecting "Import Device
Database", you will be prompted to select the 'data source', being the PLC database, the symbolic file
or the .CSV file obtained from the PLC data or device explorer.
After getting the file desired, you will be shown the window, as illustrated below, which displays the
variables it contains.
Attention: Importing data from the PLC is supported in all the drivers for the most
well-known devices. Check the access modalities or 'data source' requirements,
which may vary from one device to another.
If variables that are already in the RealTimeDB are recovered while importing data,
they will be overwritten without requesting confirmation beforehand. Those that will
be overwritten include the "Data Type" and "Fixed I/O Address" properties but the
"Tag Description" property will remain the same and will only be imported if the
variable is not already in project's RealTimeDB.
The import operation will take longer to complete when a large number of variables has
been selected and can however be aborted by using the "ESC" key.
Importing Structures and Arrays using the device's Data Base's import tool can be done in two different
modes:
If the Structure's root is selected from the tool's dialog window following by activating the "import"
button, a prototype defined with the structure's members and a variable of the same prototype will be
created in the project. After this happens, it will then be possible to import a multiple selection of
structures. This can also be done using the "Select All" button and then the "Import" button.
28
If one or more members of one or more Structures are selected and then imported, variable types
corresponding to those of the selected members will be created and not those of the structure
prototypes. The same result can be obtained clicking on the "Expand All" button to explore the
Structures' members, then clicking on the "Select All" button to select them all and then finally on the
"Import" button to import each member as distinct variables.
If each single variable as well as the Structure variables are on the device's variable list, when used
the "Select All" button will select them all.
When importing Arrays, select then import the root of the Array to create an Array type variable with
its "Element Type for Array" property set to the Array type. The same can be done using the "Select
All" button and then the "Import" button.
If one or more elements or Arrays are selected and then imported, variables corresponding to the
selected elements will be created but not the Array type variables. This same result can be obtained
by clcking on the "Expand All" button to explore the Array elements, then clicking on the "Select All"
for selecting them all, followed by clicking the "import" button to import each single element as distinct
variables.
If each single variable as well as the Array variable are on the device's variable list, the "Select All"
button will select them all when clcked on.
Select All
Allows you to select all the variables from the importation file.
Use the CTRL+Click or SHIFT+Click keys for partially selecting variables.
Select None
Allows you to deselect all the variables from the importation file.
Use the CTRL+Click or SHIFT+Click combo keys for partially deselecting variables.
Browse File...
Allows you to change the origin file, by activating the standard window for file selection.
? (help)
Activates the guide containing information relating to the origin data format requirements.
Import
Activates the importation of variables from the origin file (device's data source) to the Supervisor
project. When the importation has terminated, the project's Real Time Database resource will result
as being populated with all the imported variables.
As the 'data sources' depend on the device and might change, it is advised
to always check the imported variables' properties to see whether the
automatic parsing, the type assigned and the device's address have been
executed correctly when the importation has terminated.
Cancel
This button cancels the importing operation.
Station:
This box allows you to select the driver's station to be assigned to the imported variables, when the
driver has been set with more than one station.
To make programming easier you can enable the interested Driver Reference within the basic script
routine to declare the specific necessary object types (ie. DriverInterface, TaskInterface, etc.) and
29
not generic types (Object). This will give you a list of methods and properties of each specific object
you declare.
Please keep in mind that the Reference enabling is not supported on the WinCE platform. If you have
to develop a project which has to be executed on WinCE, the References mustn't be enabled but you
must declare all Object types.
The examples shown in function documentation have all been created by enabling the driver's
Reference.
The following example can only work on Windows 32/64 bit platforms.
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim bError As Boolean
bError = station.IsInError
MsgBox "IsInError = " & CStr(bError),vbInformation,"ERROR"
To make it compatible with the WinCE platform the driver References must be enabled and the
variables should be declared as follows:
Sub Main
Dim drv As Object
Dim station As Object
Dim bError As Boolean
bError = station.IsInError
MsgBox "IsInError = " & CStr(bError),vbInformation,"ERROR"
30
Synchronous Tasks and Asynchronous Tasks
When a task is executed using the "Execute()" function you can choose whether the task should be
executed in Sync. mode or Async. mode:
Synchronous Tasks
To made a task become synchronous just assign a timeout time higher than zero to the "Execute()"
function. Therefore when this function is called, the script will not be executed until the function has
terminated. If the function is executed successfully it will return the "True" value. Otherwise it will
return the "False" value if not executed, which may mean that timeout expired before completion.
The "Execute()" function returns the "True" value when it has been
executed, meaning that the task was executed but there may be an error
and therefore you will have to verify this by controlling the Station's status.
Synchronous Tasks are usually used in cases where data read/writes need to be controlled. For
example, to double-check whether a production recipe has been transferred before giving start
production command.
To make sure the synchronous task works correctly you will need to set the
"Execute()" function's timeout parameters with a higher value to that set in the
Station's timeout. For instance, if the station's timeout is 2000 msec, you can then
set the "Execute()" function's timeout with 5000 msec. This will ensure that the
function's timeout does not expire before the Station's timeout does.
Asynchronous Tasks
To make a task asynchronous, just assign the "Execute()" function with timeout equal to zero.
Therefore when the function is called, the script's execution will continue without waiting for the
function to terminate. The task will therefore be executed when possible but it will not be possible to
know exactly when it happened. In this case the function will always return a "True" value if no error
has occurred in the task's creation, such as a wrong parameter. The "True" value for a asynchronous
task does not necessarily mean that it has been executed but has just simply been created and is
waiting to be executed.
1.6.2. DriverInterface
DriverInterface Events
FireOnDataSent, DriverInterface Event
Description This event is fired when data has been sent by a task. It can be used to retrieve
new information without polling.
Remarks Only available from external COM clients. Not available from Supervisor
BasicScripts.
Parameter Description
(ByVal lpszTaskName As The name of the task in which data has been sent.
String)
Example:
Parameter Description
31
(ByVal lpszTaskName As The name of the task in which data has changed.
String)
Example:
Option Explicit
Dim WithEvents Drv As ModbusTCPIP.DriverInterface
Dim task As ModbusTCPIP.TaskInterface
Dim task2 As ModbusTCPIP.TaskInterface
Dim var As Variant
Parameter Description
(ByVal lpszTaskName As The name of the task in which data has changed quality.
String)
Example:
Dim WithEvents Drv As ModbusTCPIP.DriverInterface
Dim task As ModbusTCPIP.TaskInterface
Dim var As Variant
DriverInterface Functions
AddDriverTask, DriverInterface Function
Syntax AddDriverTask(lpszName, lpszSettings)
Description Adds a Dynamic Task to a driver. A new Dynamic Task is created and its resources
are allocated, but it will not be executed until a call to the Execute function is made.
The task will remain allocated in the driver until removed by a call to
RemoveDriverTask.
Remarks
Parameter Description
32
lpszSettings As String containing the Dynamic Settings for the task. Please refer to each
String driver's specific documentation for Dynamic Settings formats. This string is
the same one inserted in the "Dynamic" variable's property.
[DRV]Modbus
TCPIP.Sta=ModbusTCP|Typ=10|Size=10|TaskType=0|Unit=1|FC=2|SA=20
where:
[DRV]: this is the parameter that indicates driver use and must be followed
by driver's name, in the example this will be "Modbus TCPIP"
Sta: this is the parameter that indicated the name of the reference station
in which task is created. In the example the station will be called
"ModbusTCP"
Typ: indicates data type to be exchanged. The following values may be
used in this parameter:
0 = Bit
1 = Sign Byte
2 = Byte
3 = Sign Word
4 = Word
5 = Sign DWord
6 = DWord
7 = Float
8 = Double
9 = String
10 = Array
11 = Structure
0 = Task Input
1 = Task Input/Output
2 = Task Exception Output
3 = Task Unconditional Output
Unit:this is the parameter that indicates the unit number. This parameter
is only available for the Modbus driver only
FC: this is the parameter that indicated the function code to use. This
parameter is only available for the Modbus driver only
SA: this is the start address parameter that indicates the start address from
where data is to be read/written on device.
Result TaskInterface
Example:
Sub Main
Dim drv As DriverInterface
Dim Station As StationInterface
Dim TaskReset As TaskInterface
Dim sDynString As String
Dim vBuffer As Variant
33
Set Station = drv.GetDriverStation("Station1")
If Station Is Nothing Then
MsgBox "Station1 didn't found in the driver stations list!", vbExclamation,
GetProjectTitle
Exit Sub
End If
If Station.IsInError Then
MsgBox "Station in Error!", vbExclamation, GetProjectTitle
Exit Sub
End If
sDynString = "[DRV]Modbus
TCPIP.Sta=Station1|Typ=4|Size=2|TaskType=2|Unit=1|FC=2|SA=100"
TaskReset.PollingTime = 0
ret = TaskReset.SetWriteByteBuffer(vBuffer)
'Remove task
ret = drv.RemoveDriverTask("Dyn1")
34
Remarks
Parameter Description
Result Object
If Function has been executed successfully it will retrieve an object of type
StationInterface if otherwise Nothing is returned.
Example:
See the "AddDriverTask" function example.
Description Returns a task object. This function can be used to retrieve the interface to any
static or dynamic task.
Remarks
Parameter Description
Result Object
If Function has been executed successfully it will retrieve an object of TaskInterface
type if otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim Station As StationInterface
Dim task As TaskInterface
Dim var As Variant
Dim nVal As Integer
Dim nVal2 As Integer
Dim AppByte As Byte
35
Wend
Description Initialises a Communication Driver. Once this function has been called successfully,
the driver is ready to operate.
Remarks Only available from external COM clients. Not available from Supervisor BasicScripts
Parameter Description
lpszSerialNumber As String Driver Serial Number. Contact Sails Office for a valid Serial Number
for the Driver you want to use.
LpszFileSettings As String Path to a Directory containing the Driver Settings File. The file name
must have the following format:
<DriverDLLName>.drvsettings
Result Boolean
True = the driver has been initialised successfully
False = driver initialization failed
Example:
Private Sub Form_Load()
Dim bInitOk As Boolean
Set Drv = CreateObject("SupervisorDriver.ModbusTCPIP.1")
'Drv.SetDriver "C:\Projects\TestPrj\RESOURCES\TestPrj\"
bInitOk = Drv.InitDriver("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"C:\Projects\TestPrj\RESOURCES\TestPrj\")
If Not bInitOk Then
MsgBox "InitDriver failed!",vbExclamation,"ERROR"
End If
End Sub
Description Removes a Dynamic Task from a driver. A Dynamic Task is removed and its
resources are freed.
Remarks
Parameter Description
Result Boolean
True = function has been executed successfully
False = function execution failed
36
Example:
See the "AddDriverTask" function example.
Description Destroys and removes a station from the driver's station list. this function
removes both stations dynamically added with AddStation and those created
through the driver's user interface (file. DrvSettings).
Remarks This function stops the execution station's defined tasks. In addition, if executed in stations
that already existed when starting the project up in runtime, this function will render the
Station unusable in runtime but will not cancel its XML data from the .drvsettings file.
Parameter Description
Result Boolean
If the function is successful it returns the value True.
Please note To permanently remove (in the file DrvSettings) call the function
SaveConfigDriver.
Example:
Sub Main
Option Explicit
Const DRIVER_NAME = "Modbus Serial"
Sub Main
Dim objDrvInt As DriverInterface
Dim sStationNameas String
Dim bRet As Boolean
sStationName = This.GetParameter(0)
'REMOVE STATION
bRet = objDrvInt.RemoveStation(sStationName)
End If
End Sub
Description Displays a Property Sheet dialog box, by which the user can change a driver's
General and Station settings.
Remarks Only available from external COM clients. Not available from Supervisor
BasicScripts.
This function must be called when the driver is not initialised, that is before InitDriver
is called, otherwise it will fail.
37
Parameter Description
lpszFileSettings As String Path to a Directory containing the Driver Settings File. The file name
must have the following format:
<DriverDLLName>.drvsettings
Result Boolean
True = the function has been executed successfully
False = function execution failed
Example:
Private Sub Form_Load()
Dim bInitOk As Boolean
Set Drv = CreateObject("SupervisorDriver.ModbusTCPIP.1")
Remarks Only available from external COM clients. Not available from Supervisor BasicScripts
Parameter Description
None None
Result Boolean
True = the driver has been terminated successfully
False = driver termination failed
Example:
Private Sub Form_Load()
Dim bInitOk As Boolean
Set Drv = CreateObject("SupervisorDriver.ModbusTCPIP.1")
'Drv.SetDriver "C:\Projects\TestPrj\RESOURCES\TestPrj\"
bInitOk = Drv.InitDriver("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"C:\Projects\TestPrj\RESOURCES\TestPrj\")
If Not bInitOk Then
MsgBox "InitDriver failed"
End If
If not Drv.TerminateDriver()
MsgBox "TerminateDriver failed!",vbExclamation,"ERROR"
End If
End Sub
Description Dynamically creates a new station, and inserts it into the list of stations Driver.
When a station is created its resources are allocated, but to put
running, you must use the "StartStation."
38
Remarks A station can have any name, as long as unique and not null.
Parameter Description
Result Boolean
If the function is successful it returns the value True. If the station has added a zero
or station name exists in the station list is returned False.
Note: The new station is additionally configured with default property values.
Note: To permanently store the new station (in the file. DrvSettings) invoke the
function "SaveConfigDriver".
Example:
Option Explicit
Const DRIVER_NAME = "Modbus Serial"
Sub Main
Dim objDrvInt As DriverInterface
Dim sStationNameas String
Dim bRet As Boolean
sStationName = This.GetParameter(0)
'ADD STATION
bRet = objDrvInt.AddStation(sStationName)
End If
End Sub
Description SSave permanently (in the file. DrvSettings) the configuration parameters drivers.
Can be used, for example, to save a station dynamically added with the function
AddStation.
Remarks
Parameter Description
None None
Result Boolean
If the function is successful it returns the value True.
Example:
Option Explicit
Const DRIVER_NAME = "Modbus Serial"
39
Sub Main
Dim objDrvInt As DriverInterface
Dim bRet As Boolean
End Sub
Description Loads and starts a thread of a new station dynamically added by the function
AddStation.
Please note. The stations created from the file .DrvSettings not need to be initiated
by startStation.
Parameter Description
Result Boolean
If the function is successful it returns the value True.
Example:
Option Explicit
Const DRIVER_NAME = "Modbus Serial"
Sub Main
Dim objDrvInt As DriverInterface
Dim sStationNameas String
Dim bRet As Boolean
sStationName = This.GetParameter(0)
'START STATION
bRet = objDrvInt.StartStation(sStationName)
End If
End Sub
40
DriverInterface Properties
DelayEvents, DriverInterface Property
Syntax DelayEvents = Long
Remarks Only available from external COM clients. Not available from Supervisor
BasicScripts.
Parameter Description
None None
Result Long
Events delay interval in milliseconds.
Example:
Private Sub Form_Load()
Dim lNewVal As Long
Dim bRet As Boolean
Dim drv As Object
1.6.3. TaskInterface
TaskInterface Functions
Execute, TaskInterface Function
Syntax Execute(dwTimeout)
Description This function puts Tasks into execution. The task in question can previously be
created with the "AddDriverTask" function, or can be an already existing task from
the driver's static task list and must be referenced by calling the "GetDriverTask"
function.
ATTENTION! This function returns the True value in cases where the task has been
executed, however in order to know if it has been executed successfully without
errors, you will need to test the station's status.
Remarks
Parameter Description
DwTimeout As Long Time (milliseconds) to wait for task completion. Setting this
parameter with a value higher than zero (it is advised that you set
a value higher than the one set in the station's timeout time) the
task will be executed in Synchronous mode. Setting this parameter
to Zero, the task will be executed in Asynchronous mode. In both
cases, however, the task will be executed only once, therefore if you
use Asynchron Tasks the code must be created so that the function
call is recycled.
Result Boolean
True = the function has been executed successfully
41
False = function execution failed
Example:
See the "AddDriverTask" and "GetDriverTask" function example.
Description Gets the Variable List of a static task. As only static tasks have a Variable List, this
function is useless with dynamic tasks.
Remarks
Parameter Description
None None
Result String
A String containing the Variable List. The separator character can be retrieved by
calling the "GetVariableListSeparator" function.
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strVarlist As String
strVarlist = task.GetFlatVariableList
MsgBox "GetFlatVariableList = " & strVarlist,vbInformation,"ERROR "
Description Gets the maximum number of bytes that can be allocated for a task's read/write
buffers.
Remarks
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
42
Dim nSizeBytes As Long
nSizeBytes = task.GetMaxByteSize
MsgBox "GetMaxByteSize = " & CStr(nSizeBytes),vbInformation,"ERROR "
Description Returns the latest read values from the task. The Task must previously be added by
calling the "AddDriverTask" function and at least one call to the "Execute" function
must have been made. If task is already present in the project's static task list, it
will not be necessary to create and execute the task but it will have to be referenced
only by calling the "GetDriverTask" function.
Remarks
Parameter Description
None None
Result Variant
A Variant containing the last read values from the task. Usually the variable data
type is dimensioned by the driver based on the data area to be read. If The task is
a static task then the function will retrieve an Byte Array containing the data.
Example1:
See the "GetDriverTask" function example.
Example2:
Sub Main
Dim drv As DriverInterface
Dim Station As StationInterface
Dim task As TaskInterface
Dim ret As Boolean
Dim var As Variant
task.PollingTime = 500
var = task.GetReadByteBuffer
SetVariableValue("AsyncRead", var)
DoEvents
Wend
43
Set Station = Nothing
Set drv = Nothing
Set task = Nothing
End Sub
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
StationInterface if otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim Station As StationInterface
Dim task As TaskInterface
Description Gets the number of bytes allocated for a task's read/write buffers.
Remarks If bit variables (being the Project RealTimeDB variables) have been used in the task,
the returned value is a bit number (the driver reserves a byte for each bit internally).
Parameter Description
None None
Result Long
44
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim nSizeBytes As Long
nSizeBytes = task.GetTotalSizeBytes
MsgBox "GetTotalSizeBytes = " & CStr(nSizeBytes),vbInformation,"ERROR "
Description Gets the Variable List Separator of a static task. As only static tasks have a Variable
List, this function is useless with dynamic tasks.
Remarks
Parameter Description
None None
Result String
A String containing the Variable List separator character (default is ';').
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strListSep As String
strListSep = task.GetVariableListSeparator
MsgBox "GetVariableListSeparator = " & strListSep,vbInformation,"ERROR "
Remarks
45
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strGetXMLSettings As String
strGetXMLSettings = task.GetXMLSettings
MsgBox "GetXMLSettings = " & strGetXMLSettings,vbInformation,"ERROR "
Description This function returns information that task has been executed in read, with success,
at least once. This function is therefore used for "Input" or "Input/Output" tasks.
Remarks
Parameter Description
None None
Result Boolean
True = task has been executed in read at least once successfully
False = task has still not been executed in read or if executed has returned an error
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bHasBeenExecuted As Boolean
bHasBeenExecuted = task.HasBeenExecuted
MsgBox "HasBeenExecuted = " & CStr(bHasBeenExecuted),vbInformation,"ERROR "
46
IsValid, TaskInterface Function
Syntax IsValid
Remarks
Parameter Description
None None
Result Boolean
True = task is valid
False = task is not valid
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bIsValid As Boolean
bIsValid = task.IsValid
MsgBox "IsValid = " & CStr(bIsValid),vbInformation,"ERROR "
Description Sets the task with values to write. The Task must be previously be added by a call
to "AddDriverTask" function and at least one call to the "Execute" function must
have been made. If task is already present in the static task list of the project, is
not necessary create an execute the task but it must only be referenced by a call to
"GetDriverTask" function.
Remarks
Parameter Description
Result Boolean
True = the function has been executed successfully
False = function execution failed
Example:
See the "AddDriverTask" function example.
47
Description Gets the Dynamic Settings string of a task. Please refer to each driver's specific
documentation for Dynamic Settings formats.
Remarks
Parameter Description
None None
Result String
String containing the Dynamic Settings for the task. Please refer to each driver's
specific documentation for Dynamic Settings formats.
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strToString As String
strToString = task.ToString
MsgBox "ToString = " & strToString,vbInformation,"ERROR "
TaskInterface Properties
AutoDelete, TaskInterface Property
Syntax Boolean = task.AutoDelete
Parameter Description
None None
Result Boolean
True = AutoDelete enabled
False = AutoDelete disabled
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bAutoDelete As Boolean
48
End If
bAutoDelete = task.AutoDelete
MsgBox "AutoDelete = " & CStr(bAutoDelete),vbInformation,"ERROR "
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strCondVar As String
strCondVar = task.ConditionalVariable
MsgBox "ConditionalVariable = " & strCondVar,vbInformation,"ERROR"
Parameter Description
None None
Result Boolean
True = task in use
False = task not in use
Example:
Sub Main
49
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bInUse As Boolean
bInUse = task.InUse
MsgBox "InUse = " & CStr(bInUse),vbInformation,"ERROR "
Parameter Description
None None
Result Date
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim dLastExec As Date
dLastExec = task.LastExecutionTime
MsgBox "LastExecutionTime = " & CStr(dLastExec),vbInformation,"ERROR"
Parameter Description
50
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strName As String
strName = task.Name
MsgBox "Task Name = " & strName,vbInformation,"ERROR "
Remarks
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim lPollTime As Long
lPollTime = task.PollingTime
MsgBox "PollingTime = " & CStr(lPollTime),vbInformation,"ERROR "
51
Description Gets a task's "not-in-use" Polling Time. The time is in Milliseconds.
Remarks
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim lPollTime As Long
lPollTime = task.PollingTimeNoInUse
MsgBox "PollingTimeNoInUse = " & CStr(lPollTime),vbInformation,"ERROR "
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strStation As String
strStation = task.Station
MsgBox "Task Station = " & strStation,vbInformation,"ERROR "
52
Set drv = Nothing
Set task = Nothing
End Sub
Parameter Description
None None
Result Boolean
True = Swap Byte enabled
False = Swap Byte disabled
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bSwapBytes As Boolean
bSwapBytes = task.SwapBytes
MsgBox "SwapBytes = " & CStr(bSwapBytes),vbInformation,"ERROR "
Parameter Description
None None
Result Boolean
True = Swap Word enabled
False = Swap Word disabled
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim bSwapWords As Boolean
53
Set drv = GetDriverInterface("Modbus TCPIP")
Set task = drv.GetDriverTask("Task")
If task Is Nothing Then
MsgBox "Task not found!",vbExclamation,"ERROR "
Exit Sub
End If
bSwapBytes = task.SwapWords
MsgBox "SwapWords = " & CStr(bSwapWords),vbInformation,"ERROR "
Parameter Description
None None
Result Byte
0 = Input Type
1 = Input/Output Type
2 = Exception Output Type
3 = Unconditional Output Type
-2147220992 = not defined
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim nTaskType As Byte
nTaskType = task.Type
MsgBox "Task Type = " & CStr(nTaskType),vbInformation,"ERROR "
Description This property returns the write settings of the task at project startup. Shows the
value of the "Write Outputs at Startup" property. This only has meaning for
"Input/Output" or "Exception Output" tasks.
Remarks Read only property.
Parameter Description
54
None None
Result Boolean
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Set drv = GetDriverInterface("Modbus TCPIP")
Set task = drv.GetDriverTask("Task")
If Not task.IsValid Then
MsgBox "Task is not valid!",vbExclamation,"ERROR "
Exit Sub
End If
MsgBox "WriteOutputsAtStartup = " & task.WriteOutputsAtStartup,vbExclamation,"ERROR "
Set drv = Nothing
Set task = Nothing
End Sub
1.6.4. StationInterface
StationInterface Functions
GetBaseStationInterface, StationInterface Function
Syntax GetBaseStationInterface
Remarks
Parameter Description
None None
Result Nothing
Example:
Description Returns a SubStation object. According to the driver type, the returned object may
be: "Nothing",
"SerialStationInterface","SerialHalfDuplexBaseStationInterface",
"SerialTAPIHalfDuplexBaseStationInterface", "TAPIStationInterface",
"TCPIPStationInterface", "RASStationInterface".
Remarks
Parameter Description
None None
55
Result Object:
Nothing
SerialStationInterface
SerialHalfDuplexBaseStationInterface
SerialTAPIHalfDuplexBaseStationInterface
TCPIPStationInterface
TAPIStationInterface for serial drivers
RASStationInterface for TCPIP drivers
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim drv1 As DriverInterface
Dim station1 As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim SerialTAPIHalfDuplexBaseStation As SerialTAPIHalfDuplexBaseStationInterface
Dim SerialStation As SerialStationInterface
Dim TAPIStation As TAPIStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim RASStation As RASStationInterface
56
Set drv = Nothing
Set station = Nothing
Set drv1 = Nothing
Set station1 = Nothing
Set TAPIStation = Nothing
Set SerialStation = Nothing
Set RASStation = Nothing
Set TCPIPStation = Nothing
End Sub
Description Returns a task object. This function can be used to retrieve the interface to any
static or dynamic task.
Remarks
Parameter Description
Result Object
If Function has been executed successfully it will retrieve an object of type
TaskInterface if otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim task As TaskInterface
Dim bInUse As Boolean
bInUse = task.InUse
MsgBox "InUse = " & CStr(bInUse),vbInformation,"ERROR "
Remarks
Parameter Description
57
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim strGetXMLSettings As String
strGetXMLSettings = station.GetXMLSettings
MsgBox "GetXMLSettings = " & strGetXMLSettings,vbInformation,"ERROR "
Remarks
Parameter Description
None None
Result Boolean
True = station in error
False = Station ok
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim bError As Boolean
bError = station.IsInError
MsgBox "IsInError = " & CStr(bError),vbInformation,"ERROR "
58
StationInterface Properties
LastErrorCode, StationInterface Property
Syntax Long = task.LastErrorCode
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim lLastError As Long
lLastError = station.LastErrorCode
MsgBox "LastErrorCode = " & CStr(lLastError),vbInformation,"ERROR "
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim lLastError As String
59
MsgBox "Station not found!",vbExclamation,"ERROR "
Exit Sub
End If
lLastError = station.LastErrorString
MsgBox "LastErrorString = " & CStr(lLastError),vbInformation,"ERROR "
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strName As String
strName = station.Name
MsgBox "Name = " & strName,vbInformation,"ERROR "
Description This property sets or returns the parameter of the station: Error Threshold.
Remarks
Parameter Description
None None
Result Long
Example:
60
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim lErrorThreshold As Long
station.ErrorThreshold= 2
lErrorThreshold = station.ErrorThreshold
MsgBox "Error Threshold e= " & lErrorThreshold ,vbInformation,"ERROR"
Description This property sets or returns the parameter of the station: State/Command Variable.
Remarks
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim strStateCommandVariable As String
station.StateCommandVariable = "StateCommand"
strStateCommandVariable = station.StateCommandVariable
MsgBox "State/Command Variable= " & strStateCommandVariable,vbInformation,"ERROR"
61
Remarks This property is read-only.
Parameter Description
None None
Result Integer
The returned values tally with the OPC specification quality values:
252 = OPC_STATUS_MASK
3 = OPC_LIMIT_MASK
0 = OPC_QUALITY_BAD
64 = OPC_QUALITY_UNCERTAIN
192 = OPC_QUALITY_GOOD
4 = OPC_QUALITY_CONFIG_ERROR
8 = OPC_QUALITY_NOT_CONNECTED
12 = OPC_QUALITY_DEVICE_FAILURE
16 = OPC_QUALITY_SENSOR_FAILURE
20 = OPC_QUALITY_LAST_KNOWN
24 = OPC_QUALITY_COMM_FAILURE
28 = OPC_QUALITY_OUT_OF_SERVICE
68 = OPC_QUALITY_LAST_USABLE
80 = OPC_QUALITY_SENSOR_CAL
84 = OPC_QUALITY_EGU_EXCEEDED
88 = OPC_QUALITY_SUB_NORMAL
216 = OPC_QUALITY_LOCAL_OVERRIDE
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim nQuality As Integer
nQuality = station.Quality
MsgBox "Quality = " & CStr(nQuality),vbInformation,"ERROR "
Parameter Description
None None
Result Byte
0 = normal. This value is returned when the driver uses external library, such
as Modbus TCPIP, INTERBUS, etc.
1 = SerialType
62
2 = TAPIType
3 = TCPIPType
4 = RASTCPIPType
-2147220992 = station not defined
Example:
Sub Main
Dim drv As DriverInterface
Dim task As TaskInterface
Dim nStationType As Byte
nStationType = station.StationType
MsgBox "StationType = " & CStr(nStationType),vbInformation,"ERROR "
1.6.5. SerialTAPIHalfDuplexBaseStationInterface
Functions
GetBaseStationInterface, SerialTAPIHalfDuplexBaseStationInterface Function
Syntax GetBaseStationInterface
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
TAPIStationInterfaceif , otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim SerialStation As SerialStationInterface
Dim TAPIStation As TAPIStationInterface
Dim SubTAPIStation As TAPIStationInterface
63
MsgBox "MODBUSStation not found!",vbExclamation,"ERROR"
Exit Sub
End If
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
SerialTAPIHalfDuplexBaseStationInterface if , otherwise Nothing is returned.
Example:
Sub Main
64
Exit Sub
End If
End Sub
GetXMLSettings, SerialTAPIHalfDuplexBaseStationInterfaceFunction
Syntax GetXMLSettings
Remarks
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim strGetXMLSettings As String
65
MsgBox "TAPIHalfDupStation not found!",vbExclamation,"ERROR"
Exit Sub
End If
Properties
DelayAfterLastChar, SerialTAPIHalfDuplexBaseStationInterface Property
Syntax objTAPIHalfDpStation.DelayAfterLastChar
Description This property sets or returns the time between the transmission last character and
the setting to OFF control signal.
The time is in milliseconds.
Remarks This time should be considered non-deterministic, because Windows is not an OS real-time.
Parameter Description
None None
Result Long
Example:
Description This property sets or returns the time between the set to the ON control signal and
the transmission of a message.
The time is expressed in milliseconds.
Remarks This time should be considered non-deterministic, because Windows is not an OS real-time.
Parameter Description
None None
Result Long
Example:
Option Explicit
Const DRIVER_NAME = "Modbus Serial"
66
Enum eHafDupSignal
None
RTS
DTS
End Enum
Sub Main
Dim objDrvInt As DriverInterface
Dim sStationNameas String
sStationName = This.GetParameter(0)
If sStationName <> "" Then
Set objDrvInt = GetDriverInterface(DRIVER_NAME)
Set objStation = objDrvInt.GetDriverStation(sStationName)
If Not objStation Is Nothing Then
Set objModbusStation = objStation.GetSubStationInterface
'Parametrize Modbus Station properties
If Not objModbusStation Is Nothing Then
'Retreive the TAPI Half-Duplex Base Objects
Set objTAPIHalfDpStation = objModbusStation.GetBaseStationInterface
If Not objTAPIHalfDpStation Is Nothing Then
objTAPIHalfDpStation.DelayBeforeFirstChar = 0
Else
Debug.Print "VBA Driver - objTAPIHalfDpStation Error! Station: '" &
objStation.Name & "'
End If
Else
Debug.Print "VBA Driver - objModbusStation is Nothing for the Station'" &
sStationName & "'"
End If
Else
Debug.Print "VBA Driver - objStation is Nothing for the Station'" & sStationName & "'"
End If
Set objDrvInt = Nothing
Set objStation= Nothing
Set objModbusStation = Nothing
Set objTAPIHalfDpStation = Nothing
End Sub
Description This property selects or returns the control signal used to control the direction of
transmission.
Possible values: None, RTS and DTR.
Remarks
Parameter Description
None None
Result Long
Example:
67
1.6.6. SerialStationInterface
SerialStationInterface Functions
GetSubStationInterface, SerialStationInterface Function
Syntax GetSubStationInterface
Description This function, according to driver type, used at this level may return
"SerialStationInterface" or "ModbusStationInterface" object type.
Remarks
Parameter Description
None None
Result Object:
SerialStationInterface
ModbusStationInterface
Example:
See the "GetBaseStationInterface" property example.
Remarks
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim SerialStation As SerialStationInterface
Dim TAPIStation As TAPIStationInterface
Dim strGetXMLSettings As String
68
If SerialStation Is Nothing Then
MsgBox "SerialStation not found!",vbExclamation,"ERROR "
Exit Sub
End If
strGetXMLSettings = SerialStation.GetXMLSettings
MsgBox "GetXMLSettings = " & CStr(strGetXMLSettings),vbInformation,"ERROR "
SerialStationInterface Properties
BaudRate, SerialStationInterface Property
Syntax Long = station.BaudRate
Description This property sets or returns the COM Port BaudeRate value of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim SerialStation As SerialStationInterface
Dim TAPIStation As TAPIStationInterface
Dim lBaudRate As Long
Dim nParity As Byte
Dim nPortID As Byte
Dim nStopBits As Byte
Dim nByteSize As Byte
Dim nFlowControl As Byte
69
Set TAPIStation = SerialTAPIHalfDuplexBaseStation .GetBaseStationInterface
If TAPIStation Is Nothing Then
MsgBox "TAPIStation not found!",vbExclamation,"ERROR"
Exit Sub
End If
nPortID = SerialStation.PortID
lBaudRate = SerialStation.BaudRate
nByteSize = SerialStation.ByteSize
nParity = SerialStation.Parity
nStopBits = SerialStation.StopBits
nFlowControl = SerialStation.FlowControl
Description This property sets or returns the COM Port ByteSize value of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Byte
Example:
See the "BaudRate" property example.
Description This property sets or returns the Timeout for the COM Port Cd signal of the Station.
This time is in milliseconds.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
70
Result Long
Example:
See the "RxTimeout" property example.
Description This property sets or returns the Timeout for the COM Port Cts signal of the Station.
This time is in milliseconds.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
See the "RxTimeout" property example.
Description This property sets or returns the Timeout for the COM Port Dsr signal of the Station.
This time is in milliseconds.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
See the "RxTimeout" property example.
Description This property sets or returns the COM Port Flow Control value of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Byte
0 = None
71
1 = Hardware
2 = Xon / Xoff
Example:
See the "BaudRate" property example.
Description This property allow to keep the COM Port always opened during the project runtime.
If the property is set to false the COM port will be opened and then will be closed
each time that some data have to be exchanged.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Boolean
True = COM port is keep opened
False = COM port is opened and closed each time some data have to be exchanged
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim SerialStation As SerialStationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim TAPIStation As TAPIStationInterface
Dim bKeepPortOpened As Boolean
bKeepPortOpened = SerialStation.KeepPortOpened
MsgBox "KeepPortOpened = " & CStr(bKeepPortOpened),vbInformation,"ERROR"
72
Set drv = Nothing
Set station = Nothing
Set TAPIStation = Nothing
Set SerialStation = Nothing
End Sub
Description This property sets or returns the COM Port Parity value of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Byte
0 = None
1 = Odd
2 = Even
3 = Mark
4 = Blank
Example:
See the "BaudRate" property example.
Description This property sets or returns the COM Port number of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Byte
0 = COM1
1 = COM2
2 = COM3
3 = COM4
......
Example:
See the "BaudRate" property example.
Description This property sets or returns the Timeout for the COM Port Rx signal of the Station.
This time is in milliseconds.
Remarks A modification of this value will come acquired only to the following serial port
opening.
73
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim SerialStation As SerialStationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim TAPIStation As TAPIStationInterface
Dim lRxTimeout As Long
Dim lTxTimeout As Long
Dim lCdTimeout As Long
Dim lCtsTimeout As Long
Dim lDsrTimeout As Long
lRxTimeout = SerialStation.RxTimeout
lTxTimeout = SerialStation.TxTimeout
lCdTimeout = SerialStation.CdTimeout
lCtsTimeout = SerialStation.CtsTimeout
lDsrTimeout = SerialStation.DsrTimeout
74
SizeReceivingQueue, SerialStationInterface Property
Syntax Long = station.SizeReceivingQueue
Description This property sets or returns the Receiving Buffer Queue (Bytes) for the COM Port
of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
Description This property sets or returns the Transmission Buffer Queue (Bytes) for the COM
Port of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
See the "BaudRate" property example.
Description This property sets or returns the COM Port Stop Bits value of the Station.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Byte
0 = 1 stop bit
1 = 1.5 stop bits
2 = 2 stop bits
Example:
See the "BaudRate" property example.
75
TxTimeout, SerialStationInterface Property
Syntax Long = station.TxTimeout
Description This property sets or returns the Timeout for the COM Port Tx signal of the Station.
This time is in milliseconds.
Remarks A modification of this value will come acquired only to the following serial port
opening.
Parameter Description
None None
Result Long
Example:
See the "RxTimeout" property example.
1.6.7. TAPIStationInterface
TAPIStationInterface Functions
GetBaseStationInterface, TAPIStationInterface Function
Syntax GetBaseStationInterface
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
SerialStationInterface if , otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim SerialStation As SerialStationInterface
Dim TAPIStation As TAPIStationInterface
Dim SubTAPIStation As TAPIStationInterface
76
Exit Sub
End If
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
TAPIStationInterface if , otherwise Nothing is returned.
Example:
See the "GetBaseStationInterface" property example.
Remarks
Parameter Description
77
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim TAPIStation As TAPIStationInterface
Dim strGetXMLSettings As String
strGetXMLSettings = TAPIStation.GetXMLSettings
MsgBox "GetXMLSettings = " & CStr(strGetXMLSettings),vbInformation,"ERROR"
Description Gets the connection state of the RAS Station. The "True" value indicates that the
station is being connected or already connected.
Remarks
Parameter Description
None None
Result Boolean
True = Station Connected or being connected
False = Station not Connected
Example:
Sub Main
78
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim TAPIStation As TAPIStationInterface
Dim bIsConnected As Boolean
bIsConnected = TAPIStation.IsConnected
MsgBox "IsConnected = " & CStr(bIsConnected),vbInformation,"ERROR"
TAPIStationInterface Properties
DisconnectAfterSecs, TAPIStationInterface Property
Syntax Long = station.DisconnectAfterSecs
Description This property sets or returns the time in milliseconds after which the modem
connection of the TAPI Station will hang up. The counter of the time will start from
the moment in which all the communication tasks are not in use, and it will be reset
if at least one task returns in use before the expiration of the time.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
79
Dim TAPIStation As TAPIStationInterface
Dim strPhoneNumber As String
Dim nRetries As Byte
Dim lDisconAfter As Long
Dim lRetryAfter As Long
Dim bEnableTAPI As Boolean
Dim bPrompt As Boolean
Dim bShowCon As Boolean
strPhoneNumber = TAPIStation.PhoneNumber
nRetries = TAPIStation.Retries
lDisconAfter = TAPIStation.DisconnectAfterSecs
lRetryAfter = TAPIStation.RetryAfterSecs
bEnableTAPI = TAPIStation.EnableTAPICallOnThisStation
bPrompt = TAPIStation.PromptForConnection
bShowCon = TAPIStation.ShowConnectionDlg
Description This property sets or returns the enable to execute the modem connection for the
Station.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
80
Result Boolean
True = TAPI call enable
False = TAPI call disable
Example:
See the "DisconnectAfterSecs" property example.
Description This property returns the date and time of end of the last modem connection of the
Station.
Remarks This property is read-only.
Parameter Description
None None
Result Date
Example:
See the "StartConnectionTime" property example.
Description This property returns the connection time of the last modem call of the Station.
Parameter Description
None None
Result Date
Example:
See the "StartConnectionTime" property example.
Description This property returns the last error code occurs during the modem call of the Station.
Parameter Description
None None
81
Result Long
Example:
See the "StartConnectionTime" property example.
Description This property returns a description text about the state of the modem call of the
Station. This string can be an error message or a state connection message.
Remarks This property is read-only.
Parameter Description
None None
Result String
Example:
See the "StartConnectionTime" property example.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result String
Example:
See the "DisconnectAfterSecs" property example.
Description This property allows you to show or hide the connection confirmation dialog window.
If this property is true, before start connection, the Supervisor will show a
confirmation dialog window. Only if the user will click the OK button the Supervisor
will start the connection.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
82
Result Boolean
True = show the dialog window before connecting
False = don't show the dialog window and start connection
Example:
See the "DisconnectAfterSecs" property example.
Description This property sets or returns the number of retries to execute for the modem call of
the Station when the connection fails.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Byte
Example:
See the "DisconnectAfterSecs" property example.
Description This property sets or returns the time in milliseconds after which the modem
connection will be retried if the previous call has failed.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Long
Example:
See the "DisconnectAfterSecs" property example.
Description This property allows you to show or hide the connection status dialog window.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
83
Result Boolean
True = show dialog window
False = hide dialog window
Example:
See the "DisconnectAfterSecs" property example.
Description This property returns the date and time of begin of the last modem connection of
the Station.
Remarks This property is read-only.
Parameter Description
None None
Result Date
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim MODBUSStation As ModbusStationInterface
Dim TAPIHalfDupStation As SerialTAPIHalfDuplexBaseStationInterface
Dim TAPIStation As TAPIStationInterface
Dim dStartConn As Date
Dim dEndConn As Date
Dim dTotalConn As Date
Dim dLastConn As Date
Dim lLastError As Long
Dim strLastErrorString As String
dStartConn = TAPIStation.StartConnectionTime
dEndConn = TAPIStation.EndConnectionTime
dTotalConn = TAPIStation.TotalConnectionTime
dLastConn = TAPIStation.LastConnectionTime
lLastError = TAPIStation.LastTAPIError
strLastErrorString = TAPIStation.LastTAPIErrorString
84
MsgBox "StartConnectionTime = " & CStr(dStartConn) & vbLf & _
"EndConnectionTime = " & CStr(dEndConn) & vbLf & _
"TotalConnectionTime = " & CStr(dTotalConn) & vbLf & _
"LastConnectionTime = " & CStr(dLastConn) & vbLf & _
"LastTAPIError = " & CStr(lLastError) & vbLf & _
"LastTAPIErrorString = " & CStr(strLastErrorString),vbInformation,"ERROR"
Description This property returns the total connection time of the modem call of the Station.
The time is the sum of all calls executed from the start of the Project.
Remarks This property is read-only.
Parameter Description
None None
Result Date
Example:
See the "StartConnectionTime" property example.
1.6.8. TCPIPStationInterface
TCPIPStationInterface Functions
GetBaseStationInterface, TCPIPStationInterface Function
Syntax GetBaseStationInterface
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve a StationInterface type
object, otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim SubRASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim SubTCPIPStation As StationInterface
85
Set drv = GetDriverInterface("Modbus TCPIP")
Set station = drv.GetDriverStation("Station1")
If station Is Nothing Then
MsgBox "Station not found!",vbExclamation,"ERROR "
Exit Sub
End If
Description This function, according to driver type, used at this level returns a
"TCPIPStationInterface" or "RASStationInterface" object type.
Remarks
Parameter Description
None None
Result Object:
TCPIPStationInterface
RASStationInterface
Example:
See the "GetBaseStationInterface" property example.
86
Remarks
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim strGetXMLSettings As String
strGetXMLSettings = TCPIPStation.GetXMLSettings
MsgBox "GetXMLSettings = " & CStr(strGetXMLSettings),vbInformation,"ERROR "
TCPIPStationInterface Properties
BackupServerAddress, TCPIPStationInterface Property
Syntax String = station.BackupServerAddress
Description This property sets or returns the IP address of the Backup Server for the station.
Shows the value of the "Backup Server Address" property.
Remarks
Parameter Description
None None
87
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
TCPIPStation.BackupServerAddress = "192.168.0.10"
TCPIPStation.SwitchServerTimeout = 20000
Description This property sets or returns the local IP Address that the station will use for the
connection. This property is useful when on the PC are present two or more network
cards. If the field comes lets voids the IP address of the default card will be used.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result String
Example:
See the "ServerAddress" property example.
Description This property sets or returns the local Port that the station will use for the
connection. If the field comes lets voids the default Port will be used.
88
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result Long
Example:
See the "ServerAddress" property example.
Description This property sets or returns the Receiving Buffer Queue (Bytes) for the Station.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim lMaxReceive As Long
Dim lMaxSend As Long
lMaxReceive = TCPIPStation.MaxReceive
lMaxSend = TCPIPStation.MaxSend
89
Set RASStation = Nothing
Set TCPIPStation = Nothing
End Sub
Description This property sets or returns the Sending Buffer Queue (Bytes) for the Station.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result Long
Example:
See the "MaxReceive" property example.
Description This property sets or returns the Timeout for the data receiving. This time is in
milliseconds.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result Long
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim lRxTimeout As Long
Dim lTxTimeout As Long
90
Exit Sub
End If
lRxTimeout = TCPIPStation.RxTimeout
lTxTimeout = TCPIPStation.TxTimeout
Description This property sets or returns the Name or the IP Address of the Server to which the
station will be connected.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
Dim strServerAddress As String
Dim lServerPort As Long
Dim strLocalBoundAddress As String
Dim lLocalBoundPort As Long
strServerAddress = TCPIPStation.ServerAddress
lServerPort = TCPIPStation.ServerPort
strLocalBoundAddress = TCPIPStation.LocalBoundAddress
lLocalBoundPort = TCPIPStation.LocalBoundPort
91
"LocalBoundAddress = " & CStr(strLocalBoundAddress) & vbLf & _
"LocalBoundPort = " & CStr(lLocalBoundPort),vbInformation,"ERROR "
Description This property sets or returns the Port number of the Server to which the station will
be connected.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
Result Long
Example:
See the "ServerAddress" property example.
Description This property sets or returns the time, in milliseconds, which passes between the
communication with a server error verification and the attempt to connect to another
server. Shows the value of the "Switch Server Timeout" property.
Remarks
Parameter Description
None None
Result Long
Example:
See the "BackupServerAddress" property example.
Description This property sets or returns the Timeout for the data sending. This time is in
milliseconds.
Remarks A modification of this value will come acquired only when the socket will open. For example
on the project startup before that the communication tasks are executed at least once.
Parameter Description
None None
92
Result Long
Example:
See the "RxTimeout" property example.
1.6.9. RASStationInterface
RASStationInterface Functions
GetBaseStationInterface, RASStationInterface Function
Syntax GetBaseStationInterface
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
TCPIPStationInterface if , otherwise Nothing is returned.
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim SubRASStation As RASStationInterface
Dim TCPIPStation As TCPIPStationInterface
93
Set SubRASStation = Nothing
Set TCPIPStation = Nothing
End Sub
Remarks
Parameter Description
None None
Result Object
If Function has been executed successfully it will retrieve an object of type
RASStationInterface if , otherwise Nothing is returned.
Example:
See the "GetBaseStationInterface" property example.
Remarks
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim strGetXMLSettings As String
strGetXMLSettings = RASStation.GetXMLSettings
MsgBox "GetXMLSettings = " & CStr(strGetXMLSettings),vbInformation,"ERROR "
94
Set station = Nothing
Set RASStation = Nothing
End Sub
Description Gets the connection state of the RAS Station. The "True" value indicates that the
station is being connected or already connected.
Remarks
Parameter Description
None None
Result Boolean
True = Station Connected or is being connected
False = Station not Connected
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim bIsConnected As Boolean
bIsConnected = TAPIStation.IsConnected
MsgBox "IsConnected = " & CStr(bIsConnected),vbInformation,"ERROR "
RASStationInterface Properties
DisconnectAfterSecs, RASStationInterface Property
Syntax Long = station.DisconnectAfterSecs
Description This property sets or returns the time in milliseconds after which the modem
connection of the RAS Station will hang up. The counter of the time will start from
the moment in which all the communication tasks are not in use, and it will be reset
if at least one task returns in use before the expiration of the time.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
95
None None
Result Long
Example:
See the "PhoneBookEntry" property example.
Description This property sets or returns the enable to execute the modem connection for the
Station.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Boolean
True = RAS call enable
False = RAS call disable
Example:
See the "PhoneBookEntry" property example.
Description This property returns the date and time of end of the last modem connection of the
Station.
Remarks This property is read-only.
Parameter Description
None None
Result Date
Example:
See the "StartConnectionTime" property example.
Description This property returns the connection time of the last modem call of the Station.
Parameter Description
96
None None
Result Date
Example:
See the "StartConnectionTime" property example.
Description This property returns the last error code occurs during the modem call of the Station.
Parameter Description
None None
Result Long
Example:
See the "StartConnectionTime" property example.
Description This property returns a description text about the state of the modem call of the
Station. This string can be an error message or a state connection message.
Remarks This property is read-only.
Parameter Description
None None
Result String
Example:
See the "StartConnectionTime" property example.
Description This property sets or returns the number of retries to execute for the modem call of
the Station when the connection fails.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
97
Result Byte
Example:
See the "PhoneBookEntry" property example.
Description This property sets or returns the password of the User selected for the RAS
connection. This field is not used if the property "PhoneBookEntry" is not null.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result String
Example:
See the "PhoneBookEntry" property example.
Description This property sets or returns the name of the connection previously created and
configurated in the Operating System.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result String
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim strPhoneBook As String
Dim strPhoneNumber As String
Dim strUserName As String
Dim strPassword As String
Dim nNumRetries As Byte
Dim lDisconnectAfter As Long
Dim lRetryAfter As Long
Dim bEnableRASCall As Boolean
Dim bPromptForConn As Boolean
Dim bShowConnDlg As Boolean
98
End If
strPhoneBook = RASStation.PhoneBookEntry
strPhoneNumber = RASStation.PhoneNumber
strUserName = RASStation.UserName
strPassword = RASStation.Password
nNumRetries = RASStation.NumRetries
lDisconnectAfter = RASStation.DisconnectAfterSecs
lRetryAfter = RASStation.RetryAfterSecs
bEnableRASCall = RASStation.EnableRASCallOnThisStation
bPromptForConn = RASStation.PromptForConnection
bShowConnDlg = RASStation.ShowConnectionDlg
Description This property sets or returns the telephone number to call. This field is not used if
the property "PhoneBookEntry" is not null.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result String
Example:
See the "PhoneBookEntry" property example.
Description This property allows you to show or hide the connection confirmation dialog window.
If this property is true, before start connection, the Supervisor will show a
confirmation dialog window. Only if the user will click the OK button the Supervisor
will start the connection.
Remarks A modification of this value will come acquired only to the following call.
99
Parameter Description
None None
Result Boolean
True = show the dialog window before connecting
False = don't show the dialog window and start connection
Example:
See the "PhoneBookEntry" property example.
Description This property sets or returns the time in milliseconds after which the modem
connection will be retried if the previous call has failed.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Long
Example:
See the "PhoneBookEntry" property example.
Description This property allows you to show or hide the connection status dialog window.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result Boolean
True = show dialog window
False = hide dialog window
Example:
See the "PhoneBookEntry" property example.
Description This property returns the date and time of begin of the last modem connection of
the Station.
Remarks This property is read-only.
100
Parameter Description
None None
Result Date
Example:
Sub Main
Dim drv As DriverInterface
Dim station As StationInterface
Dim RASStation As RASStationInterface
Dim dStartConn As Date
Dim dEndConn As Date
Dim dTotalConn As Date
Dim dLastConn As Date
Dim lLastError As Long
Dim strLastErrorString As String
dStartConn = RASStation.StartConnectionTime
dEndConn = RASStation.EndConnectionTime
dTotalConn = RASStation.TotalConnectionTime
dLastConn = RASStation.LastConnectionTime
lLastError = RASStation.LastRASErrorNumber
strLastErrorString = RASStation.LastRASErrorString
Description This property returns the total connection time of the modem call of the Station.
The time is the sum of all calls executed from the start of the Project.
Remarks This property is read-only.
Parameter Description
None None
101
Result Date
Example:
See the "StartConnectionTime" property example.
Description This property sets or returns the name of the User selected for the RAS connection.
This User must be authenticated by the Server. This field is not used if the property
"PhoneBookEntry" is not null.
Remarks A modification of this value will come acquired only to the following call.
Parameter Description
None None
Result String
Example:
See the "PhoneBookEntry" property example.
1.7. Errors
Errors are grouped by scope and are listed in alphabetical order.
Design errors
Error message Scope Gravity Possible cause Possible solution
Internal Error in file design serious problem in user interface call support center
'<file_name>' at the line controls creation or
<line_number>. Please configuration files access
contact the Technical
Support
Invalid Address Offset design warning the selected variable is not choose an existing integer
Variable. Enter the name of of a valid type. variable from the tags
an existing integer variable database.
Invalid conditional design warning the selected variable is not choose an existing integer
variable'<variable_name>' valid: does not exist or has variable from the tags
for the task '<task_name>' been cancelled or is of a database.
wrong data type.
Invalid conditional variable. runtime warning the conditional variable is choose an existing integer
Enter only one existing not valid: does not exist or variable of the tags
variable of numeric type. has been cancelled or is of database.
a wrong data type.
ListView out of memory design serious there is not enough free some memory closing
memory to manage processes or applications,
operation on stations list or restart Supervisor or PC if
tasks list. needed.
Name <name>' is already in design warning station name or task name change station or task
use. Please, choose a already existing. Duplicated name
different name are not allowed.
Task size exceeds the runtime warning the total size of the reduce the number of
maximum allowed size for variables belonging to the variables associated to this
this protocol task is bigger than the task
maximum allowed size for
this protocol
The selected Dynamic design warning the dynamic address string check address format and
Settings String is either specified for the variable is variable data type
invalid or not allowed for this invalid or not allowed
Variable!
102
The selected COM port is design warning the port number set in allowed values for
either not supported or is Station/Serial port Station/SerialPort
being used by another settings/Port property is settings/Port property are
application. Please select invalid positive integer (not zero)
another port.
Value cannot be empty! design warning ethernet drivers only. The enter a valid Server
Please enter a value values for TCPIP address: IP address in
station/Server address xxx.xxx.xxx.xxx format, or
property or Server port server name i.e. 'server1'
property are invalid. enter a valid Server port
number :positive integer
(not zero)
Value cannot be zero! Please design warning the value for Rx queue size enter a positive integer
enter a number greater then or Tx queue size in (not zero)
0 Station/Queue size
properties is invalid
Variable '<variable_name>' runtime warning the selected variable is not choose an existing variable
is not valid for the task valid: does not exist or has of the tags database.
'<task_name>' been cancelled or is of a Check task design and
wrong data type addressing rules.
Hardware errors
Error message Scope Gravity Possible cause Possible solution
Error loading runtime fatal the driver dll file has not check if
<drivername>.dll been found <drivername>.dll file is
present in 'Drivers'
subfolder under Supervisor
installation folder
Communication errors
Error message Scope Gravity Possible cause Possible solution
Communication error : runtime various this is the generic message check the possible error
station <station_name>, for communication errors: source as suggested by
error <error_description> error description gives a error description
detail explanation of the
error source
Error ! Driver has already runtime fatal unexpected behavior of the call support center
been initialized ! driver, an attempt to
initialize it was made but the
driver was already running.
Failed to open the communi- serious failed to open serial port check if port number is
communication device. The cation test (serial drivers) or correct, check cables
configurated COM port is communication socket connection, check if
either not supported or is port is in use by
being used by another another application,
application check device
accessibility
Communication messages
Message Scope Gravity Possible cause Possible solution
Communication established : runtime info the communication has
station <station_name> been established properly
103
Communication restored runtime info the communication has
been restored after a
communication problem
Station quality changed : station runtime info the quality of the
<station_name>, quality bitfield (debug station's data changed:
<quality_value> window) possible values are bad,
good, uncertain, not
connected
Task <task_name> (Station runtime info if in-use management is
<station_name>) is now in use... (debug on, the dynamic tasks are
window) activated or deactivated
according to tags in use.
Task <task_name> (Station runtime info if in-use management is
<station_name>) is now NOT in (debug on, the dynamic tasks are
use... window) activated or deactivated
according to tags in use.
The station <station_name> has runtime info applies to Ethernet driver
switched from server only. If a backup server
<primary_server_name> has been defined in
to <secondary_server_name> Network
services/Redundancy
property and the primary
server is down, the
station connects to
the backup server, or
vice-versa.
104
control if supported by the
device
The selected COM port runtime serious the COM port does not exist check port number in
is either not supported or is already used by another Station/SerialPort
or is being used by application. settings/Port property; free
another application. the port closing the
Please select another application using it and
port. restart the PC if needed
Tx Buffer Full ! runtime serious the transmission buffer is increase Station/Queue
full, messages are not exiting size/Tx queue size
Unexpected WM_QUIT runtime info the driver received a close
received ! message from Windows and
is shutting down
105
Connection window runtime or serious internal error: the driver check available memory
creation failed : station communi- application can not create the resources
<station_name> cation test dialog window, for example
due to a lack of memory
resources
Could not initialise the runtime serious the command for initializing check modem state,
Modem on the Bridging modem has been sent but settings and cables
Port, station there was no proper answer
<station_name>
Could not perform read runtime serious can not read data check modem state,
operation on the Bridging settings and cables
Port,
station <station_name>
Could not perform write runtime serious can not write data check modem state,
operation on the Bridging settings and cables
Port,
station <station_name>
Device control has been runtime info end of the bridging
restored - Bridging ended! operations
- station
Disconnection sequence runtime info there is no more bridging
received on the Bridging activity so the
Port, station communication has been
stopped
The modem has been runtime info self explanatory
disconnected from the
Bridging Port, station
<station_name>
Too many characters runtime serious too many characters have reset the bridging
received on the Bridging been received with respect to closing the modem port
Port, station the internal buffer size.
106
CloseDriver
before the
DriverInterface.
OpenDriver
Error! Driver runtime warning The
already DriverInterface.CloseDriv
closed or er has been called with a
application is inactive driver.
shutting
down!
1.8. About
Through this window you can checkout the selected Driver version and any associated descriptions
and comments.
Always check whether the Supervisor Driver file is the latest available, otherwise it
would be in your best interests to update the file (.DLL) by downloading it from the
local dealer support web site according to the modalities provided.
107
M O V I C O N 1 1
Movicon™ is a trademark of Progea, related to the HMI/SCADA platform entirely developed and produced
by Progea. © 2016 All Rights reserved.
No part of this document or of the program may be reproduced or transmitted in any form
without the express written permission of Progea.
Information in this document is subject to change without notice and is not binding in any way for the
company producing it.
108