[go: up one dir, main page]

0% found this document useful (0 votes)
137 views851 pages

MNL 041 Q 100

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 851

Index

ELSIST Srl, www.elsist.it MNL041Q100

Remoter 8.4.0 handbook


What is Remoter

Use of Remoter

Commands index
File management commands
Editing commands
View commands
Project management commands
Target management commands
Project compiling commands
Macro management commands
Tools configuration commands
Windows management commands
Help commands

Workspace
Creation of a new workspace

Project
Creation of a new project
How to compile the project

Project settings
Hardware target selection
Software target selection
Target system configuration
Project type selection
Library selection
Memory limits setting
PLC settings
Various settings
Programming communication
Debug communication

RLD File
How to add a file
How to build a branch
How to run the debug

http://192.168.0.61/Destination/Index.htm (1 of 3) [06/10/2008 17.40.41]


Index

RIL File
How to add a file
How to run the debug

RFB File
How to add a RFB file
FB MODBUS communication
FB terminal operator

Assembly File
How to add file
How to run the debug

C File
How to add a file
How to run the debug

Operations on target
System catch
Information request
Software version
Memory deletion
Program upload
Program download
Program running
Project information
Mass memory manager

Utilities
Terminal emulation

Function blocks

C Language
Macros
Data types
Variables
Functions
ANSI Functions

RIL Language
Operands

http://192.168.0.61/Destination/Index.htm (2 of 3) [06/10/2008 17.40.41]


Index

reserved operands

Instructions
Operand definition instructions
Logical instructions
Data management instructions
Math instructions(Fixed)
Math instructions(Float)
Serial instructions
Program management instructions
Utility instructions

How to

Appendix
How to migrate the program from 7.x versions
How to migrate the program from 8.0.x versions
Ascii code table
Error list
Libraries
Memory map
Loaders
Kernels
Netsyst line
Picosyst line
Worspaces list

http://192.168.0.61/Destination/Index.htm (3 of 3) [06/10/2008 17.40.41]


What is Remoter

ELSIST Srl, www.elsist.it MNL041Q100

Index

Remoter

Remoter is a set of development for every single product, easy and nice to use. it allows to generate "multi
file" projects, with the opportunity of integrating some code parts developed in the C language. The
powerful and versatile set allows the development of your own work, as well as to load it in the device and
to manage the debug. Proper dialog windows, that you can size and place as you like, let you monitor the
different conditions of the controller and its operands.

A set of commands for the file management, view, project management, editing, project compiling, target
management, macro management is directly accessible from toolbars, which can be personalized in order
to satisfy particular user's needs, and it gives a faster access to the most useful functions .

A powerful set of instructions, that contains operand definitions, logic, data management,program
management, fixed or float mathematical, serial, or utility, lets the user to realize programs that solve any
automation requirements.

The symbolical programming allows to use a proper name for every single operand making easier the
comprehension of the program by breaking the limits of the numerical programming, that imposes a defined
numerical range for every operand. Indeed the symbolical programming gives the opportunity of using the
whole memory area of the product by placing the operands according to your own needs. The interaction
between the RIL program and the functions carried out in other languages, such as assembler and C, see
the proper chapter.

Application development

The application development is very easy, here they are the steps to follow.

1 Create a new workspace


2 Create a new project
3 Insert the required RLD, RIL, C, FB MODBUS communication, FB system terminal files in the project
4 Compile and link all the files of the project
5 Link the system to the PC through the communication media selected in the communication settings
6 Execute the catch procedure of the target system
7 upload the program on the target system
8 Start the RIL, RLD, C program debug

With Remoter are supplied some example programs that shows different programming techniques.

http://192.168.0.61/Destination/Html/Remoter.htm [06/10/2008 17.40.42]


File management commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

File management commands

These commands are accessible from the File menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

New It opens the insert new file window, it


can be activated with the key
sequenceCtrl+N.

Open It allows the disk browsing to open a


file, it can be activated with the key
sequence Ctrl+O.
Save It saves the editing active file, it can be
activated with the key sequence Ctrl
+S.
Save As... It saves the editing active file allowing
the directories browsing and the file
name definition.
Save all It saves all the opened in editing files.
Close It closes the editing active file.
Close All It closes all the opened files.
Toggle read only It locks/unlocks the editing of the
current file.
Reload active file It reloads the editing active file from
the disk. ATTENTION! All the changes
you made will be lost.
Reload all docs It reloads all the project files from the
disk. ATTENTION! All the changes
you made will be lost.
Save active project It saves the active project.
Save all project It saves all the projects of the
workspace.
Open Workspace It opens the open workspace window,
choosing a new workspace it will be
opened replacing the present one. It
can be activated with the key
Figure 1 sequence Ctrl+W.

Save Workspace It saves the workspace.


Close Workspace It closes the workspace.
Print It prints the editing active file.

http://192.168.0.61/Destination/Html/Use/Commands/File.htm (1 of 2) [06/10/2008 17.40.43]


File management commands

Print Preview It visualizes a print preview of the


editing active file.
Print Setup It visualizes the printer setup window.
Page Setup It visualizes the page setup window.
Exit It closes the Remoter.

http://192.168.0.61/Destination/Html/Use/Commands/File.htm (2 of 2) [06/10/2008 17.40.43]


Editing commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Editing commands

These commands are accessible from the Edit menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Undo It undoes the latest operation, it can be


activated with the key sequence Ctrl+Z.
Redo It executes the operation that has just
been undone. It can be activated with
the key sequence Ctrl+Shift+Z.
Cut It cuts the selected objects and it
transfers them in the clipboard. It can
be activated with the key sequence Ctrl
+X.
Copy It transfers the selected objects in the
clipboard. It can be activated with the
key sequence Ctrl+C.
Paste It pastes the contents of the clipboard
in the file. It can be activated with the
key sequence Ctrl+V.
Tabulate Selection It executes the shift to the right
Tabulation of the selected text. It can
be activated with the key sequence
Tab.
Untabulate Selection It executes the shift to the left
Untabulation of the selected text. It
can be activated with the key sequence
Shift+Tab.
Comment Selection It transforms in comment the lines of
text chosen. It can be used to
temporarily exclude from a program
some lines of code without delete
them.
Figure 1 Uncomment Selection It deletes the comment on the text lines
chosen.
Show white space It displays the spaces in the text files
with the symbol ".". The control is
useful to check if there are characters,
different from the space, that cannot
be displayed in the file.
Find It executes the search of text in the
editing active file, it can be activated
with the key sequence Ctrl+F.

http://192.168.0.61/Destination/Html/Use/Commands/Edit.htm (1 of 2) [06/10/2008 17.40.44]


Editing commands

Find In Files It executes the search of text in all the


project files, it can be activated with the
key sequence Ctrl+Shift+F.
Replace It executes the search of text and
replace it in the editing active file, it can
be activated with the key sequence Ctrl
+H.
Select All It select all the content of the editing
active file, it can be activated with the
key sequence Ctrl+A.
Find Next It continues the search of text in the
editing active file, it can be activated
with the key sequence F3.
Toggle Bookmark It adds/deletes a bookmark on the
pointed text line, it can be activated
with the key sequence Ctrl+F2.
Next Bookmark It moves the cursor in the file on the
next bookmark, it can be activated
with the key sequence F2.
Prev Bookmark It moves the cursor in the file on the
previous bookmark.
Delete All Bookmarks It deletes all the bookmarks in the
editing active file.
Goto Line It moves the cursor on the line and and
column defined in the editing active file.
It can be activated with the key
sequence i Ctrl+G.
Advanced Enables the advanced settings window.

http://192.168.0.61/Destination/Html/Use/Commands/Edit.htm (2 of 2) [06/10/2008 17.40.44]


View commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

View commands

These commands are accessible from the View menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Toolbar Enables/disables the toolbar display.


Status Bar Enables/disables the status bar display.
Workbook Mode Enables/disables the open files display in a
workbook mode.
WorkSpace Enables/disables the workspace window
display. It can be activated with the key
sequence Alt+1.
Output Window Enables/disables the output window display. It
can be activated with the key sequence Alt+2.
Figura 1 The window is automatically displayed when the
project is compiled or when a communication
with the target system is execute.
Watch Window Enables/disables the watch window display. It
can be activated with the key sequence Alt+3.
The window is automatically displayed when the
debug is started.
Terminal Window Enables/disables the terminal window display. It
can be activated with the key sequence Alt+4.

http://192.168.0.61/Destination/Html/Use/Commands/View.htm [06/10/2008 17.40.45]


Project management commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Project management commands

These commands are accessible from the Project menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Settings It opens the project settings wizard.


Set Active Next It select as active project the project that
follows the the current active project. It can be
activated with the key sequence Ctrl+Tab.
Add to Project It opens the add to project objects window.
Project Locked It locks/unlocks the project. In alocked project
is not allowed to move the file order on the
project tree.

Scan It executes the scan of all the RIL and RLD


files of the project and it compiles a list of all
the existing operands.
Figure 1
Update Comments It executes the update of all the operand
comments of the RIL and RLD files of the
project.
Set Upload Table It opens the upload files window, it's possible
to specify which files must be uploaded on
target.
View Cross Reference It displays the cross reference file.
View Project Settings It displays the project settings window.

Add to Project...

I comandi permettono di aggiungere al progetto nuovi oggetti. Di seguito riportiamo elenco dei comandi
disponibili.

Files... It opens the window to add a new file in the project.


Container... It opens the window to define the name of the container to be
Figure 2 added to the project. A container could be useful to group a files
with the same purpose.

http://192.168.0.61/Destination/Html/Use/Commands/Project.htm [06/10/2008 17.40.46]


Target management commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Target management commands

These commands are accessible from the Target menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Make All It commands all the operations for the


project compiling, the target system catch,
the upload and the running of the project on
the target system.
Catch It commands the catch of the target. The
target system is reset and connected to the
PC.
Stop Stops the program on the target system.
Upload Uploads the program on the target system.
Download Downloads the program from the target
system.
Run Starts the program on the target system.
Info It asks for the informations from the target
system.
Loaded Project Info It asks for the informations about the
project from the target system.
Figure 1
Version It asks for the software version from the
target system.
Clear Memory It clears the RAM memory on the target
system.
Test Not implemented
Mass Memory It displays the manager windows for the
Manager mass memory module (PC111) connnected
to the system.
Debug... It opens the debug window.

Debug...

I comandi permettono di eseguire il debug del programma sul sistema target. Di seguito riportiamo elenco
dei comandi disponibili.

Start... Actives the program debug, it allows to visualize and change the values of
Figure 2
the program variables, while it's in execution on the target system. Please
refer to the RIL o C debug chapters.

http://192.168.0.61/Destination/Html/Use/Commands/Target.htm [06/10/2008 17.40.47]


Project compiling commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Project compiling commands

These commands are accessible from the Build menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Build It compiles all the project files changed after the previous
compilation. The control executed on the dates of the files
included in the project. If the include directive is used in a C
files, it's possible that some changed files are not compiled, so
we suggest to use the Rebuild All command.
Figure 1 Rebuild All It compiles all the project files.
Stop Building It stops the build procedure.

http://192.168.0.61/Destination/Html/Use/Commands/Build.htm [06/10/2008 17.40.48]


Macro management commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Macro management commands

These commands are accessible from the Macro menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

New It enables/disables the record of a macro. The record allows to store all the
operations executed with the keyboard. With the Play command the
operations stored are repeated in the same order in wich were memorized.
Play It executes the registered macro.
Stop It stops the playing of the macro.
Figure 1

http://192.168.0.61/Destination/Html/Use/Commands/Macro.htm [06/10/2008 17.40.48]


Tools commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Tools commands

These commands are accessible from the Tools menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Customize Displays the configuration window, it allows to


configure tool bars. It can be activated with the key
sequence Ctrl+Shift+C.
Options Displays the options configuration window.
Language Displays the language selection window. All the
Figure 1
menus will be displayed in the selected language.

Language

It allows to select the desired language. Here it is the list of the available commands.

Italian It select the italian language. All the menus, the file header, will be visualized
in italian language.

Figure 2
English It select the english language. All the menus, the file header, will be
visualized in english language.

http://192.168.0.61/Destination/Html/Use/Commands/Tools.htm [06/10/2008 17.40.49]


Window commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Window commands

These commands are accessible from the Window menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

New Window It opens a new window in which the editing active


file is displayed. All the windows operate on the
same file, so a modify in a window will be visible
also in the other one.
Cascade It commands the cascade display of all the editing
windows opened.
Tile It commands the contemporary display of all the
editing windows opened.
Arrange Icons It executes the arrangement of all the editing
windows opened reduced to icon.
Figure 1 Next It selects as editing active file the file opened in the
window next to which currently active. It can be
activated with the key sequence Ctrl+F6.
Previous It selects as editing active file the file opened in the
window previous to which currently active. It can
be activated with the key sequence Ctrl+Shift+F6.

http://192.168.0.61/Destination/Html/Use/Commands/Windows.htm [06/10/2008 17.40.49]


Help commands

ELSIST Srl, www.elsist.it MNL041Q100

Index

Help commands

These commands are accessible from the View menu. However, you can find some keys in the proper
toolbar to have the direct access to the different functions. Here it is the list of the available commands.

Help Topics... It opens the Remoter help visualizing the topics index.
Help Index... It opens the Remoter help visualizing the index.
Splash Screen... It displays the Remoter splash screen, it reports the
version.
Tip of the day... It displays the tip of the day window, to every
command a new tip is displayed.
About Remoter... It displays the window with the information about
Remoter. ATTENTION! From this window it's possible
Figure 1 to input the registration code, in order to register the
product.
Register... It displays the window with the register request form.
ATTENTION! If you already have the user name and
password to register the products, please use the
About Remoter... command.

http://192.168.0.61/Destination/Html/Use/Commands/Help.htm [06/10/2008 17.40.50]


What is a workspace

ELSIST Srl, www.elsist.it MNL041Q100

Index

Workspace

Remoter allows to organize your own work easily and rationally. the element that contains the list of the
projects used by the developer is the workspace that appears as a file, under extension rws (remoter
workspace); follow the information at the chapter create a new Workspace. Every workspace can contain
different projects, different in characteristics and code type; the workspace are to be considered as global
containers that can be set up and separately visualized. The figure below shows an example of workspace
with 2 projects.

Figure 1

Every project contained in the workspace follows its own project settings, the project compiling will work
only on the active project (green project icon) ; therefore you have to set the project you want to operate
on, as active project. You can use the keys Ctrl+Tab, which move the selection among the different
projects of the workspace, to select the active project. Otherwise you can place the mouse on the icon of
the project you desire operate on and select the option Set as Active Project, with the right key of the
mouse.

http://192.168.0.61/Destination/Html/Use/Workspace/Workspace.htm (1 of 2) [06/10/2008 17.40.51]


What is a workspace

Figure 2

http://192.168.0.61/Destination/Html/Use/Workspace/Workspace.htm (2 of 2) [06/10/2008 17.40.51]


Creation of a new workspace

ELSIST Srl, www.elsist.it MNL041Q100

Workspace

Creation of a new workspace

To create a new workspace, please choose New item of the File menu, press the Ctrl+N keys or press the
key. The command opens the new workspace window, which allows to to choose the type and the
destination folder of the workspace. After to defined the disk path in the Location box, it's necessary to
define in the name in the Workspace name box. Automatically inside the defined path will be created a
directory and inside of it a file with the with the name of the workspace and rws extension. It supposing to
want to create a project with name Mnl041 on the local disk C, we will have a like condition like that
reported in figure.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

http://192.168.0.61/Destination/Html/Use/Workspace/NewWorkspace.htm [06/10/2008 17.40.51]


Project

ELSIST Sr, www.elsist.it MNL041Q100

Index

Project

A project represents a list of files written in different languages, all together generate a unique program to
be transferred to the target system, follow the instructions to create a new project. The program will be
generated according to the defined project settings, every file is represented with an icon indicating its type.
To add a new file in the project choose the item New from the File menu, use the key or push the key
sequence Ctrl+N. Will be displayed a window with allows to select the file type desired.

You can execute the project debug only if you insert a function block (FB) allowing the operation. So
yo have to insert the Modbus slave communication FB in the project.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

rld Program files in Ladder diagram language, by default they are automatically called.
ril Program files in Instruction list language, by default they are automatically called.

http://192.168.0.61/Destination/Html/Use/Project/Project.htm (1 of 3) [06/10/2008 17.40.53]


Project

c Program files in C language, they are never automatically called, the functions are contained in
them, have to be called by the RIL file using the TASK instruction or by other Assembler or C files
using the function call.
h These files doesn't have a program, but only the definitions for the C program files.
a51 Program files in Assembler language, they are never automatically called, the functions are
contained in them, have to be called by the RIL file using the TASK instruction or by other
Assembler or C files using the function call.
txt Text file, they are not taken in consideration for the creation of the program. They can be included
to contain useful text notes for the description of the project.
rfb Graphic FB management files, by default they are automatically called. You can add a terminal
operator management FB or MODBUS communication management FB.

Inserted the new file, it will be visible in the project tree as in the figure.

Figure 2

Next to the file type icon could be a green ball and a blue arrow . The green ball indicates that the file is
inserted in the program, there are files that are present in the project tree but they don't are inserted in the
project (Example the text files txt). The blue arrow indicates that the file will be automatically executed
Autocalled File. The execution order of the files is that with which they are reported in the project tree
starting from the top to the low. Positioning the mouse on a file name and clicking on the right key it's
possible to choose the relate options:

Figure 3

Remove Item, allows to remove the file from the project. The removed files are moved to the Trash
directory created in the project path.

Rename Item, allows to rename the file, it will be renamed also on the disk. It isn't possible modify the file
extension, so the file still remain of the same type.

http://192.168.0.61/Destination/Html/Use/Project/Project.htm (2 of 3) [06/10/2008 17.40.53]


Project

Duplicate Item, allows to duplicate the file, will be created a new file of the same type with the same
extension on the disk and inserted in the project tree. The new file will have the name of the original file
followed by Copy.

Excluded from Project, allows you to include or exclude the file from the project. The excluded files
(Displayed in gray) doesn't have any effects on the creation of the final program. This option allows you
to delete files from the project leaving them in the tree. An excluded file can be included in the project
afterwards. The exclusion of a Container automatically causes the exclusion of all the file contained in it.

Autocalled File, selects if the file has to be automatically executed or not. This option is available only for
the RLD, RIL, RFB files. If a file is not autocalled it must be called by other files with the CALF instruction to
be executed.

How to add a container

To add a Container to the project, place the mouse on the project name, use the right key and select the
item Add to project...->Container....

The container isn't a real directory on the disk, but it is only a virtual folder in which you can move the
project files to make it more readable. To move the file to the container you have to execute a drag
and drop operation on the files you need. We remind you that the file execution rules are maintaneid
also in the Container.

Figure 4

http://192.168.0.61/Destination/Html/Use/Project/Project.htm (3 of 3) [06/10/2008 17.40.53]


Creation of a new project

ELSIST Srl, www.elsist.it MNL041Q100

Project

Creation of a new project

To create a new project, please choose the New item of the File menu, press the sequence of keys Ctrl+N or to use the
icon. A window appear, from it it's possible to choose the type and the destination folder of the project. After to have defined the
Location it's necessary to define the Project name. Supposing to create a project with name English, we will have condition
like that reported in figure.

By clicking on the key located near the Position box a window appears allowing the disk browsing, so it's possible to
select the path instead of digit it.

Figure 1

Confirming the selection, the project settings windows with the request of the target hardware is displayed. Select the proper
target system.

http://192.168.0.61/Destination/Html/Use/Project/NewProject.htm (1 of 3) [06/10/2008 17.40.54]


Creation of a new project

Figure 2

It's important to correctly define the target system, so below the selection an image of the chosen device is displayed. However
to avoid mistakes we suggest to read the product code reported on the product identification label figure 3, the presence of
asterisks indicates that any number or letter in that position is however valid.

Figure 3

Press the Next key until to reach the end of the settings, to this point will be automatically created a project with some files
included in the project tree as reported in the figure.

http://192.168.0.61/Destination/Html/Use/Project/NewProject.htm (2 of 3) [06/10/2008 17.40.54]


Creation of a new project

Figure 4

http://192.168.0.61/Destination/Html/Use/Project/NewProject.htm (3 of 3) [06/10/2008 17.40.54]


How to compile the project

ELSIST Srl, www.elsist.it MNL041Q100

Project

How to compile the project

Finished to write all the program files, it's necessary to execute the compiling and link procedures. The icon
Build all allows to execute this procedure automatically on all the project files, generating only one file in
intel-hex format to be transfered to the target system. During the program changes you can use the icon Build
that compiles only the modified files, avoiding loss of time for the compilation of files not modified.

The Build procedure is a shortcut to save time, in some cases is possible that the result of the
procedure doesn't respects the modifies done, it is advised so to execute a Rebuild all.

Figure 1

The project files are subject to different operations according to their type and every operation executes on
them specific controls. Ended the compilation and the link procedures, a message reporting information about
how much memory the project used is displayed.

Possible errors cause the block of the procedure and in the Build window a message is displayed reporting
information about the number of error and a short message with information about it. If you place the mouse on
the error message and click twice on it, the file with the error will open automatically and the cursor will be
pointed to the line where the error is, as shown in figure. For a complete list of the errors please refer to the
proper chapter.

Figure 2

http://192.168.0.61/Destination/Html/Use/Project/Build.htm [06/10/2008 17.40.55]


Project settings

ELSIST Srl, www.elsist.it MNL041Q100

Index

Project settings

Every project has its own settings, choose the Settings item of Project menu, to visualize the settings of the active project.
The settings are visualized in sequence with specific windows for every type. To pass from one set to the next one, use the Next key
in the lower part of every window.

It is also possible to position with the mouse on the project icon and with the right key choose the Settings option.

Figure 1

A window will be opened with all the possible settings subdivided for the different categories.

http://192.168.0.61/Destination/Html/Use/Project/Settings/ProjectSettings.htm (1 of 2) [06/10/2008 17.40.56]


Project settings

Figure 2

Target Hardware Permette la definizione del target per il quale viene creato il programma.
Software Permette la definizione del software installato sul target per il quale viene creato il programma.
Configurazione Target Permette la definizione delle configurazioni del kernel
Progetto Tipo di Progetto Permette la definizione del tipo di progetto.
Librerie Permette la definizione delle librerie utilizzate per lo sviluppo del progetto.
Limiti di Memoria Permette la definizione dei limiti di memoria.
PLC Permette la definizione delle impostazioni variabili PLC.
Varie Permette la definizione di alcune impostazioni selezionabili dall'utente.
Computer
Comunicazioni
Programmazione Protocollo Permette la definizione del protocollo di comunicazione da utilizzarsi per la programmazione del
sistema target.
Mezzo di Permette la definizione del mezzo di comunicazione da utilizzarsi per la programmazione del
comunicazione sistema target.

Protocollo Analog Devices uC Loader Utilizza il protocollo di comunicazione proprietario Analog Devices presente nei chips ADuC845.
Atmel 89C51 Loader Utilizza il protocollo di comunicazione proprietario Atmel presente nei chips 89C51.
Modbus Utilizza il protocollo di comunicazione Modbus.
Philips 89C51 Loader Utilizza il protocollo di comunicazione proprietario Philips presente nei chips 89C51.
Media Porta Seriale Permette la definizione delle impostazioni della linea seriale per la programmazione del sistema target.
Driver Seriale Permette la definizione delle impostazioni del driver seriale per la programmazione del sistema target.
TCP/IP Permette la definizione delle impostazioni comunicazione TCP/IP per la programmazione del sistema target.
Debugging Protocollo Permette la definizione del protocollo di comunicazione da utilizzarsi per il debug del sistema
target.
Mezzo di Permette la definizione del mezzo di comunicazione da utilizzarsi per il debug del sistema target.
comunicazione
Protocollo Modbus Permette la definizione delle impostazioni del protocollo modbus per la comunicazione con il sistema target.
Media Porta Seriale Permette la definizione delle impostazioni della linea seriale per il debug del sistema target.
Driver Seriale Permette la definizione delle impostazioni del driver seriale per per il debug del sistema target.
TCP/IP Permette la definizione delle impostazioni comunicazione TCP/IP per per il debug del sistema target.

http://192.168.0.61/Destination/Html/Use/Project/Settings/ProjectSettings.htm (2 of 2) [06/10/2008 17.40.56]


Target hardware

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Target hardware

It allows the definition of the target you create the program for. First you choose the products family NetSyst line and PicoSyst
line, then you can choose in the relate tree the target system you desire.

Figure 1

It's important to correctly define the target system, so below the selection an image of the chosen device is displayed. However
to avoid mistakes we suggest to read the product code reported on the product identification label figure 2, the presence of
asterisks indicates that any number or letter in that position is however valid.

Figure 2

http://192.168.0.61/Destination/Html/Use/Project/Settings/Target/Hardware.htm [06/10/2008 17.40.56]


Target software

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Target software

It allows to define the software installed on the target you create the program for. Remoter shows a default choice, that is valid for
the target hardware, previously selected.

Figure 1

Software

Allows to define the kind of software installed on the target system to which the application is referred.

Elsist loader The application is referred to the loader.


Elsist Kernel The application is referred to the kernel.

Software version

Allows to define the software version installed on the target device. It's suggested to choose the last version available, Remoter
will automatically check the version really installed and will set up itself according to it.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Target/Software.htm [06/10/2008 17.40.57]


Target configuration

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Target configuration

The target system can be configured according the user needs. The system configuration is stored into a non volatile memory
and remain memorized in the target system until a new configuration is been stored. The target configuration option opens a
window with the visualization of all possible settings divided into a several categories.

To modify the target configuration, a new configuration must be transferred into the target system.

Figure 1

Security
Users User ... Allows to define the access rights, the username and password for the users. Up to 4 users can be configured with
different settings.
Hardware resources
Serial ports
Serial Serial Port Allows to define the serial port settings.
Port ...
Serial Driver Allows to define the serial driver settings.
Drivers
Access Points Access point ... Allows to define the access point parameters.
Command Managers
Modbus Modbus ... Allows to define the modbus protocol parameters.
Devices
Modems Modem ... Allows to define the modem settings.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/TargetCfg.htm [06/10/2008 17.40.58]


Project type

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Project type

It allows to define the project type. Now the only type you can select is the default shown.

Figure 1

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/ProjectType.htm [06/10/2008 17.40.58]


Libraries

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Libraries

It allows to define the libraries to use, they are divided into categories, as shown in figure.

After to have added a new library in Remoter, press the Save Current key to replace the previous versions presents in the project.

Figure 1

System library Defines the version of the system library. The system library contains the functions allowing the management of the target system,
every system needs its own library, the only available versions for the selected target are shown.
PLC library Defines the version of the library for the PLC instruction management. The library contains the functions allowing to execute the RIL
language instructions, the only available versions for the selected target are shown.
FB libraries Defines the list of the function blocks used in the project. If you execute a call to a FB in the project, you also need to insert it in the
list so that the linker can link its proper code. The FB are supplied in different versions, it's important to select the only the version
used in the project.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/Library.htm [06/10/2008 17.40.59]


Memories limits

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Memories limits

The memory configuration window allows you to define the memory areas for the compilation of the program, as shown in figure.
The default configuration selects the best values for the type of target that is being used.

To avoid problems, we suggest to keep all the ranges set as shown in default.

Figure 1

Code Defines the allocation range of the Code memory for the user program, to see the target memory configuration please refer to the
memory map.
XData Range Defines the allocation range of the RAM memory for the user program, to see the target memory configuration please refer to the
memory map.
Data Range Defines the allocation range of the RAM memory /Inside of the uP) for the user program, to see the target memory configuration
please refer to the memory map.

Ranges definition

The ranges change according to the different targets and the type of program must be realized. In the gray box are reported
the settings that are automatically defined by Remoter.

Code Target system Program type Data Bit XData Code Page

MPS024**1* NetReader ATM AT89C51RD2


User program (On chip loader) 0x00-0x7F 0x00-0x7F 0x0000-0x03FF 0x0000-0xFBFF 0x0000
PCB104**1* NetReader ATM AT89C51RD2
MPS024**2* NetReader PHI P89C664
User program (On chip loader) 0x00-0x7F 0x00-0x7F 0x0000-0x06FF 0x0000-0xFFFF 0x0000
PCB104**2* NetReader PHI P89C664
MPS024**3* NetReader ATM AT89C51ED2
User program (On chip loader) 0x00-0x7F 0x00-0x7F 0x0000-0x06FF 0x0000-0xFBFF 0x0000
PCB104**3* NetReader ATM AT89C51ED2

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/MemoryLimits.htm (1 of 2) [06/10/2008 17.41.00]


Memories limits

MPS022**** Netlog User program (Loader) 0x00-0x7F 0x00-0x7F 0x8000-0xFFFF 0x0000-0xFFFF 0x0000
CPU016**** Picosyst Millenium CPU
MPS026**** Picolog Millenium
User program (Loader) 0x00-0x7F 0x00-0x7F 0x8000-0xFFFF 0x0000-0xFFFF 0x0000
MPS027**** Facelog Millenium
OIF018*0*0 Picoface Millenium
MPS029**** NetlogII Lite User program (On chip loader) 0x00-0x7F 0x00-0x7F 0x0000-0x07FF 0x0000-0xF7FF 0x0000
MPS030**** NetmasterII TINI
MPS031**** NetmasterII SNAP
MPS033**** NetmasterII TSTICK User program (Loader) 0x00-0x7F 0x00-0x7F 0x0000-0x07FF 0x0000-0xDFFF 0x0000

CPU017**** Picosyst MilleniumII CPU User program (Loader) 0x00-0x7F 0x00-0x7F 0x0000-0x5FFF 0x0000-0xFFFF 0x0800
MPS036**** Picolog MilleniumII
Kernel program (Loader) 0x00-0x5F 0x00-0x3F 0xE000-0xFFFF 0x0000-0xFFFF 0x0800
MPS037**** Facelog MilleniumII
OIF020*0*0 Picoface MilleniumII User program (Kernel) 0x60-0x7F 0x40-0x7F 0x0000-0x5FFF 0x0800-0xFFFF 0x0800
User program (Loader) 0x00-0x7F 0x00-0x7F 0x0000-0x5FFF 0x0000-0xFFFF 0x0800
Kernel program (Loader) 0x00-0x5F 0x00-0x3F 0xE000-0xFFFF 0x0000-0xFFFF 0x0800
MPS034**** NetlogII
User program (Kernel) 0x60-0x7F 0x40-0x7F 0x0000-0x5FFF 0x0800-0xFFFF 0x0800
User program paged (Kernel) 0x60-0x7F 0x40-0x7F 0x0000-0x5FFF 0x0800-0x7FFF 0x0800 0x8000-0xFFFF 5

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/MemoryLimits.htm (2 of 2) [06/10/2008 17.41.00]


PLC settings

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

PLC settings

It allows the definition of the memory areas to place for the PLC variables, as shown in figure. The configuration of default sets up
the best values for the type of target you are using.

Figure 1

Call User Startup If selected, enables the call of a startup function defined by the user. This function is called once before to execute the user
program further information.

In the Real time clock section, it's possible to define the configuration for the real time clock management.

Manage Target Rtc If selected, enables the management of the real time clock on the target system providing the updating of the proper reserved
operands. If the user program doesn't need the use of the real time clock, can deselect it reducing the program loop time.
Rtc Data Start Add Defines the allocation address of the PLCRtcData variable for the management of the real time clock. If not defined the variable
will be allocated automatically.

In the Logic Input section, it's possible to define the configuration for the logic input (I) management.

Start Address Defines the start address of the allocation buffer in the RAM memory.
End Address Defines the end address of the allocation buffer in the RAM memory, it's automatically calculated using the defined Nr.of
bytes.
Nr.of bytes Defines the allocation buffer dimension expressed in bytes.
Disable management If selected, disables the logic input management.
Debouncing Time It defines the logic input debouncing time.

In the Logic Output section, it's possible to define the configuration for the logic input (O) management.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/PLC.htm (1 of 2) [06/10/2008 17.41.01]


PLC settings

Start Address Defines the start address of the allocation buffer in the RAM memory.
End Address Defines the end address of the allocation buffer in the RAM memory, it's automatically calculated using the defined Nr.of
bytes.
Nr.of bytes Defines the allocation buffer dimension expressed in bytes.
Disable management If selected, disables the logic output management.

In the F, Y, W, DW, FL section, it's possible to define the configuration for the Flag (F), Byte (Y), Word (W), Double (DW), Float
(FL) operands.

Start Address Defines the start address of the allocation buffer in the RAM memory.
End Address Defines the end address of the allocation buffer in the RAM memory, it's automatically calculated using the defined Nr.of bytes.
Nr.of bytes Defines the allocation buffer dimension expressed in bytes.

In the Backup Area section, it's possible to define the configuration for backup memory.

Start Address Defines the start address of the allocation buffer in the RAM memory. All variables that start from this address for the Nr.of
bytes defined are automatically stored in the backup buffer.
End Address Defines the end address of the allocation buffer in the RAM memory, it's automatically calculated using the defined Nr.of
bytes. After this address will be allocated all the mnemonic backup variables defined in the RIL program by using the
DEFB instruction.
Nr.of bytes Defines the allocation buffer dimension expressed in bytes.

If it's not required to have numeric backup variables, this value must be set to 0. Anyway all the mnemonic backup
variables defined in the RIL program by using the DEFB instruction will be allocated.
Copy buffer mem. Type Defines the backup buffer memory type, see the memory map of target system.
Copy buffer start add. Defines the start address of the backup memory. Please note that the dimension of the total buffer required it's calculated
adding to the defined Nr.of bytes all the variables defined in the RIL program by using the DEFB instruction.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/PLC.htm (2 of 2) [06/10/2008 17.41.01]


Various settings

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Various settings

It allows the definition of some settings that the user can select, as shown in figure.

Figure 1

In the Project Info window you can insert a description of the project, the text that has been inserted will be saved in the project file.

Under the text box for the description insertion, some information about the build number, the date of the last compilation and
the version of Remoter you used, are reported. This information are managed automatically (every time you compile the build
number increases). This information are transferred to the PLCRemoterProjectInfo structure by carrying out the project uploading
the target, you can read it again from the target system by using the Loaded Project Info procedure.

The tick box Ask before Stop Target, if selected, forces to ask a confirmation before stopping the target system with the catch.control.

The tick box Allows code download, if selected, allows the download of the program from the target device.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Project/Various.htm [06/10/2008 17.41.02]


RLD file overview

ELSIST Srl, www.elsist.it MNL041Q100

Index

RLD file overview

A graphic ladder file RLD is shown in a window as that reported below. The PgUp and PgDw keys allows
zoom in and zoom out the graphic sheet so you can have a better view of the project. The + and - keys of
the numerical keyboard allow to modify the size of the characters.

Figure 1

On the right hand of the drawing sheet it is visible the line numerator, clicking on the Show Grid icon it's
possible to show or hide the line numerator and the grid on the drawing sheet. To write the program it's
available a toolbar that contains all the graphic objects. The toolbar doesn't include specific components for
the program manipulation for the serial line management, so if required the as complement to the RLD files,
RIL and/or C language files must be used. For further information on the management of the RLD files
please refer to how to create a rung in RLD or to the debug chapters.

http://192.168.0.61/Destination/Html/Use/RLDFile/FileOverview.htm (1 of 3) [06/10/2008 17.41.04]


RLD file overview

Figure 2

Beyond to the connection elements , , , , , , , , , , , that allow connect


the various symbols for the program rungs creation, RLD program uses the symbols reported below:

Open and close rung. A rung must init with symbol and end with the symbol.
Normally open contact, it can be used with the Counter (C), Flag (F), Input (I), Output (O), Timer
(T) operands.
One shot normally open contact, it can be used with Counter (C), Flag (F), Input (I), Output (O),
Timer (T) operands.
Normally close contact, it can be used with the Counter (C), Flag (F), Input (I), Output (O), Timer
(T) operands.
Output, it can be used with the Flag (F), Output (O) operands.
One shot output, it can be used with the Flag (F), Output (O) operands.
Inverted output, it can be used with the Flag (F), Output (O) operands.
Set output, the output condition still active until a rung with the symbol will becomes active. it can
be used with the Flag (F), Output (O) operands.
Reset output, the output condition still inactive until a rung with the symbol will becomes active. it
can be used with the Flag (F), Output (O) operands.
Timer output, it can be used with the Timer (T) operand.
Counter output, it can be used with the Counter (C) operand.
mAthematical operation, it can be used to define all mathematics operations.
Show/hide grid, allows to make visible or to hide the grid in the drawing sheet.
Comment box, allows to define a box where to insert comments.
Insert space up, insert space up the selected rung.
Insert space down, insert space down the selected rung.

With a double click of the mouse on the drawing sheet, it's possible to open a window that allows to define
the greatest number of lines present in the drawing. After to have defined the value press ok to confirm.The
grid can contain at maximum a matrix of max 600 lines for 14 columns. If the number pressed exceeds the
greatest or minimum value, will appear a window that will indicate the limits.

http://192.168.0.61/Destination/Html/Use/RLDFile/FileOverview.htm (2 of 3) [06/10/2008 17.41.04]


RLD file overview

Figure 3

http://192.168.0.61/Destination/Html/Use/RLDFile/FileOverview.htm (3 of 3) [06/10/2008 17.41.04]


Add a RLD file

ELSIST Srl, www.elsist.it MNL041Q100

RLD file

Add a RLD file

To add a graphic ladder file RLD into the project, choose the New item from the menu File, use the
icon, or press the Ctrl+N key sequence. A window will be displayed allowing the possibility to choose the
desired file type. Select the Ladder Diagram Source File (*.rld) entry from the list and specify the name
you want to give the file in the text box signed by the File name label, for instance RldFile, it is not
necessary to specify the extension because it is assigned automatically. If you press the OK key, you
create the file in the directory selected in Location, add it into the project tree and open it in editing. Further
information about the RLD file programming techniques are reported in the proper chapter.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

http://192.168.0.61/Destination/Html/Use/RLDFile/AddFile.htm [06/10/2008 17.41.05]


Create a rung in RLD

ELSIST Srl, www.elsist.it MNL041Q100

RLD file

Create a rung in RLD

To insert in the shutter a component available in the toolbars, you just have to click on the component and
place it through a following Click, where you want it to be, the component will be placed inside the square
automatically, without any other actions. the following images show the above procedure.

Figure 1

By clicking over a symbol it will becames blue it means thai it is selected. It is possible to select whole rungs
and with copy and past operations double them.

Figure 2

If the symbol is visualized on red background indicates that in that position exist two or more symbols, it's
necessary to select the symbol (The color will become purple) and cancel the symbols with the Canc key.

http://192.168.0.61/Destination/Html/Use/RLDFile/CreateLadderRung.htm (1 of 3) [06/10/2008 17.41.06]


Create a rung in RLD

Figure 3

Rung structure

All of the rungs always should begin with the Left power rail, the absence of such symbol causes
errors during the project compilation. Subsequently can be drawn the branch opening symbols: , , ,
that, connected between them by means of the components connection symbols , , , , , ,
, , , , , , allow to realize the rung wanted. The rungs should be drawn following all of the
defined rules, otherwise could verify errors during the project compilation. After to have drawn the whole
branch, it's possible draw the close symbols, , , , , , , , that always be followed by the
Right power rail, the absence of such symbol causes errors during the project compilation.

Operands

By double clicking on the operand will appear a component properties window, on it it will be possible to
define the component type and its address.

Figure 4

Comments

http://192.168.0.61/Destination/Html/Use/RLDFile/CreateLadderRung.htm (2 of 3) [06/10/2008 17.41.06]


Create a rung in RLD

Inside of the drawing sheet can be introduced comment blocks by using the Add comment icon. To
change the text and the dimension of the comment box double click with the mouse on it. It will appear a
window that allows to define the new text and the dimension in number of grill column.

Figure 5

Grid

The graphic objects that are present in the program always are positioned inside of a reference grid, it's
possible to show or hide it hidden simply maintaining all the features of posizionamento of the same
components. Acting on the Show grid icon it's possible to display or hide the grid.

http://192.168.0.61/Destination/Html/Use/RLDFile/CreateLadderRung.htm (3 of 3) [06/10/2008 17.41.06]


Debug a RLD program

ELSIST Srl, www.elsist.it MNL041Q100

RLD file

Debug a RLD program

After the upload running of the user program on the target system, you can carry out the debug. If the FB
communication MODBUS has been inserted in the project the debug will work, by using the key, when
the target system is connected to the PC through the selected communication media and when the user
program is running.

If you select the file RLD you want to debug, from the project tree, it will be displayed and at every
instruction will be reported the status of the logical branch. The instruction underlined by the green box
means that it is in a true logical status.

If you realize the example in figure linking the input I 0000 to the button that is normally open (RUN) and the
input I 0001 to the button that is normally closed (STOP), you can verify that the behavior of the output and
of its auxiliary contact through the simulation of the different logical status.

Figure 1

The RUN occurs through the pressing of the button START, while the stop occurs through the pressing of
the button STOP; you can notice that the pressing of START doesn't have effects if you keep pressing the
button STOP.

http://192.168.0.61/Destination/Html/Use/RLDFile/FileDebug.htm [06/10/2008 17.41.07]


RIL file overview

ELSIST Srl, www.elsist.it MNL041Q100

Index

RIL file overview

A RIL file is shown as the window reported below, see figure. This is an editing window; you can write the program
on it, by using the typical facilities of an editor. See the proper chapter for a full list of the editing controls. You have
to refer to the instructions, operands and function blocks for the program writing. We remind that it is not important
to keep the alignment of the program, the use of capital or small letters for the instruction and operand writing too.
All the written text after ";" has no importance and it is considered as a comment. To add a file to the project, please
refer to the information reported in the proper chapter.

Figure 1

Syntax coloring

In order to have better reading of the file, an automatic coloring of the syntax is carried out. The instructions are
blue colored, the operands are pink colored, the mnemonics of the reserved operands are gray colored and the
comments are green colored.

Operand comment

In the RIL programming you can automatically match every operand with a comment string, all the text following the
instruction, after ";", are considered as the operand comment.

By acting on the Scan and Xreference icon, is executed a scansion of all the RIL and RLD files of the project
and to every operand is matched with its own comment, if exists. If the instruction has more than one operand, the
comment is matched only with the first operand.

http://192.168.0.61/Destination/Html/Use/RILFile/FileOverview.htm (1 of 2) [06/10/2008 17.41.07]


RIL file overview

By acting on the Update comments and format icon, the instructions and the operands automatically become
in capital letters and the written program will be aligned on the predefined tabulations. The proper comment is
automatically reported to any operand by overwriting the eventual edited comments.

File example

It 's reported an example of file written in RIL language, this example can be used as a track to write a file to add to
own Remoter project.

; ******************************************************************************
; Project :
; Programmer :
; Date :
; ******************************************************************************
; Description :
; ------------------------------------------------------------------------------

; ------------------------------------------------------------------------------
; @Section("Blinking Flag")
; ------------------------------------------------------------------------------

ORGR
LODT F PLCTimeBase800 ;Timebase 800 mSec
OUTT F 0000 ;Blinking Flag

; [End of file]

http://192.168.0.61/Destination/Html/Use/RILFile/FileOverview.htm (2 of 2) [06/10/2008 17.41.07]


Add a RIL file

ELSIST Srl, www.elsist.it MNL041Q100

RIL file

Add a RIL file

To add a RIL file in the project, choose the New item from the menu File, use the icon, or press the Ctrl
+N key sequence. A window will be displayed allowing the possibility to choose the desired file type. Select
the Instruction List Source File (*.ril) entry from the list and specify the name you want to give the file in
the text box signed by the File name label, for instance RilFile, it is not necessary to specify the extension
because it is assigned automatically. If you press the OK key, you create the file in the directory selected in
Location, add it into the project tree and open it in editing. Further information about the RIL file
programming techniques are reported in the proper chapter.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

http://192.168.0.61/Destination/Html/Use/RILFile/AddFile.htm [06/10/2008 17.41.08]


Debug a RIL program

ELSIST Srl, www.elsist.it MNL041Q100

RIL file

Debug a RIL program

After the upload running of the user program on the target system, you can carry out the debug. If the FB communication
MODBUS has been inserted in the project the debug will work, by using the key, when the target system is connected to
the PC through the selected communication media and when the user program is running.

You have to activate and configurable correctly the window Watch for the file debug in language C, by using the proper button
. The window Watch, that contains 8 index cards, will be activated by using the key and it will appear as shown in figure.

Figure 1

You can insert the operands in two different ways in it. The first one consists of placing the operands involved at the window
WorkSpace and dragging it with the mouse to the window Watch. This operation is simple and immediate, because it allows
you to compile all the fields you need, automatically and without mistakes. When you address an operand to the window
Watch, this one will be placed in the active folder.

http://192.168.0.61/Destination/Html/Use/RILFile/FileDebug.htm (1 of 4) [06/10/2008 17.41.09]


Debug a RIL program

Figure 2

The second one consists of "Clicking" twice on a box of the Watch window activating the window that allows you to define the
operand in debug.

Figure 3

Memory Defines the kind of memory where the variable is allocated. For all the RIL operands is Auto detected.

http://192.168.0.61/Destination/Html/Use/RILFile/FileDebug.htm (2 of 4) [06/10/2008 17.41.09]


Debug a RIL program

Type Defines the operand type as defined in the RIL program. The possible types are:
C [Counter] Counter (C) operand.
F [Flag] Flag (F) operand, refer to project settings for the range definition.
I [Input] Input (I) operand, refer to project settings for the range definition.
O [Output] Output (O) operand, refer to project settings for the range definition.
M [Memory] Memory (M) operand.
T [Timer] Timer (T) operand.
Y [Byte] Byte (Y) operand, refer to project settings for the range definition.
W [Word] Word (W) operand, refer to project settings for the range definition.
DW [Double Word] Double word (DW) operand, refer to project settings for the range definition.
FL [Float] Float (FL) operand, refer to project settings for the range definition.
Address Defines the memory address of the operand, the value is hexadecimal (ie: 0x123). For the mnemonic
operands the operand name must be defined.
Bit Number Allows to manage a single bit within the variable. ie: 0x02 manages the bit 2.
Local Filename Defines the file name in which the operand is defined, it's used only for local operands.
Comment Allows to define a comment.

After having correctly compiled all the fields involved, you can confirm with the OK key and the operand is transferred in the
Watch window to the proper box. If the debug works correctly, the Watch window appears as shown below. The green
background of the table shows that the link is active. Therefore you can monitor the state changes of the different operands.
You can change its properties any time, by clicking twice on the operand involved, or delete it from the window by selecting it
and then pushing the Canc button.

Figure 4

You can force a specific value by clicking on the operand with the right key of the mouse, as shown the window below. You
can force it differently according to the kind of operand and the display format you had chosen. A Byte (Y) operand will be
under different rules from a Flag (F) one or an Input (I) one.

http://192.168.0.61/Destination/Html/Use/RILFile/FileDebug.htm (3 of 4) [06/10/2008 17.41.09]


Debug a RIL program

Figure 5

http://192.168.0.61/Destination/Html/Use/RILFile/FileDebug.htm (4 of 4) [06/10/2008 17.41.09]


RFB file overview

ELSIST Srl, www.elsist.it MNL041Q100

Index

RFB file overview

A RFB file is the graphic representation of a funtion block, some FB have its own graphic representation, it
provided only for those more complex. We remind that a FB can be included in a project by using the
proper graphic representation, executing the call with the TASK instruction from RIL files, or by executing
the call from Assembler and C files. To add a file to the project, please refer to the informations reported in
the proper chapter.

The insertion of a function block in a program requires also the selection of the function block
version in the project settings.

Figure 1

http://192.168.0.61/Destination/Html/Use/RFBFile/FileOverview.htm [06/10/2008 17.41.10]


Add a RFB file

ELSIST Srl, www.elsist.it MNL041Q100

RFB file

Add a RFB file

To add a RFB file in the project, choose the New item from the menu File, use the icon, or press the Ctrl
+N key sequence. A window will be displayed allowing the possibility to choose the desired file type. Select
one of the function blocks FB from the list and specify the name you want to give it in the text box signed
File name, for instance DebugFile, it is not necessary to specify the extension because it is assigned
automatically. If you press the OK key, you create the file in the directory selected in Location, add it into
the project tree and open it in editing. Further information about the RFB file programming techniques are
reported in the proper chapter.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

The function blocks actually available in RFB format are.

FB Modbus Slave Communication Allows to insert a MODBUS communication FB.

http://192.168.0.61/Destination/Html/Use/RFBFile/AddFile.htm (1 of 2) [06/10/2008 17.41.11]


Add a RFB file

FB System Terminal Manager Allows to insert a system terminal management FB.

http://192.168.0.61/Destination/Html/Use/RFBFile/AddFile.htm (2 of 2) [06/10/2008 17.41.11]


FB MODBUS communication

ELSIST Srl, www.elsist.it MNL041Q100

RFB file

FB MODBUS communication

The FB of communication provides the management of the MODBUS protocol. The MODBUS protocol is used by Remoter to
execute the debug of the application. In the window all the needed parameters must be set, at the beginning we suggest a
minimum set.

Figure 1

Select the serial port on the target device to use, by choosing among the options given in the list (Instruction SETV). You can
automatically set the FB management controls for the communication with the RS232 line, by clicking with the mouse on the
RS232 Default key.

All the others definitions are used for a ModBus communication management, with different aims from that one for the
application debug, If you want a full list of the different fields, see the comment page for the Modbus Ascii or the Modbus Rtu.

http://192.168.0.61/Destination/Html/Use/RFBFile/FBMODBUS.htm [06/10/2008 17.41.11]


FB system terminal

ELSIST Srl, www.elsist.it MNL041Q100

RFB file

FB system terminal

The FB of terminal operator management is a function block providing the management of the Picoface terminal, and the
keyboards and display integrated in the Netsyst systems. Further information about the FB working are in the relate comment
page. In the window you have to set all the necessary parameters, at the first use we suggest a minimum set. Select the port
to use (Instruction SETV), the IOTerminal value has to be used for all the terminals connected directly to the system. Select
the type of the display Display Target to use according to the product. by clicking on the Set Default key all the parameters
for the Picoface terminal are set.

Figure 1

Executed all the necessary settings will be possible to proceed in the definition of the messages to visualize. Positioning the
mouse in the window Message list and pressing the right key, will be visualized a menu with all the possible type of
messages.

Figure 2

Add Message Allows you to add an ordinary message, it can be displayed by defining its number in the
MessageNr variable.
Add Page Message Allows you to add a page message, it can be displayed by defining its number in the
MessageNr variable or by using the page selection keys.

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (1 of 6) [06/10/2008 17.41.15]


FB system terminal

Add Alarm Page Message It allows you to add a page message for the alarms display, it can be displayed by defining its
number in the MessageNr variable or by using the page selection keys.
Add Warning Page Message It allows you to add a page message for the warnings display, it can be displayed by defining
its number in the MessageNr variable or by using the page selection keys.
Change ID Message It allows you to change the ID Message. We remind you that ID is the number that has to be
written in the MessageNr variable to have the message displayed.
ID Locked It allows you to lock the ID Message. So the message compression function doesn't have
effect on it. The messages are introduced with a progressive ID, the cancel or move
operations can modify the message ID.

For every message it is possible to define an operation that must be executed, on special events, following the table below:

Never No operations are executed.


Key pressed go to message By pressing any key function, the message, whose ID is defined into the box beside, is
Key pressed go to function displayed or is executed the function defined into the box beside.
[FUN] pressed go to message By pressing or key function, the message, whose ID is defined into the box beside, is
[FUN] pressed go to function displayed or is executed the function defined into the box beside.
[ESC] pressed go to message By pressing key function, the message, whose ID is defined into the box beside, is
[ESC] pressed go to function displayed or is executed the function defined into the box beside.
[CLR] pressed go to message By pressing key function, the message, whose ID is defined into the box beside, is
[CLR] pressed go to function displayed or is executed the function defined into the box beside.
[ENT] pressed go to message By pressing or key function, the message, whose ID is defined into the box beside, is
[ENT] pressed go to function displayed or is executed the function defined into the box beside.
Always go to function The function defined into the box beside is always executed before the message
visualization.

The tick box Back on Timeout, if selected, after the time defined in KeyboardTimeOut, automatically display the previous
message. If the message is a page message it will be possible to define the following functions:

Page Nr It defines the page number of the message, the pages from 0 to 6 are directly selected by the relate
to keys, all the pages will be however selected with the , or , keys. If the
page number isn't defined will not be possible to reach the message with the keyboard, to visualize
the message its number must be written in the MessageNr variable.
Autoscroll time (mSec) It defines the automatic scroll time in msec of the submessages.
Not reachable If selected, avoid the message to be displayed by the using of the key buttons dedicated to the page.
Not scrollable If selected, it avoids the submessages to be scrolled by the using of the key function , or ,
.

Selecting a message, by placing the mouse on the Variables windows the right key allows to display the option for the
message variable insertion. A message can have an infinite number of variables, every time you insert a new variable, its ID is
automatically increased. You have to put the ID included between the <> signs, as shown in figure below, to have the variable
display and to be able to input the variable value. In the green part, representing the display, is displayed the message as will
be in the reality. To display in the message special characters it is necessary to reference to the characters set of the display
controller HT011.

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (2 of 6) [06/10/2008 17.41.15]


FB system terminal

Figure 3

Include File It defines the name and the path of the variable definition file.

For every variable it is possible to define:

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (3 of 6) [06/10/2008 17.41.15]


FB system terminal

Type It defines the variable type to be display.

Display format

C It identifies an operand in a RIL program of type Counter (C)


F It identifies an operand in a RIL program of type Flag (F)
I It identifies an operand in a RIL program of type Input (I)
O It identifies an operand in a RIL program of type Output (O)
T It identifies an operand in a RIL program of type Timer (T)
Y It identifies an operand in a RIL program of type Byte (Y)
W It identifies an operand in a RIL program of type Word (W)
DW It identifies an operand in a RIL program of type Double (DW)
FL It identifies an operand in a RIL program of type Float (FL)
char It identifies a variable in a C program of type char
unsigned char It identifies a variable in a C program of type unsigned char
int It identifies a variable in a C program of type int
unsigned int It identifies a variable in a C program of type unsigned int
long It identifies a variable in a C program of type long
unsigned long It identifies a variable in a C program of type unsigned long
float It identifies a variable in a C program of type float
string It identifies a variable in a C program of type string
Address It contains the variable address. If the variable is for an operand program RIL type, it is possible digit the
address as number or as mnemonic. In case of program C type, then is possible define it only as
mnemonic.
In case the need is to display a variable that is already defined in the C program, it is possible include the
mnemonic name between the <> symbol.
Allowed range It contains the indication of the min. and max. value that the variable can reach in both visualization or
editing mode. The defined range will automatically define the numbers of digit that can be assumed from
the variable one.
In case the variable value will exceed the defined range, in visualization mode will be shown , on the
display, the symbols ++++ or ---- in alternative to min. or max. limit of range, while in editing mode the
value will not be accepted and the variable goes back to the actual value.
Format It defines the visualization format :

Dec Decimal, the visualization will become as decimal format plus sign.
UDec Unsigned decimal, the visualization will become as decimal format without sign.
Hex Hexadecimal, the visualization will become as hexadecimal format.
Oct Octal, the visualization will become as octal format.
Bin Binary, the visualization will become as binary format.
BinEnh Binary enhanced, the visualization will become as binary advanced format.
String String, the visualization will become as string format.
Password Password,the visualization will become as UDec format, but the value will be shown as *.
This selection is possible only if a DW or unsigned long is selected as a Type.

For the floating point variables is possible to define also the number of decimal digit to be visualized.
Some ticks allow to define more selection on the variable format.

Fill with 0 It forces the value display with the zero blanked before the value..If a variable has a
value equal to 10 and it is displayed with 4 digits, without the option it will be shown as
10, with the option as 0010.
Left Align It forces the value display with left alignment, the default setting show the value aligned
to the right side.

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (4 of 6) [06/10/2008 17.41.15]


FB system terminal

Editable It forces the variable to be editable, in this way the variable value can be modified using
the keyboard keys.
Prefix with Sign It places the sign before the value display.
Pre view function It defines a function that will be automatically executed before the variable value visualization. In this
function, the user will be able to execute all the necessary calculations and an eventually recalculation of
the value that have to be visualized.
Post edit function It defines a function that will be automatically executed just after the editing of a new value of the variable.
In this function, the user will be able to execute the control of the edited value.

Comments about the page messages

The page messages are a special type of messages, which submessages can be referred to by placing the mouse on the
page message and pressing the key on the right, the option will be displayed for the insertion of the submessages, figure 4.

To display them the ID number must be defined in the MessageNr variable or in case of Picoface terminals by using the
numerical key defined in the page number , , , , , , . By using the and keys of the Picoface
terminal or the and keys in the Netsyst systems you can scroll all the defined page messages.

Activated the page message display, it's possible by acting on the the and keys of the Picoface terminal or the
and keys in the Netsyst systems execute the scroll of all the defined page submessages. Defining a time in the variable
Autoscroll Time (mSec) variable, all the submessages are automatically scrolled with the defined time.

Figure 4

Warning messages

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (5 of 6) [06/10/2008 17.41.15]


FB system terminal

The warning messages are special type of messages, which


submessages can be referred to as the page messages. You
can scroll all the submessages that have the proper set bit in
the Warnings structure, by using the and keys of the
Picoface terminal or the and keys of the Netsyst
systems. If the AutoAckWarnings option is not selected, the
warning message eventually appeared, keeps stored even
when it disappears until the proper message is not displayed.
When the warning page message is left all bits relate to the Figure 5
displayed messages is reset more information.

Alarm messages

The alarm messages are special type of messages, which


submessages can be referred to as the page messages. You
can carry out the scrolling of all the submessages having the
proper set bit in the Alarms structure, by using the and
keys of the Picoface terminal or the and keys of the
Netsyst systems. If the AutoAckAlarms option is not selected,
the alarm message eventually appeared, keeps stored even
when it disappears until the proper message is not displayed.
When the alarm page message is left all bits relate to the Figure 6
displayed messages is reset more information.

Input of the variable value

The editable variables can be entered directly by using the terminal keys, when the editing is done, the input value will take
over the variable value, if it is in the defined range.

Picoface The value of the first editable variable of the message will flash, by using the key. If you keep pushing that key
without pushing others, the value of the second editable variable will flash, and the same for all the variables that
are declared to be editable in the message. You can edit a new value with a flashing variable, by using the numeric
key of the terminal, then use the key to accept the new value. During the editing, the key allows you to
correct the input value and the key allows you to abort the editing phase. If the variable is decimal type, the
key allows you to edit the sign first, and then the point for the decimal.

Hexadecimal variables
To edit hexadecimal variables it is necessary edit the digit from A to F, to do this the numerical keys from to
must be used. With a pressure in rapid sequence on the key, the input value changes between 0 to A, with
a pressure in rapid sequence on the key, the input value changes between 1 to B, and so on.

Binary enhanced variables


To edit binary enhanced variables it is necessary edit the digit from A to F, to do this, follow the information
reported for the hexadecimal variables. In the case it's necessary to have all the bits set to 0 use the key, on
the display the '-' character will be displayed and the correspondent bit will be set to 0.
Netlog The value of the first editable variable of the message will flash, by using the key. If you keep pushing that key
without pushing others, the value of the second editable variable will flash, and the same for all the variables that
are declared to be editable in the message. You can select the digit to change with flashing variable, by using the
and keys . The and keys allows you to change the digit value selected before. The key allows
you to accept the value. During the editing, the key allows you to abort the input phase.

http://192.168.0.61/Destination/Html/Use/RFBFile/FBTerminal.htm (6 of 6) [06/10/2008 17.41.15]


Assembly file overview

ELSIST Srl, www.elsist.it MNL041Q100

Index

Assembly file overview

An Assembly file is shown as windows like which reported in the figure below. This is an editing window; you can
write the program on it, by using the typical facilities of an editor. See the proper chapter for a full list of the editing
controls. To write a program you have to refer to the specifications of the Assembly language for the MCS51
microprocessor family. To add a file to the project, please refer to the information reported in the proper chapter.

Figure 1

Syntax coloring

In order to have better reading of the file, an automatic syntax coloring is provided. The reserved names are blue
colored, the mnemonics of the reserved operands are gray colored and the comments are green colored.

File example

It 's reported an example of file written in Assembly language, this example can be used as a track to write a file to
add to own Remoter project .

http://192.168.0.61/Destination/Html/Use/AssemblyFile/FileOverview.htm (1 of 3) [06/10/2008 17.41.16]


Assembly file overview

; ******************************************************************************
; Project :
; Programmer :
; Date :
; ******************************************************************************
; Description :
; ------------------------------------------------------------------------------

; ------------------------------------------------------------------------------
; GLOBAL FUNCTIONS AND VARIABLES DECLARATION
; ------------------------------------------------------------------------------
; Global functions declaration.

PUBLIC AssemblyFct

; Global variables declaration.

PUBLIC BitValue
PUBLIC RandomNr

; ------------------------------------------------------------------------------
; EXTERN FUNCTIONS AND VARIABLES DECLARATION
; ------------------------------------------------------------------------------
; Extern functions declaration.

EXTRN CODE (Random)

; Extern variables declaration.

EXTRN XDATA (SystemConfig)

; ------------------------------------------------------------------------------
; FILE INCLUSION
; ------------------------------------------------------------------------------

include ElSystemLib.inc

; ------------------------------------------------------------------------------
; BIT VARIABLES DEFINITION
; ------------------------------------------------------------------------------

SEGMENTNAME_BDATA SEGMENT BIT


RSEG SEGMENTNAME_BDATA

BitValue: DBIT 1 ;This is a bit variable

; ------------------------------------------------------------------------------
; XDATA VARIABLES DEFINITION
; ------------------------------------------------------------------------------

SEGMENTNAME_XDATA SEGMENT XDATA


RSEG SEGMENTNAME_XDATA

RandomNr: DS 1 ;unsigned char RandomNr

; ------------------------------------------------------------------------------
; CODE SEGMENT DEFINITION
; ------------------------------------------------------------------------------
; Code segment definition.

http://192.168.0.61/Destination/Html/Use/AssemblyFile/FileOverview.htm (2 of 3) [06/10/2008 17.41.16]


Assembly file overview

SEGMENTNAME_CODE SEGMENT CODE


RSEG SEGMENTNAME_CODE

; ------------------------------------------------------------------------------
; @Section("void AssemblyFct(void)")
; ------------------------------------------------------------------------------
; This function must be called by the RIL language using the TASK instruction.
; Store a random number in the "RandomNr" variable.

AssemblyFct: lcall Random ;Random()


mov dptr,#RandomNr
mov a,r7
movx @dptr,a

; Change status of bit variable.

cpl BitValue

; Read the "SystemConfig.Microprocessor" value.

mov dptr,#SystemConfig+3
movx a,@dptr
ret

END

; [End of file]

http://192.168.0.61/Destination/Html/Use/AssemblyFile/FileOverview.htm (3 of 3) [06/10/2008 17.41.16]


Add an assembly file

ELSIST Srl, www.elsist.it MNL041Q100

Assembly file

Add an assembly file

To add ac Assembly file in the project, choose the New item from the menu File, use the icon, or press
the Ctrl+N key sequence. A window will be displayed allowing the possibility to choose the desired file type.
Select the C Source File (*.c) entry from the list and specify the name you want to give the file in the text
box signed by the File name label, for instance CFile, it is not necessary to specify the extension because
it is assigned automatically. If you press the OK key, you create the file in the directory selected in
Location, add it into the project tree and open it in editing. Further information about the C file
programming techniques are reported in the proper chapter.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

http://192.168.0.61/Destination/Html/Use/AssemblyFile/AddFile.htm [06/10/2008 17.41.17]


Debug an assembly program

ELSIST Srl, www.elsist.it MNL041Q100

Assembly file

Debug a C program

To debug an Assembly program please refer to the information reported in the debug a C program chapter.

http://192.168.0.61/Destination/Html/Use/AssemblyFile/FileDebug.htm [06/10/2008 17.41.17]


C file overview

ELSIST Srl, www.elsist.it MNL041Q100

Index

C file overview

A C file is shown as windows like which reported in the figure below. This is an editing window; you can write the
program on it, by using the typical facilities of an editor. See the proper chapter for a full list of the editing controls.
You have to refer to the ANSI specifications of the C language for the program writing. To add a file to the project,
please refer to the information reported in the proper chapter.

Figure 1

Syntax coloring

In order to have better reading of the file, an automatic syntax coloring is provided. The reserved names are blue
colored, the mnemonics of the reserved operands are gray colored and the comments are green colored.

File example

It 's reported an example of file written in C language, this example can be used as a track to write a file to add to
own Remoter project .

http://192.168.0.61/Destination/Html/Use/CFile/FileOverview.htm (1 of 2) [06/10/2008 17.41.18]


C file overview

// *****************************************************************************
// Project :
// Programmer :
// Date :
// *****************************************************************************
// Description :
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// @Section("void CustomFunction(void)")
// -----------------------------------------------------------------------------
// This function must be called by the RIL language using the TASK instruction.

void CustomFunction(void)
{
// Local variables definition.

unsigned int Counter; //Counter

// -------------------------------------------------------------------------
// COUNTER MANAGEMENT
// -------------------------------------------------------------------------
// The "Counter" variable is incremented every 100 mSec.

if (PLCPulse100)
Counter++; //Counter
}

// [End of file]

http://192.168.0.61/Destination/Html/Use/CFile/FileOverview.htm (2 of 2) [06/10/2008 17.41.18]


Add a C file

ELSIST Srl, www.elsist.it MNL041Q100

"C" file

Add a C file

To add a C file in the project, choose the New item from the menu File, use the icon, or press the Ctrl
+N key sequence. A window will be displayed allowing the possibility to choose the desired file type. Select
the C Source File (*.c) entry from the list and specify the name you want to give the file in the text box
signed by the File name label, for instance CFile, it is not necessary to specify the extension because it is
assigned automatically. If you press the OK key, you create the file in the directory selected in Location,
add it into the project tree and open it in editing. Further information about the C file programming
techniques are reported in the proper chapter.

By clicking on the key located near the Position box a window appears allowing the disk browsing,
so it's possible to select the path instead of digit it.

Figure 1

http://192.168.0.61/Destination/Html/Use/CFile/AddFile.htm [06/10/2008 17.41.18]


Debug a C program

ELSIST Srl, www.elsist.it MNL041Q100

"C" file

Debug a C program

After the upload running of the user program on the target system, you can carry out the debug. If the FB communication
MODBUS has been inserted in the project the debug will work, by using the key, when the target system is connected to
the PC through the selected communication media and when the user program is running.

You have to activate and configurable correctly the window Watch for the file debug in language C, by using the proper
button . The window Watch, that contains 8 index cards, will be activated by using the key and it will appear as shown in
figure.

Figure 1

You can insert the variables you want debug. You have to click twice on a box of the window Watch, activating the window
Watch that allows you to insert the variables.

http://192.168.0.61/Destination/Html/Use/CFile/FileDebug.htm (1 of 3) [06/10/2008 17.41.19]


Debug a C program

Figure 2

Memory Defines the kind of memory where the variable is allocated. All the mnemonic variables are Auto detected.
Internal Ram Defines the microprocessor internal RAM (Range from 0x00 to 0xFF).
Defines the microprocessor external RAM. For the address range please refer to memory
Ram
map.
Flash Defines the FLASH memory. For the address range please refer to memory map.
EEProm Defines the EEPROM memory. For the address range please refer to memory map.
Defines the PCB088 mass memory module. For the address range please refer to memory
Pcb088
map.
Defines the PCB111 mass memory module. For the address range please refer to memory
Pcb111
map.
Type Defines the variable type as defined in the C program. The possible types are:
Char Signed 8 bit variable.
Unsigned char Unsigned 8 bit variable.
Int Signed 16 bit variable.
Unsigned int Unsigned 16 bit variable.
Long Signed 32 bit variable.
Unsigned long Unsigned 32 bit variable.
Float Floating point variable.
String String variable. The variable length (number of character) must be specified.
Address Defines the memory address where the variable is allocated, the value is hexadecimal (ie: 0x123). For the
mnemonic variables the variable name must be defined.
Bit Number Allows to manage a single bit within the variable. ie: 0x02 manages the bit 2.
Local Filename Defines the file name in which the variable is defined, it's used only for local variables.
Comment Allows to define a comment.

After having correctly compiled all the fields involved, you can confirm your work with the OK key and the variable is
ransferred to the Watch window to the proper box. If it works correctly, the window appears as shown below. The green
background of the table shows that the link is active. Therefore you can monitor the state changes of the different operands.
You can change its properties any time, by clicking twice on the operand involved, or delete it from the window by selecting it
and then pushing the Canc button.

http://192.168.0.61/Destination/Html/Use/CFile/FileDebug.htm (2 of 3) [06/10/2008 17.41.19]


Debug a C program

Figure 3

You can force a specific value by clicking on the operand with the key at the right of the mouse, as shown the window below.
You can force it differently according to the kind of operand and the display format you chose.

Figure 4

http://192.168.0.61/Destination/Html/Use/CFile/FileDebug.htm (3 of 3) [06/10/2008 17.41.19]


Catch procedure

ELSIST Srl, www.elsist.it MNL041Q100

Index

Catch procedure

The Catch icon allows to force a reset to the target system and connect it to Remoter. To execute the catch procedure it's
necessary to connect the target system to the PC by using the communication media set up in the project, usual is used the
serial line, but the connection is possible also through a TCP/IP. If in the project settings is select the tick of request before stop
the system, a window will appear with the request confirm. During the catch procedure in the Results window is visualized the
message Waiting please... as shown in the figure.

If the target device is running, the catch is possible only if the communication FB is working in the program. By using the
icon, a reset is sent to the device, which will be forced in stop condition, when it restarts it will be forced in stop
condition activating the connection with Remoter.

If the catch condition doesn't work automatically, you can manually turning off and turning on the target device.

Figure 1

If the catch procedure ends correctly in the Results window is visualized the message Device linked! followed by the
information about the version of the software that is on the target device as shown in the figure. The catch procedure can be
aborted at any time by acting on the icon, or pressing the Esc key.

Figure 2

http://192.168.0.61/Destination/Html/Use/Target/Catch.htm [06/10/2008 17.41.20]


Information request

ELSIST Srl, www.elsist.it MNL041Q100

Index

Information request

When the target system is connected and in catch condition, you can request the state, by using the Info icon. The request
string will be sent to the target system that will answer with a hexadecimal string displayed in the Results window, as shown
below.

Figure 1

The answer string has different meanings according to the target.

Target Answer string Description

CPU016**** 1st field: Node number


MPS026****
0xFF, 0xFF, 0x00000005 2nd field: Serial configuration
MPS027****
OIF018**** 3rd field: System config
1st field: Node number
MPS022**** 0xFF, 0xFF, 0x00000005 2nd field: Serial configuration
3rd field: System config
MPS023****
MPS024**0*
MPS024**1*
MPS029**** The command is not possible
PCB099****
PCB104**0*
PCB104**1*

http://192.168.0.61/Destination/Html/Use/Target/Info.htm [06/10/2008 17.41.21]


Software version

ELSIST Srl, www.elsist.it MNL041Q100

Index

Software version

When the target system is connected and in catch condition, you can request the current software version, by using the Version
key. The request will be sent to the target system, it will answer with the version that will be seen at the Results window as
shown below.

Figure 1

http://192.168.0.61/Destination/Html/Use/Target/Version.htm [06/10/2008 17.41.21]


Clear memory

ELSIST Srl, www.elsist.it MNL041Q100

Index

Clear memory

With the target system in catch condition by acting on the Clear Memory icon is possible to execute the deletion of the whole
RAM and FLASH memory of the system, this operation is useful to to be sure that all the data in memory are zeroed. Working on
the icon the clear memory order will be sent to the target system, the system will answers with a message that indicates the order
execution, the message is displayed in the Results window as shown in the figure.

The command causes the deletion of the RAM and FLASH memory and also the loss of the user program and the BIOS
configuration parameters.

Figure 1

This command is not supported by all the target systems. Here the table with the targets that support this command.

Code Target

CPU016**** CPU Picosyst Millennium, central processor unit used in all Picosyst ME products
MPS026*0*0 PICOLOG Millennium relè, small programmable controller.
MPS026*3*0 PICOLOG Millennium static, small programmable controller.
MPS027***0 FACELOG, hybrid operator terminal, it has also digital I/Os.
OIF018*0*0 PICOFACE, low cost operator terminal.
MPS022**** Netlog, programmable controller inserted in a DIN43880 box.

If the control is sent to a system that cannot support it, an error message will be displayed in the Results window, as shown
below.

Figure 2

http://192.168.0.61/Destination/Html/Use/Target/ClearMemory.htm [06/10/2008 17.41.22]


Upload procedure

ELSIST Srl, www.elsist.it MNL041Q100

Index

Upload procedure

This procedure allows you to transfer to the target only the files that are selected into the upload table. In order to
display the upload table, you have to place the mouse on the project and select the Set Upload Table , by the right
key of the mouse.

Figure 1

The upload table allows you the define the files that has to be transferred. The selection of Builded Program selects
the upload of the realized program, otherwise you can carry out the upload process of one of the last download
processes.

Figure 2

When you have the target system connected and when you are in catch condition, you can transfer the selected file to
the upload table on the target system by using the Upload key. During the procedure, a report of the last

http://192.168.0.61/Destination/Html/Use/Target/Upload.htm (1 of 2) [06/10/2008 17.41.23]


Upload procedure

operations will be seen as shown in figure.

Figure 3

The upload procedure allows the deletion of the memory sectors involved, on the target system based on FLASH
memory. If the tick box On erase execute an "All sectors" erase was selected in the project settings, the deletion will
be done on the whole FLASH memory area with a time saving compared to the single deletion of the sectors.

After the deletion, the program file transfer in the target device begins. During this phase, a flowing stroke displays the
progression condition in the lower part of the window. If the tick box Allows code download in the project settings
selected, you will be able to a future download process of the program that was previously transferred in the target
device. When the upload process successfully ends, a window with the operations request will be seen, as shown
below.

Figure 4

The options allow:

Yes The program will be executed on the target system.


Will be executed the comparison between the file, whose upload process has been carried out, and the resident
No
program on the target system.
CancelThe sequence ends leaving the target device in stop condition.

When the upload procedure ends, the program will keep being in the target system that will automatically carry
it out when the target is turned on.

http://192.168.0.61/Destination/Html/Use/Target/Upload.htm (2 of 2) [06/10/2008 17.41.23]


Download procedure

ELSIST Srl, www.elsist.it MNL041Q100

Index

Download procedure

With the target system in catch condition by acting on the Download from Target icon, it's possible to transfer the entire
memory map of the target system to a file on the PC. During the procedure, a report of the operations will be seen at the
Results window as shown in the figure.

Figure 1

When the reading of the whole memory map of the system is finished will be displayed the request of the definition of the file
in which to save the download executed. For default it's proposed the DownloadFile1.rdn inside of the project directory. It's
possible to change the name and the location of the file. Defined the name it wil be added to the project tree and a window
with relate information will be displayed. The Title and Notes fields can be changed and the user can write the relate
information.

Figure 2

http://192.168.0.61/Destination/Html/Use/Target/Download.htm (1 of 2) [06/10/2008 17.41.23]


Download procedure

The download procedure is possible only if the project transferred to the target system has the download allowed in
the project settings. Otherwise the download process will not be possible and an error message will be displayed in the
Results window.

Figure 3

http://192.168.0.61/Destination/Html/Use/Target/Download.htm (2 of 2) [06/10/2008 17.41.23]


Program running

ELSIST Srl, www.elsist.it MNL041Q100

Index

Program running

The program running on the target system automatically occurs at the end of the upload process, however in some target
systems you can force the program running after a catch condition. The control of program running will be sent by using the Run
key, the target system will check that the program to carry out really exists and it will send it to running, giving back an answer
string at the Results window, as shown below.

Figure 1

http://192.168.0.61/Destination/Html/Use/Target/Run.htm [06/10/2008 17.41.24]


Project information request

ELSIST Srl, www.elsist.it MNL041Q100

Index

Project information request

When the target system is connected and it is in run condition , you can request information about the current project, by using
the Loaded Project Info icon. An information request about the loaded project will be sent to the target system, and the
information will be seen at the Results window, as shown in the figure.

Figure 1

The returned information includes the name of the project, date and time of the latest bulid, and the version of Remoter, that has
been used for the building. We remind that all these information are automatically generated during every building and they are
transferred to the target system in the stucture PLCRemoterProjectInfo during the upload. If you want to compare the information
just read with that one of the project being used by Remoter, see the project settings.

http://192.168.0.61/Destination/Html/Use/Target/ProjectInfo.htm [06/10/2008 17.41.24]


Mass memory manager

ELSIST Srl, www.elsist.it MNL041Q100

Index

Mass memory manager

When the target system is connected and in catch condition, by pressing the Mass memory manager icon, you can activate
the mass memory module management window.

The Make backup procedure is possible only if the project transferred to the target system has the download allowed in
the project settings.

Figure 1

In the Operation to Perform field it's possible to select:

Format Mass Memory By pressing the OK key, the mass memory module will be format. The formatted module inserted in a
programmed system at it power on will provide to automatially transfer to the mass memory module
the data defined in Data to Manage.
Make Backup By pressing the OK key, the data defined in Data to Manage will be transferred to the mass memory
module.
Esegui da Mass Memory By pressing the OK key, the operation defined on the mass memory module will be executed.

In the Data to Manage field it's possible to select the memory on which the perations are executed:

Code If selected, the operations are executed on code memory.


Data If selected, the operations are executed on data memory.

In the Mass Memory Type is possibile to select the memory support on which to execute the operations:

PCB111*000 Mass Memory It selects the PCB111 mass memory module.

The mass memory management order, it isn't supported from all of the target systems, following we report a table with the
indication of the targets and the BIOS version that support it.

Code BIOS Target

CPU016**** SFW128F000 CPU Picosyst Millennium, central processor unit used in all Picosyst ME products
MPS026*0*0 SFW128F000 PICOLOG Millennium relè, small programmable controller.

http://192.168.0.61/Destination/Html/Use/Target/MassMemory.htm (1 of 2) [06/10/2008 17.41.25]


Mass memory manager

MPS026*3*0 SFW128F000 PICOLOG Millennium static, small programmable controller.


MPS027***0 SFW128F000 FACELOG, hybrid operator terminal, it has also digital I/Os.
OIF018*0*0 SFW128F000 PICOFACE, low cost operator terminal.
MPS022**** SFW116E000 Netlog, programmable controller inserted in a DIN43880 box.

If the command is executed on a target that doesn't support it, in the Results window an error message will be displayed.

Figure 2

http://192.168.0.61/Destination/Html/Use/Target/MassMemory.htm (2 of 2) [06/10/2008 17.41.25]


Terminal emulation

ELSIST Srl, www.elsist.it MNL041Q100

Index

Terminal emulation

Clicking on the Show Terminal Bar icon, it visualizes a terminal emulation window inside of Remoter program. A
windows like below will be opened:

Figure 1

A drop down menu allows to select the communication media to be connected to the terminal:

Serial port direct Uses the serial COM, by acting to the Set key, it's possible to set the function parameters desired.
TCP/IP Uses the TCP/IP socket, It can be used in with a TCP/IP to serial converter. Working on the key it
Plans it is possible to plan the parameters of operation wanted. can be used può essere utilizzato
in unione ad un convertitore TCP/IP seriale. By acting to the Set key, it's possible to set the
function parameters desired.

Terminal settings

By acting to the Set key and choosing the Terminal Settings, it's possible to set the terminal working parameters.

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/Terminal.htm (1 of 3) [06/10/2008 17.41.26]


Terminal emulation

Figure 2

Substitute Unprintable Chars Selected forces the display of the received unprintable characters from the
communication media. The unprintable characters are replaced with their exadecimal
code between square brackets, (Example: [0x33]).
Terminal in Hex Mode Selected forces the display in hexadecimal code of the received characters from the
communication media. The characters are replaced with their hexadecimal code
between square brackets, (Example: [0x33]).
Local Echo Selected forces the display in the terminal window of the characters pressed locally
on the keyboard.
Transmit LF After CR Selected forces the transmission of a line feed character after any carriage return.

With the Font Rx and Font Tx keys it's possible to set the font to be used to display in the terminal window, the
received and the transmitted characters (Only if Local Echo chosen). For default are displayed in red the transmitted
and in blue the received characters. If activated the management of the control characters on the serial line, it's
possible to set the DTR and RTS signals by set a tick in the relate box.

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/Terminal.htm (2 of 3) [06/10/2008 17.41.26]


Terminal emulation

Figure 3

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/Terminal.htm (3 of 3) [06/10/2008 17.41.26]


Function blocks

ELSIST Srl, www.elsist.it MNL041Q100

Index

Function blocks

The function blocks FB are functions that execute complex operations or are used as drivers for specific
hardware module. Here it is the index of the function blocks available. If in the user program a function block is
used, you have to insert it also in the libraries otherwise Remoter cannot include it in the program and a link
error will be created.

Name Code Description

FbCounterOverIO PFB035 16 bit counter management by using logic inputs B C A A A A A

FbDMXProtocol PFB076 DMX protocol management - - - - - - A

FbElevatorCall PFB062 Elevator call reservation D E A C A B A

FbEncoderOverIO PFB018 Encoder acquisition by using logic inputs with quadrature B C A A A A A

FbI2CSerial PFB057 Driver for serial line management on extension module B C A A A A A

FbI2CSlaveManager PFB064 I2C slave system management - - A - B C A

FbIOComm PFB043 Logic I/O communication management B C A A A A A

FbModbusAsciiMs PFB044 Master MODBUS ASCII communication management D E C C A B A

FbModbusAsciiSl PFB042 Slave MODBUS ASCII communication management D E D C A B A

FbModbusRtuMs PFB069 Master MODBUS RTU communication management D E C C A B A

FbModbusRtuSl PFB060 Slave MODBUS RTU communication management D E C C A B A

FbModemMng PFB053 MODEM management B C A A A A A

FbNetlogAD PFB050 Analog acquisition on Netlog systems B C A A A A A

FbNetlogDA PFB051 Analog output on Netlog systems B C A A A A A

FbNetlogIIAD PFB065 Analog acquisition on Netlog II systems - - A - C - A

FbNetlogIIDA PFB066 Analog output on Netlog II systems - - A - C - A

FbPicofaceSerial PFB055 PICOFACE terminal connected to serial port management D E A C A B A

FbPIDMng PFB056 PID loop management B C A A A A A

FbPsystADSubm PFB047 PSYST coprocessor module A/D submodule management - C A - - - A

FbPsystAnaCp PFB033 PSYST coprocessor module management - C A - - - A

FbPsystDASubm PFB048 PSYST coprocessor module D/A submodule management - C A - - - A

FbPWMRegulation PFB072 PWM regulation B C A A A A A

FbQuoteMng PFB059 Quote management B C A A A A A

FbRtuManager PFB061 RTU peripheral for telecontrol D E C C A B A

FbSetSerialPar PFB058 Serial communication parameters setting B C A A A A A

FbSle44x2Card PFB063 Sle4432 and Sle4442 types chip cards management - - A A - A -

FbSysTerminal PFB054 System terminals management D E A C A B A

The function blocks can be used both by the RIL and by the C language. Every function block uses a data
structure in external memory for the interface with the user program, in the call instruction need to be defined the
allocation address of this structure. Here it is the example of data structure definition of a function block.

http://192.168.0.61/Destination/Html/FctBlocks/FctBlock.htm (1 of 3) [06/10/2008 17.41.27]


Function blocks

typedef struct
{
// --------------------------[Members that can be managed by user program]--

...

// -----------------------------[Members automatically managed by Remoter]--

...

// --------------------------------------------[Internal use only members]--

...
}FB...DATA;

The members under the indication Members that can be managed by user program can be used by the user
program for the setting definition and for the return value reading.

The members under the indication Members automatically managed by Remoter, in case of using the
management graphic utility, are managed automatically by Remoter, in case of using it by the C program they
have to be managed by the user program.

The members under the indication Internal use only members are used inside the function block and they don't
have to be used by the user program.

Use from RIL language

For the activation of the FB, need to be defined their call by using the proper instruction TASK, also defining the
function and the allocation address od the data structure. Remoter will automatically provide for adding the
function code in the executable program.

In the programming in absolute mode, if you use the numerical addressing of the operands, you have to pay
attention to the size of the data structure of the function block in order to avoid to allocate other operands in the
same allocation address of the structure.

Here it is an example of program with the call to the function block FbEncoderOverIO, the data structure of the
FB uses 8 bytes, and it is allocated at the address Y 0100, so all the operands from Y 0100 to Y 0108 will be
used by the function block.

ORGR
SETR
MOVI Y 0100 K 0000 ; Logic inputs selection
TASK L FbEncoderOverIO Y 0100 ; Encoder acquisition
LODA W 0102 ; Encoder value

; [End of file]

Programming in mnemonic mode, the allocation of the data structure is carried out automatically by Remoter,
need to be defined the memory size by using the instructions DEFL or DEFG. Here it is an example of program
with the call to the function block FbEncoderOverIO.

http://192.168.0.61/Destination/Html/FctBlocks/FctBlock.htm (2 of 3) [06/10/2008 17.41.27]


Function blocks

DEFL Y EncAcq KD 8
DEFL Y Inputs Y EncAcq KH 0000 ; Logic inputs selection
DEFL Y Error Y EncAcq KH 0001 ; Acquisition error
DEFG W Value Y EncAcq KH 0002 ; Encoder value

ORGR
SETR
MOVI Y Inputs K 0000 ; Logic inputs selection
TASK L FbEncoderOverIO Y EncAcq ; Encoder acquisition
LODA W Value ; Encoder value

; [End of file]

Use from "C" language

To program in C language, a definition file h is given for every function block. In this file the data structure and
the prototype of the function block are defined. In the user program just need to be included the definition file,
and carry out a function, giving the allocation address of the data structure, Remoter will automatically provide
for adding the function code in the executable program.

void Example(void)
{
unsigned int EncoderQuote; //Encoder quote
static FBENCODEROVERIODATA EncoderStruct; //PFB018, data struct

EncoderStruct.Inputs=0x00; //Logic inputs selection


FbEncoderOverIO(&EncoderStruct); //Acquisizione encoder
EncoderQuote=EncoderStruct.Value; //Encoder quote
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FctBlock.htm (3 of 3) [06/10/2008 17.41.27]


"C" macros

ELSIST Srl, www.elsist.it MNL041Q100

Index

"C" macros

The system libraries have some type of predefined macro functions, here follows the list.

ASCIIToHEX Convert an ASCII character to an hexadecimal number D E - C A B A

DISABLEINT Alows to disable all the interrupt sources, it prevents the program - - - - - - A
execution interruption
ENABLEINT Alows to enable all the interrupt sources. It must be used after the - - - - - - A
DISABLEINT macro
HEXToASCII Convert an hexadecimal number to an ASCII character D E - C A B A

HICHAR It returns an unsigned char number that represents the high nibble of an - H - - E - A
unsigned int number
HIINT It returns an unsigned int number that represents the high nibble of an - H - - E - A
unsigned long number
LOCHAR It returns an unsigned char number that represents the low nibble of an - H - - E - A
unsigned int number
LOINT It returns an unsigned int number that represents the low nibble of an - H - - E - A
unsigned long number
MAKEINT It returns an unsigned int number by attaching two unsigned char - H - - E - A
numbers
MAKELONG It returns an unsigned long number by attaching two unsigned int - H - - E - A
numbers
PLCOp(x) Alows to read or write any numerical RIL language operand - - A - - - A

SWCHAR It swaps an unsigned char number - H - - E - A

SWINT It swaps an unsigned int number - H - - E - A

SWLONG It swaps an unsigned long number - H - - E - A

http://192.168.0.61/Destination/Html/CLanguage/Macros.htm [06/10/2008 17.41.28]


"C" data types

ELSIST Srl, www.elsist.it MNL041Q100

Index

"C" data types

The system libraries have some type of predefined data, here follows the list.

Type Description

ACSPOINTFUNCTIONS Access point functions vectors data structure


BLINKBITDATA BlinkBit function data structure
CANINITDATA CANInit function data structure
I2CMNGFUNCTIONS I2C communication vectors data structure
MODEMSTRUCT Modem data structure
NSYSTBUSIODATA NSYSTBusIO function data structure
NSYSTEXTMODSTS Netsyst extension module status data structure.
PLCRTCDATA Real time clock data structure (PLC use)
RTCDATA Real time clock data structure
SERIALFUNCTIONS Serial device functions vectors data structure
SERIALSTRUCT Serial line configuration data structure
TERMINALFUNCTIONS Terminal device functions vectors data structure
TERMINALSTRUCT Terminal management data structure
TERMIOFUNCTIONS I/O functions vectors data structure
TERMIOVECTORS I/O console vectors data structure
USERFLAGS User flags data structure

http://192.168.0.61/Destination/Html/CLanguage/DataTypes.htm [06/10/2008 17.41.28]


"C" variables

ELSIST Srl, www.elsist.it MNL041Q100

Index

"C" variables

The system libraries have some predefined variables. In the programs development it's necessary to refer
to the used library version verifying in the following table if the variable is supported. In a migration of a
project from a target to another one it's possible that the library of the new target doesn't support one of the
used variables, in that case a linker error will be generated.

The data struct variables are recognized by the linker only with the name of data structure and not
with the names of the internal members. So it's possible that the use of a member not defined in the
library, even if doesn't generate a linker error, can create a mistakes in the program. Please refer to
the variable documentation to know the internal members supported for every variable.

I/O console vectors

TERMIOVECTORS* IOAcsPointA I/O console vector definition on access point A


TERMIOVECTORS* IOAcsPointB I/O console vector definition on access point B
TERMIOVECTORS* IODeviceNotCorrect I/O console vector definition not correct
TERMIOVECTORS* IOModemA I/O console vector definition on modem A
TERMIOVECTORS* IOSerialPortA I/O console vector definition on serial line port A
TERMIOVECTORS* IOSerialPortB I/O console vector definition on serial line port B
TERMIOVECTORS* IOSerialPortC I/O console vector definition on serial line port C
TERMIOVECTORS* IOTerminalA I/O console vector definition on terminal A
TERMIOVECTORS* IOTerminalB I/O console vector definition on terminal B
TERMIOVECTORS* IOTerminalC I/O console vector definition on terminal C
TERMIOVECTORS* IOTerminalD I/O console vector definition on terminal D
System variables

unsigned int EEPROMWriteCtr It counts accesses in writing to EEPROM memories


data struct ExecutionErrors Report execution errors
unsigned int FLASHWriteCtr It counts accesses in writing to FLASH memories
data struct KernelErrors Report Kernel errors
unsigned int NSYSTBusRetries It counts Netsyst bus error access retries
data struct PLCErrors Report PLC management errors
data struct PLCRemoterProjectInfo It contains information on the project
PLCRTCDATA PLCRtcData System real time clock data structure
PLCRTCDATA* PLCRtcDataPtr Pointer to a system real time clock data structure
data struct SystemConfig System configuration
data struct SystemErrors Report system errors

http://192.168.0.61/Destination/Html/CLanguage/Variables.htm [06/10/2008 17.41.29]


"C" Functions

ELSIST Srl, www.elsist.it MNL041Q100

Index

"C" functions

Remoter is provided with a libraries series for the different target systems supported, the libraries contain all
the functions needed for the system management.

Loader

HardwareConfig It returns the hardware configuration word - - - - - - A

ManufacturerID It returns the manufacturer code of the system - - - - - - A

Kernel

ExecuteKernelFct Executes a kernel function - - - - E - A

GetUserFlags It returns the user flags data structure - - - - - - A

KernelReadVar Reads a variable from the kernel program - - - - - - A

KernelWriteVar Writes a variable to the kernel program - - - - - - A

StopUserProgram It stops the user program returning to the kernel - - - - E - A

UserPrgConfig It returns the user program configuration - - - - - - A

Utility

ArrayBitCount It counts the set bitS in an array D E - C A B A

ArrayBitSet It forces the logical status of a bit in an array D E - C A B A

ArrayBitStatus It returns the logical status of a bit in an array D E - C A B A

AsciiStringConvert It converts an ASCII string in an hexadecimal number D E - C A B A

BlinkBit It executes the bit blinking D C - A A A A

Linearize It executes the value linearization - - D - - - A

MemCrc It calculates the16 bit CRC on a memory area B C - A A A A

ModbusCrc It calculates the 16 bit CRC on a memory area according to - G - - D - A


the MODBUS Rtu format
Random It returns a random number D C - A A A A

Hardware management

NSYSTBusIO It manages the Netsyst bus - - - - E - B

NSYSTExtModuleAbort It sends abort command to the Netsyst extension module B C - A A A A

NSYSTExtModuleInp Logic input acquisition from Netsyst extension module D C - A A A A

NSYSTExtModuleNumber It returns the number of Netsyst extension modules D C - A A A A


connected
NSYSTExtModuleOut Logic output management on Netsyst extension module D C - A A A A

http://192.168.0.61/Destination/Html/CLanguage/Functions.htm (1 of 4) [06/10/2008 17.41.31]


"C" Functions

NSYSTExtReadVar It executes reading of a variable from Netsyst extension C D - B A A A


module
NSYSTExtWriteVar It executes writing of a variable on Netsyst extension module C D - B A A A
NSYSTModSts Returns the Netsyst extension module status - - - - - - D

NSYSTReadyIn It returns the status of the RDYIN-N signal on the Netsyst - - - - B C A


extension bus
PeripheralInp Logic input acquisition from the extension modules B C - A A A A

PeripheralOut Logic output management on the extension modules B C - A A A A

RunLEDMng It manages the status of Run yellow LED E F - D A B A

SetPeripheralReady It executes ready signal management on peripheral bus B C - A A A A

System management

SystemMemoryRead It executes the reading of the system memory E D - C B B A

SystemMemoryWrite It executes the writing of the system memory E D - C B B A

Real time clock management

GetRtc It returns the time structure from the real time clock B C - A A A A

SetRtc It sets the time structure in the real time clock B C - A A A A

Tick management

GetClockIntTime It returns the execution time of the interrupt clock function B C - A A A A

GetSystemTime It returns the system time expressed in mSec B C - A A A A

IsMsecTimeOver It controls if a defined time is expired (mSec) B C - A A A A

IsSecTimeOver It controls if a defined time is expired (Sec) B C - A A A A

SetClockIntTime It defines the execution time of the interrupt clock function B C - A A A A

SetClockIntVector It defines the vector of execution interrupt clock function B G - A A A A

Timer management

SetTimerEnable It allows to enable time B C - A A A A

SetTimerIntVector It defines the execution vector of timer interrupt function B G - A A A A

External interrupt management

SetEIntVector It enables and defines the execution vector of external B G - A A A A


interrupt function

Power down management

SetPwDownIntVector It enables and defines the execution vector of power down B C - - A - A


interrupt function

Watch dog management

http://192.168.0.61/Destination/Html/CLanguage/Functions.htm (2 of 4) [06/10/2008 17.41.31]


"C" Functions

GetWDogTime It returns the time value of the intervention watch dog circuit B C - A A A A

HwWDogRefresh It executes the refresh hardware watch dog circuit B C - A A A A

SetWDogTime It sets the intervention time watch dog circuit B C - A A A A

WDogRefresh It executes the refresh watch dog circuit B C - A A A A

I2C master management

I2CMasterNodeCheck It checks if the defined device is connected to the I2C BUS D F - D B C A

I2CMasterRead It allows the reading from I2C BUS B C - A A A A

I2CMasterWrite It allows the writing on I2C BUS B C - A A A A

I2C slave management

I2CSlaveAddress Sets the I2C BUS communication address - - - - B C A

I2CSlaveEnable It allows to enable the I2C BUS communication - - - - B C A

I2CSlaveInit Initialize the I2C BUS communication - - - - B C A

I2CSlaveVectors Sets the I2C BUS communication function vectors - - - - B C A

Serial port management

GetSerialMode It returns the communication mode set B C - A A A A

SerialDTRMng It sets the working mode of the DTR signal B C - A A A A

SetSerialMode It sets the communication mode B C - A A A A

Terminal management

DisplayClear Clears the display B C - A A A A

GetCursorColumn It returns the column where the cursor is located B C - A A A A

GetCursorRow It returns the line where the cursor is located B C - A A A A

SetCursorPos It places the cursor on the display B C - A A A A

I/O terminal

GetCh It returns a character from the defined I/O terminal B C - A A A A

GetRxChars It returns numbers available characters from the defined I/O B C - A A A A


terminal
GetTermIOData It returns the data structure allocation address of the defined I/ - - - - E - A
O terminal
GetTermIOVectors It returns the vector to the I/O terminal functions currently B C - A A A A
defined
GetTxSpace It returns the space available in the defined I/O terminal B C - A A A A

InputStream It returns a string of characters from the defined I/O terminal B C - A A A A

OutputStream It sends a string of characters to the defined I/O terminal B C - A A A A

PutCh It sends a character to the defined I/O terminal B C - A A A A

SetTermIOData It sets the data structure allocation address of the defined I/O - - - - E - A
terminal

http://192.168.0.61/Destination/Html/CLanguage/Functions.htm (3 of 4) [06/10/2008 17.41.31]


"C" Functions

SetTermIOVectors It sets the vector to the I/O terminal functions B C - A A A A

TermIOClose It closes the defined I/O terminal B C - A A A A

TermIOIsOpen It returns the defined I/O terminal status B C - A A A A

TermIOOpen It opens the defined I/O terminal B C - A A A A

TermIORxClear It clears the reception buffer and resets errors to the defined I/ B C - A A A A
O terminal
TermIORxFlush It executes the flush of the reception buffer to the defined I/O B C - A A A A
terminal
TermIOTick It manages the tick of the defined I/O terminal B C - A A A A

TermIOTxClear It clears the transmission buffer and resets errors in the B C - A A A A


defined I/O terminal
TermIOTxFlush It executes the flush of the transmission buffer of the defined B C - A A A A
I/O terminal

CAN controller

CANInit Initializes the CAN controller - - - - - - A

CANRx Manages the reception of CAN frames - - - - - - A

CANTest Executes the CAN BUS test - - - - - - A

CANTx Manages the transmission of CAN frames - - - - - - A

PLC

PLCDebouncing It executes the debouncing on 8 bits - - D - - - -

The functions with are obsolete, they have been reported in order to guarantee the compatibility with the
previous versions, we advice to don't use them in the new projects. Please follow the indications reported in
the documentation of the function.

http://192.168.0.61/Destination/Html/CLanguage/Functions.htm (4 of 4) [06/10/2008 17.41.31]


ANSI "C" functions
ELSIST Srl, www.elsist.it MNL041Q100

Index

ANSI "C" functions

The C compiler included in Remoter support a lot of the ANSI standard functions, a list of the functions supported.

Character handling <ctype.h>

isalnum Letter or digit equality int isalnum(int c);


isalpha Letter equality int isalpha(int c);
iscntrl Control code equality int iscntrl(int c);
isdigit Digit equality int isdigit(int c);
isgraph Printable non-space character equality int isgraph(int c);
islower Lower case equality int islower(int c);
isprint Printable character equality int isprint(int c);
ispunct Punctuation character equality int ispunct(int c);
isspace White-space character equality int isspace(int c);
isupper Upper case equality int isupper(int c);
isxdigit Hex digit equality int isxdigit(int c);
tolower Converts to lower case int tolower(int c);
toupper Converts to upper case int toupper(int c);
Mathematics <math.h>

acos Arc cosine double acos(double arg);


asin Arc sine double asin(double arg);
atan Arc tangent double atan(double arg);
atan2 Arc tangent with quadrant double atan2(double arg1, double arg2);
ceil Smallest int greater than or equal to arg double ceil(double arg);
cos Cosine double cos(double arg);
cosh Hyperbolic cosine double cosh(double arg);
exp Exponential double exp(double arg);
fabs Double-precision float absolute double fabs(double arg);
floor Largest integer less than or equal double floor(double arg);
fmod Floating-point remainder double fmod(double arg1, double arg2);
frexp Splits a float number in two parts double frexp(double arg1, int *arg2);
ldexp Multiply by power of two double ldexp(double arg1, int arg2);
log Natural logarithm double log(double arg);
log10 Base-10 logarithm double log10(double arg);

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions.htm (1 of 3) [06/10/2008 17.41.33]


ANSI "C" functions

modf Fractional and integer parts double modf(double value, double *iptr);
pow Raises to the power double pow(double arg1, double arg2);
sin Sine double sin(double arg);
sinh Hyperbolic sine double sinh(double arg);
sqrt Square root double sqrt(double arg);
tan Tangent double tan(double x);
tanh Hyperbolic tangent double tanh(double arg);
Non-local jumps <setjmp.h>

longjmp Long jump void longjmp(jmp_buf env, int val);


setjmp Sets up a jump return point int setjmp(jmp_buf env);
Variable arguments <stdarg.h>

va_arg Next argument in function call type va_arg(va_list ap, mode);


va_end Ends reading function call arguments void va_end(va_list ap);
va_start Starts reading function call arguments void va_start(va_list ap, parmN);
Console Input/Output <stdio.h>

getchar Gets character int getchar(void);


gets Gets string char *gets(char *s);
printf Writes formatted data int printf(const char *format, ...);
putchar Puts character int putchar(int value);
puts Puts string int puts(const char *s);
scanf Reads formatted data int scanf(const char *format, ...);
sprintf Writes formatted data to a string int sprintf(char *s, const char *format,);
sscanf Reads formatted data from a string int sscanf(const char *s, const char *format, ...);
General utilities <stdlib.h>

abort Terminates the program abnormally void abort(void);


abs Absolute value int abs(int j);
atof Converts ASCII to double double atof(const char *nptr);
atoi Converts ASCII to int int atoi(const char *nptr);
atol Converts ASCII to long int long atol(const char *nptr);
bsearch Makes a generic search in an array void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare) (const void *_key, const void *_base));
calloc Allocates memory for an array of objects void *calloc(size_t nelem, size_t elsize);
div Divide div_t div(int number, int denom);
exit Terminates the program void exit(int status);
free Frees memory void free(void *ptr);
labs Long absolute long int labs(long int j);
ldiv Long division ldiv_t ldiv(long int numer, long int denom);
malloc Allocates memory void *malloc(size_t size);
http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions.htm (2 of 3) [06/10/2008 17.41.33]
ANSI "C" functions

mempool_init Inits dinamic memory allocation void mempool_init (dynamic_allocator_struct allocmem *p, size_t size);
qsort Makes a generic sort of an array void qsort(const void *base, size_t nmemb, size_t size, int (*compare) (const void *_key, const void *_base));
rand Random number int rand(void);
realloc Reallocates memory void *realloc(void *ptr, size_t size);
srand Sets random number sequence void srand(unsigned int seed);
strtod Converts a string to double double strtod(const char *nptr, char **endptr);
strtol Converts a string to a long integer long int strtol(const char *nptr, char **endptr, int base);
strtoul Converts a string to an unsigned long unsigned long int strtoul (const char *nptr, char **endptr, base int);
String handling <string.h>

memchr Searches for a character in memory void *memchr(const void *s, int c, size_t n);
memcmp Compares memory int memcmp(const void *s1, const void *s2, size_t n);
memcpy Copies memory void *memcpy(void *s1, const void *s2, size_t n);
memmove Moves memory void *memmove(void *s1, const void *s2, size_t n);
memset Sets memory void *memset(void *s, int c, size_t n);
strcat Concatenates strings char *strcat(char *s1, const char *s2);
strchr Searches for a character in a string char *strchr(const char *s, int c);
strcmp Compares two strings int strcmp(const char *s1, const char *s2);
strcpy Copies string char *strcpy(char *s1, const char *s2);
strcspn Spans excluded characters in string size_t strcspn(const char *s1, const char *s2);
strerror Gives an error message string char *strerror(int errnum);
strlen String length size_t strlen(const char *s);
strncat Concatenates characters with a string char *strncat(char *s1, const char *s2, size_t n);
strncmp Compares characters with a string int strncmp(const char *s1, const char *s2, size_t n);
strncpy Copies characters from a string char *strncpy(char *s1, const char *s2, size_t n);
strpbrk Copies character in a string char *strpbrk(const char *s1, const char *s2);
strrchr Copies character from right in a string char *strrchr(const char *s, int c);
strspn Spans characters in a string size_t strspn(const char *s1, const char *s2);
strstr Searches for a substring char *strstr(const char *s1, const char *s2);
strtok Breaks a string into tokens char *strtok(char *s1, const char *s2);

The functions with are not inclued in the ANSI standard.

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions.htm (3 of 3) [06/10/2008 17.41.33]


Operands list

ELSIST Srl, www.elsist.it MNL041Q100

Index

Operands list

An operand of an instruction is the variable treated by the instruction itself. An operand is usually made with
the type and the address. The operand address can change according to the target type you selected.

Type Description PSYST NSYST Netreader

B Function block 0-999


BD Decimal bit address 0-31
BH Hexadecimal bit address 0-1F
C Counter 0-FFFF
DW Memory double word 0-5BC (*) 0-5BC (*) 0-60 (*)
F Flag 0-5BF (*) 0-5BF (*) 0-63 (*)
FL Float 0-5BC (*) 0-5BC (*) 0-60 (*)
I Logic input 0-FF (*) 0-FF (*) 0-7 (*)
K Costant 0-FFFF
KD Decimal costant 0-4294967295
KH Hexadecimal costant 0-FFFFFFFF
KO Octal costant 0-37777777777
KB Binary costant 0-11111111111111111111111111111111
KF Float constant -3.4028233e+38-+3.4028233e+38
KE Enum constant Only mnemonic
L Label Only mnemonic
O Logic output 0-FF (*) 0-FF (*) 0-7 (*)
T Timer 0-FFFF
W Memory word 0-5BE (*) 0-5BE (*) 0-62 (*)
Y Memory byte 0-5BF (*) 0-5BF (*) 0-63 (*)

The operand range indicated with (*), represents the default value, the user can modify the range by
defining a new value on the window project settings.

http://192.168.0.61/Destination/Html/RILLanguage/Operands.htm [06/10/2008 17.41.33]


reserved operands

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Reserved operands

To give facilities to the user during the editing of the program, there are available some operands that have
predefined assignment, here follow the table of them. To give more facilities to import a project made with
an old version of Remoter, in the column V.7.X are reported the old value operands that must be
substituted. All the reserved operands can be used in a C program file, see proper chapter.

Type Name Function V.7.x

F PLCAlwaysOne Logic flag always at logical active (TRUE) status A

F PLCAlwaysZero Logic flag always at logical non active (FALSE) status A

F PLCRxBufEmpty It becomes active if the serial reception buffer is empty (Managed F05C0 A
by SRXC instruction)
F PLCTxBufFull It becomes active if the serial transmission buffer is full (Managed F05C1 A
by STXC instruction)
F PLCTxBufEmpty It becomes active if the serial transmission buffer is empty F05C4 A
(Managed by STXC instruction)
F PLCChrReceived It becomes active if the SRXD instruction has transferred the F05C5 A
arrived character in AccA
F PLCClock100 Change its logic status (blinks) every 100 msec A

F PLCClock500 Change its logic status (blinks) every 500 msec A

F PLCClock1000 Change its logic status (blinks) every 1 Sec A

F PLCFirstLoop It stay true only in the first loop of the program F05D0 A
F PLCLoopToggle Change its logic status (blinks) every program execution loop F05D1 A
F PLCTimeBase100 Change its logic status (blinks) every 100 msec F05D2 A
F PLCTimeBase200 Change its logic status (blinks) every 200 msec F05D3 A
F PLCTimeBase400 Change its logic status (blinks) every 400 msec F05D4 A
F PLCTimeBase800 Change its logic status (blinks) every 800 msec F05D5 A
F PLCTimeBase1600 Change its logic status (blinks) every 1.6 Sec F05D6 A
F PLCTimeBase3200 Change its logic status (blinks) every 3.2 Sec F05D7 A
F PLCTimeBase6400 Change its logic status (blinks) every 6.4 Sec F05D8 A
F PLCTimeBase12800 Change its logic status (blinks) every 12.8 Sec F05D9 A
F PLCPulse100 It becomes active for a program execution loop every 100 mSec A

F PLCPulse500 It becomes active for a program execution loop every 500 mSec A

F PLCPulse1000 It becomes active for a program execution loop every 1 Sec A

F PLCSubIsNegative It becomes active if the subtraction instruction has a negative result C


(Managed by SUBA and FSUB instructions)
F PLCMathError It becomes active if the execution of a mathematical instruction has F05DD A
an error

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Reserved.htm (1 of 2) [06/10/2008 17.41.35]


reserved operands

F PLCConvError Attiva su errore esecuzione istruzioni conversione dati F05DE A


F PLCLesFlag It becomes active if AccA<AccB (Managed by CPRA and FCPR F05E4 A
instructions)
F PLCGrtFlag It becomes active if AccA>AccB (Managed by CPRA and FCPR F05E5 A
instructions)
F PLCEquFlag It becomes active if AccA =AccB (Managed by CPRA and FCPR F05E6 A
instructions)
F PLCRestoreFault It becomes active if the data restore is an error (All the backup data A
are cleared)
F PLCBackupDisable Set by the user program it disables the data backup. D

F PLCBackupOneShot Set by the user program, it forces a single backup cycle, it's D
automatically resets.
(Valid only if the PLCBackupDisable=TRUE)
F PLCBackupEnd It becomes active for a program execution loop every backup cycle C
The backup cycle requires a number of program loops equal to: (Nr
backup bytes /4)+Nr backup bytes
Y PLCRtcYear Real time clock year value (Range 0 - 99) A

Y PLCRtcMonth Real time clock month value (Range 0 - 12) A

Y PLCRtcDay Real time clock day value (Range 0 - 31) A

Y PLCRtcWeekDay Real time clock day of the week value (Range 0 - 6) A


(0:Sunday, 1:Monday, 2:Tuesday, 3:Wednesday, 4:Thursday, 5:
Friday, 6:Saturday)
Y PLCRtcHour Real time clock hour value (Range 0 - 23) A

Y PLCRtcMinute Real time clock minutes value (Range 0 - 59) A

Y PLCRtcSecond Real time clock seconds value (Range 0 - 59) A

Y PLCRtcHundred Real time clock cent of second value (Range 0 - 99) A

Y PLCRandom Random value, it changes at every program loop (Range 0 - FF) C

W PLCSystemTime System time value, it's increased at every 1 mSec (Range 0 - FFFF) D

W PLCLoopTime Executed program loop time value, in mSec (Range 0 - FFFF) A

W PLCMinLoopTime Executed program minimum loop time value, in mSec (Range 0 - A


FFFF)
W PLCMaxLoopTime Executed program maximum loop time value, in mSec (Range 0 - A
FFFF)

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Reserved.htm (2 of 2) [06/10/2008 17.41.35]


RIL instructions characteristics

ELSIST Srl, www.elsist.it MNL041Q100

Index

RIL instructions characteristics

The language used by Remoter for the programming is called RIL (Remoter Instruction Language), it's
based on a set of instructions divided in function groups.

Type Description

Operand definition Instructions for the operand definition


Logic Instructions for the logical instructions management
Data management Instructions for the data management
Fixed math Instructions for the execution of the fixed math operations
Float math Instructions for the execution of the float math operations
Serial Instructions for the management of the serial line operation
Program management Instructions for the program management
Utility Utility Instructions

The instruction function is the operation that the function carries out in the rung. The instructions have 5
different functions we can identify the instructions of:

Function Description

Rung open Instructions defining the logical block beginning


Branch open Instructions opening a branching in the logical block
Branch modify Instructions modifying the logical block
Branch close Instructions closing a branching in the logical block
Rung close Instructions defining the logical block end

It is necessary that every logical block begins with a Rung open instruction and ends with at least one
Rung close. If some more instructions Rung close are inserted, they will be considered in parallel.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions.htm (1 of 2) [06/10/2008 17.41.35]


RIL instructions characteristics

An operand of an instruction is the variable treated by the instruction itself. An operand is usually made by a
type and an address. The instructions can have up to 3 operands, in some instructions the operands can be
optional.

There are some reserved operands, having a specific meaning in the program, see the summary page for a
full list.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions.htm (2 of 2) [06/10/2008 17.41.35]


Operand definition instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Operand definition instructions

These instructions allow the definition of the mnemonic operands. Instead of the numerical operands can
be used without definition, the mnemonic operands have to be define their mnemonic name, type and if are
local, global, backup or external.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, T, C, Y, W, DW, FL
DEFG DEFine Global operand None Y KD No A
Y Y KD

F, T, C, Y, W, DW, FL
DEFL DEFine Local operand None Y KD No A
Y Y KD

F, C, Y, W, DW, FL
DEFB DEFine Backup operand None No A
Y KD

EXTR EXTeRn operand None F, C, Y, W, DW, FL, L No A

SVIW Symbol VIeW None F, Y, W, DW, FL No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition.htm [06/10/2008 17.41.36]


Logic instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Logic instructions

These instructions allows you to realize the logical sequences, they can operate both on real inputs and
outputs and on internal variables as flags (F), timer (T), counter (C). Moreover you can use any bit of a
Byte (Y), Word (W) or Double (DW) operands as internal flag of program.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ORGR ORiGin Rung Rung open No A

C, F, I, O, T
LODT LOaD True Open branch No A
Y, W, DW K, BD, BH

C, F, I, O, T
LODF LOaD False Open branch No A
Y, W, DW K, BD, BH

C, F, I, O, T
ANDT AND logic True Modify branch No A
Y, W, DW K, BD, BH

C, F, I, O, T
ANDF AND logic False Modify branch No A
Y, W, DW K, BD, BH

C, F, I, O, T
ORLT OR Logic True Modify branch No A
Y, W, DW K, BD, BH

C, F, I, O, T
ORLF OR Logic False Modify branch No A
Y, W, DW K, BD, BH

ANDR AND logic True Close branch No A

ORLR OR Logic Rungs Close branch No A

F, O
OUTT OUT True Close rung No A
Y, W, DW K, BD, BH

F, O
OUTF OUT False Close rung No A
Y, W, DW K, BD, BH

F, O
LTCH LaTCH Close rung No A
Y, W, DW K, BD, BH

F, O
UTCH UnlaTCH Close rung No A
Y, W, DW K, BD, BH

MCRS Master Control Relay Start Close rung No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic.htm (1 of 3) [06/10/2008 17.41.38]


Logic instructions

MCRE Master Control Relay End Close rung No A

F, O
SBSR Step By Step Relay Close rung Yes A
Y, W, DW K, BD, BH

INRG INvert Rung Modify branch No A

PULS PULSe Modify branch No A

SETR SET Rung Open branch No A

RESR RESeT Rung Open branch No A

KD, KH, Y, W,
DW
OUTM OUt TiMer Close rung T No A
KD, KH, Y, W,
KE
DW

KD, KH, KO, KB,


CTUP CounTer Up Close rung C Yes A
Y

CTRS CounTer ReSet Close rung C No A

SHFT SHiFT Close rung F, O Yes A

SHRS SHift ReSet Close rung F, O No A

LODB LOaD Bit Open branch Y K No A

OUTB OUT Bit Close rung Y K No A

FSGN Float SiGN Open branch No A

Y, W, DW
Y, W, DW KD, KH, KO, KB
INCO INCrement Operand Close rung No C
FL
FL KF

Y, W, DW
Y, W, DW KD, KH, KO, KB
DECO DECrement Operand Close rung No C
FL
FL KF

KD, KH, KO, KB,


Y
Y
KD, KH, KO, KB,
W
GRTC GReaTher Compare Open branch W No A
KD, KH, KO, KB,
DW
DW
FL KF, FL

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic.htm (2 of 3) [06/10/2008 17.41.38]


Logic instructions

KD, KH, KO, KB,


Y
Y
KD, KH, KO, KB,
W
LESC LESs Compare Open branch W No A
KD, KH, KO, KB,
DW
DW
FL KF, FL

KD, KH, KO, KB,


Y
Y
KD, KH, KO, KB,
W
EQUC EQUal Compare Open branch W No A
KD, KH, KO, KB,
DW
DW
FL KF, FL

KD, KH, KO, KB,


Y
Y
KD, KH, KO, KB,
W
NTQC NoT eQual Compare Open branch W No A
KD, KH, KO, KB,
DW
DW
FL KF, FL

The instructions with the symbol are obsolete, they are reported only to maintain the compatibility with
the previous versions, we suggest to not use them in the new projects. Please follow the indications
reported in the instruction documentation.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic.htm (3 of 3) [06/10/2008 17.41.38]


Data management instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Data management instructions

In the RIL programs the data management is based on the use of two 32 bits accumulators, called AccA e
AccB, the instructions below allow you to operate on the two accumulators. Use the LODA instruction to
transfer the value from the operands to the AccA accumulator and the STRA instruction to transfer the
value from the AccA accumulator to the operands.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

K, KD, KH, KF, KO, KB, C,


LODA LOaD Accumulator Close rung No A
Y, W, DW, FL

STRA SToRe Accumulator Close rung Y, W, DW, FL No A

XCHA eXCHange Accumulators Close rung No A

ANDA AND Accumulators Close rung No A

ORLA OR Accumulators Close rung No A

XORA XOR Accumulators Close rung No A

RORA ROtate Right Accumulator Close rung K, KD, KH, Y No A

SHRA SHift Right Accumulator Close rung K, KD, KH, Y No A

ROLA ROtate Left Accumulator Close rung K, KD, KH, Y No A

SHLA SHift Left Accumulator Close rung K, KD, KH, Y No A

ASHX AScii to HeXadecimal Close rung No A

HXAS HeXadecimal to AScii Close rung No A

FIXC float to FIXed Conversion Close rung No A

FLTC fixed to FLoaTing Conversion Close rung No A

CPRA ComPaRe Accumulators Close rung No A

FCPR Float ComPaRe accumulators Close rung No A

BCDH BCD to Hexadecimal conversion Close rung No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng.htm (1 of 2) [06/10/2008 17.41.40]


Data management instructions

HBCD Hexadecimal to BCD conversion Close rung No A

POPA POP Accumulator Close rung No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng.htm (2 of 2) [06/10/2008 17.41.40]


Math instructions (Fixed)

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Math instructions (Fixed)

The math instructions operate on two accumulators AccA e AccB, the result is always transferred in AccA.
Use the LODA instruction to transfer the value from the operands to the AccA accumulator and the STRA
instruction to transfer the value from the AccA accumulator to the operands. Proper instructions of data
management allow you to operate on the data of the two accumulators.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ADDA ADD Accumulators Close rung No A

SUBA SUBtact Accumulators Close rung No A

MULA MULtiply Accumulators Close rung No A

DIVA DIVide Accumulators Close rung No A

INCA INCrement Accumulator Close rung KD, KH, KO, KB No A

DECA DECrement Accumulator Close rung KD, KH, KO, KB No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath.htm [06/10/2008 17.41.40]


Math instructions (Float)

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Math instructions (Float)

The math instructions operate on two accumulators AccA e AccB, the result is always transferred in AccA.
Use the LODA instruction to transfer the value from the operands to the AccA accumulator and the STRA
instruction to transfer the value from the AccA accumulator to the operands. Proper instructions of data
management allow you to operate on the data of the two accumulators.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FADD Float ADD accumulators Close rung No A

FSUB Float SUBtact accumulators Close rung No A

FMUL Float MULtiply accumulators Close rung No A

FDIV Float DIVide accumulators Close rung No A

FCHS Float CHange Sign accumulator Close rung No A

FINC Float INCrement accumulator Close rung KF No A

FDEC Float DECrement accumulator Close rung KF No A

FCLG Float Common LoGaritm Close rung No A

FPPI Float Push PI Close rung No A

FNLG Float Natural LoGaritm Close rung No A

FSIN Float SINe Close rung No A

FCOS Float COSine Close rung No A

FTAN Float TANgent Close rung No A

FSQR Float SQuare Root Close rung No A

FPOW Float raise to POWer Close rung No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath.htm [06/10/2008 17.41.41]


Serial instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Serial instructions

These instructions allow to operate on the serial line directly from the RIL program. You can define the
communication parameters and manage the data reception and transmission. We remind that the serial line
is buffered by the operating system, so the serial instructions will operate on the reception and transmission
buffers.

On targets that have mode than one serial line you need to define the serial line, which you want to
operate on, using the SETV instruction, the selection will remain active till a different selection.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SRXC Serial RX Characters received Close rung No A

SRXD Serial RX Data Close rung No A

STXC Serial TX Characters space Close rung No A

STXD Serial TX Data Close rung No A

STXI Serial TX data Immediate Close rung K, KD, KH No A

SMOD Serial MODe Close rung K, KH Yes A

DTRE Data Terminal Ready Enable Close rung K, KE No A

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial.htm [06/10/2008 17.41.42]


Program management instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Program management instructions

These instructions allow to manage the program execution by changing the flow. You can jump some parts,
run routines, run parts of program written in RIL, assembler or C language.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

LABL LABeL None K, L No A

JUMP JUMP to label Close rung K, L No A

CALL CALL function Close rung K, L No A

RETN RETurN from function Close rung K, L No A

CALF CALl File Close rung L No A

L
L Y A
TASK TASK call Close rung B Y No
W
C
W Y

K, KH, KD
TINE Temporal INterrupt Enable Close rung No A
K, KH, KD KE

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng.htm [06/10/2008 17.41.43]


Utility instructions

ELSIST Srl, www.elsist.it MNL041Q100

Instructions

Utility instructions

These instructions allows you to manage utility operations in the program.

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SETV SEt Terminal I/O device Vectors Close rung KE, W No A

CMPA CoMPress to Accumulator Close rung I, O, F No A

EXPA EXPand from Accumulator Close rung I, O, F No A

IOAQ I/O Acquisition Close rung K No A

I, O, F, C I, O, F, C
Y I, O, F, C, Y
W I, O, F, C, Y, W
MOVM MOVe Memory Close rung No A
I, O, F, C, Y, W,
DW
DW
FL FL

I, O, F, Y, W,
MOVA MOVe Address Close rung W No A
DW, FL, L

I, O, F, C, Y, W, K, KD, KB, KH,


MOVI MOVe Immediate Close rung DW KO No A
FL KF

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility.htm [06/10/2008 17.41.44]


How to

ELSIST Srl, www.elsist.it MNL041Q100

Index

How to

In this chapter some information more detailed and some examples are provided to help the user in the
solution of difficult problems.

Description

Make MODBUS Ascii network


Execute the startup function
Execute the average of a value
Manage RIL operands by C program
Modify the target device
Add a library in Remoter
Test a GSM MODEM
Test a PSTN MODEM
Use the smart card Sle4442
Set the BIOS configuration parameters
Visualize special characters on the terminal display
Manage warnings and alarms
Manage logic sequences on interrupt
Execute program backup and restore on mass memory
Define from user program the Netsyst extension module address
Adjust the Pt100 temperature transducers
Manage the Modem on target systems with kernel

http://192.168.0.61/Destination/Html/HowTo/HowTo.htm [06/10/2008 17.41.44]


Migrating from versions 7.x

ELSIST Srl, www.elsist.it MNL041Q100

Index

Migrating from versions 7.x

Remoter Version 8.x introduced a lot of new functions, like symbolic system programming and the "C"
language integration. All these new functions required a complete re - writing of the Remoter code and,
tough the efforts done in order to keep the compatibility with the programs written with the previous versions
7.x, the importing of projects written with the previous versions requires some small manual intervention.

Files RLD and RIL

Once imported in the new Remoter Version, the RLD and RIL files will have to be updated as follow:

For all the operands (F, Y, W) that have addresses included between 05C0 and 05FF, the numerical
address will have to be replaced with the correspondent symbolic indication, see the default operands
table. So for example the instruction LODT F 05D0, will become LODT F PLCFirstLoop, the
instruction LODT F 05D4 will become LODT F PLCTimeBase400 and so on
All the OUTM instructions will have to be updated replacing, in the time indication, the (K) constant
with the (KD) constant. So for example the instruction OUTM T OOOO K OO10 will become
OUTM T 0000 KD 0010.
If in the program was used backup counters (from C 0040 to C 007F) they must be changed with
mnemonic counters defined in the backup memory with the DEFB instruction.
If in the program the function blocks FB 0024 or FB 0032 were used for the conversion from
hexadecimal to BCD, it will be necessary to remove them and use the new instruction HBCD HBCD.
If in the program was used the function block FB 0025 for the conversion from BCD to hexadecimal, it
will be necessary to remove it and use the new instruction BCDH.
If in the program the function block FB 0028 of flag settings was used on index, it will be necessary to
remove it and use the new instruction EQUC to compare the byte value with a constant that
represents the desired value of the flag.
If in the program the function block FB 0036 of real time clock management was used , it will be
necessary to remove it and use the default operands of clock management.
If in the program the function block FB 0037 of multiplication between words was used, it will be
necessary to remove it and use the new MULA instruction.
If in the program the function block FB 0038 of division between words was used, it will be necessary
to remove it and use the new DIVA instruction.
The accumulator acts on 32 bits, in the 7.x versions acted on 16 bits, so ROLA instruction has a
different behaviour. Charging in accumulator the 0x8000 value and doing a ROLA K 0001, saving the
result in a (W), it will be obtained 0x0000, instead of 0x0001 with the previous versions.
The accumulator acts on 32 bits, in the 7.x versions acted on 16 bits, so RORA instruction has a
different behaviour. Charging in accumulator the 0x8000 value and doing a RORA K 0001, saving the
result in a (W), it will be obtained 0x0000, instead of 0x1000 with the previous versions.

PICOFACE file messages

http://192.168.0.61/Destination/Html/Appendix/Migrate/Versions7x.htm (1 of 2) [06/10/2008 17.41.45]


Migrating from versions 7.x

Concerning the Picoface file messages, you don’t need any importing instrument, so the file messages will
have to be rewritten in the imported program using the specific FB graphic management.

http://192.168.0.61/Destination/Html/Appendix/Migrate/Versions7x.htm (2 of 2) [06/10/2008 17.41.45]


Migrating from versions 8.0

ELSIST Srl, www.elsist.it MNL041Q100

Index

Migrating from versions 8.0

All the programs written with Remoter Version 8.0.x can be directly imported to the Version 8.1.x opening
the project workspace. However, there are some operations to be done manually on the project files, to
make them compatible with the new version. Once imported the files, is essential to compile all the files of
the project and then save both the project and the workspace.

Files RLD and RIL

Once imported in the new Remoter Version, the RLD and RIL files will have to be updated as follow:

The function blocks management by graphic utility for both MODBUS communication and terminal
management, in the previous versions needed the project library automatic definition. In the new
version it is necessary to define the use in the project settings
The function blocks are not identified anymore with a progressive number but with a function name,
therefore it is necessary to research all the call instructions and replace the function block number with
the correspondent name. For example, the instruction TASK B 0018 Y 0000 or the instruction
TASK L Pfb018 Y 0000 will have to become TASK L FbEncoderOverIO Y 0000. For a complete list
of the function blocks and their correspondent names make reference to the list page. Updating
suggested, not indispensable.

C Files

Once imported in the new Remoter Version, the C files will have to be updated as follow:

The function blocks are not identified anymore with a progressive number but with a function name,
therefore it is necessary to research all the call instructions and replace the function block number with
the correspondent name. For example, the inclusion #include <Pfb018b000.h> will have to
become#include <FbEncoderOverIO.h>.
The function blocks are not identified anymore with a progressive number but with a function name,
therefore it is necessary to research all the call instructions and replace the function block number with
the correspondent name. For example, the instruction Pfb018(&EncoderStruct); will have to become
FbEncoderOverIO(&EncoderStruct). Also the definition of the data structures type has been
modified in the same way, for example, the statement FB018_DATASTRUCT EncoderStruct will
have to become FBENCODEROVERIODATA EncoderStruct. Updating suggested, not
indispensable.
The libraries are not identified anymore with a number depending on the target system but with a
name that is the same for all the targets, this makes easier to turn a program from a target to another
one. Therefore it is necessary to research all the inclusions of definition files and replace the function
block number with the correspondent name. For example, the inclusion #include <Sfr026c000> will
have to become #include <ElSystemLib.h>.

Function blocks name reference table

http://192.168.0.61/Destination/Html/Appendix/Migrate/Version80.htm (1 of 2) [06/10/2008 17.41.46]


Migrating from versions 8.0

Number Name New name Data structure New data structure

0018 Pfb018 FbEncoderOverIO PFB018_DATASTRUCT FBENCODEROVERIODATA


0033 Pfb033 FbPsystAnaCp PFB033_DATASTRUCT FBPSYSTANACPDATA
0035 Pfb035 FbCounterOverIO PFB035_DATASTRUCT FBCOUNTEROVERIODATA
0042 Pfb042 FbModbusAsciiSl PFB042_DATASTRUCT FBMODBUSASCIISLDATA
0043 Pfb043 FbIOComm PFB043_DATASTRUCT FBIOCOMMDATA
0044 Pfb044 FbModbusAsciiMs PFB044_DATASTRUCT FBMODBUSASCIIMSDATA
0047 Pfb047 FbPsystADSubm PFB047_DATASTRUCT FBPSYSTADSUBMDATA
0048 Pfb048 FbPsystDASubm PFB048_DATASTRUCT FBPSYSTDASUBMDATA
0050 Pfb050 FbNetlogAD PFB050_DATASTRUCT FBNETLOGADDATA
0051 Pfb051 FbNetlogDA PFB051_DATASTRUCT FBNETLOGDADATA
0056 Pfb056 FbPIDMng PFB056_DATASTRUCT FBPIDMNGDATA

Library reference table

Library Previous inclusion Actual inclusion

Sfr013 #include <Sfr013e000> #include <ElSystemLib.h>


Sfr025 #include <Sfr026b000> #include <ElSystemLib.h>
Sfr026 #include <Sfr026c000> #include <ElSystemLib.h>
Sfr036 #include <Sfr036a000> #include <ElPLCLib.h>
Sfr037 #include <Sfr037a000> #include <ElSystemLib.h>

http://192.168.0.61/Destination/Html/Appendix/Migrate/Version80.htm (2 of 2) [06/10/2008 17.41.46]


Ascii code table

ELSIST Srl, www.elsist.it MNL041Q100

Index

Ascii code table

To send out to the serial line text strings by using the STXI e STXD instructions, the Ascii code must be
used it uses a 8 bits hexadecimal data to codify all the characters. In the table below the code used:

ASCII codes

http://192.168.0.61/Destination/Html/Appendix/Documents/AsciiTable.htm (1 of 2) [06/10/2008 17.41.47]


Ascii code table

Extended ASCII codes

http://192.168.0.61/Destination/Html/Appendix/Documents/AsciiTable.htm (2 of 2) [06/10/2008 17.41.47]


Error list

ELSIST Srl, www.elsist.it MNL041Q100

Index

Error list

All the project compiling phases can produce errors that are reported with the indication of a number for an
easier identification. For the different phases we will have groups of numbers as indicated in the following
table:

Phase Error range Description

Scanner RME100 RME199 The scanner considers all the project RIL files examining the
instructions and the operands contained.
Parser RME200 RME299 The parser considers all the project RIL files examining the instructions
and the operands contained.
RFB Converter RME300 RME349 The RFB converter converts all the project FB graphics files,
examining the instructions and the operands contained.
RLD Converter RME350 RME399 The RLD converter converts all the project files written in ladder
diagram, examining the instructions and the operands contained.
AOF Converter RME400 RME499 The AOF converter converts the file created by the linker in the Intel-
hex format to be transferred on the target system.
Linker RMW500 RMW549 The linker merges the different project files in one program file to be
RME500 RME549 passed to the AOF converter.
Assembler RMW550 RMW599 The assembler converts the files written in assembler language in the
RME550 RME599 format to be interpreted by the linker.
Compiler RMW600 RMW649 The compiler converts the files written in C language in the format to
RME600 RME649 be interpreted by the linker.
Project RMW650 RMW699 Before to execute all the project compiling phases all the project
RME650 RME699 settings are checked.

http://192.168.0.61/Destination/Html/Appendix/Errors/Errors.htm [06/10/2008 17.41.47]


Libraries

ELSIST Srl, www.elsist.it MNL041Q100

Index

System libraries "ElSystemLib"

For every target system the related library of system is supplied. Here follows the table with references
between the libraries and the different target systems.

Code Description

SFR025 Library for Netlog systems History report

SFR026 Library for Picosyst systems History report

SFR037 Library for Netreader with Temic T89C51 microcontroller systems History report

SFR038 Library for Netlog II lite systems History report

SFR039 Library for Netreader with Philips P89C664 microcontroller systems History report

SFR043 Library for Picosyst special and NetlogII systems History report

PLC libraries "ElPLCLib"

For every target system the related library PLC is supplied. Here follows the table with references between
the libraries and the different target systems.

Code Description

Library for Picosyst systems


Library for Picosyst special systems
Library for Netlog systems
SFR036 Library for NetlogII systems History report
Library for NetlogII lite systems
Library for Netreader with Temic T89C51 microcontroller systems
Library for Netreader with Philips P89C664 microcontroller systems

http://192.168.0.61/Destination/Html/Appendix/Libraries/Libraries.htm [06/10/2008 17.41.48]


Memory map

ELSIST Srl, www.elsist.it MNL041Q100

Index

Memory map

Every target system is characterized by its own memory configuration, the access to the memory is
possible by using the SystemMemoryRead, SystemMemoryWrite functions. It's necessary to set the proper
memory configuration in the project settings according to the target system.

Family Code System Backup Memory map

CPU016**00 Picosyst Millenium CPU (All versions)


MPS026**** Picolog Millenium (All versions)
MPS027***0 Facelog Millenium (All versions)
OIF018*0*0 Picoface Millenium (All versions)
Picosyst
CPU017**00 Picosyst MilleniumII CPU (All versions)
MPS036**** Picolog MilleniumII (All versions)
MPS037**** Facelog MilleniumII (All versions)
OIF020*0*0 Picoface MilleniumII (All versions)
MPS022*** Netlog (All versions)
MPS024**0* NetReader PHI 89C51RD2 based (All versions
MPS024**1* NetReader ATM AT89C51RD2 based (All versions)
MPS024**2* NetReader PHI P89C664 based (All versions)
MPS024**3* NetReader ATM AT89C51ED2 based (All versions)
MPS029**** Netlog II Lite (All versions)
MPS030**** NetMaster II TINI (All versions)
Netsyst
MPS031**** NetMaster II SNAP (All versions)
MPS033**** NetMaster II TSTIK (All versions)
MPS034*** Netlog II (All versions)
NetReader Main Board ATM AT89C51RD2 based (All
PCB104**1*
versions)
PCB104**2* NetReader PHI P89C664 based (All versions)
PCB104**3* NetReader ATM AT89C51ED2 based (All versions)

Backup memory

In some systems exists a retentive memory for the data backup, it can be battery backed up RAM or
EEPROM. The backup is executed by transferring the data memory area selected as back memory in the
retentive memory, for the definition of the backup area and the type and address of the retentive memory to
use, see project settings.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/MemoryMap.htm [06/10/2008 17.41.48]


Loaders

ELSIST Srl, www.elsist.it MNL041Q100

Index

Loaders

All the targets systems have a loader program, it allows the transfer of the application developed with
Remoter, in the target device by using the selected communication media. Usually it's used the serial line.
Some loaders are supplied from the manufacturer of the microcontroller and are residents in it, other were
specially developed for the purpose.

Any loader has a proper set of commands, the loaders supplied by the manufacturer of the microcontroller
usually use a different set of ascii commands for every type of microcontroller used. The loaders specially
developed for the purpose, uses the Modbus RTU protocol with some specially implemented commands.

Is important to set the correct loader for the target device using the project settings procedure,
otherwise will be not possible to upload the application on the target.

In the following table we report the loaders code referred to the proper target system.

Code Description

SFW142 NetlogII systems loader History report

SFW147 Picosyst ME II systems loader History report

SFW152 Picosyst ME III systems loader History report

SFW154 Picosyst ME III systems loader (With PICOLOG1st series emulator package) History report

http://192.168.0.61/Destination/Html/Appendix/Loaders/Loaders.htm [06/10/2008 17.41.49]


Kernels

ELSIST Srl, www.elsist.it MNL041Q100

Index

Kernels

Some target systems have a kernel program that besides to allow the transfer of the application developed
with Remoter in the device, contains all the of interface functions between the user program and the target
device hardware. Using the kernel functions it's possible to maintain the compatibility of the user program
with the different versions of available hardware.

To allow the transfer of the application developed with Remoter in the device, the kernel uses the Modbus
RTU protocol with some specially implemented commands.

Is important to set the correct kernel for the target device using the project settings procedure,
otherwise the user program doesn't work properly.

In the following table we report the kernels code referred to the proper target system.

Code Description

SFW146 NetlogII systems kernel History report

SFW149 Picosyst ME II system kernel History report

SFW153 Picosyst ME III system kernel History report

Kernel variables

In the kernel exist variables allocated at absolute addresses it is possible to visualize their value with the
debug procedure from Remoter. The value of every variable allows a detailed information on the the kernel
status.

The allocation of these variables is reported only to allow to debug them. It is unadvised to reference
in the user program to the addresses reported, the allocation it's s not guaranteed.

Type Address Variable Description

BOOL 0xE000 UserModuleError User module error flag. It's activated by the
ExecutetKernelFct function, it allows to the user
program to force the run led to blink with error code.
BOOL 0xE001 SwitchToKernelCode Code memory access exchange flag. If set the
commands of modbus kernel, when access to the
code memory, are directed towards to the kernel code
memory allowing to perform the debug of the kernel
code.
unsigned int 0xE002 WrongFctsAdd Function call error address. If the user program calls a
kernel that does not exist, in the variable it's saved the
address of the function called.

http://192.168.0.61/Destination/Html/Appendix/Kernels/Kernels.htm (1 of 2) [06/10/2008 17.41.50]


Kernels

TERMIOVECTORS* 0xE004 TermIOInError Terminal I/O error address. If the user program sets
an I/O terminal that does not exist SystemErrors.
IODeviceNotCorrect flag set, in the variable it's
saved transferred the address of the terminal set.
unsigned char 0xE008 NSystModError Nsyst module error address. If the user program
accesses on Nsyst bus to a module that does not
exist, besides the set of the SystemErrors.
NSYSTModAddress flag it's saved in this variable the
address of the module accessed.
unsigned char 0xE012 LoaderRunSts Kernel execution command from loader status report.
unsigned int 0xE010 KrnCfgWrCode Kernel configuration warning code. If a warning in
kernel configuration is detect, KernelErrors.
KrnCfgWarning bit set, in this variable the parameter
code in warning is returned.
unsigned int 0xE012 KrnCfgErCode Kernel configuration error code. If an error in kernel
configuration is detect, KernelErrors.KrnCfgError bit
set, in this variable the parameter code in error is
returned.
unsigned int 0xE014 PrjCfgWrCode Project configuration warning code. If a warning in
project configuration is detect, KernelErrors.
PrjCfgWarning bit set, in this variable the parameter
code in warning is returned.
unsigned int 0xE016 PrjCfgErCode Project configuration error code. If an error in project
configuration is detect, KernelErrors.PrjCfgError bit
set, in this variable the parameter code in error is
returned.
unsigned int 0xE018 KrnReadVarErID KernelReadVar function error code. If an error is
detect, KernelErrors.KrnReadVarErID bit set, in this
variable the variable ID in error is reported.
unsigned int 0xE01A KrnWriteVarErID KernelWriteVar function error code. If an error is
detect, KernelErrors.KrnWriteVarErID bit set, in this
variable the variable ID in error is reported.

http://192.168.0.61/Destination/Html/Appendix/Kernels/Kernels.htm (2 of 2) [06/10/2008 17.41.50]


Netsyst line

ELSIST Srl, www.elsist.it MNL041Q100

Index

Netsyst line

MPS022**** Netlog
It's a programmable controller, engineered in standard container DIN43880,
which offers an economical solution of the automation problems. Based on
ADuC812 Analog devices (core MCS51 compatible) microcontroller, it has, as
base module, of 12 optoisolated logic inputs, 8 relays or static logic outputs, 4
analog inputs 0÷10Vdc 12bit, 2 analog outputs 0÷2,5Vdc 12bit and 2 serial port
RS232. Manual
MPS024**2* Netreader
It's a programmable controller equipped with smart card interface. This feature
makes it particularly interesting in the applications in which, at the classic
management of the logics typical of the PLC, it is necessary to have an
identification system. Based on T89C51 Temic (core MCS51 compatible)
microcontroller, it disposes, as base module of 6 optoisolated logic inputs, 4
relays or static logic outputs, a serial port RS232. Manual
MPS029****, NetlogII lite
It is a programmable controller, engineered in standard container DIN43880,
which offers an economical solution of the automation problems. Based on
ADuC845 Analog devices (core MCS51 compatible) microcontroller, it
disposes, as base module, of 12 optoisolated logic inputs, 8 relays or static
logic outputs, 4 analog inputs 0÷10Vdc 16bit, 2 analog outputs 0÷10Vdc 12bit
and 1 serial port RS232. Manual
MPS031****, Netmaster SNAP
MPS033****, Netmaster TSTICK
Is a network I/O interface, that offer a flexible and cheap solution to the remote
control problems and to data acquisition through internet/intranet networks.
The I/O section is based on ADuC845 Analog devices (core MCS51
compatible) microcontroller, it disposes, as base module, of 12 optoisolated
logic inputs, 8 relays or static logic outputs, 4 analog inputs 0÷10Vdc 16bit, 2
analog outputs 0÷10Vdc 12bit and 1 serial port RS232. RS485 version
manual CAN version manual
PCB099****, 20 I/O extension module
The module is engineered in a standard DIN43880 enclosure. Based on
ADuC845 Analog devices (core MCS51 compatible) microcontroller it provides
12 optoisolated digital input, 8 isolated digital output, 4 analog inputs 0-10V (or
RTD) 16bit resolution, 2 analog outputs 0-10V. Each digital input/output is
equipped with LED status indicator. Manual

http://192.168.0.61/Destination/Html/Appendix/Targets/Netsyst.htm (1 of 2) [06/10/2008 17.41.51]


Netsyst line

PCB104**1* Netreader (OEM version)


The smart-card reader card is the semiwork component of Netreader and is
supplied separately as spare part or as component for systems integrators.
Based on T89C51 Temic (core MCS51 compatible) microcontroller, it disposes
of 6 optoisolated logic inputs, 4 relays or static logic outputs, a serial port
RS232. Manual

PCB104**2*, 10 I/O extension module


The module is engineered in a standard DIN43880 enclosure. Based on
P89C664 Philips (core MCS51 compatible) microcontroller it disposes of 6
optoisolated digital inputs, 4 relays or static digital outputs, 1 RS232 serial port
and a smart card interface. Manual

http://192.168.0.61/Destination/Html/Appendix/Targets/Netsyst.htm (2 of 2) [06/10/2008 17.41.51]


Picosyst line

ELSIST Srl, www.elsist.it MNL041Q100

Index

Picosyst line

CPU016**00, CPU Picosyst Millennium


The module CPU Picosyst Millennium is the central unit base of all the product of the
Picosyst ME line and is supplied separately as spare part or as semiwork for systems
integrators. The module is available in three different versions, differentiated for type of
processor and for number and type of serial interface. Manual

MPS026*0*0, PICOLOG Millennium relays


It is a programmable controller of little dimension, which offers an economical solution to
the littlest problems of automation. It is equipped, as a base module, with 16 optoisolated
logic inputs, 8 relays logic outputs. Every I/Os is provided with LED of status indication.
Manual

MPS026*3*0, PICOLOG Millennium static


It is a programmable controller of little dimension, which offers an economical solution to
the littlest problems of automation. It is equipped, as a base module, with 16 static logic
inputs and 16 logic outputs. Every I/Os is provided with LED of status indication.
Manual

MPS027***0, FACELOG
It is a hybrid operator terminal, equipped with optoisolated digital entries and exits, it
integrates, in just one product, the hardware e software features of a static PICOLOG
and of a PICOFACE. The shape and use flexibility is maintained and improved anyway,
with further containment of the costs. Manual

OIF018*0*0, PICOFACE
It is a low cost operator terminal, for panel assembly, specially designed to be combined
with the products of the Picosyst Millennium line. It permits an interactive dialog with the
operator through the showing of alphanumerical messages and numerical variables,
which can also be input. Manual

http://192.168.0.61/Destination/Html/Appendix/Targets/Picosyst.htm [06/10/2008 17.41.52]


Workspaces list

ELSIST Srl, www.elsist.it MNL041Q100

Index

Workspaces list

With Remoter are supplied some application and example programs, al the programs are supplied as
workspaces. To load this programs is necessary to choose the Open Workspace... item of the File menu,
it will be displayed a windows like this:

Figure 1

The windows is divided in for tabs:

Existing It allows the directory browsing to search for a workspace. The search starts from the
directory definite in the Work directory options of Remoter. The open workspace will be
saved in the Recents.
Recents It contains list of the last opened workspaces.
Applications It contains list of the application programs.
Examples It contains list of example programs.

By selecting with the mouse the workspace name, in the window below a brief description of it will be

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Workspaces.htm (1 of 2) [06/10/2008 17.41.52]


Workspaces list

displayed. By double clicking on the workspace name it will be opened in Remoter.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Workspaces.htm (2 of 2) [06/10/2008 17.41.52]


HT004

ELSIST Srl, www.elsist.it MNL041Q100

How to

Manage RIL operands by "C" program

Numerical operands

All the numerical operands are accessible from program C. Proper macrofunctions divided for type of operand
permit to entry in writing and in reading to all the operands addressable, you need to define the addresse of the
operand in esadecimal so as indicated in the program RIL.

Type Description C Macrofunction

DW Memory double word PLCOpDW(Address)


F Logic flag PLCOpF(Address)
FL Float PLCOpFL(Address)
I Logic input PLCOpI(Address)
O Logic output PLCOpO(Address)
W Memory word PLCOpW(Address)
Y Memory byte PLCOpY(Address)

In the following example, from program C some operands are acquired from language RIL.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES DEFINITION
// -----------------------------------------------------------------------------

BOOL InputValue;
BOOL OutputValue;
BOOL FlagValue;
unsigned char ByteValue;
unsigned int WordValue;
unsigned long DoubleValue;
float FloatValue;

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
InputValue=PLCOpI(0x0001); //To read the input 0001
PLCOpI(0x0001)=InputValue; //To write the input 0001

http://192.168.0.61/Destination/Html/HowTo/HT004.htm (1 of 3) [06/10/2008 17.41.53]


HT004

OutputValue=PLCOpO(0x0001); //To read the output 0001


PLCOpO(0x0001)=OutputValue; //To write the output 0001

FlagValue=PLCOpF(0x0010); //To read the flag 0010


PLCOpF(0x0010)=FlagValue; //To write the flag 0010

ByteValue=PLCOpY(0x000A); //To read the Byte 000A


PLCOpY(0x000A)=ByteValue; //To write the Byte 000A

WordValue=PLCOpW(0x001C); //To read the word 001C


PLCOpW(0x001C)=WordValue; //To write the word 001C

DoubleValue=PLCOpDW(0x0004); //To read the double word 0008


PLCOpDW(0x0004)=DoubleValue; //To write the double word 0008

FloatValue=PLCOpFL(0x0010); //To read the float 0010


PLCOpFL(0x0010)=FloatValue; //To write the float 0010
}

// [End of file]

Mnemonic operands

To entry a mnemonic operand, you need to define it as global operand (Instructions DEFG, DEFB). From C
program define an external variable of the same type of the operand putting before the mnemonic a
suffix that depends on the type so as in the following table. As already expressed previously the operands
(I) and (O) cannot be declared in mnemonic way.

Type Description RIL Declaration Suffix C Definition

DW Memory double word DEFG DW Name


PLC_DW_ extern unsigned long PLC_DW_Name
DEFB DW Name
F Logic flag DEFG F Name
PLC_F_ extern BOOL PLC_F_Name
DEFB F Name
FL Float DEFG FL Name
PLC_FL_ extern float PLC_FL_Name
DEFB FL Name
W Memory word DEFG W Name
PLC_W_ extern unsigned int PLC_W_Name
DEFB W Name
Y Memory byte DEFG Y Name
PLC_Y_ extern unsigned char PLC_Y_Name
DEFB Y Name

In the following example, some global operands are declared by RIL language, by C program an external
variable is declared for every operand. As an example in the program loop the reading and the writing of the
flag operand is executed.

RIL C program

http://192.168.0.61/Destination/Html/HowTo/HT004.htm (2 of 3) [06/10/2008 17.41.53]


HT004

DEFG F IsFlag extern BOOL PLC_F_IsFlag;


DEFB Y IsByte extern unsigned char PLC_Y_IsByte;
DEFB W IsWord extern unsigned int PLC_W_IsWord;
DEFG DW IsDouble extern unsigned long PLC_DW_IsDouble;
DEFG FL IsFloat extern float PLC_FL_IsFloat;

void Example(void)
{
// Local variable declarations.

BOOL FlagValue;

// External flag access example.

FlagValue=PLC_F_IsFlag; //This read the value


PLC_F_IsFlag=FlagValue; //This write the value
}

reserved operands

All the predefined operands are directly accessible by C program. In the following example some of them are
used.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static unsigned long SecsCtr; //Seconds counter

// -------------------------------------------------------------------------
// PROGRAM EXECUTION
// -------------------------------------------------------------------------
// Execute the variable init at first program execution loop.

if (PLCFirstLoop)
SecsCtr=0; //Seconds counter

// Increase the seconds counter at every second.

if (PLCPulse1000)
SecsCtr++; //Seconds counter
}

// [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT004.htm (3 of 3) [06/10/2008 17.41.53]


Example programs

ELSIST Srl, www.elsist.it MNL041Q100

Worspaces list

Example programs

Normally the example programs are realized for a specific target system, but it's easy to change the
target system to adapt the program to the proper needs, please refer to the relate documentation.

PTP001F100 : Alias "LogicInstructionsTutorial"


Reports a series of logic instructions examples in RIL language.

PTP002F100: Alias "MathInstructionsTutorial"


Reports a serine of mathematical instructions examples in RIL language.

PTP021B100: Alias "Alarms"


Shows how the FbSysTerminal FB manages the alarm messages. A date and time message display
is provided.

PTP053F100: Alias "Vt100Terminal"


Program that emulates part of the VT100 terminal commands on a Picoface terminal. The program
is developed in C language.

PTP055B100: Alias "RemoteIOControl"


This program should be used with a Visual Basic program that using PICOTEL allows the logic
inputs reading and the logic output management by the PC.

PTP058E100:Alias "MotorSpeed"
It calculates the motor rotation speed using an encoder fixed on the shaft. To read the encoder is
used the FbEncoderOverIO executed in interrupt.

PTP076B100: Alias "MultiplexerIO"


It transfers logic and analog I/Os between two Picolog Millennium systems in master/slave
configuration. It can be easy modified in order to use cable or radiomodem connections

PTP077C100: Alias "CallFilesTutorial"


It shows how to call files by using the CALF instruction. The program is written Siemens PLC like, a
OB1 main file calls the FB100 and FB200 logic files.

PTP080A100: Alias "Ramp"


By using a function in RIL language, it shows how it's possible to manage a ramp.

PTP081A100: Alias "MemoryByIndex"


It shows how it's possible to manage a data array access by using an index.

PTP082A100: Alias "SMSSend"


SMS messages send, the program uses the FbModemMng.

PTP083A100: Alias "PrintTest"


It shows how to print out by the serial line alphanimeric strings. The strings can be send to a printer.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Examples.htm (1 of 2) [06/10/2008 17.41.54]


Example programs

PTP087D000: Alias "CLIPAndSMSManager"


Complete demo about the use of the MODEM management FB, FbModemMng. The program allows
to identify the calling number CLIP, to execute orders on reception of SMS messages, to send SMS
messages on events and of to activate the data communication on call, see relate documentation.

PTP088A100: Alias "AnalogIOManagement"


Complete demo about the use of FbNetlogIIAD and FbNetlogIIDA that manages the analog
acquisition and the analog output on NetlogII lite systems.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Examples.htm (2 of 2) [06/10/2008 17.41.54]


Program management instructions: TASK

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

TASK

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

L A
L Y A
TASK TASK call Close rung B Y No A
W C
W Y C

The instruction TASK call allows the functions written in other languages to be executed directly from the
RIL program, allows the execution of standard function blocks (FB) supplied as libraries or developed by a
client. It also allows to execute functions loaded at relative address.

To execute a function blocks (FB), the function block type (B) must be used as 1st operand followed by the
function block to be executed. The second operand defines the memory Byte (Y) address allocation for the
function block.

To execute a function written in other languages, the label type (L) must be used as 1st operand followed
by the name of the function. The second operand (optional) defines the address Byte (Y) of memory
allocation for the function.

To execute a function loaded at relative address, it is necessary to memorize the address in a Word (W)
and use as it 1st operand. The second operand (optional) defines the address Byte (Y) of memory
allocation for the function.

Examples

In the following example, if the I 0000 is active the function block FbCounterOverIOis executed, defining
Y 0100 as the allocation address of the data structure. When the function block ends, the program
execution continues from the next branch.

Ladder RIL "C" language


ORGR
LODT I 0000
TASK L FbCounterOverIO Y 0100

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Task.htm [06/10/2008 17.41.55]


Program management instructions: CALF

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

CALF

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CALF None CALl File Close rung L No A

The instruction CALl File should be used to call the RLD, RIL o RFB files in the project with the option
Autocalled file disabled (See project rules). The call depends on the status of the logical branch where the
instruction is and is executed only if it is active. When the instruction is active, the program in the called file
is executed. When the program ends, executions backs to the instruction that follows it. You can nesting
CALF instructions without any limit.

ATTENTION! The instruction execution doesn't change the status of logic stack.

Examples

A specific example of the use of this instruction is in the Ptp077, see the example programs

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Calf.htm [06/10/2008 17.41.55]


Programming

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Programming

This window allows to configure the communication settings with the target device for the programming operations.

Figure 1

In the Protocol section it's possible to define the type of protocol to be used to program the target system.

Analog Devices uC Loader Uses the proprietary Analog Devices protocol, it's present in the ADuC845 microcontrollers.
Atmel 89C51 Loader Uses the proprietary Atmel protocol, it's present in the 89C51 microcontrollers.
Modbus Uses the ModBus communication protocol.
Philips 89C51 Loader Uses the proprietary Philips protocol, it's present in the 89C51 microcontrollers.

In the Media, section it's possible to define the type of media to be used to program the target system.

Serial direct The PC serial port will be used, it's possible to select any PC COM port.
TCP/IP The TCP/IP protocol over ethernet, on PPP connection, over Internet will be used.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Programming.htm [06/10/2008 17.41.56]


Analog Devices loader settings

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Analog Devices loader settings

It allows to define the Analog Devices proprietary loader settings.

Figure 1

Answer Timeout Define the time to wait the answer after a command.
Max Data Record Length Define the maximun length of data record.
Allows High Baud Rate Selected forces Remoter to increase the baud rate during the program upload, reducing the time needed.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Protocol/ADuCLoaderSet.htm [06/10/2008 17.41.57]


Atmel loader settings

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Atmel loader settings

It allows to define the Atmel 89C51 proprietary loader settings.

Figure 1

Answer Timeout Define the time to wait the answer after a command.
Max Data Record Length Define the maximun length of data record.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Protocol/AtmelLoaderSet.htm [06/10/2008 17.41.57]


Modbus protocol

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Modbus protocol

This window allows to define the modbus protocol parameters.

Figure 1

Modbus Type Defines the type of modbus protocol to be used to program the target system.
Slave Node Number Defines the target Modbus node number.
Answer Timeout Defines the waiting time for the answer from the target system. After this time an error timeout is detect.
Command Wait Time Defines the waiting time after the reception of the command answer and the send of a new command.
Max Data Record Length Defines the maximum length of the record data to be used to dialogue with the target system.
Allows High Baud Rate Selected allows to automatically change the baud rate when upload program is started.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Protocol/Modbus.htm [06/10/2008 17.41.58]


Philips loader settings

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Philips loader settings

It allows to define the Philips 89C51 proprietary loader settings.

Figure 1

Answer Timeout Define the time to wait the answer after a command.
Max Data Record Length Define the maximun length of data record.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Protocol/PhilipsLoaderSet.htm [06/10/2008 17.41.58]


Serial set

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Serial set

This window allows to define the serial parameters.

Figure 1

Baud rate Defines the communication baud rate.


Data Bits Defines the data bits length.
Parity Defines the parity.
Stop Bits Defines the number of stop bits.
Flow Control Select the flow control mode.
Port Select the COM port to use for debugging.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Media/SerialSet.htm [06/10/2008 17.41.59]


Serial driver setting

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Serial driver

This window allows the setting of the serial driver parameter as reported in the figure below.

Figure 1

Enable Driver Capability Selected, enables the serial driver allowing the options set.
Wait Time Before Tx Indicates the wait time between the Tx signal activation and the and the real transmission of the characters
Wait Time After Tx Indicates the wait time between the transmission of the last character and the Tx signal deactivation.
Clear Tx Echo Selected forces the clear of the echo received string.
Tx Signal Complement Selected complement the status of the selected signal for Tx enable.
Tx Signal Management Defines the operation way of the selected signal for Tx enable.
Signal for Tx Enable Defines the signal must be used to enable the transmission.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Media/DriverSet.htm [06/10/2008 17.41.59]


TCP/IP set

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

TCP/IP set

This window allows to set the TCP/IP communication settings for the programming communication.

Figure 1

IP Address Defines the IP address of the interface device connected with the target system.
Port Defines the port of the interface device connected with the target system.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Programming/Media/TCPIPSet.htm [06/10/2008 17.42.00]


Modbus protocol

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Modbus protocol

This window allows to define the modbus protocol parameters.

Figure 1

Modbus Type Defines the type of modbus protocol to be used to debug application on target system.
Slave Node Number Defines the target Modbus node number.
Answer Timeout Defines the waiting time for the answer from the target system. After this time an error timeout is detect.
Command Wait Time Defines the waiting time after the reception of the command answer and the send of a new command.
Max Data Record Length Defines the maximum length of the record data to be used to dialogue with the target system.
Allows High Baud Rate Selected allows to automatically change the baud rate when debug is started.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Debugging/Protocol/Modbus.htm [06/10/2008 17.42.00]


Serial set

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Serial set

This window allows to define the serial parameters.

Figure 1

Baud rate Defines the communication baud rate.


Data Bits Defines the data bits length.
Parity Defines the parity.
Stop Bits Defines the number of stop bits.
Flow Control Select the flow control mode.
Port Select the COM port to use for debugging.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Debugging/Media/SerialSet.htm [06/10/2008 17.42.01]


Serial driver setting

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

Serial driver

This window allows the setting of the serial driver parameter as reported in the figure below.

Figure 1

Enable Driver Capability Selected, enables the serial driver allowing the options set.
Wait Time Before Tx Indicates the wait time between the Tx signal activation and the and the real transmission of the characters
Wait Time After Tx Indicates the wait time between the transmission of the last character and the Tx signal deactivation.
Clear Tx Echo Selected forces the clear of the echo received string.
Tx Signal Complement Selected complement the status of the selected signal for Tx enable.
Tx Signal Management Defines the operation way of the selected signal for Tx enable.
Signal for Tx Enable Defines the signal must be used to enable the transmission.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Debugging/Media/DriverSet.htm [06/10/2008 17.42.02]


TCP/IP set

ELSIST Srl, www.elsist.it MNL041Q100

Project settings

TCP/IP set

This window allows to set the TCP/IP communication settings for the debug communication.

Figure 1

IP Address Defines the IP address of the interface device connected with the target system.
Port Defines the port of the interface device connected with the target system.

http://192.168.0.61/Destination/Html/Use/Project/Settings/Debugging/Media/TCPIPSet.htm [06/10/2008 17.42.02]


User configuration

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

User configuration

Allows to define the user access configuration. Up to 4 users can be defined.

The user configuration will be used only if an access point is used to access to the target system.

Figure 1

User Type Defines the access rights for the user. The possibles choices are.
Admin The user has the maximum rights on the system, he can debug the program, change the variable values, stop and run the
program and change the program.
Guest The user can debug the program and change the variable values but he cannot stop and change the program.
User The user can only debug the program but he cannot change the variable values.
Username Defines the username to be used to access. (Case sensitive)
Password Defines the password to be used to access. (Case sensitive)

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/User.htm [06/10/2008 17.42.03]


Impostazioni porta seriale

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

Serial set

This window allows to define the serial parameters.

Figure 1

Baud rate Defines the communication baud rate.


Data Bits Defines the data bits length.
Parity Defines the parity.
Stop Bits Defines the number of stop bits.
Flow Control Select the flow control mode.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/SerialSet.htm [06/10/2008 17.42.04]


Serial driver settings

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

Serial driver

It allows to define the serial criver parameters as reported in the following figure.

Figure 1

Enable Driver Capability Selected, enables the serial driver allowing the options set.
Wait Time Before Tx Indicates the wait time between the Tx signal activation and the and the real transmission of the characters
Wait Time After Tx Indicates the wait time between the transmission of the last character and the Tx signal deactivation.
Clear Tx Echo Selected forces the clear of the echo received string.
Tx Signal Complement Selected complement the status of the selected signal for Tx enable.
Tx Signal Management Defines the operation way of the selected signal for Tx enable.
Signal for Tx Enable Defines the signal must be used to enable the transmission.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/DriverSet.htm [06/10/2008 17.42.05]


Access point configuration

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

Access point

Allows to define the access point configuration. The access point authenticate the user to allow the acces to the defined terminal I/O.
A set of parametrs must be defined for any user.

Figure 1

TermIO Defines the I/O terminal where the access point is connected to.
The defined terminal I/O cannot be used by any other resource.
Timeout Defines the inactivity time on the access point after which the user will be disconnected.
No Login If selected allow to access without login.
User nr Associates one of the 4 users when the No Login is selected.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/AccessPoint.htm [06/10/2008 17.42.05]


Modbus configuration

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

Modbus protocol

This window allows to define the modbus protocol parameters.

Figure 1

TermIO Defines the I/O terminal where the modbus manager is connected to.
The defined terminal I/O cannot be used by any other resource.
Modbus Type Defines the type of modbus protocol to be used to debug application on target system.
Node Number Defines the target Modbus node number.
Answer Timeout Defines the waiting time for the answer from the target system. After this time an error timeout is detect.
User prg debug enable If set it will be possible to execute the user program debug.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/Modbus.htm [06/10/2008 17.42.06]


Gestione modem

ELSIST Srl, www.elsist.it MNL041Q100

Target configuration

Modem settings

This window reports the modem settings.

Figure 1

TermIO Defines the I/O terminal where the access point is connected to.
The defined terminal I/O cannot be used by any other resource.
Modem type Defines the type of modem is used.
Ring Nr Defines the number of ring waited before to answer a call.
Dial Tries Defines the unsuccessful number of attempts on telephone call. After the definite number the call is aborted.
Inter Dial Time Defines the wait time between the call attempts.
SMS Send Tries Defines the unsuccessful number of attempts on SMS send. After the definite number the SMS send is aborted.
Inter SMS Send Time Defines the wait time between the SMS send attempts.
Timeout Defines the inactivity check time. After the defined time with non modem acrtivity the line is disconnected.

http://192.168.0.61/Destination/Html/Use/Project/Settings/TargetCfg/Modem.htm [06/10/2008 17.42.07]


HT002

ELSIST Srl, www.elsist.it MNL041Q100

How to

Execute the startup function

It is possible to force the execution of a startup function before passing to the execution of the user program. By
activating the related option in the project settings, and by defining in the program the function to be executed
written in RIL, C or assembler language and labelled with the name PLCUserStartUp, at the ignition of the
target system before passing to the execution of the user program, the function will be executed.

Example RIL

The example that follows does not have a real utility it is just an indication of how possible it is to define a startup
function by using the RIL language. The subroutine labelled with LABL L PLCUserStartUp will be executed just
once at the ignition of the target system before passing to the ciclic execution of the user program.

; ------------------------------------------------------------------------------
; @Section("User program")
; ------------------------------------------------------------------------------

ORGR
LODT F PLCTimeBase400
OUTT O 0001 ; Blinking Output

; User program end.

ORGR
SETR
RETN

; ------------------------------------------------------------------------------
; @Section("User startup routine")
; ------------------------------------------------------------------------------
; This function is automatically called once before to execute the user program.

ORGR
LABL L PLCUserStartUp
SETR
LTCH O 0000 ; Startup output
RETN

; [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT002.htm [06/10/2008 17.42.07]


"C" variables: PLCRtcData

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern PLCRTCDATA PLCRtcData;

This variable contains the real time clock data, the variable is automatically allocated by Remoter.

Writing from program or from MODBUS a new value in an any member of the variable, the real time
clock will be automatically updated with the new value.

By acting in the project settings it's possible to define the address of memory where this variable will
be allocated. This is useful in the case it should be reached from MODBUS.

typedef struct
{
unsigned char Year; //Year, range from 0 to 99
unsigned char Month; //Month, range from 1 to 12
unsigned char Day; //Day, range from 1 to 31
unsigned char WeekDay; //Week day, range from 0 to 6
unsigned char Hour; //Hour, range from 0 to 23
unsigned char Minute; //Minute, range from 0 to 59
unsigned char Second; //Second, range from 0 to 59
unsigned char Hundred; //Hundred, range from 0 to 99
}RTCDATA;

Some fields of the data structure are not managed in some libraries because the target system has not the
real time clock. In the following table the indication of the different field are reported with reference to the
supported libraries.

Ofs Name Description

00 Year Year value (Range from 0 to 99) - - C - - - -


01 Month Month value (Range from 1 to 12) - - C - - - -
02 Day Day value (Range from 1 to 31) - - C - - - -
03 WeekDay Day of the week value (Range from 0 to 6) - - C - - - -
(0:Sunday, 1:Monday, 2:Tuesday, 3:Wednsday, 4:Thursday, 5:Friday, 6:
Saturday)
04 Hour Hour value (Range from 0 to 23) - - C - - - -
05 Minute Minute value (Range from 0 to 59) - - C - - - -
06 Second Second value (Range from 0 to 59) - - C - - - -
07 Hundred Hundred of second value (Range from 0 to 99) - - C - - - -

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCRtcData.htm [06/10/2008 17.42.08]


Operandi: Input

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Input

The Input operand can be used in the logical instructions, it represents the status of a logic input. Its status
can have only 2 values, FALSE or TRUE.

All the logic inputs are acquired as process image at the beginning of the program loop and their status is
transferred to the memory. The Input operand tests the status as it was saved in the process image, so the
status of the operand doesn't change during the program loop even if the real input status changes. In case
you need to test the real status of a logic input you can use the IOAQ instruction it directly acquire the logic
inputs.

Numerical declarations

The Input operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

I Input 0-FF (*) 0-FF (*) 0-7 (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

Mnemonic declarations

The Input operands cannot be defined mnemonically, so we suggest to copy their status to a Flag (F)
declared in mnemonic mode, as in the example.

Ladder RIL
DEFG F CmdPushButton ;Global flag

ORGR
LODT I 0000
OUTT F CmdPushButton

Using from "C" language

In order to use the Input operand from C language we suggest to define a global BOOL variable and from
RIL language define it as external Flag (F)and then copy the Input operand to the Flag. In the example the

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Input.htm (1 of 2) [06/10/2008 17.42.08]


Operandi: Input

status of the F Input is tested, in the RIL program the status of logic input I 0000 has been copied to it. For
more information about how to access from C language to the RIL operands see the proper chapter.

RIL "C" language


EXTR F Input ;Extern flag BOOL Input; //Global boolean

ORGR void Example(void)


LODT I 0000 {
OUTT F Input BOOL IsFalse=FALSE; //Local boolean
BOOL IsTrue=FALSE; //Local boolean

if (Input == FALSE)
IsFalse=TRUE;
else
IsTrue=TRUE;
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Input.htm (2 of 2) [06/10/2008 17.42.08]


Operandi: Output

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Output

The Output operand can be used in the logical instructions, it represents the status of a logic outputs. Its
status can have only 2 values, FALSE or TRUE.

All the logic outputs are managed as process image, at the end of the program loop their status is
transferred to the physical outputs. So if during the program loop the status of the Output operand change
the real output will be updated only at the program loop end. In case you need to set the real output during
the program loop you can use theIOAQ instruction, it set the logic output directly.

Numerical declarations

The Output operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

O Output 0-FF (*) 0-FF (*) 0-7 (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

Mnemonic declarations

The Output operands cannot be defined mnemonically, so we suggest to use Flag (F) declared in
mnemonic mode and copy their status to the operand, as in the example.

Ladder RIL
DEFG F MotorOn ;Global flag

ORGR
LODT F MotorOn
OUTT O 0000

Using from "C" language

In order to use the Output operand from C language we suggest to define a global BOOL variable and
from RIL language define its mnemonic as external Flag (F) and copy the Output operand status to it. In
the example the status of the F Output is managed, in the RIL program it's copied to the O 0000. For more

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Output.htm (1 of 2) [06/10/2008 17.42.09]


Operandi: Output

information about how to access from C language to the RIL operands see the proper chapter.

RIL "C" language


EXTR F Output ;Extern flag BOOL Output; //Global boolean

ORGR void Example(void)


LODT F Output {
OUTT O 0000 if (PLCTimeBase400 == FALSE)
Output=FALSE;
else
Output=TRUE;
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Output.htm (2 of 2) [06/10/2008 17.42.09]


Operandi: Flag

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Flag

The Flag operand can be used in the logical instructions, it represents a boolean variable inside the
memory area. Its status can have only 2 values, FALSE or TRUE.

Numerical declarations

The Flag operands can be defined in numerical mode according to the defined addressing range. Using the
numerical declaration it's possible to know their memory address referring to the allocation address defined
in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

F Flag 0-5BF (*) 0-5BF (*) 0-3F (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

ATTENTION ! The operand uses 1 memory byte, when allocated in numerical mode, it uses the same
allocation of the variable Byte (Y). So the operand F 0100 uses the same allocation of the operand Y 0100.
Please pay attention to not use the same memory area for different operands.

Mnemonic declarations

If you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG F Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB F Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL F Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

Example

If the F BackupFlag is in the logical status TRUE and if F CommandFlag is in the logical status TRUE,
and F EnableFlag is in the logical status TRUE, the F IsActive will be forced in the logical status TRUE.
The variable F BackupFlag is defined as backup, so it retains its status when the system turns off.

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Flag.htm (1 of 2) [06/10/2008 17.42.10]


Operandi: Flag

Ladder RIL
EXTR F IsActive ;Extern flag
DEFB F BackupFlag ;Backup flag
DEFG F CommandFlag ;Global flag
DEFL F EnableFlag ;Local flag

ORGR
LODT F CommandFlag
ANDT F BackupFlag
ANDT F EnableFlag
OUTT F IsActive

Use from "C" language

Are executed the he same operations of the RIL example, the F variables are defined as BOOL. It is not
possible to define backup variables, so the BackupFlag variable is declared as global variable. For more
information about how to access from C language to the RIL operands see the proper chapter.

"C" language
#extern BOOL IsActive; //Extern boolean
BOOL BackupFlag; //Global boolean
BOOL CommandFlag; //Global boolean

void Example(void)
{
BOOL EnableFlag; //Local boolean

IsActive=CommandFlag&BackupFlag&EnableFlag;
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Flag.htm (2 of 2) [06/10/2008 17.42.10]


Operandi: Byte

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Byte

The Byte operand can be used in all the mathematical instructions, it represents a 8 bits variable in the
memory area. Its range is 0x00-0xFF in hexadecimal or 0-255 in decimal. The logical instructions can
operate on Byte operand by testing the status of every bit, so the LODT Y 0100 BD 0004 instruction will
returns a true logical condition if the bit 4 of Y 0100 is set.

Numerical declarations

The Word operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

Y Byte 0-5BF (*) 0-5BF (*) 0-3F (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

ATTENTION ! The operand uses 1 memory byte, when allocated in numerical mode, it uses the same
allocation of the variable Flag (F). So the operand Y 0100 uses the same allocation of the operand F 0100.
Please pay attention to not use the same memory area for different operands.

Mnemonic declarations

If you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG Y Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB Y Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL Y Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

Example

At every second the value of the variable Y Counter increases, it is executed the operation
Y Result=Y Threshold-Y Counter, and when the value of the Y Counter is the same one of the value

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Byte.htm (1 of 3) [06/10/2008 17.42.11]


Operandi: Byte

Y Threshold, its value is taken to zero and Y Comparisons increases. The variable Y Threshold is
defined as backup, so it retains its value when the system turns off.

Ladder RIL
EXTR Y Counter ;Extern byte
DEFB Y Threshold ;Backup byte
DEFG Y Result ;Global byte
DEFL Y Comparisons ;Local byte

ORGR
LODT F PLCPulse1000
PULS
LODA Y Counter
INCA KD 1
STRA Y Counter
LODA Y Threshold
SUBA
STRA Y Result

ORGR
EQUC Y Counter Y Threshold
MOVI Y Counter KD 0
LODA Y Comparisons
INCA KD 1
STRA Y Comparisons

Use from "C" language

Are executed the same operations of the RIL example, the Y variables are defined as unsigned char. It is
not possible to define backup variables, so the Threshold variable is declared as global variable. For more
information about how to access from C language to the RIL operands see the proper chapter.

"C" language
#extern unsigned char Counter; //Extern char
unsigned char Threshold; //Global char
unsigned char Result; //Global char

void Example(void)
{
unsigned char Comparisons; //Local char

if (PLCPulse1000)
{
Counter++;
Result=Threshold-Counter;
}

if (Counter &= Threshold)


{

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Byte.htm (2 of 3) [06/10/2008 17.42.11]


Operandi: Byte

Counter=0;
Comparisons++;
}
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Byte.htm (3 of 3) [06/10/2008 17.42.11]


Operandi: Word

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Word

The Word operand can be used in all the mathematical instructions, it represents a 16 bits variable in the
memory area. Its range is 0x0000-0xFFFF in hexadecimal or 0-65535 in decimal. The logical instructions
can operate on Word operand by testing the status of every bit, so the LODT W 0100 BD 0008 instruction
will returns a true logical condition if the bit 8 of W 0100 is set.

Numerical declarations

The Word operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

W Word 0-5BE (*) 0-5BE (*) 0-3E (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

ATTENTION ! The operand uses 2 memory bytes, when allocated in numerical mode, it uses the same
allocation of 2 variables Flag (F) or Byte (Y). So the operand W 0100 uses the same allocation of the
operands F 0100, F 0101 or the operands Y 0100, Y 0101. Please pay attention to not use the same
memory area for different operands.

Mnemonic declarations

If you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG W Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB W Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL W Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

Example

At every second the value of the variable W Counter increases, it is executed the operation

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Word.htm (1 of 3) [06/10/2008 17.42.11]


Operandi: Word

W Result=W Threshold-W Counter, and when the value of the W Counter is the same one of the value
W Threshold, its value is taken to zero and W Comparisons increases. The variable W Threshold is
defined as backup, so it retains its value when the system turns off.

Ladder RIL
EXTR W Counter ;Extern word
DEFB W Threshold ;Backup word
DEFG W Result ;Global word
DEFL W Comparisons ;Local word

ORGR
LODT F PLCPulse1000
PULS
LODA W Counter
INCA KD 1
STRA W Counter
LODA W Threshold
SUBA
STRA W Result

ORGR
EQUC W Counter W Threshold
MOVI W Counter KD 0
LODA W Comparisons
INCA KD 1
STRA W Comparisons

Use from "C" language

Are executed the same operations of the RIL example, the W variables are defined as unsigned int. It is
not possible to define backup variables, so the Threshold variable is declared as global variable. For more
information about how to access from C language to the RIL operands see the proper chapter.

"C" language
#extern unsigned int Counter; //Extern int
unsigned int Threshold; //Global int
unsigned int Result; //Global int

void Example(void)
{
unsigned int Comparisons; //Local int

if (PLCPulse1000)
{
Counter++;
Result=Threshold-Counter;
}

if (Counter >= Threshold)

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Word.htm (2 of 3) [06/10/2008 17.42.11]


Operandi: Word

{
Counter=0;
Comparisons++;
}
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Word.htm (3 of 3) [06/10/2008 17.42.11]


Operandi: DoubleWord

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Double word

The Double Word operand called also Double, can be used in all the mathematical instructions, it
represents a 32 bits variable in the memory area. Its range is 0x00000000-0xFFFFFFFF in hexadecimal or
0-4294967295 in decimal. The logical instructions can operate on Double operand by testing the status of
every bit, so the LODT DW 0100 BH 0010 instruction will returns a true logical condition if the bit 0x10 of
DW 0100 is set.

Numerical declarations

The Double operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

DW Double word 0-5BC (*) 0-5BC (*) 0-3C (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

ATTENTION ! the operand uses 4 memory bytes, when allocated in numerical mode, it uses the same
allocation of 4 variables Flag (F) or Byte (Y), of 2 variables Word (W) or of one variable Float (FL). So the
operand DW 0100 uses the same allocation of the operands F 0100, F 0101, F 0102, F 0103 or the
operands Y 0100, Y 0101, Y 0102, Y 0103 or the operands W 0100, W 0102, or the operand FL 0100.
Please pay attention to not use the same memory area for different operands.

Mnemonic declarations

If you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG DW Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB DW Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL DW Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

Example

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Double.htm (1 of 3) [06/10/2008 17.42.12]


Operandi: DoubleWord

At every second the value of the variable DW Counter increases, it is executed the operation
DW Result=DW Threshold-DW Counter, and when the value of the DW Counter is the same of the value
DW Threshold, its value is reset and DW Comparisons increased. The variable DW Threshold is
defined as backup, so it retains its value when the system turns off.

Ladder RIL
EXTR DW Counter ;Extern double
DEFB DW Threshold ;Backup double
DEFG DW Result ;Global double
DEFL DW Comparisons ;Local double

ORGR
LODT F PLCPulse1000
PULS
LODA DW Counter
INCA KD 1
STRA DW Counter
LODA DW Threshold
SUBA
STRA DW Result

ORGR
EQUC DW Counter DW Threshold
MOVI DW Counter KD 0
LODA DW Comparisons
INCA KD 1
STRA DW Comparisons

Use from "C" language

Are executed the same operations of the RIL example, the DW variables are defined as unsigned long. It
is not possible to define backup variables, so the Threshold variable is declared as global variable. For
more information about how to access from C language to the RIL operands see the proper chapter.

"C" language
#extern unsigned long Counter; //Extern long
unsigned long Threshold; //Global long
unsigned long Result; //Global long

void Example(void)
{
unsigned long Comparisons; //Local long

if (PLCPulse1000)
{
Counter++;
Result=Threshold-Counter;
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Double.htm (2 of 3) [06/10/2008 17.42.12]


Operandi: DoubleWord

if (Counter >= Threshold)


{
Counter=0;
Comparisons++;
}
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Double.htm (3 of 3) [06/10/2008 17.42.12]


Operandi: Float

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Float

The Float operand can be used in all the mathematical instructions, it represents a 32 bits variable in the
memory area. Its range is from -3.4028233e+38 to +3.4028233e+38 in decimal.

Numerical declarations

The Float operands can be defined in numerical mode according to the defined addressing range. Using
the numerical declaration it's possible to know their memory address referring to the allocation address
defined in the project settings window.

Numerical range
Type Description
PSYST NSYST Netreader

FL Float 0-5BC (*) 0-5BC (*) 0-3C (*)

The numerical ranges with (*), indicates the default accepted values, user can change the defined range in
the project settings window. Naturally the total quantity of definable operands for every target depends on
the RAM memory available.

ATTENTION ! The operand uses 4 memory bytes, when allocated in numerical mode, it uses the same
allocation of 4 variables Flag (F) or Byte (Y), of 2 variables Word (W) or of one variable Double (DW). So
the operand FL 0100 uses the same allocation of the operands F 0100, F 0101, F 0102, F 0103 or the
operands Y 0100, Y 0101, Y 0102, Y 0103 or the operands W 0100, W 0102, or the operand DW 0100.
Please pay attention to not use the same memory area for different operands.

Mnemonic declarations

If you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG FL Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB FL Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL FL Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

Example

At every second the value of the variable FL Counter increases, it is executed the operation
FL Result=FL Threshold-FL Counter, and when the value of the FL Counter is the same of the value

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Float.htm (1 of 3) [06/10/2008 17.42.13]


Operandi: Float

FL Threshold, its value is reset and FL Comparisons increased. The variable FL Threshold is defined as
backup, so it retains its value when the system turns off.

Ladder RIL
EXTR FL Counter ;Extern float
DEFB FL Threshold ;Backup float
DEFG FL Result ;Global float
DEFL FL Comparisons ;Local float

ORGR
LODT F PLCPulse1000
PULS
LODA FL Counter
FINC KF 1.000000
STRA FL Counter
LODA FL Threshold
FSUB
STRA FL Result

ORGR
EQUC FL Counter FL Threshold
MOVI FL Counter KF 0.000000
LODA FL Comparisons
FINC KF 1.000000
STRA FL Comparisons

Use from "C" language

Are executed the he same operations of the RIL example, the FL variables are defined as float. It is not
possible to define backup variables, so the Threshold variable is declared as global variable. For more
information about how to access from C language to the RIL operands see the proper chapter.

"C" language
#extern float Counter; //Extern float
float Threshold; //Global float
float Result; //Global float

void Example(void)
{
float Comparisons; //Local float

if (PLCPulse1000)
{
Counter++;
Result=Threshold-Counter;
}

if (Counter >= Threshold)


{

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Float.htm (2 of 3) [06/10/2008 17.42.13]


Operandi: Float

Counter=0;
Comparisons++;
}
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Float.htm (3 of 3) [06/10/2008 17.42.13]


Operand definition instructions: DEFB

ELSIST Srl, www.elsist.it MNL041Q100

Operand definition instructions

DEFB

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, C, Y, W, DW, FL
DEFB DEFine Backup operand None No A
Y KD

The instruction DEFine Backup operand has to be used to define a new mnemonic operand, having a
global visibility inside the project. The value of the defined operand will be memorized when the system is
turned off and reloaded at the next turning on. The instruction doesn't have any logical function in the
program so it has to be inserted without any definition of the logical branch, we suggest of inserting the
instruction at the beginning of the RIL file. Instructions can access to the defined operand from any RIL file
of the project by only indicating its type and name.

ATTENTION! You cannot define two operands with the same name in the same project (even they are in
different files) even they have different type. So you cannot define local operands DEFL, or global operands
DEFG using names defined as backup operands.

Examples

In the following example, when I 0000 is activated, the value of the W Counter is increased. In case of
turning off of the system the value of the W Counter gets memorized and at the next system on it will have
the value it had when the system was turned off. You cannot define an operand with the name Counter in
any other file.

Ladder RIL "C" language


DEFB W Counter

ORGR
LODT I 0000
PULS
INCO W Counter

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition/Defb.htm [06/10/2008 17.42.14]


"C" variables: PLCRemoterProjectInfo

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern code PLCREMOTERPROJECTINFO PLCRemoterProjectInfo;

This variable is automatically allocated by Remoter in area code and it is set with the project information so
as reported in the project settings. The information contained can be read with the proper command of
project information request.

typedef struct
{
// --------------------------------------[Members returned as project info]--

unsigned char BuildDay; //Day, range from 1 to 31


unsigned char BuildMonth; //Month, range from 1 to 12
unsigned char BuildYear; //Year, range from 0 to 99
unsigned char BuildHour; //Hour, range from 0 to 23
unsigned char BuildMinute; //Minute, range from 0 to 59
unsigned char BuildSecond; //Second, range from 0 to 59
unsigned int BuildNr; //BuildNr
unsigned char RemoterVersionMajor; //Major version di Remoter
unsigned char RemoterVersionMinor; //Minor version di Remoter
unsigned char RemoterVersionSubMinor; //SubMinor version di Remoter
char ProjectName[22]; //Project name

// ----------------------------[Members that can be readed by user program]--

unsigned int LIStartAddress; //Logic inputs start address


unsigned int LINrOfBytes; //Logic inputs number of bytes
unsigned int LOStartAddress; //Logic outputs start address
unsigned int LONrOfBytes; //Logic outputs number of bytes
unsigned int FStartAddress; //Flags start address
unsigned int FNrOfBytes; //Flags number of bytes
}PLCREMOTERPROJECTINFO;

Ofs Name Description

00 BuildDay It contains the indication of the day in which the project - - C - - - -


has been compiled (From 1 to 31).
01 BuildMonth It contains the indication of the month in which the project - - C - - - -
has been compiled (From 1 to 12).
02 BuildYear It contains the indication of the year in which the project - - C - - - -
has been compiled (From 0 to 99).
03 BuildHour It contains the indication of the hour in which the project - - C - - - -
has been compiled (From 0 to 23).
04 BuildMinute It contains the indication of the minutes in which the - - C - - - -
project has been compiled (From 0 to 59).
05 BuildSecond It contains the indication of the seconds in which the - - C - - - -
project has been compiled (From 0 to 59).

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCRemoterProjectInfo.htm (1 of 2) [06/10/2008 17.42.15]


"C" variables: PLCRemoterProjectInfo

06 BuildNr It contains the indication of the compilation number of the - - C - - - -


project (From 0 to 65535).
08 RemoterVersionMajor It contains the indication of the Remoter version with - - C - - - -
which the project has been compiled (From 0 to 99).
09 RemoterVersionMinor It contains the indication of the Remoter underversion with - - C - - - -
which the project has been compiled (From 0 to 99).
0A RemoterVersionSubMinor It contains the indication of the Remoter underversion with - - C - - - -
which the project has been compiled (From 0 to 99).
0B ProjectName[22] It contains the indication of the project name. The field - - C - - - -
contains just the first 21 name charachters, project with
name of length longer are cut at the 21st character.
20 LIStartAddress It contains logic input allocation address in PLC area, as - - D - - - -
defined in Project settings (From 0x000 to 0xFFFF).
22 LINrOfBytes It contains logic input allocation number in PLC area, as - - D - - - -
defined in Project settings (From 0x000 to 0xFFFF).
24 LOStartAddress It contains logic output allocation address in PLC area, as - - D - - - -
defined in Project settings (From 0x000 to 0xFFFF).
26 LONrOfBytes It contains logic output allocation number in PLC area, as - - D - - - -
defined in Project settings (From 0x000 to 0xFFFF)
28 FStartAddress It contains Flag (F), Byte (Y), Word (W), Double (DW), - - D - - - -
Float (FL) allocation address in PLC area, as defined in
Project settings (From 0x000 to 0xFFFF).
2A FNrOfBytes It contains Flag (F), Byte (Y), Word (W), Double (DW), - - D - - - -
Float (FL) allocation number in PLC area, as defined in
Project settings (From 0x000 to 0xFFFF).

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCRemoterProjectInfo.htm (2 of 2) [06/10/2008 17.42.15]


Operandi: Counter

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Counter

The Counter operand allows to define a counter, the counters are expressed as variables with 8 bits in the
memory area. Its range is 0x00-0xFF in hexadecimal or 0-255 in decimal. The allocation of the Counter
operand is made automatically it is assigned a memory space of 8 bytes to every operand, one for the
status, and the others for the management.

The Counter operand as how implemented in the version 7.x of Remoter had some limits, it was not
possible to perform its decrement, to know its value, to preset it to a desired value. Besides its range was
expressed only by using a 8 bits variable. With the version 8.0 of Remoter were implemented new logic
instructions, they make obsolete the Counter operand. By using the INCO and DECO instructions it is
possible to increase and decrease any operand value, while with the GRTC, EQUC, LESC instructions it is
possible to compare the value with a constant (K) or with another operand.

We suggest to not use in the future this operand and to use in alternative the INCO, DECO, GRTC, EQUC,
LESC instructions.

Numerical declarations

The operand can be defined in numerical mode according to the defined addressing range. Anyway it's not
possible to know its memory allocation address, because also using the numerical declaration it will be
allocated automatically.

Numerical range
Type Description
PSYST NSYST Netreader

C Counter 0-FFFF (*)

The numerical ranges with (*), indicates the accepted numerical values, naturally the total quantity of
operands definable for every target depends on the quantity of RAM memory available. The sequentially of
the numbering it doesn't matter for the memory use optimization.

Mnemonic declarations

if you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG C Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFB C Name To define a mnemonic operand called Name with global visibility it can be used in all the
project files. The operand value will be saved at the system power off and restored when
the system will be switched on again.
DEFL C Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Counter.htm (1 of 2) [06/10/2008 17.42.15]


Operandi: Counter

Example

At every second the value of Y Counter variable it's increased, when the value is equal to 4 the operand
F 0000 it's activated.

Ladder RIL "C" language


DEFG Y Counter

ORGR
LODT F PLCPulse1000
INCO Y Counter

ORGR
EQUC Y Counter KD 4
OUTT F 0000

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Counter.htm (2 of 2) [06/10/2008 17.42.15]


Operandi: Timer

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Timer

The Timer operand can be used in the logical instructions, it represents a boolean variable inside the
memory area. Its status can have only 2 values, FALSE or TRUE. In the OUTM instruction, even if it
represents a boolean variable it needs the activation delay time definition. The allocation of the Timer
operand is made automatically, it is assigned a memory space of 16 bytes to every operand, one for the
status, and the others for the management.

Numerical declarations

The operand can be defined in numerical mode according to the defined addressing range. Anyway it's not
possible to know its memory allocation address, because also using the numerical declaration it will be
allocated automatically.

Numerical range
Type Description
PSYST NSYST Netreader

T Timer 0-FFFF (*)

The numerical ranges with (*), indicates the accepted numerical values, naturally the total quantity of
operands definable for every target depends on the quantity of RAM memory available. The sequentially of
the numbering it doesn't matter for the memory use optimization.

Mnemonic declarations

if you don't need to know the allocation address you can define the operand in mnemonic mode by using
the RIL instructions:

DEFG T Name To define a mnemonic operand called Name with global visibility, it can be used in all the
project files.
DEFL T Name To define a mnemonic operand called Name with local visibility, it can be used only in the
file where it is defined.

ATTENTION! It's not possible to define Timer operands in backup area.

Example

If F CommandFlag is in the logical status TRUE and if T StartDelay is in the logical status TRUE, after 10
mSec T WorkDelay will be in status TRUE and after 60 Sec T OffDelay will be in status TRUE. When
F CommandFlag or T StartDelay are in status FALSE, immediately T WorkDelay and T OffDelay will be
in status FALSE.

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Timer.htm (1 of 2) [06/10/2008 17.42.16]


Operandi: Timer

Ladder RIL program


EXTR T StartDelay ;Extern timer
DEFG T WorkDelay ;Global timer
DEFL F OffDelay ;Local flag

ORGR
LODT F CommandFlag
ANDT T StartDelay
OUTM T WorkDelay KD 10 KE Base1mS
OUTM T OffDelay KD 1 KE Base60S

Use from "C" language

The operand Timer can be tested by C language but it cannot be managed. In the example the status T
WorkDelay defined as a global variable in the RIL program is tested.

"C" language
#extern BOOL WorkDelay; //Extern boolean

void Example(void)
{
BOOL IsFalse=FALSE; //Local boolean
BOOL IsTrue=FALSE; //Local boolean

if (WorkDelay == FALSE)
IsFalse=TRUE;
else
IsTrue=TRUE;
}

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Timer.htm (2 of 2) [06/10/2008 17.42.16]


Utility instructions: SETV

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

SETV

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SETV SEt Terminal I/O device Vectors Close rung KE, W No A

The instruction SEt Terminal I/O device Vectors allows the definition of the vectors for the management of
the standard I/O devices. All the standard I/O management instructions will operate with the device set with
this instruction.

The operand (KE) identifies the device according to the table.

IOSerialPortA Identifies the serial line A


IOSerialPortB Identifies the serial line B

The operand Word (W) allows to set the vector, whom address is defined in a memory word.

Examples

In the following example, when I 0000 gets activated, the string Hello! will be sent to the serial line A.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
SETV KE IOSerialPortA {
STXI KH 0048 OneShot=PLCOpI(0x0000);
STXI KH 0065
STXI KH 006C if (PLCOpI(0x0000))
STXI KH 006C {
STXI KH 006F SetTermIOVectors(IOSerialPortA);
STXI KH 0021 printf("Hello\r\n");
STXI KH 000D }
STXI KH 000A }

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Setv.htm [06/10/2008 17.42.17]


Function blocks: FbModbusAsciiSl

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbModbusAsciiSl

This function block allows the management of the MODBUS ASCII protocol as slave. The function block can be
called also by using the proper graphic utility this simplify the use. In case of mistake in the user defined
parameters, the StatusBit.ParamErrs and the FBParameters bit in the PLCErrors data structure are set.

Code:PFB042 History report


Prototype
FbModbusAsciiSl.h

Declaration
void FbModbusAsciiSl(FBMODBUSASCIISLDATA* S);

Parameters
FBMODBUSASCIISLDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members, reported under the
Members automatically managed by Remoter label are managed automatically by Remoter in case of use the
graphic utility, on the contrary they have to be managed by the user program. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL ResetCtrs:1; //Resets all the counters
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}CmdBit; //Command

struct
{
BOOL Enabled:1; //Enabled
BOOL ReceiveOk:1; //Receive ok
BOOL CmActive:1; //Communication active
BOOL ParamErrs:1; //Parameters error

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (1 of 12) [06/10/2008 17.42.22]


Function blocks: FbModbusAsciiSl

BOOL Timeouts:1; //Timeout error


BOOL Overruns:1; //Overrun error
BOOL CommErrs:1; //Communication error
BOOL Excepts:1; //Command error
}StatusBit; //Status

unsigned char NodeAdd; //Node address


unsigned char Dummy1;
unsigned int AnswerWt; //Answer wait time (mSec)
unsigned int TimeOutCk; //Timeout Check (mSec)
unsigned int Timeouts; //Timeout errors counter
unsigned int Overruns; //Overrun error counter
unsigned int CommErrs; //Communication error counter
unsigned int ExceptsErr; //Command errors counter
unsigned int Communs; //Command received counter
unsigned int Answers; //Answer sent counter
unsigned int Dummy2;
unsigned int CmActiveDelay; //Communication active delay (mSec)
unsigned char FrameLength; //Rx/Tx frame length
unsigned char Dummy3;

// -----------------------------[Members automatically managed by Remoter]--

unsigned int Dummy4;


unsigned char* FrameBuf; //Rx/Tx frame buffer
BOOL Compatibility; //MODICON compatibility

// --------------------------------------------[Internal use only members]--


...
}FBMODBUSASCIISLDATA;

00 CmdBit
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB and the communication is hang up. By disabling the FB all the error
bits in StatusBit are reset and all the other command bits are not active.
TRUE: It enables the FB.
1 ResetCtrs TRUE: It resets all the counters, the bit is automatically reset.

01 StatusBit
Status bits of the function block, the user program can test these bits. The value can be acquired by
MODBUS with the diagnostic command 0002: Return diagnostic register.
0 Enabled TRUE: The FB is enabled.
1 ReceiveOk It's activated for a program loop at the reception of every MODBUS command.
2 CmActive It's activated at FB enable or when a MODBUS command is received. It's reset if MODBUS
commands are not received for a time longer than the time defined in CmActiveDelay or by
resetting the CmdBit.Enable.
3 ParamErrs TRUE: Indicates an error on user defined parameters. It can be reset by resetting the CmdBit.
Enable.
4 Timeouts TRUE: Indicates a command execution timeout error. It can be reset by resetting the CmdBit.
Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic
command.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (2 of 12) [06/10/2008 17.42.22]


Function blocks: FbModbusAsciiSl

5 Overruns TRUE: Indicates an overruns error in reception from serial line, more characters than the
reception buffer length has been received. It can be reset by resetting the CmdBit.Enable or
at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.
6 CommErrs TRUE: Indicates an error command reception from serial line, a wrong character or a number
of characters different from the requested has been received. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers
diagnostic command.
7 Excepts TRUE: Indicates a reception of a MODBUS function that is not supported. It can be reset by
resetting the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic
registers diagnostic command.

02 NodeAdd
Loaded by user program it defines the address of slave node (From 0x00 to 0xFF).
04 AnswerWt
Loaded by user program it defines the waiting time expressed in mSec between the reception of a MODBUS
command and the transmission of the proper answer (From 0x0000 to 0xFFFF).
06 TimeOutCk
Loaded by user program it defines the available time expressed in mSec to receive an entire command
frame. Time is considered from the reception of the start frame ":" character. (From 0x0000 to 0xFFFF).
08 Timeouts
It returns the occurred timeouts errors counting (From 0x0000 to 0xFFFF). It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

0A Overruns
It returns the occurred overrun errors counting (From 0x0000 to 0xFFFF). The value can be acquired by
MODBUS with the 0012: Return bus character overrun count diagnostic command. It can be reset by
resetting the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers
diagnostic command.
0C CommErrs
It returns the occurred communication errors counting (From 0x0000 to 0xFFFF). The value con be acquired
by MODBUS with the 000C: Return bus error count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

0E ExceptsErr
It returns the occurred except errors counting (From 0x0000 to 0xFFFF). The value con be acquired by
MODBUS with the 000D: Return bus exception error count diagnostic command. It can be reset by resetting
the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic
command.
10 Communs
It returns the received MODBUS commands counting (From 0x0000 to 0xFFFF). The value con be acquired
by MODBUS with the 000B: Return bus message count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

12 Answers
It returns the sent MODBUS answers counting (From 0x0000 to 0xFFFF). The value con be acquired by
MODBUS with the 000E: Return slave message count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

16 CmActiveDelay

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (3 of 12) [06/10/2008 17.42.22]


Function blocks: FbModbusAsciiSl

Loaded by user program it defines the time in mSec, after that if no MODBUS command are received the
active communication bit StatusBit.CmActive is reset (From 0x0000 to 0xFFFF).
18 FrameLength
Loaded by user program it defines the dimension of the frame reception/transmission buffer (From 12 to
255). To maintain compatibility with the previous versions a buffer of at least 40 bytes must be defined.
1C FrameBuf
Automatically loaded by Remoter if the graphic utility is used, otherwise it must by loaded by user program, if
defines the allocation address of the frame reception/transmission buffer (From 0x0000 to 0xFFFF).
1E Compatibility
Automatically loaded by Remoter if the graphic utility is used, otherwise it must by loaded by user program, if
defines the working of the Read holding register, Read input registers, Preset single register e Preset
multiple registers MODBUS command:
FALSE: The commands are managed with byte addressing as used in Remoter.
TRUE: The commands are managed with word addressing as defined in MODICON specifications. The
memory word address it's calculated by multiplying for 2 the address specified in the command frame. So to
reach the W 0100 it will be necessary to define in the command frame the starting address 0080.

RIL example

In the following example the MODBUS slave communication management is executed, when the MODBUS
ASCII command strings are received, the system will answer by sending the answer strings.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; MODBUS slave communication, data structure.

DEFL Y Mdb KD 64
DEFL Y MdbCmdBit Y Mdb KH 0000 ; Mdb.CmdBit
DEFL Y MdbStatusBit Y Mdb KH 0001 ; Mdb.StatusBit
DEFL Y MdbNodeAdd Y Mdb KH 0002 ; Mdb.NodeAdd
DEFL W MdbAnswerWt Y Mdb KH 0004 ; Mdb.AnswerWt
DEFL W MdbTimeOutCk Y Mdb KH 0006 ; Mdb.TimeOutCk
DEFL W MdbTimeouts Y Mdb KH 0008 ; Mdb.Timeouts
DEFL W MdbOverruns Y Mdb KH 000A ; Mdb.Overruns
DEFL W MdbCommErrs Y Mdb KH 000C ; Mdb.CommErrs
DEFL W MdbExceptsErr Y Mdb KH 000E ; Mdb.ExceptsErr
DEFL W MdbCommuns Y Mdb KH 0010 ; Mdb.Communs
DEFL W MdbAnswers Y Mdb KH 0012 ; Mdb.Answers
DEFL W MdbCmActiveDelay Y Mdb KH 0016 ; Mdb.CmActiveDelay
DEFL Y MdbFrameLength Y Mdb KH 0018 ; Mdb.FrameLength
DEFL W MdbFrameBuf Y Mdb KH 001C ; Mdb.FrameBuf
DEFL F MdbCompatibility Y Mdb KH 001E ;Mdb.Compatibility

; Rx/Tx frame buffer definition.

DEFL Y FrameBuf KD 45

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (4 of 12) [06/10/2008 17.42.22]


Function blocks: FbModbusAsciiSl

; MODBUS slave communication, variables settings.

ORGR
LODT F PLCFirstLoop
MOVI Y MdbNodeAdd KD 0 ; Mdb.NodeAdd
MOVI W MdbAnswerWt KD 0 ; Mdb.AnswerWt
MOVI W MdbTimeOutCk KD 2000 ; Mdb.TimeOutCk
MOVI W MdbCmActiveDelay KD 2000 ; Mdb.CmActiveDelay
MOVI Y MdbFrameLength KD 40 ; Mdb.FrameLength
MOVA W MdbFrameBuf Y FrameBuf ; Mdb.FrameBuf
UTCH F MdbCompatibility ; Mdb.Compatibility
LTCH Y MdbCmdBit K 0001 ; Mdb.CmdBit.ResetCtrs

; ------------------------------------------------------------------------------
; @Section("MODBUS communication, slave management")
; ------------------------------------------------------------------------------
; MODBUS slave communication management on port "A".

ORGR
SETR
SETV KE IOSerialPortA
TASK L FbModbusAsciiSl Y Mdb ; MODBUS slave management
LTCH Y MdbCmdBit K 0000 ; Mdb.CmdBit.Enable

; [End of file]

"C" example

In the following example the MODBUS slave communication management is executed, when the MODBUS
ASCII command strings are received, the system will answer by sending the answer strings.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModbusAsciiSl.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define MDBFRAMELENGTH 45 //Modbus frame length

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBMODBUSASCIISLDATA Mdb; //MODBUS slave data structure


unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (5 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the system init at first program execution loop.

if (PLCFirstLoop)
{
// Set variables to manage the MODBUS slave communication.

Mdb.NodeAdd=0; //Node address


Mdb.AnswerWt=0; //Answer wait time (mSec)
Mdb.TimeOutCk=100; //Timeout Check (mSec)
Mdb.CmActiveDelay=2000; //Communication active delay (mSec)
Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=&FrameBuf; //Rx/Tx frame buffer
Mdb.Compatibility=FALSE; //MODICON compatibility
Mdb.CmdBit.ResetCtrs=TRUE; //Resets all the counters
}

// -------------------------------------------------------------------------
// MODBUS SLAVE COMMUNICATION
// -------------------------------------------------------------------------
// Here define the serial line that must be used.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


TermIOTick(); //Manage the selected I/O console

// MODBUS slave communication management.

FbModbusAsciiSl(&Mdb); //MODBUS slave management


Mdb.CmdBit.Enable=TRUE; //Enable
}

// [End of file]

Supported MODBUS commands

To reduce the code the FB doesn't implement all the functions previewed in the MODBUS protocol, following are
described those implemented.

ATTENTION! The hexadecimal codes are made by 2 characters, as the example Function code 03 corresponds
to the reception of the ascii codes 0x30 and 0x33. The characters Begin frame, Carriage return and Line feed
correspond to the ascii codes 0x3A, 0x0D, 0x0A.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (6 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

Code 03: Read holding register Command frame Answer frame


It returns the content of consecutive memory words int the Begin frame character : Begin frame character :
range between W 0000 and W FFFE. We remind that the Node address FF Node address FF
variable addressing in the memory is offset by the value Function code 03 Function code 03
defined in project settings. The maximum number of Starting address (Hi) 01 Byte count 04
consecutive words that can be returned, can be calculated Starting address (Lo) FE W 01FE data (Hi) 12
with the formula (FrameLength-4)/2. No of Points (Hi) 00 W 01FE data (Lo) 34
No of Points (Lo) 02 W 0200 data (Hi) A5
Error check (LRC) FD W 0200 data (Hi) F2
The example frame :FF0301FE0002FD^M^J returns the
Carriage return CR Error check (LRC) 1D
value of 2 words from the address W 01FE. It returns the
Line feed LF Carriage return CR
value of W 01FE=0x1234 and word W 0200=0xA5F2.
Line feed LF
Code 04: Read input register Command frame Answer frame
Begin frame character : Begin frame character :
It returns the content of consecutive memory words in the Node address FF Node address FF
range between W 0000 and W FFFE. We remind that the Function code 04 Function code 04
variable addressing in the memory is offset by the value Starting address (Hi) 01 Byte count 04
defined in project settings. The maximum number of Starting address (Lo) FE W 01FE data (Hi) 12
consecutive words that can be returned, can be calculated No of Points (Hi) 00 W 01FE data (Lo) 34
with the formula (FrameLength-4)/2. No of Points (Lo) 02 W 0200 data (Hi) A5
Error check (LRC) FC W 0200 data (Hi) F2
The example frame :FF0401FE0002FC^M^J returns the Carriage return CR Error check (LRC) 1C
value of 2 words from the address W 01FE. It returns the Line feed LF Carriage return CR
value of W 01FE=0x1234 and word W 0200=0xA5F2. Line feed LF

Code 06: Preset single register Command frame Answer frame


It allows to change the content of a memory word in the range Begin frame character : Begin frame character :
between W 0000 and W FFFF. We remind that the variable Node address FF Node address FF
addressing in the memory is offset by the value defined in Function code 06 Function code 06
project settings. Starting address (Hi) 01 Starting address (Hi) 01
Starting address (Lo) 84 Starting address (Lo) 84
Data (Hi) 12 Data (Hi) 12
The example frame :FF060184123430^M^J writes in the
Data (Lo) 34 Data (Lo) 34
word W 0184 the data 0x1234. In the answer frame is
Error check (LRC) 30 Error check (LRC) 30
returned the command echo.
Carriage return CR Carriage return CR
Line feed LF Line feed LF
Code 08: Loopback diagnostic test Command frame Answer frame
It returns the result of the test requested by the command. Begin frame character : Begin frame character :
The example frame :FF080000A55AFA^M^J executes the Node address FF Node address FF
0000 Return query data test, with the data 0xA55A. In the Function code 08 Function code 08
answer frame is returned the same data of the command Diagnostic code (Hi) 00 Diagnostic code (Hi) 00
frame. Diagnostic code (Lo) 00 Diagnostic code (Lo) 00
Data (Hi) A5 Data (Hi) A5
Between all the possible tests supported by the protocol Data (Lo) 5A Data (Lo) 5A
(Diagnostic codes) the FB executes only those reported. Error check (LRC) FA Error check (LRC) FA
Carriage return CR Carriage return CR
Line feed LF Line feed LF

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (7 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

0000: Return query data


The example frame :FF080000A55AFA^M^J executes the 0000 Return query data test, with the data
0xA55A. In the answer frame is returned the same data of the command frame.

Command frame Answer frame


: FF 08 00 00 A5 5A FA CR LF : FF 08 00 00 A5 5A FA CR LF

0002: Return diagnostic register


The example frame :FF0800020000F7^M^J executes the 0002: Return diagnostic register test. In the
answer frame is returned the value of the StatusBit (From 0x00 to 0xFF).

Command frame Answer frame


: FF 08 00 02 00 00 F7 CR LF : FF 08 00 02 00 01 F6 CR LF

000A: Clear counters and diagnostic registers


The example frame :FF08000A0000EF^M^J executes the 000A: Clear counters and diagnostic registers
test. The command resets all the internal counters and the error bits in StatusBit. In the answer frame the
0x0000 value is returned.

Command frame Answer frame


: FF 08 00 0A 00 00 EF CR LF : FF 08 00 0A 00 00 EF CR LF

000B: Return bus message count


The example frame :FF08000B0000FF^M^J executes the 000B: Return bus message count test. In the
answer frame is returned the value of the MODBUS commands received counter Communs (From 0x0000 to
0xFFFF).

Command frame Answer frame


: FF 08 00 0B 00 00 EE CR LF : FF 08 00 0B A3 DB 70 CR LF

000C: Return bus error count


The example frame :FF08000C0000ED^M^J executes the 000C: Return bus error count test. In the answer
frame is returned the value of the communication commands errors counter CommErrs (From 0x0000 to
0xFFFF).

Command frame Answer frame


: FF 08 00 0C 00 00 ED CR LF : FF 08 00 0C 12 34 A7 CR LF

000D: Return bus exception error count


The example frame :FF08000D0000EC^M^J executes the 000D: Return bus exception error count test. In
the answer frame is returned the value of the exception errors counter ExceptsErr (From 0x0000 to 0xFFFF).

Command frame Answer frame


: FF 08 00 0D 00 00 EC CR LF : FF 08 00 0D 0F 10 CD CR LF

000E: Return slave message count


The example frame :FF08000E0000EB^M^J executes the 000E: Return slave message count test. In the

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (8 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

answer frame is returned the value of the MODBUS answers sent counter Answers (From 0x0000 to 0xFFFF).

Command frame Answer frame


: FF 08 00 0E 00 00 EB CR LF : FF 08 00 0E F3 00 F8 CR LF

0012: Return bus character overrun count


The example frame :FF0800120000E7^M^J executes the 0012: Return bus character overrun count test. In
the answer frame is returned the value of the overruns errors counter Overruns (From 0x0000 to 0xFFFF).

Command frame Answer frame


: FF 08 00 12 00 00 E7 CR LF : FF 08 00 12 00 01 E6 CR LF

Code 10: Preset multiple registers Command frame Answer frame


It allows to change the content of a memory words in the Begin frame character : Begin frame character :
range between W 0000 and W FFFF. We remind that the Node address FF Node address FF
variable addressing in the memory is offset by the value Function code 10 Function code 10
defined in project settings. The maximum number of Starting address (Hi) 01 Starting address (Hi) 01
consecutive words that can be preset, can be calculated with Starting address (Lo) 84 Starting address (Lo) 84
the formula (FrameLength-8)/2. No of registers (Hi) 00 No of registers (Hi) 00
No of registers (Lo) 02 No of registers (Lo) 02
Byte count 04 Error check (LRC) 6A
The example frame :FF1001840002041234567852^M^J
W 0184 data (Hi) 12 Carriage return CR
writes two consecutive words starting from the W 0184. In the
W 0184 data (Lo) 34 Line feed LF
W 0184 the data 0x1234 is written and in the W 0186 the data
W 0186 data (Hi) 56
0x5678 is written. In the answer frame the begin address and W 0186 data (Lo) 78
the number of written words are returned. Error check (LRC) 52
Carriage return CR
Line feed LF
Code 41: Read memory bytes (User function) Command frame Answer frame
It returns the content of consecutive bytes of RAM memory in Begin frame character : Begin frame character :
the range between the address 0x0000 to 0xFFFF. The Node address FF Node address FF
maximum number of consecutive bytes that can be read, can Function code 41 Function code 41
be calculated with the formula FrameLength-4. Starting address (Hi) E1 No of bytes 04
Starting address (Lo) 03 0xE103 data 12
The example frame :FF41E10304D8^M^J returns the value No of bytes 04 0xE104 data AB
of 4 consecutive bytes from the address 0xE103, in the Error check (LRC) D8 0xE105 data F0
answer frame are returned the values of the bytes
Carriage return CR 0xE106 data 32
0xE103=0x12, 0xE104=0xAB, 0xE105=0xF0, 0xE106=0x32.
Line feed LF Error check (LRC) DD
Carriage return CR
Line feed LF
Code 42: Write memory bytes (User function) Command frame Answer frame
It allows to write consecutive bytes of RAM memory in the Begin frame character : Begin frame character :
range between the address 0x0000 to 0xFFFF. The Node address FF Node address FF
maximum number of the consecutive bytes that can be Function code 42 Function code 42
written, can be calculated with the formula FrameLength-6. Starting address (Hi) E3 Starting address (Hi) E3
Starting address (Lo) 40 Starting address (Lo) 40

The example frame :FF42E34002A532C3^M^J writes 2 No of bytes 02 No of bytes 02


consecutive bytes from the address 0xE340. In the byte 0xE340 data A5 Error check (LRC) 9A
0xE340 is written the data 0xA5 and in the byte 0xE341 is
0xE341 data 32 Carriage return CR
written the data 0x32. In the answer frame the begin address
Error check (LRC) C3 Line feed LF
Carriage return CR
and the number of written bytes are returned.
Line feed LF

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (9 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

Extended memory access


In order to gain the access to the whole memory the system can address, 2 new MODBUS commands are
introduced, by using an addressing with 3 bytes they can manage the RAM and the other types of memory such
as FLASH, EEPROM, etc. Here the list of the various types of memory you can address:

RAM memory : From 0x000000 to 0x0FFFFF


FLASH memory : From 0x100000 to 0x1FFFFF
EEPROM memory : From 0x200000 to 0x2FFFFF
Mass memory(PCB088) module 4: From 0x400000 to 0x4FFFFF
Mass memory (PCB088) module 5: From 0x500000 to 0x5FFFFF
Mass memory (PCB111): Da 0x600000 a 0x6FFFFF.
Code 43: Extended read memory bytes (User function) Command frame Answer frame
It returns the content of consecutive bytes of memory, by Begin frame character : Begin frame character :
using an addressing with 3 bytes it can manage the RAM and Node address FF Node address FF
the other types of memory such as FLASH, EEPROM, etc. in Function code 43 Function code 43
the range between the address 0x000000 to 0xFFFFFF. The Starting address (Hi) 00 No of bytes 04
maximum number of consecutive bytes that can be read, can Starting address E3 0x00E300 data 12
be calculated with the formula FrameLength-4. Starting address (Lo) 00 0x00E301 data AB
No of bytes 04 0x00E302 data F0
The example frame :FF4300E30004D7^M^J returns the Error check (LRC) D7 0x00E303 data 32
value of 4 consecutive bytes from the address 0x00E300, in Carriage return CR Error check (LRC) DB
the answer frame are returned the values of the bytes
Line feed LF Carriage return CR
0x00E300=0x12, 0x00E301=0xAB, 0x00E302=0xF0,
Line feed LF
0x00E303=0x32.
Code 44: Extended write memory bytes (User function) Command frame Answer frame
It allows to write consecutive bytes of memory, by using an Begin frame character : Begin frame character :
addressing with 3 bytes it can manage the RAM and the other Node address FF Node address FF
types of memory such as FLASH, EEPROM, etc. in the range Function code 44 Function code 44
between the address 0x000000 to 0xFFFFFF. The maximum Starting address (Hi) 00 Starting address (Hi) 00
number of the consecutive bytes that can be written, can be Starting address E3 Starting address E3
calculated with the formula FrameLength-7. Starting address (Lo) 00 Starting address (Lo) 00
No of bytes 02 No of bytes 02
The example frame :FF4400E30002A53201^M^J writes 2 0x00E300 data A5 Error check (LRC) D8
consecutive bytes from the address 0x00E300. In the byte 0x00E301 data 32 Carriage return CR
0x00E300 is written the data 0xA5 and in the byte 0x00E301
Error check (LRC) 04 Line feed LF
is written the data 0x32. In the answer frame the begin
Carriage return CR
Line feed LF
address and the number of written bytes are returned.

Flat access mode


The flat access commands have an access mode byte that allows to access to the different variables type:

7 6 5 4 3 2 1 0

Type Selection Bit number

The Access mode byte is divided a bits as reported in the following table:

Bit Function Description

00: Byte
7, 6 Type 01: Word
02: Double o Float

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (10 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

FALSE: Access to variables


5 Selection
TRUE: Access to bit
4, 3, 2, 1, 0 Bit number It defines the bit number to access to if Selection=TRUE

If the access to bit is selected the No of variables field must be set to 1.

Code 47: Flat read memory variables (User function) Command frame Answer frame
It returns the content of variables located sequentially in Begin frame character : Begin frame character :
memory, by using the memory type specification and an Node address FF Node address FF
addressing with 4 bytes, it can manage all the types of Function code 47 Function code 47
memory as defined in the SystemMemoryRead function. The Security code 00 Security code FF
maximum number of consecutive bytes that can be read, can Flat access mode 40 No of bytes 02
be calculated with the formula FrameLength-5. Memory type 00 0x0000E300 data 12
Starting address (Hi) 00 0x0000E301 data 34
Starting address 00 Error check (LRC) 73
The example frame :FF470040000000E3000196^M^J
Starting address E3 Carriage return CR
returns the value of 2 consecutive bytes from RAM memory
Starting address (Lo) 00 Line feed LF
(Type: 00) at the address 0x0000E300, in the answer frame
No of variables 01
are returned the values of the bytes 0x0000E300=0x12,
Error check (LRC) 96
0x0000E301=0x34.
Carriage return CR
Line feed LF
Code 48: Flat write memory variables (User function) Command frame Answer frame
It allows to write variables located sequentially in memory, by Begin frame character : Begin frame character :
using the memory type specification and an addressing with 4 Node address FF Node address FF
bytes, it can manage all the types of memory as defined in the Function code 48 Function code 48
SystemMemoryWrite function. The maximum number of the Security code 00 Security code FF
consecutive bytes that can be written, can be calculated with Flat access mode 40 Error check (LRC) BA
the formula FrameLength-11. Memory type 00 Carriage return CR
Starting address (Hi) 00 Line feed LF
Starting address 00
The example frame :FF480040000000E3000112344F^M^J
Starting address E3
writes 2 consecutive bytes from the address 0x0000E300. In
Starting address (Lo) 00
the byte 0x0000E300 is written the data 0x12 and in the byte
No of variables 01
0x0000E301 is written the data 0x34. In the answer frame the
0x0000E300 data 12
Security code is returned. 0x0000E301 data 34
Error check (LRC) 4F
Carriage return CR
Line feed LF

Exception responses Exception frame


If the command is not included in those recognized or if it Begin frame character :
contains error in the data field, an error frame is returned, Node address FF
containing a field with information about the exception code. Function code ( 81) 81
The possible codes are: Exception code 02
Error check (LRC) 7E
01: Illegal function Carriage return CR
The received command is not included in those managed. Line feed LF
02: Illegal data address
The received command has the memory type, address field or
the byte/word number not included in the defined range.
03: Illegal data value
The received command has the data field not included in the
defined range.
04: Failure in associated device
The received command has inaccuracies, typically the frame

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (11 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusAsciiSl

length is wrong.
LRC (Longitudinal redundancy check)calculation
As described before, every data frame has a control data called LRC, the frames are considered correct only if
the control by LRC is correct. In order to calculate the LRC you have to add all the frame fields using a 8 bits
sum without carry, the result has to be complemented to 2.

Here an example for the command frame "10: Preset multiple registers".

: FF 10 01 84 00 02 12 34 EB 0D Lrc CR LF

We will have: 0xFF+0x10+0x01+0x84+0x00+0x02+0x00+0x12+0x34+0xEB+0x0D=0x2D4


Using 8 bits, we will have 0xD4, its two complement is 0x2C. So the frame LRC is 0x2C.

To control the frame received LRC you have to add all the frame fields including the LRC with a 8 bits sum
without carry, if the frame is correct, the result will be 0.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiSl.htm (12 of 12) [06/10/2008 17.42.23]


Function blocks: FbModbusRtuSl

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbModbusRtuSl

This function block allows the management of the MODBUS RTU protocol as slave. The function block can be
called also by using the proper graphic utility this simplify the use. In case of mistake in the user defined
parameters, the StatusBit.ParamErrs and the FBParameters bit in the PLCErrors data structure are set.

Code:PFB060 History report


Prototype
FbModbusRtuSl.h

Declaration
void FbModbusRtuSl(FBMODBUSRTUSLDATA* S);

Parameters
FBMODBUSRTUSLDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members, reported under the
Members automatically managed by Remoter label are managed automatically by Remoter in case of use the
graphic utility, on the contrary they have to be managed by the user program. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL ResetCtrs:1; //Resets all the counters
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}CmdBit; //Command

struct
{
BOOL Enabled:1; //Enabled
BOOL ReceiveOk:1; //Receive ok
BOOL CmActive:1; //Communication active
BOOL ParamErrs:1; //Parameters error

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (1 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

BOOL Timeouts:1; //Timeout error


BOOL Overruns:1; //Overrun error
BOOL CommErrs:1; //Communication error
BOOL Excepts:1; //Command error
}StatusBit; //Status

unsigned char NodeAdd; //Node address


unsigned char Dummy1;
unsigned int AnswerWt; //Answer wait time (mSec)
unsigned int TimeOutCk; //Timeout Check (mSec)
unsigned int Timeouts; //Timeout errors counter
unsigned int Overruns; //Overrun error counter
unsigned int CommErrs; //Communication error counter
unsigned int ExceptsErr; //Command errors counter
unsigned int Communs; //Command received counter
unsigned int Answers; //Answer sent counter
unsigned int Dummy2;
unsigned int CmActiveDelay; //Communication active delay (mSec)
unsigned char FrameLength; //Rx/Tx frame length
unsigned char Dummy3;

// ----------------------------[Members automaticallty managed by Remoter]--

unsigned int Dummy4;


unsigned char* FrameBuf; //Rx/Tx frame buffer
BOOL Compatibility; //MODICON compatibility

// --------------------------------------------[Internal use only members]--

...
}FBMODBUSRTUSLDATA;

00 CmdBit
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB and the communication is hang up. By disabling the FB all the error
bits in StatusBit are reset and all the other command bits are not active.
TRUE: It enables the FB.
1 ResetCtrs TRUE: It resets all the counters, the bit is automatically reset.

01 StatusBit
Status bits of the function block, the user program can test these bits. The value can be acquired by
MODBUS with the diagnostic command 0002: Return diagnostic register.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (2 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

0 Enabled TRUE: The FB is enabled.


1 ReceiveOk It's activated for a program loop at the reception of every MODBUS command.
2 CmActive It's activated at the reception of a MODBUS command, it's reset if no further MODBUS
commands are received for a time longer than the time defined in CmActiveDelay.
3 ParamErrs TRUE: Indicates an error on user defined parameters. It can be reset by resetting the CmdBit.
Enable.
4 Timeouts TRUE: Indicates a command execution timeout error. It can be reset by resetting the CmdBit.
Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic
command.
5 Overruns TRUE: Indicates an overruns error in reception from serial line, more characters than the
reception buffer length has been received. It can be reset by resetting the CmdBit.Enable or
at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.
6 CommErrs TRUE: Indicates an error command reception from serial line, a wrong character or a number
of characters different from the requested has been received. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers
diagnostic command.
7 Excepts TRUE: Indicates a reception of a MODBUS function that is not supported. It can be reset by
resetting the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic
registers diagnostic command.

02 NodeAdd
Loaded by user program it defines the address of slave node (From 0x00 to 0xFF).
04 AnswerWt
Loaded by user program it defines the waiting time expressed in mSec between the reception of a MODBUS
command and the transmission of the proper answer (From 0x0000 to 0xFFFF).
06 TimeOutCk
Loaded by user program it defines the available time expressed in mSec to receive an entire command
frame. Time is considered from the reception of the start frame ":" character. (From 0x0000 to 0xFFFF).
08 Timeouts
It returns the occurred timeouts errors counting (From 0x0000 to 0xFFFF). It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

0A Overruns
It returns the occurred overrun errors counting (From 0x0000 to 0xFFFF). The value can be acquired by
MODBUS with the 0012: Return bus character overrun count diagnostic command. It can be reset by
resetting the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers
diagnostic command.
0C CommErrs
It returns the occurred communication errors counting (From 0x0000 to 0xFFFF). The value con be acquired
by MODBUS with the 000C: Return bus error count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

0E ExceptsErr
It returns the occurred except errors counting (From 0x0000 to 0xFFFF). The value con be acquired by
MODBUS with the 000D: Return bus exception error count diagnostic command. It can be reset by resetting
the CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic
command.
10 Communs

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (3 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

It returns the received MODBUS commands counting (From 0x0000 to 0xFFFF). The value con be acquired
by MODBUS with the 000B: Return bus message count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

12 Answers
It returns the sent MODBUS answers counting (From 0x0000 to 0xFFFF). The value con be acquired by
MODBUS with the 000E: Return slave message count diagnostic command. It can be reset by resetting the
CmdBit.Enable or at the reception of the 000A: Clear counters and diagnostic registers diagnostic command.

16 CmActiveDelay
Loaded by user program it defines the time in mSec, after that if no MODBUS command are received the
active communication bit StatusBit.CmActive is reset (From 0x0000 to 0xFFFF).
18 FrameLength
Loaded by user program it defines the dimension of the frame reception/transmission buffer (From 12 to
255). To maintain compatibility with the previous versions a buffer of at least 40 bytes must be defined.
1C FrameBuf
Automatically loaded by Remoter if the graphic utility is used, otherwise it must by loaded by user program, if
defines the allocation address of the frame reception/transmission buffer (From 0x0000 to 0xFFFF).
1E Compatibility
Automatically loaded by Remoter if the graphic utility is used, otherwise it must by loaded by user program, if
defines the working of the Read holding register, Read input registers, Preset single register e Preset
multiple registers MODBUS command:
FALSE: The commands are managed with byte addressing as used in Remoter.
TRUE: The commands are managed with word addressing as defined in MODICON specifications. The
memory word address it's calculated by multiplying for 2 the address specified in the command frame. So to
reach the W 0100 it will be necessary to define in the command frame the starting address 0080.

RIL example

In the following example the MODBUS slave communication management is executed, when the MODBUS RTU
command strings are received, the system will answer by sending the answer strings.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; MODBUS slave communication, data structure.

DEFL Y Mdb KD 64
DEFL Y MdbCmdBit Y Mdb KH 0000 ; Mdb.CmdBit
DEFL Y MdbStatusBit Y Mdb KH 0001 ; Mdb.StatusBit
DEFL Y MdbNodeAdd Y Mdb KH 0002 ; Mdb.NodeAdd
DEFL W MdbAnswerWt Y Mdb KH 0004 ; Mdb.AnswerWt
DEFL W MdbTimeOutCk Y Mdb KH 0006 ; Mdb.TimeOutCk
DEFL W MdbTimeouts Y Mdb KH 0008 ; Mdb.Timeouts
DEFL W MdbOverruns Y Mdb KH 000A ; Mdb.Overruns
DEFL W MdbCommErrs Y Mdb KH 000C ; Mdb.CommErrs
DEFL W MdbExceptsErr Y Mdb KH 000E ; Mdb.ExceptsErr
DEFL W MdbCommuns Y Mdb KH 0010 ; Mdb.Communs
DEFL W MdbAnswers Y Mdb KH 0012 ; Mdb.Answers
DEFL W MdbCmActiveDelay Y Mdb KH 0016 ; Mdb.CmActiveDelay
DEFL Y MdbFrameLength Y Mdb KH 0018 ; Mdb.FrameLength

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (4 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

DEFL W MdbFrameBuf Y Mdb KH 001C ; Mdb.FrameBuf


DEFL F MdbCompatibility Y Mdb KH 001E ;Mdb.Compatibility

; Rx/Tx frame buffer definition.

DEFL Y FrameBuf KD 45

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------
; MODBUS slave communication, variables settings.

ORGR
LODT F PLCFirstLoop
MOVI Y MdbNodeAdd KD 0 ; Mdb.NodeAdd
MOVI W MdbAnswerWt KD 0 ; Mdb.AnswerWt
MOVI W MdbTimeOutCk KD 2000 ; Mdb.TimeOutCk
MOVI W MdbCmActiveDelay KD 2000 ; Mdb.CmActiveDelay
MOVI Y MdbFrameLength KD 40 ; Mdb.FrameLength
MOVA W MdbFrameBuf Y FrameBuf ; Mdb.FrameBuf
UTCH F MdbCompatibility ; Mdb.Compatibility
LTCH Y MdbCmdBit K 0001 ; Mdb.CmdBit.ResetCtrs

; ------------------------------------------------------------------------------
; @Section("MODBUS communication, slave management")
; ------------------------------------------------------------------------------
; MODBUS slave communication management on port "A".

ORGR
SETR
SETV KE IOSerialPortA
TASK L FbModbusRtuSl Y Mdb ; MODBUS slave management
LTCH Y MdbCmdBit K 0000 ; Mdb.CmdBit.Enable

; [End of file]

"C" example

In the following example the MODBUS slave communication management is executed, when the MODBUS RTU
command strings are received, the system will answer by sending the answer strings.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModbusAsciiSl.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define MDBFRAMELENGTH 45 //Modbus frame length

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (5 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBMODBUSASCIISLDATA Mdb; //MODBUS slave data structure


unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the system init at first program execution loop.

if (PLCFirstLoop)
{
// Set variables to manage the MODBUS slave communication.

Mdb.NodeAdd=0; //Node address


Mdb.AnswerWt=0; //Answer wait time (mSec)
Mdb.TimeOutCk=100; //Timeout Check (mSec)
Mdb.CmActiveDelay=2000; //Communication active delay (mSec)
Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=&FrameBuf; //Rx/Tx frame buffer
Mdb.Compatibility=FALSE; //MODICON compatibility
Mdb.CmdBit.ResetCtrs=TRUE; //Resets all the counters
}

// -------------------------------------------------------------------------
// MODBUS SLAVE COMMUNICATION
// -------------------------------------------------------------------------
// Here define the serial line that must be used.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


TermIOTick(); //Manage the selected I/O console

// MODBUS slave communication management.

FbModbusAsciiSl(&Mdb); //MODBUS slave management


Mdb.CmdBit.Enable=TRUE; //Enable
}

// [End of file]

Supported MODBUS commands

To reduce the code the FB doesn't implement all the functions previewed in the MODBUS protocol, following are
described those implemented.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (6 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

Code 01: Read coil status Command frame Answer frame


It returns the content of consecutive flags in the range between Node address FF Node address FF
F 0000 and F FFFF. We remind that the variable addressing in Function code 01 Function code 01
the memory is offset by the value defined in project settings. The 01
Starting address (Hi) Byte count 02
state of the flags is returned on the return value bits, the flag 00
Starting address (Lo) F 0107-F 0100 12
addressed in the command is returned on bit 0 of the first byte. No of Points (Hi) 00 F 010F-F 0108 34
The maximum number of consecutive flags that can be returned No of Points (Lo) 09 9D
Error check (LRC)
can be calculated with the formula: ((FrameLength-5)/2)*8, E8 5F
Error check (CRC)
however cannot be more than 32. If the number of requested 2E
flags is not an exact multiple of 8 are returned a number of flag
equal to the next multiple of 8.

The example frame FF 02 01 00 00 09 E8 2E executes the read


of 9 flags starting from F 0100. In the answer frame the flags
from F 0100 to F 010F are returned.
Code 02: Read inut status Command frame Answer frame
It returns the content of consecutive flags in the range between Node address FF Node address FF
F 0000 and F FFFF. We remind that the variable addressing in Function code 02 Function code 01
the memory is offset by the value defined in project settings. The Starting address (Hi) 01 Byte count 02
state of the flags is returned on the return value bits, the flag Starting address (Lo) 00 F 0107-F 0100 12
addressed in the command is returned on bit 0 of the first byte. No of Points (Hi) 00 F 010F-F 0108 34
The maximum number of consecutive flags that can be returned No of Points (Lo) 09 9D
Error check (LRC)
can be calculated with the formula: ((FrameLength-5)/2)*8, E8 5F
Error check (CRC)
however cannot be more than 32. If the number of requested 2E
flags is not an exact multiple of 8 are returned a number of flag
equal to the next multiple of 8.

The example frame FF 02 01 00 00 09 E8 2E executes the read


of 9 flags starting from F 0100. In the answer frame the flags
from F 0100 to F 010F are returned.
Code 03: Read holding register Command frame Answer frame
It returns the content of consecutive memory words int the range Node address FF Node address FF
between W 0000 and W FFFE. We remind that the variable Function code 03 Function code 03
addressing in the memory is offset by the value defined in Starting address (Hi) 01 Byte count 04
project settings. The maximum number of consecutive words Starting address (Lo) FE W 01FE data (Hi) 12
that can be returned, can be calculated with the formula No of Points (Hi) 00 W 01FE data (Lo) 34
(FrameLength-5)/2. No of Points (Lo) 02 W 0200 data (Hi) A5
B1 W 0200 data (Hi) F2
Error check (CRC)
D9 5B
The example frame FF 03 01 FE 00 02 B1 D9 returns the value Error check CRC)
9F
of 2 words from the address W 01FE. It returns the value of
W 01FE=0x1234 and word W 0200=0xA5F2.
Code 04: Read input register Command frame Answer frame
Node address FF Node address FF
It returns the content of consecutive memory words in the range Function code 04 Function code 04
between W 0000 and W FFFE. We remind that the variable 01
Starting address (Hi) Byte count 04
addressing in the memory is offset by the value defined in FE
Starting address (Lo) W 01FE data (Hi) 12
project settings. The maximum number of consecutive words No of Points (Hi) 00 W 01FE data (Lo) 34
that can be returned, can be calculated with the formula No of Points (Lo) 02 W 0200 data (Hi) A5
(FrameLength-5)/2. 04 W 0200 data (Hi) F2
Error check (CRC)
19 5A
Error check CRC)
The example frame FF 04 01 FE 00 02 04 19 returns the value 28
of 2 words from the address W 01FE. It returns the value of
W 01FE=0x1234 and word W 0200=0xA5F2.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (7 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

Code 05: Force single coil Command frame Answer frame


Ritorna Node address FF Node address FF
Function code 04 Function code 04
01
Starting address (Hi) Byte count 04
FE
Starting address (Lo) W 01FE data (Hi) 12
W 0184 data (Hi) 00 W 01FE data (Lo) 34
W 0184 data (Lo) 02 W 0200 data (Hi) A5
04 W 0200 data (Hi) F2
Error check (CRC)
19 5A
Error check CRC)
28
Code 06: Preset single register Command frame Answer frame
It allows to change the content of a memory word in the range Node address FF Node address FF
between W 0000 and W FFFF. We remind that the variable Function code 06 Function code 06
addressing in the memory is offset by the value defined in Starting address (Hi) 01 Starting address (Hi) 01
project settings. Starting address (Lo) 84 Starting address (Lo) 84
W 0184 data (Hi) 12 W 0184 data (Hi) 12
W 0184 data (Lo) 34 W 0184 data (Lo) 34
The example frame FF 06 01 84 12 34 D0 B6 writes in the word
D0 D0
W 0184 the data 0x1234. In the answer frame is returned the Error check (CRC) Error check (CRC)
B6 B6
command echo.
Code 08: Loopback diagnostic test Command frame Answer frame
It returns the result of the test requested by the command. The Node address FF Node address FF
example frame FF 08 00 00 A5 5A 0E BE executes the 0000 Function code 08 Function code 08
Return query data test, with the data 0xA55A. In the answer Diagnostic code (Hi) 00 Diagnostic code (Hi) 00
frame is returned the same data of the command frame. Diagnostic code (Lo) 00 Diagnostic code (Lo) 00
Data (Hi) A5 Data (Hi) A5
Between all the possible tests supported by the protocol Data (Lo) 5A Data (Lo) 5A
(Diagnostic codes) the FB executes only those reported. 0E 0E
Error check (CRC) Error check (LRC)
BE BE
0000: Return query data
The example frame FF 08 00 00 A5 5A 0E BE executes the 0000 Return query data test, with the data
0xA55A. In the answer frame is returned the same data of the command frame.

Command frame Answer frame


FF 08 00 00 A5 5A 0E BE FF 08 00 00 A5 5A 0E BE

0002: Return diagnostic register


The example frame FF 08 00 02 00 00 54 15 executes the 0002: Return diagnostic register test. In the
answer frame is returned the value of the StatusBit (From 0x00 to 0xFF).

Command frame Answer frame


FF 08 00 02 00 00 54 15 FF 08 00 02 00 01 95 D5

000A: Clear counters and diagnostic registers


The example frame FF 08 00 02 00 00 54 15 executes the 000A: Clear counters and diagnostic registers
test. The command resets all the internal counters and the error bits in StatusBit. In the answer frame the
0x0000 value is returned.

Command frame Answer frame


FF 08 00 0A 00 00 D5 D7 FF 08 00 0A 00 00 D5 D7

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (8 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

000B: Return bus message count


The example frame FF 08 00 0B 00 00 84 17 executes the 000B: Return bus message count test. In the
answer frame is returned the value of the MODBUS commands received counter Communs (From 0x0000 to
0xFFFF).

Command frame Answer frame


FF 08 00 0B 00 00 84 17 FF 08 00 0B A3 DB BC BC

000C: Return bus error count


The example frame FF 08 00 0C 00 00 35 D6 executes the 000C: Return bus error count test. In the answer
frame is returned the value of the communication commands errors counter CommErrs (From 0x0000 to
0xFFFF).

Command frame Answer frame


FF 08 00 0C 00 00 35 D6 FF 08 00 0C 12 34 38 A1

000D: Return bus exception error count


The example frame FF 08 00 0D 00 00 64 16 executes the 000D: Return bus exception error count test. In
the answer frame is returned the value of the exception errors counter ExceptsErr (From 0x0000 to 0xFFFF).

Command frame Answer frame


FF 08 00 0D 00 00 64 16 FF 08 00 0D 0F 10 60 2A

000E: Return slave message count


The example frame FF 08 00 0E 00 00 94 16 executes the 000E: Return slave message count test. In the
answer frame is returned the value of the MODBUS answers sent counter Answers (From 0x0000 to 0xFFFF).

Command frame Answer frame


FF 08 00 0E 00 00 94 16 FF 08 00 0E F3 00 D0 E6

0012: Return bus character overrun count


The example frame FF 08 00 12 00 00 55 D0 executes the 0012: Return bus character overrun count test. In
the answer frame is returned the value of the overruns errors counter Overruns (From 0x0000 to 0xFFFF).

Command frame Answer frame


FF 08 00 12 00 00 55 D0 FF 08 00 12 01 50 54 7C

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (9 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

Code 10: Preset multiple registers Command frame Answer frame


It allows to change the content of a memory words in the range Node address FF Node address FF
between W 0000 and W FFFF. We remind that the variable Function code 10 Function code 10
addressing in the memory is offset by the value defined in Starting address (Hi) 01 Starting address (Hi) 01
project settings. The maximum number of consecutive words Starting address (Lo) 84 Starting address (Lo) 84
that can be preset, can be calculated with the formula No of registers (Hi) 00 No of registers (Hi) 00
(FrameLength-9)/2. No of registers (Lo) 02 No of registers (Lo) 02
Byte count 04 15
Error check (CRC)
W 0184 data (Hi) 12 C3
The example frame FF 10 01 84 00 02 04 12 34 56 67 FA BB
W 0184 data (Lo) 34
writes two consecutive words starting from the W 0184. In the
W 0186 data (Hi) 56
W 0184 the data 0x1234 is written and in the W 0186 the data
W 0186 data (Lo) 67
0x5678 is written. In the answer frame the begin address and
FA
the number of written words are returned. Error check (CRC)
BB

Flat access mode


The flat access commands have an access mode byte that allows to access to the different variables type:

7 6 5 4 3 2 1 0

Type Selection Bit number

The Access mode byte is divided a bits as reported in the following table:

Bit Function Description

00: Byte
7, 6 Type 01: Word
02: Double o Float
FALSE: Access to variables
5 Selection
TRUE: Access to bit
4, 3, 2, 1, 0 Bit number It defines the bit number to access to if Selection=TRUE

If the access to bit is selected the No of variables field must be set to 1.

Code 47: Flat read memory variables (User function) Command frame Answer frame
It returns the content of variables located sequentially in Node address FF Node address FF
memory, by using the memory type specification and an Function code 47 Function code 47
addressing with 4 bytes, it can manage all the types of memory Security code 00 Security code FF
as defined in the SystemMemoryRead function. The maximum Flat access mode 40 No of bytes 02
number of consecutive bytes that can be read, can be calculated Memory type 00 0x0000E300 data 12
with the formula FrameLength-6. 00
Starting address (Hi) 0x0000E301 data 34
Starting address 00 3C
Error check (CRC)
Starting address E3 B8
The example frame FF 47 00 40 00 00 00 E3 00 01 23 F5
00
Starting address (Lo)
returns the value of 2 consecutive bytes from RAM memory
No of variables 01
(Type: 00) at the address 0x0000E300, in the answer frame are
23
returned the values of the bytes 0x0000E300=0x12, Error check (CRC)
F5
0x0000E301=0x34.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (10 of 11) [06/10/2008 17.42.28]


Function blocks: FbModbusRtuSl

Code 48: Flat write memory variables (User function) Command frame Answer frame
It allows to write variables located sequentially in memory, by Node address FF Node address FF
using the memory type specification and an addressing with 4 Function code 48 Function code 48
bytes, it can manage all the types of memory as defined in the Security code 00 Security code FF
SystemMemoryWrite function. The maximum number of the Flat access mode 40 37
Error check (CRC)
consecutive bytes that can be written, can be calculated with the Memory type 00 B0
formula FrameLength-11. 00
Starting address (Hi)
Starting address 00
Starting address E3
The example frame FF 48 00 40 00 00 00 E3 00 01 12 34 E4 14
00
Starting address (Lo)
writes 2 consecutive bytes from the address 0x0000E300. In the
No of variables 01
byte 0x0000E300 is written the data 0x12 and in the byte
0x0000E300 data 12
0x0000E301 is written the data 0x34. In the answer frame the
0x0000E301 data 34
Security code is returned.
E4
Error check (CRC)
14

Exception responses Exception frame


If the command is not included in those recognized or if it Node address FF
contains error in the data field, an error frame is returned, Function code ( 81) 81
containing a field with information about the exception code. The Exception code 02
possible codes are: A0
Error check (CRC)
61
01: Illegal function
The received command is not included in those managed.
02: Illegal data address
The received command has the address field or the byte/word
number not included in the defined range.
03: Illegal data value
The received command has the data field not included in the
defined range.
04: Failure in associated device
The received command has inaccuracies, typically the frame
length is wrong.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuSl.htm (11 of 11) [06/10/2008 17.42.28]


Function blocks: FbSysTerminal

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbSysTerminal

This function block allows the management of the operator terminal, it can be executed only by using the proper
graphic utility.

Code:PFB054 History report


Prototype
FbSysTerminal.h

Declaration
void FbSysTerminal(FBSYSTERMINALDATA* S);

Parameters
FBSYSTERMINALDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 96 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Active enables the function block
BOOL DisablePageSel:1; //Active disables the page selection
BOOL DisableMsgScroll:1; //Active disables the message scroll
BOOL DisableEdit:1; //Active disables the variables edit
BOOL DisablePageScroll:1; //Active disables the page scroll
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //Active if the function block is enabled
BOOL Warnings:1; //Active if warnings present
BOOL Alarms:1; //Active if alarms present
BOOL b3:1;
BOOL KeyPressed:1; //Active if any key is pressed
BOOL b5:1;
BOOL b6:1;

http://192.168.0.61/Destination/Html/FctBlocks/FbSysTerminal.htm (1 of 5) [06/10/2008 17.42.30]


Function blocks: FbSysTerminal

BOOL b7:1;
}Status;

struct
{
BOOL LED0:1; //Key [0] led command
BOOL LED1:1; //Key [1] led command
BOOL LED2:1; //Key [2] led command
BOOL LED3:1; //Key [3] led command
BOOL LED4:1; //Key [4] led command
BOOL LED5:1; //Key [5] led command
BOOL LED6:1; //Key [6] led command
BOOL LCDBacklight:1; //LCD backlight command
}LEDCommand;

unsigned int MessageNr; //Message to be displayed

struct
{
BOOL K0:1; //Key [0] status
BOOL K1:1; //Key [1] status
BOOL K2:1; //Key [2] status
BOOL K3:1; //Key [3] status
BOOL K4:1; //Key [4] status
BOOL K5:1; //Key [5] status
BOOL K6:1; //Key [6] status
BOOL K7:1; //Key [7] status

BOOL K8:1; //key [8] status


BOOL K9:1; //Key [9] status
BOOL KUP:1; //Key [UP] status
BOOL KDW:1; //Key [DW] status
BOOL KFUN:1; //Key [FUN] status
BOOL KESC:1; //Key [ESC] status
BOOL KCLR:1; //Key [CLR] status
BOOL KENT:1; //Key [ENT] status

BOOL KLEFT:1; //Key [KLEFT] status


BOOL KRIGHT:1; //Key [KRIGHT] status
}KeyStatus;

unsigned char PageNr; //Page to be displayed

// These variables contains the Warning and Alarm bits.

struct
{
unsigned long High; //Warnings from 0x20 to 0x3F
unsigned long Low; //Warnings from 0x00 to 0x1F
}Warnings;

struct
{
unsigned long High; //Warnings from 0x20 to 0x3F
unsigned long Low; //Warnings from 0x00 to 0x1F
}Alarms;

http://192.168.0.61/Destination/Html/FctBlocks/FbSysTerminal.htm (2 of 5) [06/10/2008 17.42.30]


Function blocks: FbSysTerminal

unsigned char NrOfWarnings; //Number of warnings


unsigned char NrOfAlarms; //Number of alarms

// -----------------------------[Members automatically managed by Remoter]--

struct
{
BOOL EnableWarnings:1; //Active enables the warnings management
BOOL EnableAlarms:1; //Active enables the alarms management
BOOL AutoAckWarnings:1; //Active enables the warnings auto ack
BOOL AutoAckAlarms:1; //Active enables the alarms auto ack
BOOL DisablePageLED:1; //Active disables the page LED management
}ICommand;

code unsigned int* MessagePointers; //Message pointers


unsigned int NumberOfMessages; //Number of messages

code PAGEID* Pages; //Page ID pointer


unsigned char NumberOfPages; //Number of pages

unsigned char TerminalAddress; //Terminal address


unsigned int KeyboardTimeOut; //Keyboard time out time (mSec)
unsigned char TerminalType; //Terminal type

// --------------------------------------------[Internal use only members]--


...
}FBSYSTERMINALDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB.
1 DisablePageSel TRUE: Disables the page selection from terminal keyboard. The page messages
cannot be automatically displayed, by using the page selection keys but they can be
displayed only by defining their number in MessageNr.
2 DisableMsgScroll TRUE: Disables the page submessages selection from the scroll message keys ,
o , . The page submessages can be displayed only by defining their number
in MessageNr.
3 DisableEdit TRUE: Disables the message variables editing from terminal keyboard.
4 DisablePageScroll TRUE: Disables the page messages selection from the scroll page keys , o ,
. The page messages can be displayed only by defining their number in
MessageNr.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 Warnings TRUE: There are warnings, at least one bit of the Warnings structure is set.
2 Alarms TRUE: There are alarms, at least one bit of the Alarms structure is set.
4 KeyPressed Set for a program loop when a key on the terminal is pressed.

02 LEDCommand

http://192.168.0.61/Destination/Html/FctBlocks/FbSysTerminal.htm (3 of 5) [06/10/2008 17.42.30]


Function blocks: FbSysTerminal

Terminal LED management bits (For Picoface terminals only). The user program can manage these bits
according to its own needs.
0 LED0 It commands the LED on the key of the Picoface terminal.
1 LED1 It commands the LED on the key of the Picoface terminal.
2 LED2 It commands the LED on the key of the Picoface terminal.
3 LED3 It commands the LED on the key of the Picoface terminal.
4 LED4 It commands the LED on the key of the Picoface terminal.
5 LED5 It commands the LED on the key of the Picoface terminal.
6 LED6 It commands the LED on the key of the Picoface terminal.
7 LCDBacklight It commands the display backlight of the Picoface terminal.

03 MessageNr
Loaded by user program it defines the message to display on the terminal. Refer to the Msg# reported near
the message in the graphic utility. In case the user program loads the number of an undefined message, the
Message:nnnnn is not been found message will be displayed (Range from 0 to 65535).
05 KeyStatus
Terminal key status, the user program can test these bits.
00 K0 Returns the Picoface terminal key status.
01 K1 Returns the Picoface terminal key status.
02 K2 Returns the Picoface terminal key status.
03 K3 Returns the Picoface terminal key status.
04 K4 Returns the Picoface terminal key status.
05 K5 Returns the Picoface terminal key status.
06 K6 Returns the Picoface terminal key status.
07 K7 Returns the Picoface terminal key status.
08 K8 Returns the Picoface terminal key status.
09 K9 Returns the Picoface terminal key status.
0A KUP Returns the Picoface terminal key or the Netsyst systems key status.
0B KDW Returns the Picoface terminal key or the Netsyst systems key status.
0C KFUN Returns the Picoface terminal key or the Netsyst systems key status.
0D KESC Returns the Picoface terminal key status.
0E KCLR Returns the Picoface terminal key status.
0F KENT Returns the Picoface terminal key or the Netsyst systems key status.
10 KLEFT Returns the Netsyst system key status.
11 KRIGHT Returns the Netsyst system key status.

08 PageNr

http://192.168.0.61/Destination/Html/FctBlocks/FbSysTerminal.htm (4 of 5) [06/10/2008 17.42.30]


Function blocks: FbSysTerminal

Returns the page number of displayed message. Refer to the Page# reported near the message in the
graphic utility. If the message is not a page message or submessage 0xFF will be returned. (Range from
0x00 to 0xFF).
09 Warnings
Loaded by user program, every bit is a warning. If the warning page message is displayed, by executing the
page submessages scroll, will be displayed only those, whose proper bit is set. Refer to the <WarningBitx>
reported near the message in the graphic utility.

11 Alarms
Loaded by user program, every bit is an alarm. If the alarm page message is displayed, by executing the
page submessages scroll, will be displayed only those, whose proper bit is set. Refer to the <AlarmBitx>
reported near the message in the graphic utility.

19 NrOfWarnings
Returns the number of bits set in the Warnings structure.
1A NrOfAlarms
Returns the number of bits set in the Alarmsstructure.

RIL example

No examples reported because the FB use is possible only using the graphic utility.

"C" example

No examples reported because the FB use is possible only using the graphic utility.

http://192.168.0.61/Destination/Html/FctBlocks/FbSysTerminal.htm (5 of 5) [06/10/2008 17.42.30]


HT011

ELSIST Srl, www.elsist.it MNL041Q100

How to

Visualize special characters on the terminal display

The LCD terminal supplied with ours systems are realized by using an alphanumeric display of 2 lines for 16
characters. The display is based on the Hitachi HD44780 controller, it's provided of an internal characters
generator. The correspondence of every character with the relate hexadecimal code is reported in the following
table.

http://192.168.0.61/Destination/Html/HowTo/HT011.htm (1 of 2) [06/10/2008 17.42.31]


HT011

As visible in the table for the ASCII characters whose code is greater than 0x80, the relate symbol in the
characters generator is different from the ASCII symbol reported in the standard table. To display it, it's necessary
to insert the hexadecimal value of it, in the message edited in the operator terminal FB.

Special characters

If it's request to display in the terminal messages special characters, it's necessary to define in the text of the
message a sequence of symbols, please refer to the following table.

\x Hexadecimal constant t allows to display the character relate to the hexadecimal defined code. Example, the
constant "\x041" will display ASCII character "A". The hexadecimal number must be
always defined with 3 digits, the "\x000" cannot be used.
\" Quotation marks It allows to display the quotation marks symbol.
\' Apex It allows to display the apex symbol.
\\ Backslash It allows to display the backslash symbol.

http://192.168.0.61/Destination/Html/HowTo/HT011.htm (2 of 2) [06/10/2008 17.42.31]


HT012

ELSIST Srl, www.elsist.it MNL041Q100

How to

Manage warnings and alarms

The operator terminal management FB, allows the display of warnings and alarms easily, avoiding the user
to realize specific programs for their management. Two data structures are defined one for the warnings
and one for the alarms, every structure is composed from two Double (DW) variables, to every Bit (B) of
the variable a warning or alarm is associated, therefore in total up to 64 warnings and 64 alarms can be
managed.

By activating the page of the warnings or alarms display, by acting on the and keys of the Picoface
terminal or on the e keys of the Netsyt systems it's possible to scroll along the visualization of all of
the submessages that have the relative bit in the data structure active. At the exit from the page of the
warnings or alarms display, all the bits in the data structure whose message was visualized, will be reset.

RIL program

To manage the warnings and the alarms from RIL program, it's necessary to define some global variables
of Double type, that variables must be copied in the warnings and alarms data structure of the of the
operator terminal FB. To every Bit of the defined variables, will be possible to copy the warning or alarm
condition. In the following example 4 warnings and 4 alarms are managed joining them to the state of logic
inputs. Please note the use of LTCH, OUTT and OUTF instructions that allow to have different result of
warning or alarm.

LTCH The condition remains memorized also when the event that has forced it disappears. It will remain
memorized until the display screen is reached, the relative message is displayed and the display
screen is exited.
OUTT The condition follows the state of the event that force it. In this case an impulsive event will set the
OUTF condition only for the time in which the event is true.

We suggest to privilege the use of LTCH instruction instead of the OUTT or OUTF. It guarantees the
memorization of the condition until the relate message is displayed.

Ladder RIL "C" language

http://192.168.0.61/Destination/Html/HowTo/HT012.htm (1 of 2) [06/10/2008 17.42.32]


HT012

; ----------------------------------------------------
; @Section("Global definitions")
; ----------------------------------------------------

DEFG DW WarningsHigh ;Warning bit 32-63


DEFG DW WarningsLow ;Warning bit 0-31

DEFG DW AlarmsHigh ;Alarm bit 32-63


DEFG DW AlarmsLow ;Alarm bit 0-31

; ----------------------------------------------------
; @Section("Warnings management")
; ----------------------------------------------------

ORGR
LODT I 0000
LTCH DW WarningsLow BD 0 ;Warning bit 0

ORGR
LODT I 0001
OUTT DW WarningsLow BD 31 ;Warning bit 31

ORGR
LODT I 0002
LTCH DW WarningsHigh BD 0 ;Warning bit 32

ORGR
LODF I 0003
OUTF DW WarningsHigh BD 31 ;Warning bit 63

; ----------------------------------------------------
; @Section("Alarms management")
; ----------------------------------------------------

ORGR
LODT I 0004
OUTT DW AlarmsLow BD 0 ;Alarm bit 0

ORGR
LODT I 0005
LTCH DW AlarmsLow BD 31 ;Alarm bit 31

ORGR
LODF I 0006
OUTF DW AlarmsHigh BD 0 ;Alarm bit 32

ORGR
LODT I 0007
LTCH DW AlarmsHigh BD 31 ;Alarm bit 63

http://192.168.0.61/Destination/Html/HowTo/HT012.htm (2 of 2) [06/10/2008 17.42.32]


"C" variables: SystemConfig

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern SYSTEMCONFIG SystemConfig;

This variable contains information inherent the system.

typedef struct
{
// ------------------------------------------------[Bit from 0x18 to 0x1F]--

BOOL MemoryAccessWait:1; //FALSE:No wait, TRUE:Wait


BOOL b19:1;
BOOL CfgAccessEnable:1; //FALSE:Disabled, TRUE:Enabled
BOOL MemoryAccessErrors:1; //FALSE:Enabled, TRUE:Disabled
BOOL UserGoProgram:1; //User program started from user
BOOL b1D:1;
BOOL b1E:1;
BOOL b1F:1;

// ------------------------------------------------[Bit from 0x10 to 0x17]--

BOOL UserPrgReturn:1; //FALSE:No return, TRUE:Return


BOOL UserPrgExLoop:1; //FALSE:First loop, TRUE:Other loops
BOOL b12:1;
BOOL b13:1;
BOOL GetCharEchoEnable:1; //"getchar" function echo enable
BOOL b15:1;
BOOL b16:1;
BOOL b17:1;

// ----------------------------------------------------[Device definition]--

unsigned char TargetDevice;

// --------------------------------------------[Microprocessor definition]--

unsigned char Microprocessor;


}SYSTEMCONFIG;

In the following table the indication of the different field are reported with reference to the supported libraries.

Bit Name Description

10 UserPrgReturn FALSE: User program doesn't back to Kernel. TRUE: User - - - - - - A


program goes back to Kernel.
11 UserPrgExLoop FALSE: First program execution loop. TRUE: First program - - - - - - A
execution loop executed.
12
13

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemConfig.htm (1 of 3) [06/10/2008 17.42.33]


"C" variables: SystemConfig

14 GetCharEchoEnable TRUE: On data input from standard terminal I/O a character echo is - - - - - - C
executed.
15
16
17
18 MemoryAccessWait It configures how the SystemMemoryRead and E D - C B B A
SystemMemoryWrite functions manage the condition of memory not
ready when they access to EEPROM and FLASH memories.
FALSE: The functions immediately exit with error. TRUE: The
functions wait for a timeout and then exit with error.
19
1A CfgAccessEnable Enables the function SystemMemoryWrite to write on the - - - - C - A
configuration memory.
1B MemoryAccessErrors Set disable the SystemErrors.MemoryType management in the - - - - C - A
SystemMemoryRead and SystemMemoryWrite functions.
1C UserGoProgram TRUE: The user program is started by a serial command. - - - - - - C
1D
1E
1F

This bit must be set by the user program before call the memory access function. ATTENTION! The debug
procedure returns the state of the bit always TRUE independently from its real state in the program.

TargetDevice

It contains indication of the type of target system as in the table:

Value Description

0x00 PICOSYST_ME: PICOSYST Millennium CPU


0x10 NETLOG: Netlog system
0x20 NETREADER_T89C51: Netreader based on Atmel T89C51 microprocessor
0x21 NETREADER_P89C664_MASTER: Netreader based on Philips P89C664 microprocessor
0x22 NETREADER_P89C664_SLAVE_EXT: Netreader based on Philips P89C664 microprocessor configured
as a slave extension
0x30 NETLOG_II: Netlog II system
0x31 NETLOG_II_MASTER_EXT: Netlog II system configured as a master extension
0x32 NETLOG_II_SLAVE_EXT: Netlog II system configured as a slave extension
0x38 NSYST_SOCKET: Netsyst CPU mounted on a support socket
0x40 NETLOG_II_LITE: Netlog II system (Lite version)
0x41 NETLOG_II_LITE_MASTER_EXT: Netlog II system (Lite version) configured as a master extension
0x42 NETLOG_II_LITE_SLAVE_EXT: Netlog II system (Lite version) configured as a slave extension
0x50 PICOSYST_ME_II: PICOSYST Millennium II CPU
0x60 PICOSYST_ME_III: PICOSYST Millennium III CPU

Microprocessor

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemConfig.htm (2 of 3) [06/10/2008 17.42.33]


"C" variables: SystemConfig

It contains indication of the type of microprocessor available on the target system as in the table:

Value Description

0x00 Standard microprocessor 80C31 at 11.0592 Mhz of clock


0x01 Standard microprocessor 80C31 at 22.1184 Mhz of clock
0x02 Microprocessor 80C32 at 24 Mhz of clock
0x03 Dallas Microprocessor 80C320 at 22.1184 Mhz of clock
0x04 Microprocessor TS80C32X2 ATMEL at 22.1184 Mhz of clock
0x05 Microprocessor TS80C32U2 ATMEL at 22.1184 Mhz of clock
0x06 Microprocessor P89C51RD2 PHILIPS at 11.0592 Mhz of clock
0x07 Microprocessor ADuC812 ANALOG DEVICES at 11.0592 Mhz of clock
0x08 Microprocessor 80C32 at 22.1184 Mhz of clock
0x09 Microprocessor T89C51 ATMEL at 11.0592 Mhz of clock
0x0A Microprocessore ADuC832 ANALOG DEVICES at 32.768 Khz of clock
0x0B Microprocessor P89C664 PHILIPS at 11.0592 Mhz of clock
0x0C Microprocessor uPSD3354D ST at 40 Mhz of clock
0x0D Microprocessor Winbond at 22.1184 Mhz of clock

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemConfig.htm (3 of 3) [06/10/2008 17.42.33]


HT010

ELSIST Srl, www.elsist.it MNL041Q100

How to

Set the BIOS configuration parameters

The upload operations of the application from Remoter to the target system are executed by a proper BIOS
software that is preloaded in the system. In some target systems the BIOS can be personalized. In the
following table we report the target systems that support the BIOS configuration.

Code Target

CPU016**** CPU Picosyst Millennium


MPS026*0*0 PICOLOG Millennium relay
MPS026*3*0 PICOLOG Millennium static
MPS027***0 FACELOG
OIF018*0*0 PICOFACE
MPS022**** Netlog

With the target system connected and in catch condition it is possible to use the utility terminal emulation
send a BIOS configuration setting command by using the MODBUS RTU protocol.

The BIOS configuration parameters are stored in the FLASH memory, so the setting command
completely deletes the RAM and the FLASH memory of the target system the loosing the user
program.

The execution of the clear memory command loosing also the BIOS configuration parameters.

Code FF, Subfunction 0A: BIOS configuration Command frame Answer frame
It allows to set the serial communication parameters on port B Node address FF Node address FF
and the number of MODBUS node for both the communication Function code FF Function code FF
ports. The set values are memorized in the FLASH memory of Byte number 07 Byte number 06
the system and become permanent. It is not possible to change Security byte 00 Security byte FF
the serial communication mode on port A. SubFunction 0A SubFunction 0A
Node to set 01 Result 01
The example frame FF FF 07 00 0A 01 75 B1 D9 sets the Serial mode 75 F7
Error check (CRC)
MODBUS node 01 and sets the communication parameters on B1 D8
Error check (CRC)
port B to 9600, e, 8. For the value to be set in Serial mode refer D9
to the table reported in the SMOD instruction. The value returned
in Result if 01, indicates the correct execution of the command.

On the Netlog systems starting from the BIOS version SFW116F000, a FLASH writing unlock command
was added. With writing locked from user program will not be possible to write on it.

http://192.168.0.61/Destination/Html/HowTo/HT010.htm (1 of 2) [06/10/2008 17.42.33]


HT010

Code FF, Subfunction 0A: Configurazione BIOS Command frame Answer frame
It allows to set the serial communication parameters on port B, Node address FF Node address FF
the number of MODBUS node for both the communication ports Function code FF Function code FF
and the FLASH unlock. The set values are memorized in the Byte number 08 Byte number 06
FLASH memory of the system and become permanent. It is not Security byte 00 Security byte FF
possible to change the serial communication mode on port A. SubFunction 0A SubFunction 0A
Node to set 01 Result 01
The example frame FF FF 08 00 0A 01 75 01 B4 00 sets the Serial mode 75 F7
Error check (CRC)
MODBUS node 01, sets the communication parameters on port
FLASH unlock 01 D8
B to 9600, e, 8 and unlocks the FLASH. For the value to be set in Error check (CRC)B4
00
Serial mode refer to the table reported in the SMOD instruction.
The value returned in Result if 01, indicates the correct
execution of the command.

http://192.168.0.61/Destination/Html/HowTo/HT010.htm (2 of 2) [06/10/2008 17.42.33]


Serial settings

ELSIST Srl, www.elsist.it MNL041Q100

Terminal emulation

Serial settings

The window of serial communication settings divided in tabs, reporting the various definitions.

Figure 1

Baud Rate Defines the baud rate to be used in the communication.


Data Bits Defines the number of data bits to be used in the communication.
Parity Defines the parity to be used in the communication.
Stop Bits Defines the number of stop bits to be used in the communication.
Flow Control Select the flow control.
Port Defines the COM port to be used in the communication.

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/SerialSet.htm (1 of 2) [06/10/2008 17.42.34]


Serial settings

Figure 2

Enable driver capability Selected, forces the use of the options of the communication driver.
Wait time before Tx Defines the wait time between the activation of the transmission enable signal
and the transmission of the first character.
Wait time after Tx Defines the wait time between the transmission of the last character and the
deactivation of the transmission enable signal.
Signal for Tx enable Selects the signal to be used to enable the data transmission.
Clear Tx echo Forces the automatic deletion of the received echo string.

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/SerialSet.htm (2 of 2) [06/10/2008 17.42.34]


TCP/IP settings

ELSIST Srl, www.elsist.it MNL041Q100

Terminal emulation

TCP/IP settings

The window of communication settings on TCP/IP socket.

Figure 1

IP Address Defines the IP address of the interface device used to communicate with the target system.
Port Defines the output port must be used.

http://192.168.0.61/Destination/Html/Use/Utilities/Terminal/TCPIPSet.htm [06/10/2008 17.42.35]


Function blocks: FbCounterOverIO

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbCounterOverIO

This function block manages a 16 bits counter, using a digital input of the base module as a clock signal. You
can choose the counting only on the raising edge or on raising and falling edges.

For the use in interrupt it is reported the execution time, at 11 Mhz is about 200 uSec.

Code:PFB035 History report


Prototype
FbCounterOverIO.h

Declaration
void FbCounterOverIO(FBCOUNTEROVERIODATA* S);

Parameters
FBCOUNTEROVERIODATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 8 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
unsigned char Inputs:4; //Logic inputs selection
unsigned char Mode:4; //Counter mode selection
}Command;

unsigned char Dummy1;


unsigned int Value; //Counter value

// --------------------------------------------[Internal use only members]--


...
}FBCOUNTEROVERIODATA;

00 Command

http://192.168.0.61/Destination/Html/FctBlocks/FbCounterOverIO.htm (1 of 4) [06/10/2008 17.42.36]


Function blocks: FbCounterOverIO

0 Inputs It defines on which input of the base module is connected the clock signal, according to the table
1 below.
2
3
Value Description Value Description

0 Input 0 8 Input 8
1 Input 1 9 Input 9
2 Input 2 A Input A
3 Input 3 B Input B
4 Input 4 C Input C
5 Input 5 D Input D
6 Input 6 E Input E
7 Input 7 F Input F
4 Mode It defines the type of acquisition of the clock, according to the table below.
5
6
7 Value Description

0 Only raising edges


1 Both raising and falling edges

02 Value
It returns the value of the counted impulses. The value is in hexadecimal and it has a range from 0x0000 to
0xFFFF. When the values reaches the maximum value 0xFFFF, it restarts from the value 0x0000.

RIL example

In the example below, it's executed the counting on both raising and falling edges of the clock connected to the
digital input INP 00. Debugging the operand W CounterValue it's possible to see the counting value.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG W CounterValue ; Counter value

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Counter management function block data structure.

DEFL Y Ctr KD 8
DEFL Y CtrCommand Y Ctr KH 0000 ; Ctr.Comand
DEFL W CtrValue Y Ctr KH 0002 ; Ctr.Value

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Counter management function block parameters set.
; Input 0 is used to read input pulses, rising and falling edges are count.

ORGR
LODT F PLCFirstLoop

http://192.168.0.61/Destination/Html/FctBlocks/FbCounterOverIO.htm (2 of 4) [06/10/2008 17.42.36]


Function blocks: FbCounterOverIO

MOVI Y CtrCommand KH 0010 ; Ctr.Comand

; ------------------------------------------------------------------------------
; @Section("Counter management")
; ------------------------------------------------------------------------------
; Counter management function block call.

ORGR
SETR
TASK L FbCounterOverIO Y Ctr ; Counter management
LODA W CtrValue ; Ctr.Value
STRA W CounterValue ; Counter value

; [End of file]

"C" example

In the example below, it's executed the counting on both raising and falling edges of the clock connected to the
digital input INP 00. Debugging the operand unsigned int CounterValue it's possible to see the counting value.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbCounterOverIO.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

unsigned int CounterValue; //Counter value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBCOUNTEROVERIODATA Ctr; //Counter management data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first program execution loop.

if (PLCFirstLoop)
{
Ctr.Command.Inputs=0; //Logic inputs selection
Ctr.Command.Mode=1; //Counter mode selection
}

http://192.168.0.61/Destination/Html/FctBlocks/FbCounterOverIO.htm (3 of 4) [06/10/2008 17.42.36]


Function blocks: FbCounterOverIO

// -------------------------------------------------------------------------
// COUNTER MANAGEMENT
// -------------------------------------------------------------------------
// Counter management and value store.

FbCounterOverIO(&Ctr); //Counter management


CounterValue=Ctr.Value; //Counter value
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbCounterOverIO.htm (4 of 4) [06/10/2008 17.42.36]


Function blocks: FbDMXProtocol

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbDMXProtocol

This function block manages the DMX protocol, it's possible to manage on RS845 line up to 512 dimmers. The FB will
provide to send to everyone the defined value of brightness.

Code:PFB076 History report


Prototype
FbDMXProtocol.h

Declaration
void FbDMXProtocol(FBDMXPROTOCOLDATA* S);

Parameters
FBDMXPROTOCOLDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 32 bytes data structure, we report a prototype. The members reported under the Internal
use only members label, are members used inside by the function block and they don't have to be changed by the
user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //FB enable
BOOL TxStart:1; //Tx frame command
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL TxEnd:1; //Tx frame end
BOOL b2:1;
BOOL b3:1;
BOOL WrongTermIO:1; //Wrong I/O terminal
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Status;

http://192.168.0.61/Destination/Html/FctBlocks/FbDMXProtocol.htm (1 of 4) [06/10/2008 17.42.38]


Function blocks: FbDMXProtocol

unsigned char Dummy[2];


unsigned char xdata* CmdArray; //Command array
unsigned int Devices; //Number of devices
unsigned int Delay; //Interframe delay time (mSec)

// --------------------------------------------[Internal use only members]--

unsigned char Im[22]; //Internal members area


}FBDMXPROTOCOLDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB allowing the DMX protocol.
1 TxStart TRUE: Commands a DMX frame send. It's automatically reset by the FB, if a continuous stream of
frames it's required this bit must be set to TRUE permanently.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 TxEnd Is set for a program loop at every DMX frame sent.
4 WrongTermIO TRUE: Indicates that the defined I/O terminal cannot be used by the FB. No DMX frames will be
sent.

04 CmdArray
Loaded by user program it defines the address of the DMX command array, (Range from 0x0000 to 0xFFFF).
06 Devices
Loaded by user program it defines the number of DMX devices to be managed, it must be equal or less than the
command array length, (Range from 0 to 512).
08 Delay
Loaded by user program it defines the delay time between the DMX frame transmission when the TxStart is
always set. The value is in mSec (Range da 0 a 60000).

RIL example

In the following example a DMX communication is managed, the example manages 4 dimmers.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; FbDMXProtocol function block data structure.

DEFL Y Dmx KD 32
DEFL Y DmxCommand Y Dmx KH 0000 ;Dmx.Command
DEFL Y DmxStatus Y Dmx KH 0001 ;Dmx.Status
DEFL W DmxCmdArray Y Dmx KH 0004 ;Dmx.CmdArray
DEFL W DmxDevices Y Dmx KH 0006 ;Dmx.Devices
DEFL W DmxDelay Y Dmx KH 0008 ;Dmx.Delay

; Dimmer array definition.

DEFL Y Dim KD 4
DEFL Y DimNr0 Y Dim KH 0000 ;Dimmer [0]
DEFL Y DimNr1 Y Dim KH 0001 ;Dimmer [1]

http://192.168.0.61/Destination/Html/FctBlocks/FbDMXProtocol.htm (2 of 4) [06/10/2008 17.42.38]


Function blocks: FbDMXProtocol

DEFL Y DimNr2 Y Dim KH 0002 ;Dimmer [2]


DEFL Y DimNr3 Y Dim KH 0003 ;Dimmer [3]

; ------------------------------------------------------------------------------
; @Section("DMX protocol management")
; ------------------------------------------------------------------------------
; Setup parameters for the DMX protocol management.

ORGR
SETR
SETV KE IOSerialPortA

ORGR
LODT F PLCFirstLoop
MOVA W DmxCmdArray Y Dim ;Dmx.CmdArray
MOVI W DmxDevices KD 4 ;Dmx.Devices
MOVI W DmxDelay KD 100 ;Dmx.Delay
TASK L TermIOOpen

; Manage the DMX protocol on serial port "A".

ORGR
SETR
OUTT Y DmxCommand BD 0 ;Dmx.Command.Enable
OUTT Y DmxCommand BD 1 ;Dmx.Command.TxStart
TASK L FbDMXProtocol Y Dmx ;FbDMXProtocol management

; [End of file]

"C" example

In the following example a DMX communication up to 512 dimmers is managed. The logic input I 0000 enables the FB
and the logic input I 0001 enables the frame transmission.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbDMXProtocol.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char Dimmers[512]; //Dimmers array data

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

http://192.168.0.61/Destination/Html/FctBlocks/FbDMXProtocol.htm (3 of 4) [06/10/2008 17.42.38]


Function blocks: FbDMXProtocol

static unsigned char LogInp; //Logic input buffer


static FBDMXPROTOCOLDATA Dmx; //FB data struct

// -------------------------------------------------------------------------
// MANAGE THE DMX PROTOCOL
// -------------------------------------------------------------------------
// Set the serial port to be used by the DMX protocol.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

// Execute the variables init.

if (PLCFirstLoop)
{
Dmx.CmdArray=&Dimmers; //Command array
Dmx.Devices=sizeof(Dimmers); //Number of devices
Dmx.Delay=100; //Interframe delay time (mSec)
TermIOOpen(); //Open the terminal I/O
}

// Manage the DMX protocol on serial port "A".

FbDMXProtocol(&Dmx); //Dmx protocol management

// Use the logic inputs to manage the commands.


// I 0000: Is used as FB Enable command
// I 0001: Is used as FB TxStart command

PeripheralInp(0x00, 0x00, &LogInp); //Inputs from 0 to 7


Dmx.Command.Enable=((LogInp&0x01) != 0); //FB enable
Dmx.Command.TxStart=((LogInp&0x02) != 0); //Tx frame command
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbDMXProtocol.htm (4 of 4) [06/10/2008 17.42.38]


Function blocks: FbElevatorCall

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbElevatorCall

This function block manages the up and down multiply reservation call for an elevator. The calls from the cabin,
are sequentially managed according to the direction of the cabin. The calls from the floor are managed according
to the type of reservation (up direction or down direction) through two push buttons. The function block can
manage elevators till 32 floors, the most important characteristics are:

Management up to 32 push buttons with proper lamp for call from cabin
Management up to 32 push buttons with proper lamp for call in up direction from floor
Management up to 32 push buttons with proper lamp for call in down direction from floor
Reservation reset (Clears all the active reservations)
Cabin overload sensor management, it locks the reservations
Elevator direction indication
Flashing of the cabin lamp which indicates the floor to be reach

For example: The cabin is going up from the floor 0 to the 5th floor, while the cabin hasn't reached the 3rd floor
yet, an user makes a up direction call from 3rd floor, another user makes a down direction call from 3rd floor. The
cabin stops to the 3rd floor and clear the reservation in up direction, maintaining the reservation in down
direction. When all the stops in up direction are ended, the cabin will starts in down direction stopping at the 3rd
floor to satisfy the reservation.

Code:PFB062 History report


Prototype
FbElevatorCall.h

Declaration
void FbElevatorCall(FBELEVATORCALLDATA* S);

Parameters
FBELEVATORCALLDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Floor definition

The function block manages up to 32 floors, to manage the call buttons and the lamps a Double (DW) is used.
From the RIL program it's necessary to refer to the proper bit to address the different floor. From the C program
it's necessary to define a typedef to assign the value of the floor to any variable bit, here it's the prototype.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (1 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

typedef struct
{
BOOL Floor24:1; //Floor 24
BOOL Floor25:1; //Floor 25
BOOL Floor26:1; //Floor 26
BOOL Floor27:1; //Floor 27
BOOL Floor28:1; //Floor 28
BOOL Floor29:1; //Floor 29
BOOL Floor30:1; //Floor 30
BOOL Floor31:1; //Floor 31

BOOL Floor16:1; //Floor 16


BOOL Floor17:1; //Floor 17
BOOL Floor18:1; //Floor 18
BOOL Floor19:1; //Floor 19
BOOL Floor20:1; //Floor 20
BOOL Floor21:1; //Floor 21
BOOL Floor22:1; //Floor 22
BOOL Floor23:1; //Floor 23

BOOL Floor08:1; //Floor 08


BOOL Floor09:1; //Floor 09
BOOL Floor10:1; //Floor 10
BOOL Floor11:1; //Floor 11
BOOL Floor12:1; //Floor 12
BOOL Floor13:1; //Floor 13
BOOL Floor14:1; //Floor 14
BOOL Floor15:1; //Floor 15

BOOL Floor00:1; //Floor 00


BOOL Floor01:1; //Floor 01
BOOL Floor02:1; //Floor 02
BOOL Floor03:1; //Floor 03
BOOL Floor04:1; //Floor 04
BOOL Floor05:1; //Floor 05
BOOL Floor06:1; //Floor 06
BOOL Floor07:1; //Floor 07
}FLOORS;

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (2 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL CallLock:1; //Call lock
BOOL CallReset:1; //Call reset
BOOL b3:1;
BOOL CabinReady:1; //Cabin ready
BOOL CabinIsStop:1; //Cabin is stop
BOOL b6:1;
BOOL b7:1;
}Command; //Command

struct
{
BOOL Enabled:1; //Enabled
BOOL NewCall:1; //New call
BOOL ActiveCalls:1; //Active calls
BOOL b3:1;
BOOL OpenDoors:1; //Open doors command
BOOL CabinStart:1; //Cabin start command
BOOL CabinUp:1; //Cabin in up direction
BOOL CabinDw:1; //Cabin in down direction
}Status; //Status

unsigned char NumberOfFloors; //Number of floors


unsigned char Dummy1;
unsigned char CabinPosition; //Cabin position
unsigned char FloorRequest; //Floor request
unsigned int Dummy2;

FLOORS CabinCall; //Cabin call commands


FLOORS FloorUpCall; //Floor up call commands
FLOORS FloorDwCall; //Floor dw call commands
FLOORS CabinLamp; //Cabin lamps status
FLOORS FloorUpLamp; //Floor up lamps status
FLOORS FloorDwLamp; //Floor dw lamps status

// --------------------------------------------[Internal use only members]--


...
}FBELEVATORCALLDATA;

00 Command
Comand bits, the user program can manage these bits according to its own needs.
0 Enable FALSE: Disables the FB.
TRUE: Enables the FB.
1 CallLock TRUE: Locks the call management. It can be used to avoid new calls if the cabin is full.
2 CallReset TRUE: Resets all the reservations.
4 CabinReady TRUE: Enables the OpenDoors, CabinStart, CabinUp, CabinDw status bit.
5 CabinIsStop TRUE: Indicates that the cabin is stopped.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (3 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

01 Status
Status bits, the user program can test these bits
0 Enabled TRUE: The FB is enabled.
1 NewCall It's set for a program loop at every new call.
2 ActiveCalls TRUE: It shows the presence of at least an active call.
4 OpenDoors If Command.CabinReady=TRUE and Status.CabinStart=FALSE, this bit will remains active
until a call from the current floor from any button is active.
5 CabinStart TRUE: The cabin has to move to reach the floor indicated in FloorRequested.
6 CabinUp TRUE: The cabin has to move in up direction.
7 CabinDw TRUE: The cabin has to move in down direction.

02 NumberOfFloors
Loaded by the user program, it defines the number of floors to manage. It is necessary to set the number of
the highest floor to be reach. For example in a palace of 8 floors the value will be set to 8 (Range from 1 to
31).
04 CabinPosition
Loaded by the user program, it defines the current position of the cabin (Range from 0 to 31).
05 FloorRequested
Returns the floor to reach when the Status.CabinStart bit is active (Range from 0 to 31). Its value is reset
by clearing the Command.Enable bit.
08 CabinCall
Loaded by the user program, with the status of every button call from cabin, every button is copied on the
proper bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

08 FloorUpCall
Loaded by the user program, with the status of every button call from floor in up direction, every button is
copied on the proper bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

0C FloorDwCall
Loaded by the user program, with the status of every button call from floor in down direction, every button is
copied on the proper bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

10 CabinLamp
Returns the cabin floor lamp status, the user program has to copy the status of every bit to the proper lamp.
Its value is reset by clearing the Command.Enable bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (4 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

14 FloorUpLamp
Returns the floor up call lamp status, the user program has to copy the status of every bit to the proper lamp.
Its value is reset by clearing the Command.Enable bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

18 FloorDwLamp
Returns the floor down call lamp status, the user program has to copy the status of every bit to the proper
lamp. Its value is reset by clearing the Command.Enable bit.
00 Floor00 Call on floor 00.
.. ... Call on floor
1F Floor31 Call on floor 31.

Examples

It's reported an example program realized in either RIL language and C, it manages an elevator up to 3 floors.
Using a static PICOLOG Millennium system with 16 inputs and 16 outputs it's possible to test it by connecting the
inputs and the outputs according to the following table:

Input Function Output Function

I 0000 FB enable command O 0000 Open doors status


I 0001 Call lock command O 0001 Cabin start status
I 0002 Cabin ready command O 0002 Cabin up direction status
I 0003 Cabin is stop command O 0003 Cabin down direction status
I 0004 Cabin call command (Floor 00) O 0004 Cabin call lamp (Floor 00)
I 0005 Cabin call command (Floor 01) O 0005 Cabin call lamp (Floor 01)
I 0006 Cabin call command (Floor 02) O 0006 Cabin call lamp (Floor 02)
I 0007 Cabin call command (Floor 03) O 0007 Cabin call lamp (Floor 03)
I 0008 Floor up call command (Floor 00) O 0008 Floor up call lamp (Floor 00)
I 0009 Floor up call command (Floor 01) O 0009 Floor up call lamp (Floor 01)
I 000A Floor up call command (Floor 02) O 000A Floor up call lamp (Floor 02)
I 000B Floor up call command (Floor 03) O 000B Floor up call lamp (Floor 03)
I 000C Floor down call command (Floor 00) O 000C Floor down call lamp (Floor 00)
I 000D Floor down call command (Floor 01) O 000D Floor down call lamp (Floor 01)
I 000E Floor down call command (Floor 02) O 000E Floor down call lamp (Floor 02)
I 000F Floor down call command (Floor 03) O 000F Floor down call lamp (Floor 03)

RIL example

The current position of the cabin has to be set manually by debugging the Y RealCabinPosition operand, the
current position of the cabin to reach can be read by debugging the Y SetCabinPosition operand.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (5 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

; ------------------------------------------------------------------------------
; @Section("Global definitions")
; ------------------------------------------------------------------------------
; Elevator call, data structure.

DEFG Y ElC KD 64
DEFG Y ElCCommand Y ElC KH 0000 ;ElC.Command
DEFG Y ElCStatus Y ElC KH 0001 ;ElC.Status
DEFG Y ElCNumberOfFloors Y ElC KH 0002 ;ElC.NumberOfFloors
DEFG Y ElCCabinPosition Y ElC KH 0004 ;ElC.CabinPosition
DEFG Y ElCFloorRequest Y ElC KH 0005 ;ElC.FloorRequest
DEFG DW ElCCabinCall Y ElC KH 0008 ;ElC.CabinCall
DEFG DW ElCFloorUpCall Y ElC KH 000C ;ElC.FloorUpCall
DEFG DW ElCFloorDwCall Y ElC KH 0010 ;ElC.FloorDwCall
DEFG DW ElCCabinLamp Y ElC KH 0014 ;ElC.CabinLamp
DEFG DW ElCFloorUpLamp Y ElC KH 0018 ;ElC.FloorUpLamp
DEFG DW ElCFloorDwLamp Y ElC KH 001C ;ElC.FloorDwLamp

; ------------------------------------------------------------------------------
; @Section("Elevator call management")
; ------------------------------------------------------------------------------
; Function block init.

ORGR
LODT F PLCFirstLoop
MOVI Y ElCNumberOfFloors K 0003 ;ElC.NumberOfFloors

; Elevator call management.

ORGR
SETR
TASK L FbElevatorCall Y ElC ; Elevator call management

; ------------------------------------------------------------------------------
; @Section("General commands")
; ------------------------------------------------------------------------------
; FB enable command.

ORGR
LODT I 0000 ;FB enable command
OUTT Y ElCCommand BD 0 ;ElC.Command.Enable

; Call lock command.

ORGR
LODT I 0001 ;Call lock command
OUTT Y ElCCommand BD 1 ;ElC.Command.CallLock

; Cabin ready command.

ORGR
LODT I 0002 ;Cabin ready command
OUTT Y ElCCommand BD 4 ;ElC.Command.CabinReady

; Cabin is stop command.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (6 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

ORGR
LODT I 0003 ;Cabin is stop command
OUTT Y ElCCommand BD 5 ;ElC.Command.CabinIsStop

; ------------------------------------------------------------------------------
; @Section("Status output")
; ------------------------------------------------------------------------------
; Open doors status.

ORGR
LODT Y ElCStatus BD 4 ;ElC.Status.OpenDoors
OUTT O 0000 ;Open doors status

; Cabin start status.

ORGR
LODT Y ElCStatus BD 5 ;ElC.Status.CabinStart
OUTT O 0001 ;Cabin start status

; Cabin up direction status.

ORGR
LODT Y ElCStatus BD 6 ;ElC.Status.CabinUp
OUTT O 0002 ;Cabin up direction status

; Cabin down direction status.

ORGR
LODT Y ElCStatus BD 7 ;ElC.Status.CabinDw
OUTT O 0003 ;Cabin down direction status

; ------------------------------------------------------------------------------
; @Section("Cabin commands and lamps")
; ------------------------------------------------------------------------------
; Cabin call commands management.

ORGR
LODT I 0004 ;Cabin call command (Floor 00)
OUTT DW ElCCabinCall BD 0

ORGR
LODT I 0005 ;Cabin call command (Floor 01)
OUTT DW ElCCabinCall BD 1

ORGR
LODT I 0006 ;Cabin call command (Floor 02)
OUTT DW ElCCabinCall BD 2

ORGR
LODT I 0007 ;Cabin call command (Floor 03)
OUTT DW ElCCabinCall BD 3

; Cabin call lamps management.

ORGR
LODT DW ElCCabinLamp BD 0
OUTT O 0004 ;Cabin call lamp (Floor 00)

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (7 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

ORGR
LODT DW ElCCabinLamp BD 1
OUTT O 0005 ;Cabin call lamp (Floor 01)

ORGR
LODT DW ElCCabinLamp BD 2
OUTT O 0006 ;Cabin call lamp (Floor 02)

ORGR
LODT DW ElCCabinLamp BD 3
OUTT O 0007 ;Cabin call lamp (Floor 03)

; ------------------------------------------------------------------------------
; @Section("Floor up call commands and lamps")
; ------------------------------------------------------------------------------
; Floor up call commands management.

ORGR
LODT I 0008 ;Floor up call command (Floor 00)
OUTT DW ElCFloorUpCall BD 0

ORGR
LODT I 0009 ;Floor up call command (Floor 01)
OUTT DW ElCFloorUpCall BD 1

ORGR
LODT I 000A ;Floor up call command (Floor 02)
OUTT DW ElCFloorUpCall BD 2

ORGR
LODT I 000B ;Floor up call command (Floor 03)
OUTT DW ElCFloorUpCall BD 3

; Floor up call lamps management.

ORGR
LODT DW ElCFloorUpLamp BD 0
OUTT O 0008 ;Floor up call lamp (Floor 00)

ORGR
LODT DW ElCFloorUpLamp BD 1
OUTT O 0009 ;Floor up call lamp (Floor 01)

ORGR
LODT DW ElCFloorUpLamp BD 2
OUTT O 000A ;Floor up call lamp (Floor 02)

ORGR
LODT DW ElCFloorUpLamp BD 3
OUTT O 000B ;Floor up call lamp (Floor 03)

; ------------------------------------------------------------------------------
; @Section("Floor down call commands and lamps")
; ------------------------------------------------------------------------------
; Floor dw call commands management.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (8 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

ORGR
LODT I 000C ;Floor dw call command (Floor 00)
OUTT DW ElCFloorDwCall BD 0

ORGR
LODT I 000D ;Floor dw call command (Floor 01)
OUTT DW ElCFloorDwCall BD 1

ORGR
LODT I 000E ;Floor dw call command (Floor 02)
OUTT DW ElCFloorDwCall BD 2

ORGR
LODT I 000F ;Floor dw call command (Floor 03)
OUTT DW ElCFloorDwCall BD 3

; Floor dw call lamps management.

ORGR
LODT DW ElCFloorDwLamp BD 0
OUTT O 000C ;Floor dw call lamp (Floor 00)

ORGR
LODT DW ElCFloorDwLamp BD 1
OUTT O 000D ;Floor dw call lamp (Floor 01)

ORGR
LODT DW ElCFloorDwLamp BD 2
OUTT O 000E ;Floor dw call lamp (Floor 02)

ORGR
LODT DW ElCFloorDwLamp BD 3
OUTT O 000F ;Floor dw call lamp (Floor 03)

; [End of file]

"C" example

The current position of the cabin has to be set manually by debugging the unsigned char CabinPosition
variable, the current position of the cabin to reach can be read by debugging the unsigned char FloorRequest
variable.

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (9 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbElevatorCall.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

unsigned char CabinPosition; //Cabin position


unsigned char FloorRequest; //Floor request

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

struct
{
BOOL Inp08:1; //Inp 08 bit
BOOL Inp09:1; //Inp 09 bit
BOOL Inp0A:1; //Inp 0A bit
BOOL Inp0B:1; //Inp 0B bit
BOOL Inp0C:1; //Inp 0C bit
BOOL Inp0D:1; //Inp 0D bit
BOOL Inp0E:1; //Inp 0E bit
BOOL Inp0F:1; //Inp 0F bit
BOOL Inp00:1; //Inp 00 bit
BOOL Inp01:1; //Inp 01 bit
BOOL Inp02:1; //Inp 02 bit
BOOL Inp03:1; //Inp 03 bit
BOOL Inp04:1; //Inp 04 bit
BOOL Inp05:1; //Inp 05 bit
BOOL Inp06:1; //Inp 06 bit
BOOL Inp07:1; //Inp 07 bit
}LogInp;

struct
{
BOOL Out08:1; //Out 08 bit
BOOL Out09:1; //Out 09 bit
BOOL Out0A:1; //Out 0A bit
BOOL Out0B:1; //Out 0B bit
BOOL Out0C:1; //Out 0C bit
BOOL Out0D:1; //Out 0D bit
BOOL Out0E:1; //Out 0E bit
BOOL Out0F:1; //Out 0F bit
BOOL Out00:1; //Out 00 bit
BOOL Out01:1; //Out 01 bit

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (10 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

BOOL Out02:1; //Out 02 bit


BOOL Out03:1; //Out 03 bit
BOOL Out04:1; //Out 04 bit
BOOL Out05:1; //Out 05 bit
BOOL Out06:1; //Out 06 bit
BOOL Out07:1; //Out 07 bit

}LogOut;

static FBELEVATORCALLDATA ElC; //Elevator call data structure

// -------------------------------------------------------------------------
// LOGIC I/O MANAGEMENT
// -------------------------------------------------------------------------

PeripheralInp(0x00, 0x00, (unsigned char*)&LogInp+1); //Inputs from 0 to 7


PeripheralInp(0x00, 0x01, (unsigned char*)&LogInp+0); //Inputs from 8 to F
PeripheralOut(0x00, 0x00, *(unsigned char*)&LogOut+1); //Outputs from 0 to 7
PeripheralOut(0x00, 0x01, *(unsigned char*)&LogOut+0); //Outputs from 8 to F

// -------------------------------------------------------------------------
// COMMANDS AND STATUS
// -------------------------------------------------------------------------
// General commands.

ElC.Command.Enable=LogInp.Inp00; //Enable
ElC.Command.CallLock=LogInp.Inp01; //Call lock
ElC.Command.CabinReady=LogInp.Inp02; //Cabin ready
ElC.Command.CabinIsStop=LogInp.Inp03; //Cabin is stop

// Status output.

LogOut.Out00=ElC.Status.OpenDoors; //Open doors status


LogOut.Out01=ElC.Status.CabinStart; //Cabin start status
LogOut.Out02=ElC.Status.CabinUp; //Cabin up direction status
LogOut.Out03=ElC.Status.CabinDw; //Cabin down direction status

// Cabin call commands management.

ElC.CabinCall.Floor00=LogInp.Inp04; //Cabin call command (Floor 00)


ElC.CabinCall.Floor01=LogInp.Inp05; //Cabin call command (Floor 01)
ElC.CabinCall.Floor02=LogInp.Inp06; //Cabin call command (Floor 02)
ElC.CabinCall.Floor03=LogInp.Inp07; //Cabin call command (Floor 03)

// Cabin call lamps management.

LogOut.Out04=ElC.CabinLamp.Floor00; //Cabin call lamp (Floor 00)


LogOut.Out05=ElC.CabinLamp.Floor01; //Cabin call lamp (Floor 01)
LogOut.Out06=ElC.CabinLamp.Floor02; //Cabin call lamp (Floor 02)
LogOut.Out07=ElC.CabinLamp.Floor03; //Cabin call lamp (Floor 03)

// Floor up call commands management.

ElC.FloorUpCall.Floor00=LogInp.Inp08; //Floor up call command (Floor 00)


ElC.FloorUpCall.Floor01=LogInp.Inp09; //Floor up call command (Floor 01)
ElC.FloorUpCall.Floor02=LogInp.Inp0A; //Floor up call command (Floor 02)
ElC.FloorUpCall.Floor03=LogInp.Inp0B; //Floor up call command (Floor 03)

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (11 of 12) [06/10/2008 17.42.42]


Function blocks: FbElevatorCall

// Floor up call lamps management.

LogOut.Out08=ElC.FloorUpLamp.Floor00; //Floor up call lamp (Floor 00)


LogOut.Out09=ElC.FloorUpLamp.Floor01; //Floor up call lamp (Floor 01)
LogOut.Out0A=ElC.FloorUpLamp.Floor02; //Floor up call lamp (Floor 02)
LogOut.Out0B=ElC.FloorUpLamp.Floor03; //Floor up call lamp (Floor 03)

// Floor dw call commands management.

ElC.FloorDwCall.Floor00=LogInp.Inp0C; //Floor dw call command (Floor 00)


ElC.FloorDwCall.Floor01=LogInp.Inp0D; //Floor dw call command (Floor 01)
ElC.FloorDwCall.Floor02=LogInp.Inp0E; //Floor dw call command (Floor 02)
ElC.FloorDwCall.Floor03=LogInp.Inp0F; //Floor dw call command (Floor 03)

// Floor dw call lamps management.

LogOut.Out0C=ElC.FloorDwLamp.Floor00; //Floor dw call lamp (Floor 00)


LogOut.Out0D=ElC.FloorDwLamp.Floor01; //Floor dw call lamp (Floor 01)
LogOut.Out0E=ElC.FloorDwLamp.Floor02; //Floor dw call lamp (Floor 02)
LogOut.Out0F=ElC.FloorDwLamp.Floor03; //Floor dw call lamp (Floor 03)

// -------------------------------------------------------------------------
// ELEVATOR CALL MANAGEMENT
// -------------------------------------------------------------------------
// Elevator call init.

if (PLCFirstLoop)
ElC.NumberOfFloors=3; //Number of floors

// Elevator call management.

ElC.CabinPosition=CabinPosition; //Cabin position


ElC.FloorRequest=FloorRequest; //Floor request
FbElevatorCall(&ElC); //Elevator call management
CabinPosition=ElC.CabinPosition; //Cabin position
FloorRequest=ElC.FloorRequest; //Floor request
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbElevatorCall.htm (12 of 12) [06/10/2008 17.42.42]


Function blocks: FbEncoderOverIO

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbEncoderOverIO

This function block allows the acquisition of an encoder with quadrature directly connected to the digital inputs.
The quote value expressed in encoder pulses is returned into a 16 bits Word (W) operand, the function block
executes the multiplication for 4 of encoder pulses. For example an encoder of 1024 pulses/turn will returns a
value of 4096 pulses/turn. To manages quote on 32 bits Double (DW) operand the FbQuoteMng FB can be used.

For the use in interrupt it is reported the execution time, at 11 Mhz is about 200 uSec.

Code:PFB018 History report


Prototype
FbEncoderOverIO.h

Declaration
void FbEncoderOverIO(FBENCODEROVERIODATA* S);

Parameters
FBENCODEROVERIODATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Greatest encoder frequency

To avoid errors in encoder acquisition it's important to be sure that the encoder frequency does not exceed the
maximum value that can be read by the FB. For the calculation of the greatest encoder frequency accepted by
the FB it's necessary to know the FB scansion time. It's defined scansion time the time that exists between two
executions. If the FB it's executed on user program, the scansion time is equal to program loop time, to decrease
scansion time it's possible to execute the FB many times in the user program, or to execute it on temporal
interrupt.

Following we report the formula for the calculation of the greatest encoder frequency that can be acquired by the
FB in function of its scansion time.

Ef=1/(St*5)
Ef: Encoder frequency (Hz)
St: Scansion time (Sec)

Data structure

The function block uses a 8 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

http://192.168.0.61/Destination/Html/FctBlocks/FbEncoderOverIO.htm (1 of 4) [06/10/2008 17.42.43]


Function blocks: FbEncoderOverIO

typedef struct
{
// --------------------------[Members that can be managed by user program]--

unsigned char Inputs; //Logic inputs selection


BOOL Error; //Acquisition error
unsigned int Value; //Encoder value

// --------------------------------------------[Internal use only members]--


...
}FBENCODEROVERIODATA;

00 Inputs
It specifies to which inputs of the base modules, the encoder signals are connect, according to the table
below
Value Clock A Clock B

0 INP 00 INP 01
1 INP 02 INP 03
2 INP 04 INP 05
3 INP 06 INP 07
4 INP 08 INP 09
5 INP 0A INP 0B
6 INP 0C INP 0D
7 INP 0E INP 0F

01 Error
It returns the encoder acquisition error, the error flag has to be reset by the user program. The condition of
error is when the function block detects the contemporary change of both the clock signals. This eventuality
can occur if the frequency of the clock signals is higher than the maximum acceptable by the FB.
FALSE:No error.
TRUE:Acquisition error.
02 Value
It returns the encoder value expressed in pulses, the value is in hexadecimal and it has a range from 0x0000
to 0xFFFF. A clockwise rotation of the encoder increases the count value, when it reaches its higher limit of
0xFFFF, the count restarts from the value 0x0000. A anti-clockwise rotation decreases the count value,
when it reaches its minimum limit of 0x0000, the count restarts from the value 0xFFFF.

RIL example

In the example below, it's managed an encoder connected to the digital inputs INP 00 and INP 01. The quote
value expressed in pulses can be read by debugging the operand W EncoderQuote.

http://192.168.0.61/Destination/Html/FctBlocks/FbEncoderOverIO.htm (2 of 4) [06/10/2008 17.42.43]


Function blocks: FbEncoderOverIO

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG W EncoderQuote ; Encoder quote

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Encoder acquisition function block data structure.

DEFL Y Eacq KD 8
DEFL Y EacqInputs Y Eacq KH 0000 ; Eacq.Inputs
DEFL Y EacqError Y Eacq KH 0001 ; Eacq.Error
DEFL W EacqValue Y Eacq KH 0002 ; Eacq.Value

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Encoder acquisition function block parameters set.

ORGR
LODT F PLCFirstLoop
MOVI Y EacqInputs K 0000 ; Eacq.Inputs

; ------------------------------------------------------------------------------
; @Section("Encoder acquisition")
; ------------------------------------------------------------------------------
; Encoder acquisition function block call.

ORGR
SETR
TASK L FbEncoderOverIO Y Eacq ; Encoder acquisition
LODA W EacqValue ; Eacq.Value
STRA W EncoderQuote ; Encoder quote

; [End of file]

"C" example

In the example below, it's managed an encoder connected to the digital inputs INP 00 and INP 01. The quote
value expressed in pulses can be read by debugging the variable unsigned int EncoderQuote.

http://192.168.0.61/Destination/Html/FctBlocks/FbEncoderOverIO.htm (3 of 4) [06/10/2008 17.42.43]


Function blocks: FbEncoderOverIO

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbEncoderOverIO.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

unsigned int EncoderQuote; //Encoder quote

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBENCODEROVERIODATA Eacq; //Encoder acquisition data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first program execution loop.

if (PLCFirstLoop)
Eacq.Inputs=0x00; //Logic inputs selection

// -------------------------------------------------------------------------
// ENCODER ACQUISITION
// -------------------------------------------------------------------------
// Encoder acquisition and value store.

FbEncoderOverIO(&Eacq); //Acquisizione encoder


EncoderQuote=Eacq.Value; //Encoder quote
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbEncoderOverIO.htm (4 of 4) [06/10/2008 17.42.43]


Function blocks: FbI2CSerial

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbI2CSerial

This function block, add to the system a serial line, using a Netsyst line extension module connected thru the I2C
BUS, see FbI2CSlaveManager. In case of errors in the parameters the bit FBParameters in the PLCErrors data
structure is set.

Code:PFB057 History report


Prototype
FbI2CSerial.h

Declaration
void FbI2CSerial(FBI2CSERIALDATA *S);

Parameters
FBI2CSERIALDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 224 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //FB enable
BOOL UserOpen:1; //User open enable
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL WrongModule:1; //Wrong module address
BOOL RxBufferEmpty:1; //Received character with Rx buffer empty
BOOL TxBufferFull:1; //Sent character with Tx buffer full

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSerial.htm (1 of 5) [06/10/2008 17.42.45]


Function blocks: FbI2CSerial

BOOL b7:1;
}Status;

unsigned char Dummy1;


unsigned char ModuleAdd; //Peripheral module address
unsigned char I2CFrameCh; //Characters in the I2C frame
unsigned char Dummy2;
TERMIOVECTORS* IOVector; //I/O console vector address

// --------------------------------------------[Internal use only members]--

unsigned char Im[217]; //Internal members area

}FBI2CSERIALDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the function block. The Status, I2CError and the I2CErrorCtr are reset.
TRUE: It enables the function block.
1 UserOpen FALSE: The device it's not automatically opened, it must be opened by the user program with
the TermIOOpen function.
TRUE: The device it's automatically opened.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The function block is enabled
4 WrongModule TRUE: The extension module address is wrong.
5 RxBufferEmpty TRUE: The user program has read the data, GetCh or scanf, with the WaitLoop bit of the
SERIALSTRUCT in condition FALSE, when the reception buffer was empty.
6 TxBufferFull TRUE: The user program has written the data PutCh or printf, with the WaitLoop bit of the
SERIALSTRUCT in condition FALSE, when the transmission buffer was full.

03 ModuleAdd
Loaded by user program it defines the address of the extension module that is used for the serial line
management. The setting of a module address that is not present causes the abort of the management and
the setting of the proper error bit in Status.
04 I2CFrameCh
Loaded by user program it defines the maximum number of characters that can be received or transmitted for
every I2C frame. Higher numbers increases the communication speed but increases the of program execution
loop time. (Range from 1 to 32).
06 IOVector
It returns the address of the TERMIOVECTORS data structure to be used to define the driver as standard I/O
device.

RIL example

In the example below, it is managed the communication on a serial port of the extension module with address 1,
connected to I2C bus. The communication mode 9600, n, 8 will be set by activating the input I 0000, while
deactivating it the communication mode 19200, n, 8 will be set. If the input I 0001 is activated, the string "Hello!"
will be sent to the serial line of the extension module. If the input I 0002 is activated, the string "Hello!" will be sent
to the port A serial line.

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSerial.htm (2 of 5) [06/10/2008 17.42.45]


Function blocks: FbI2CSerial

; ------------------------------------------------------------------------------
; @Section("Global definitions")
; ------------------------------------------------------------------------------
; Serial driver function block data structure.

DEFG Y Ser KD 224


DEFG Y SerCommand Y Ser KH 0000 ; Ser.Command
DEFG Y SerStatus Y Ser KH 0001 ; Ser.Status
DEFG Y SerModuleAdd Y Ser KH 0003 ; Ser.ModuleAdd
DEFG Y SerI2CFrameCh Y Ser KH 0004 ; Ser.I2CFrameCh
DEFG W SerIOVector Y Ser KH 0006 ; Ser.IOVector

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the serial driver function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y SerCommand BD 0 ; Ser.Command.Enable
UTCH Y SerCommand BD 1 ; Ser.Command.UserOpen
MOVI Y SerModuleAdd KD 1 ; Ser.ModuleAdd
MOVI Y SerI2CFrameCh KD 4 ; Ser.I2CFrameCh

; ------------------------------------------------------------------------------
; @Section("Serial driver management")
; ------------------------------------------------------------------------------
; Here the serial driver function block is called. After this call the FB is
; defined as standard I/O console.

ORGR
SETR
TASK L FbI2CSerial Y Ser ; I2C serial driver

; By deactivating the "I 0000", the serial line of the addressed extension module
; is set at "19200, e, 8".

ORGR
LODF I 0000
SMOD K 0076 ; "19200, e, 8"

; By activating the "I 0000", the serial line of the addressed extension module
; is set at "9600, n, 8".

ORGR
LODT I 0000
SMOD K 0045 ; "9600, n, 8"

; By activating the "I 0001", "Hello!" string is out on the serial line of the
; addressed extension module.

ORGR
LODT I 0001
PULS
SETV W SerIOVector
STXI KH 0048

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSerial.htm (3 of 5) [06/10/2008 17.42.45]


Function blocks: FbI2CSerial

STXI KH 0065
STXI KH 006C
STXI KH 006C
STXI KH 006F
STXI KH 0021
STXI KH 000D
STXI KH 000A

; By activating the "I 0002", "Hello!" string is sent on the serial port "A".

ORGR
LODT I 0002
PULS
SETV KE IOSerialPortA
STXI KH 0048
STXI KH 0065
STXI KH 006C
STXI KH 006C
STXI KH 006F
STXI KH 0021
STXI KH 000D
STXI KH 000A

; [End of file]

e input I 0002 is activated, the string "Hello!" will be sent to the serial port A of the system.

"C" example

In the example below, it is managed the communication on a serial port of the extension module with address 1,
connected to I2C bus. Every second the string "Hello World!" will be sent to the serial line of the extention module
and on the port A of the system, the communication is set at its default of 19200, e, 8.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbI2CSerial.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBI2CSERIALDATA Ser; //Ser driver data structure

// Here the Ser driver function block parameters are set.

if (PLCFirstLoop)

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSerial.htm (4 of 5) [06/10/2008 17.42.45]


Function blocks: FbI2CSerial

{
Ser.Command.Enable=TRUE; //FB enable
Ser.ModuleAdd=1; //Peripheral module address
Ser.I2CFrameCh=4; //Characters in the I2C frame
}

FbI2CSerial(&Ser); //I2C serial driver

// Here the "Hello World!" string is sent at every 1 Second.

if (PLCPulse1000)
{
// The string is sent on the serial port "A".

SetTermIOVectors(IOSerialPortA);
printf("Hello World! (Port A)\r\n");

// The string is sent on the serial of the addressed extension module.

SetTermIOVectors(Ser.IOVector);
printf("Hello World! (Extension module)\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSerial.htm (5 of 5) [06/10/2008 17.42.45]


Function blocks: FbI2CSlaveManager

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbI2CSlaveManager

This function block manages the I2C bus communication on a slave system it can be used on the NETSYST 10 and 20
extension I/O modules. The FB manages also two communication channels on I2C bus with the master system, one is
used to allow the master system to manage the serial line of the slave system, this allows to add serial lines to the
master system, see FbI2CSerial. The second communication channel makes available a virtual standard I/O to the
slave system, thru this virtual Std I/O it's possible to load and debug programs on the slave system from the master
system. In case of errors in the I2C communication the FBManagement bit in PLCErrors data structure is set.

The function block uses static memory, so it's possible to define only one call to the FB in the program.

Code:PFB064 History report


Prototype
FbI2CSlaveManager.h

Declaration
void FbI2CSlaveManager(FBI2CSLAVEMANAGER* S);

Parameters
FBI2CSLAVEMANAGER* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Module addressing

The FB assigns to module the I2C address, all the extension modules have at the switching on 0x7F as default
address , the master system will provide automatically to assign to every module an address in the range from 0x21 to
0x27 in function of the position of the extension module respect to the master system. The first module connected will
take address 0x21, the second 0x22 and so on. The FB checks the state of the ReadyInAtPwOn bit of SystemConfig
to recognize if it's a base module of Netlog II or Netmaster system, in that case the address 0x20 is assigned to the
module. Further information about the module addressing can be reached at the proper chapter.

Configure the module

Using the startup function, see project settings, it's possible to set the TargetDevice in the SystemConfig to configure
the extension module that can operate in two different manners

Slave They give available all their resources as the I/Os, the display, the keyboard, the serial line, to the master
system.
Master They execute an own program that manages all or part of their resources, as the I/Os, the display, the
keyboard, the serial line. The master system can dialogue with them simply managing the reading or writing of
variables directly in the memory or managing the data in the communication structure. The Netlog II Lite
targets configured as master extensions are able to manage other extensions connected to their I2C
extension bus.

Data structure

The function block uses a 128 bytes data structure, we report a prototype. The members reported under the Internal

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (1 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

use only members label, are members used inside by the function block and they don't have to be changed by the
user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL AddressForce:1; //Address force
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //Enabled
BOOL I2CSReady:1; //I2C module ready
BOOL RdyInSignal:1; //Ready in signal status
BOOL b3:1;
BOOL RxBufferEmpty:1; //Received character with Rx buffer empty
BOOL TxBufferFull:1; //Sent character with Tx buffer full
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned char I2CSAddress; //I2C module address


unsigned char I2CSRxFrames; //I2C Rx frames counter
unsigned char I2CSRxError; //I2C Rx errors counter
unsigned char Dummy1;
TERMIOVECTORS* Serial; //Serial vector address
TERMIOVECTORS* I2CStdIO; //Standard I/O vector address
unsigned char Dummy2[6];

// ------------------------------------------------[I/O extension buffers]--

unsigned char I2CSHLogInp; //I2C high logic input buffer


unsigned char I2CSLLogInp; //I2C low logic input buffer
unsigned char Dummy3[1];
unsigned char I2CSLLogOut; //I2C low logic output buffer
unsigned char I2CSADMode[4]; //I2C A/D mode
unsigned char I2CSADFilter[4]; //I2C A/D filter
float I2CSADValue[4]; //I2C A/D value
unsigned char Dummy4[2];
unsigned char I2CSDAMode[2]; //I2C D/A mode
float I2CSDAValue[2]; //I2C D/A value

// -----------------------------------------------------[Terminal buffers]--

unsigned char Dummy5[4];


struct
{
struct

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (2 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

{
BOOL K0:1; //Key [0] status
BOOL K1:1; //Key [1] status
BOOL K2:1; //Key [2] status
BOOL K3:1; //Key [3] status
BOOL K4:1; //Key [4] status
BOOL K5:1; //Key [5] status
BOOL K6:1; //Key [6] status
BOOL K7:1; //Key [7] status
}Low;

struct
{
BOOL K8:1; //Key [8] status
BOOL K9:1; //Key [9] status
BOOL KUP:1; //Key [UP] status
BOOL KDW:1; //Key [DW] status
BOOL KFUN:1; //Key [FUN] status
BOOL KESC:1; //Key [ESC] status
BOOL KCLR:1; //Key [CLR] status
BOOL KENT:1; //Key [ENT] status
}High;

struct
{
BOOL KLEFT:1; //Key [KLEFT] status
BOOL KRIGHT:1; //Key [KRIGHT] status
}Fun;
}Key;

unsigned char Dummy6[1];

struct
{
char Up[16]; //Display Up data buffer
char Dw[16]; //Display Dw data buffer
}Display;

// --------------------------------------------[Internal use only members]--


...
}FBI2CSLAVEMANAGER;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the function block. The Status is reset.
TRUE: It enable the function block.
1 AddressForce TRUE: Allows to define the module from the user program, the module assumes the address
defined in I2CSAddress. However the module address can be changed from the master system
using the I2C command Module address setting.

01 Status
Status bits, the user program can test these bits.

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (3 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

0 Enabled TRUE: The function block is enabled


1 I2CSReady It's managed by the system master with the I2C command Ready signal set.
2 RdyInSignal It returns the status of the ready input signal.
4 RxBufferEmpty TRUE: The user program has read the data, GetCh or scanf, from the virtual standard I/O
virtual Std I/O, when the reception buffer was empty.
5 TxBufferFull TRUE: The user program has written the data, PutCh or printf, from the virtual standard I/O
virtual Std I/O, when the transmission buffer was full.

02 I2CSAddress
It returns the value of the address that the system master has assigned to the module (Range from 0x21 to 0x27).
Before the assignment the address value is 0x7F.
03 I2CSRxFrames
It returns the number of received I2C frames, reached its maximum the value starts from 0 (Range from 0x00 to
0xFF).
04 I2CSRxError
It returns the I2C bus communication error, reached its maximum the value starts from 0 (Range from 0x00 to
0xFF).
06 Serial
Loaded by user program it defines the TERMIOVECTORS data structure address of the serial line that must be
managed from the master system thru I2C communication. If not defined will be not used any serial line and the
relate I2C commands (codes from 0x10 to 0x16) will be not managed. (Range from 0x0000 to 0xFFFF).
08 I2CStdIO
It returns the the TERMIOVECTORS data structure address to be used to communicate with master system thru
the virtual standard I/O (Range from 0x0000 to 0xFFFF).
10 I2CSHLogInp
Loaded by user program with the state of the logic inputs high (From INP08 a INP0F), the value can be acquired
from the master system with the I2C commands, Logic I/O management and Logic input acquisition (Range from
0x00 to 0xFF).
11 I2CSLLogInp
Loaded by user program with the state of the logic inputs low (From INP00 a INP07), the value can be acquired
from the master system with the I2C commands, Logic I/O management and Logic input acquisition (Range from
0x00 to 0xFF).
13 I2CSLLogOut
It returns the status of the logic outputs (From OUT00 a OUT07), set by the master system with the I2C
commands, Logic I/O management e Logic output management (Range from 0x00 to0xFF).

14 I2CSADMode (Channel 0)
15 I2CSADMode (Channel 1)
16 I2CSADMode (Channel 2)
17 I2CSADMode (Channel 3)
It returns the acquisition mode set by the master system with the I2C command Analog input acquisition, it must
be transferred to the FbNetlogIIAD (Range from 0x00 to0xFF).

18 I2CSADFilter (Channel 0)
19 I2CSADFilter (Channel 1)
1A I2CSADFilter (Channel 2)
1B I2CSADFilter (Channel 3)
It returns the filter value for the analog acquisition set by the master system with the I2C command Analog input
acquisition, it must be transferred to the FbNetlogIIAD (Range from 0x00 to0xFF).

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (4 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

1C I2CSADValue (Channel 0)
20 I2CSADValue (Channel 1)
24 I2CSADValue (Channel 2)
28 I2CSADValue (Channel 3)
Loaded by user program with the value of the analog inputs as returned by the FbNetlogIIAD, the value can be
acquired from the master system with the I2C command Analog input acquisition.

2E I2CSDAMode (Channel 0)
2F I2CSDAMode (Channel 1)
It returns the analog output mode set by the master system with the I2C command Analog output management, it
must be transferred to the FbNetlogIIDA (Range from 0x00 to0xFF).

30 I2CSDAValue (Channel 0)
34 I2CSDAValue (Channel 1)
It returns the value of the analog output value set by the master system with the I2C command, Analog output
management, it must be transferred to the FbNetlogIIDA.

3C Key.Low
Loaded by user program with the value of the terminal keyboard. The value can be acquired from the master
system with the I2C command Keyboard read.
0 K0 Key status
1 K1 Key status
2 K2 Key status
3 K3 Key status
4 K4 Key status
5 K5 Key status
6 K6 Key status
7 K7 Key status

3D Key.High
Loaded by user program with the value of the terminal keyboard. The value can be acquired from the master
system with the I2C command Keyboard read.
0 K8 Key status
1 K9 Key status
2 KUP Key , status
3 KDW Key , status
4 KFUN Key , status
5 KESC Key status
6 KCLR Key status
7 KENT Key , status

3E Key.Fun
Loaded by user program with the value of the terminal keyboard. The value can be acquired from the master
system with the I2C command Keyboard read.

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (5 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

0 KLEFT Key , status


1 KRIGHT Key , status

40 Display.Up
It returns the string to be displayed on the upper line of the display, set by the master system with the I2C
command Display write.

50 Display.Dw
It returns the string to be displayed on the lower line of the display, set by the master system with the I2C
command Display write.

RIL example

In the following example it's managed a I2C slave module based on a Netlog II target. To manage the terminal the
proper terminal management FB must be included in the project. Please note the startup function that sets the system
as a slave system, to execute the function the Call User Startup in the PLCSettings must be checked. An example of
use of this FB, can be found in the program loaded on the Netsyst family extension modules, SFW125 for the Netlog
based modules and SFW135 for the Netreader modules based on P89C664 processor.

; ------------------------------------------------------------------------------
; @Section("External variable definitions")
; ------------------------------------------------------------------------------

EXTR Y SystemConfig
EXTR W IOSerialPortB
DEFG Y SCTargetDevice Y SystemConfig KH 0002 ;SystemConfig.TargetDevice

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------
; "FbI2CSlaveManager" data structure definition.

DEFG Y Slm KD 128


DEFG Y SlmCommand Y Slm KH 0000 ;Slm.Command
DEFG Y SlmStatus Y Slm KH 0001 ;Slm.Status
DEFG Y SlmI2CSAddress Y Slm KH 0002 ;Slm.I2CSAddress
DEFG Y SlmI2CSRxFrames Y Slm KH 0003 ;Slm.I2CSRxFrames
DEFG Y SlmI2CSRxError Y Slm KH 0004 ;Slm.I2CSRxError
DEFG W SlmSerial Y Slm KH 0006 ;Slm.Serial
DEFG W SlmI2CStdIO Y Slm KH 0008 ;Slm.I2CStdIO
DEFG Y SlmI2CSHLogInp Y Slm KH 0010 ;Slm.I2CSHLogInp
DEFG Y SlmI2CSLLogInp Y Slm KH 0011 ;Slm.I2CSLLogInp
DEFG Y SlmI2CSLLogOut Y Slm KH 0013 ;Slm.I2CSLLogOut
DEFG Y SlmI2CSADMode0 Y Slm KH 0014 ;Slm.I2CSADMode[0]
DEFG Y SlmI2CSADMode1 Y Slm KH 0015 ;Slm.I2CSADMode[1]
DEFG Y SlmI2CSADMode2 Y Slm KH 0016 ;Slm.I2CSADMode[2]
DEFG Y SlmI2CSADMode3 Y Slm KH 0017 ;Slm.I2CSADMode[3]
DEFG Y SlmI2CSADFilter0 Y Slm KH 0018 ;Slm.I2CSADFilter[0]
DEFG Y SlmI2CSADFilter1 Y Slm KH 0019 ;Slm.I2CSADFilter[1]
DEFG Y SlmI2CSADFilter2 Y Slm KH 001A ;Slm.I2CSADFilter[2]
DEFG Y SlmI2CSADFilter3 Y Slm KH 001B ;Slm.I2CSADFilter[3]
DEFG FL SlmI2CSADValue0 Y Slm KH 001C ;Slm.I2CSADValue[0]
DEFG FL SlmI2CSADValue1 Y Slm KH 0020 ;Slm.I2CSADValue[1]
DEFG FL SlmI2CSADValue2 Y Slm KH 0024 ;Slm.I2CSADValue[2]
DEFG FL SlmI2CSADValue3 Y Slm KH 0028 ;Slm.I2CSADValue[3]

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (6 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

DEFG Y SlmI2CSDAMode0 Y Slm KH 002E ;Slm.I2CSDAMode[0]


DEFG Y SlmI2CSDAMode1 Y Slm KH 002F ;Slm.I2CSDAMode[1]
DEFG FL SlmI2CSDAValue0 Y Slm KH 0030 ;Slm.I2CSDAValue[0]
DEFG FL SlmI2CSDAValue1 Y Slm KH 0034 ;Slm.I2CSDAValue[1]
DEFG Y SlmKeyLow Y Slm KH 003C ;Slm.Key.Low
DEFG Y SlmKeyHigh Y Slm KH 003D ;Slm.Key.High
DEFG Y SlmKeyFun Y Slm KH 003E ;Slm.Key.Fun
DEFG Y SlmDisplayUp Y Slm KH 0040 ;Slm.Display.Up
DEFG Y SlmDisplayDw Y Slm KH 0050 ;Slm.Display.Dw

; "FbNetlogIIAD" data structure definition.

DEFL Y ADs KD 80
DEFL Y ADsCommand Y ADs KH 0000 ;ADs.Command
DEFL Y ADsStatus Y ADs KH 0001 ;ADs.Status
DEFL Y ADsModule Y ADs KH 0002 ;ADs.Module
DEFL Y ADsMode0 Y ADs KH 0004 ;ADs.Mode[0]
DEFL Y ADsMode1 Y ADs KH 0005 ;ADs.Mode[1]
DEFL Y ADsMode2 Y ADs KH 0006 ;ADs.Mode[2]
DEFL Y ADsMode3 Y ADs KH 0007 ;ADs.Mode[3]
DEFL Y ADsFilter0 Y ADs KH 0008 ;ADs.Filter[0]
DEFL Y ADsFilter1 Y ADs KH 0009 ;ADs.Filter[1]
DEFL Y ADsFilter2 Y ADs KH 000A ;ADs.Filter[2]
DEFL Y ADsFilter3 Y ADs KH 000B ;ADs.Filter[3]
DEFL FL ADsValue0 Y ADs KH 0010 ;ADs.Value[0]
DEFL FL ADsValue1 Y ADs KH 0014 ;ADs.Value[1]
DEFL FL ADsValue2 Y ADs KH 0018 ;ADs.Value[2]
DEFL FL ADsValue3 Y ADs KH 001C ;ADs.Value[3]

; "FbNetlogIIDA" data structure definition.

DEFL Y DAs KD 32
DEFL Y DAsCommand Y DAs KH 0000 ;DAs.Command
DEFL Y DAsStatus Y DAs KH 0001 ;DAs.Status
DEFL Y DAsModule Y DAs KH 0002 ;DAs.Module
DEFL Y DAsMode0 Y DAs KH 0004 ;DAs.Mode[0]
DEFL Y DAsMode1 Y DAs KH 0005 ;DAs.Mode[1]
DEFL FL DAsValue0 Y DAs KH 0008 ;DAs.Value[0]
DEFL FL DAsValue1 Y DAs KH 000C ;DAs.Value[1]

; ------------------------------------------------------------------------------
; @Section("FbI2CSlaveManager function block management")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y SlmCommand BD 0 ;Slm.Command.Enable
MOVM W SlmSerial W IOSerialPortB ;Slm.Serial

; Here the function block is executed.

ORGR
SETR
TASK L FbI2CSlaveManager Y Slm

; Here the logic inputs are copied to the I2C buffers.

IOAQ K 0001

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (7 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

STRA Y SlmI2CSHLogInp ;Slm.I2CSHLogInp

IOAQ K 0000
STRA Y SlmI2CSLLogInp ;Slm.I2CSLLogInp

; Here the I2C buffers are copied to the logic outputs.

LODA Y SlmI2CSLLogOut ;Slm.I2CSLLogOut


IOAQ K 0100

; ------------------------------------------------------------------------------
; @Section("FbNetlogIIAD function block management")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y ADsCommand BD 0 ;ADs.Command.Enable
MOVI Y ADsModule KH 0000 ;ADs.Module

; Here the I2C buffers are copied to the FbNetlogIIAD data structure.

ORGR
LODT Y ADsStatus BD 1 ;ADs.Status.DataReady
MOVM Y ADsMode0 Y SlmI2CSADMode0 ;ADs.Mode[0]
MOVM Y ADsMode1 Y SlmI2CSADMode1 ;ADs.Mode[1]
MOVM Y ADsMode2 Y SlmI2CSADMode2 ;ADs.Mode[2]
MOVM Y ADsMode3 Y SlmI2CSADMode3 ;ADs.Mode[3]
MOVM Y ADsFilter0 Y SlmI2CSADFilter0 ;ADs.Filter[0]
MOVM Y ADsFilter1 Y SlmI2CSADFilter1 ;ADs.Filter[1]
MOVM Y ADsFilter2 Y SlmI2CSADFilter2 ;ADs.Filter[2]
MOVM Y ADsFilter3 Y SlmI2CSADFilter3 ;ADs.Filter[3]

; Here the function block is executed.

ORGR
SETR
TASK L FbNetlogIIAD Y ADs

; Here the analog values are copied to the I2C buffers.

ORGR
LODT Y ADsStatus BD 1 ;ADs.Status.DataReady
MOVM FL SlmI2CSADValue0 FL ADsValue0 ;Slm.I2CSADValue[0]
MOVM FL SlmI2CSADValue1 FL ADsValue1 ;Slm.I2CSADValue[1]
MOVM FL SlmI2CSADValue2 FL ADsValue2 ;Slm.I2CSADValue[2]
MOVM FL SlmI2CSADValue3 FL ADsValue3 ;Slm.I2CSADValue[3]

; ------------------------------------------------------------------------------
; @Section("FbNetlogIIDA function block management")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y DAsCommand BD 0 ;ADs.Command.Enable
MOVI Y DAsModule KH 0000 ;DAs.Module

; Here the I2C buffers are copied to the FbNetlogIIDA data structure.

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (8 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

ORGR
LODT Y DAsStatus BD 1 ;ADs.Status.DataSet
MOVM Y DAsMode0 Y SlmI2CSDAMode0 ;DAs.Mode[0]
MOVM Y DAsMode1 Y SlmI2CSDAMode1 ;DAs.Mode[1]
MOVM FL DAsValue0 FL SlmI2CSDAValue0 ;DAs.Value[0]
MOVM FL DAsValue1 FL SlmI2CSDAValue1 ;DAs.Value[1]

; Here the function block is executed.

ORGR
SETR
TASK L FbNetlogIIDA Y DAs

; Main program end.

ORGR
SETR
RETN

; ------------------------------------------------------------------------------
; @Section("User startup function")
; ------------------------------------------------------------------------------
; This function is automatically called once before to execute the user program.
; Configure the system as "NETLOG_ADUC84X_LITE_SLAVE_EXT".

ORGR
LABL L PLCUserStartUp
SETR
MOVI Y SCTargetDevice KH 0042 ;SystemConfig.TargetDevice
RETN

; [End of file]

"C" example

In the following example it's managed a I2C slave module based on a Netlog II target. Please note the startup function
that sets the system as a slave system, to execute the function the Call User Startup in the PLCSettings must be
checked.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogIIAD.h>
#include <FbNetlogIIDA.h>
#include "FbI2CSlaveManager.h"

// -----------------------------------------------------------------------------
// FUNCTION "void PLC_L_PLCUserStartUp_Lbl(void)"
// -----------------------------------------------------------------------------
// This function is automatically called once before to execute the user program.

void PLC_L_PLCUserStartUp_Lbl(void)
{

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (9 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

SystemConfig.TargetDevice=NETLOG_ADUC84X_LITE_SLAVE_EXT; //Target device


}

// -----------------------------------------------------------------------------
// EXTENSION MANAGEMENT
// -----------------------------------------------------------------------------
// Extension management program.

void ExtensionMng(void)
{
// Local variable definitions.

unsigned char i; //Aux counter


static FBI2CSLAVEMANAGER Slm; //I2C slave manager data structure
static FBNETLOGIIADDATA ADs; //NetlogII A/D data structure
static FBNETLOGIIDADATA DAs; //D/A data structure
static TERMINALSTRUCT Ts; //Terminal data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the function init at first program execution loop.

if (PLCFirstLoop)
{
// I2C slave manager function block parameters setting.

Slm.Command.Enable=TRUE; //Enable
Slm.Serial=IOSerialPortB; //Serial vector address

// NetlogII A/D function block parameters setting.

ADs.Command.Enable=TRUE; //FB enable


ADs.Module=0; //Module address

// NetlogII D/A function block parameters setting.

DAs.Command.Enable=TRUE; //FB enable


DAs.Module=0; //Module address

// Terminal parameters setting.

Ts.TerminalAddress=0x07; //Terminal address


Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
}

// -------------------------------------------------------------------------
// I2C SLAVE MANAGER
// -------------------------------------------------------------------------
// Execute the I2C slave manager function block.

FbI2CSlaveManager(&Slm); //I2C slave manager

// ---------------------------------------------------------[Logic inputs]--

PeripheralInp(0, 1, &Slm.I2CSHLogInp); //INP08 to INP0F acquisition


PeripheralInp(0, 0, &Slm.I2CSLLogInp); //INP00 to INP07 acquisition

// ---------------------------------------------------------[Logic outputs]--

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (10 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

PeripheralOut(0, 0, Slm.I2CSLLogOut); //OUT00 to OUT08 management

// --------------------------------------------------------[Analog inputs]--
// Set the parameters.

for (i=0; i<4; i++)


{
ADs.Mode[i]=Slm.I2CSADMode[i]; //Mode
ADs.Filter[i]=Slm.I2CSADFilter[i]; //Filter
}

// Execute the A/D management.

FbNetlogIIAD(&ADs);

// Read the values.

if (ADs.Status.DataReady)
for (i=0; i<4; i++)
Slm.I2CSADValue[i]=ADs.Value[i]; //I2C A/D value

// -------------------------------------------------------[Analog outputs]--
// Set the parameters.

for (i=0; i<2; i++)


{
DAs.Mode[i]=Slm.I2CSDAMode[i]; //Mode
DAs.Value[i]=Slm.I2CSDAValue[i]; //Output value
}

// Execute the A/D management.

FbNetlogIIDA(&DAs);

// -------------------------------------------------------------[Terminal]--
// Set the terminal as standard I/O console and call the terminal
// management function it must be called after the variables init.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Copy the keyboard status.

Slm.Key.High.KUP=Ts.KeyStatus.KUP; //Key [UP] status


Slm.Key.High.KDW=Ts.KeyStatus.KDW; //Key [DW] status
Slm.Key.High.KFUN=Ts.KeyStatus.KFUN; //Key [FUN] status
Slm.Key.High.KENT=Ts.KeyStatus.KENT; //Key [ENT] status
Slm.Key.Fun.KLEFT=Ts.KeyStatus.KLEFT; //Key [LEFT] status
Slm.Key.Fun.KRIGHT=Ts.KeyStatus.KRIGHT; //Key [RIGHT] status

// Copy the display data.

if (Ts.Status.RefreshEnd)
OutputStream((char*)&Slm.Display, 32);
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (11 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

I2C supported commands

Every I2C command begins with the writing by the master system of the comand frame and the successive reading of
the reply answer frame. Every frame has like terminator a checksum byte that represents the sum in 2' complement of
the whole frame included the I2C address.

Code 01: Logic I/O management Command frame Answer frame


This command allows the writing of 8 logic outputs and the reading of 16 Module address 21 Module address 21
logic inputs from the extension module. Command 01 Command 01
Output value 55 Input value (Hi) 10
Frame checksum 89 Input value (Lo) 01
Frame checksum CD
Code 02: Ready signal set Command frame Answer frame
This command allows the set of the I2CSReady bit on the extension 21
Module address Module address 21
module. The Ready command byte allows to set commands on the Command 02 Command 02
module as reported in the table: Ready command00 Frame checksum DD
Bit Description DD
Frame checksum

0 Ready signal
1 Master watch dog enable
Code 04: Memory read Command frame Answer frame
This command allows the reading of numerical variables from the 21
Module address Module address21
extension module. For the variable address range please refer to the Command 04 Command 04
project settings, the number of bytes is included between 1 and 32. Address (Hi)07 Value (Hi) 12
Address (Lo)00 Value (Lo) 34
Nr of bytes 02 Frame checksum95
D2
Frame checksum
Code 05: Memory write Command frame Answer frame
This command allows the writing of numerical variables to the extension 21
Module address Module address 21
module. For the variable address range please refer to the project settings, Command 05 Command 05
the number of bytes is included between 1 and 32. Address (Hi)07 Frame checksum DA
Address (Lo)00
Nr of bytes 02
Value (Hi) 12
Value (Lo) 34
8B
Frame checksum
Code 06: Logic input acquisition Command frame Answer frame
This command allows the reading of 16 logic inputs from the extension Module address 21 Module address 21
module. Command 06 Command 06
Frame checksum D9 Input value (Hi) 10
Input value (Lo) 01
Frame checksum C8
Code 09: Logic output management Command frame Answer frame
This command allows the writing of 8 logic outputs to the extension 21
Module address Module address 21
module. Command 09 Command 09
Output value55 Frame checksum D6
81
Frame checksum
Code 0A: Display write Command frame Answer frame
This command allows the writing of data to the display of the extension 21
Module address Module address 21
module. Up to 32 bytes can be write. Command 0A Command 0A
Display address: Buffer display address (Range da 0 a 31) 00
Display address Frame checksum D5
Nr of characters: Number of bytes to be written (Range da 1 a 32) 03
Nr of characters
Char (00) 41
Char (01) 42
Char (02) 43
0C
Frame checksum

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (12 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

Code 0B: Keyboard read Command frame Answer frame


This command allows the keyboard reading from the extension module. Module address 21 Module address21
Command 0B Command 0B
Frame checksum D4 00
Kbd status (MSB)
Kbd status 00
00
Kbd status (LSB)
Frame checksumD4
Code 0C: Analog input acquisition Command frame Answer frame
This command allows the reading of analog input from the extension 21
Module address Module address 21
module. In the command frame are set the acquisition mode and filter as Command 0C Command 0C
requested in the FbNetlogIIAD. In the answer frame it's returned the 00
Analog channel 40
acquired value as a float number. Mode 01 80
Analog value
Filter 00 00
D2
Frame checksum 00
Frame checksum 13
Code 0D: Analog output management Command frame Answer frame
This command allows the writing of analog output to the extension module. Module address 21 Module address 21
In the command frame are set the acquisition mode and the output value Command 0D Command 0D
as a float number as requested in the FbNetlogIIDA. Analog channel 00 Frame checksum D2
Mode 01
40
80
Value
00
00
Frame checksum 11
Code 0F: Module address setting Command frame Answer frame
This command allows to set the module address. 21
Module address Module address 21
Command 0F Command 0F
22
Address to be set Frame checksum D0
AE
Frame checksum
Code 10: Serial Rx/Tx buffers status Command frame Answer frame
This command allows the reading of the available space in the Module address 21 Module address21
transmission buffer and the number of characters received from the serial Command 10 Command 10
port of the slave system whose vector address is defined in Serial. Frame checksum CF Tx space 04
Tx space: Number of characters that it is possible to transfer to the Rx characters 01
transmission buffer (Range from 0 to 32). If the Tx buffer CA
Frame checksum
is empty 0xFF is returned.
Rx characters: Number of characters been received (Range from 0 to 32).
Code 11: Serial Rx characters read Command frame Answer frame
This command allows the reading of the data, present in the reception 21
Module address Module address21
buffer of the serial port of the slave system whose vector address is Command 11 Command 11
defined in Serial. Up to 32 bytes can be read. 03
Nr of characters Char (00) 41
CB
Frame checksum Char (01) 42
Char (02) 43
Frame checksum08
Code 12: Serial Tx characters write Command frame Answer frame
This command allows the writing of the data in the transmission buffer of 21
Module address Module address 21
the serial port of the slave system whose vector address is defined in Command 12 Command 12
Serial. Up to 32 bytes can be write. 02
Nr of characters Frame checksum CD
Char (00) 41
Char (01) 42
48
Frame checksum

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (13 of 14) [06/10/2008 17.42.52]


Function blocks: FbI2CSlaveManager

Code 14: Serial mode read Command frame Answer frame


This command allows the reading of the communication mode, Module address 21 Module address21
SERIALSTRUCT data structure, of the serial port of the slave system Command 14 Command 14
whose vector address is defined in Serial. Frame checksum CB Byte (00) 01
Byte (..) ..
Byte (06) 02
Frame checksum ..
Code 15: Serial mode set Command frame Answer frame
This command allows the writing of the communication mode, 21
Module address Module address 21
SERIALSTRUCT data structure, of the serial port of the slave system Command 15 Command 15
whose vector address is defined in Serial. Byte (00) 01 Frame checksum CA
Byte (..) ..
Byte (06) 02
..
Frame checksum
Code 16: Serial DTR signal management Command frame Answer frame
This command allows the setting of the DTR signal, of the serial port of the 21
Module address Module address 21
slave system whose vector address is defined in Serial. Command 16 Command 16
01
DTR signal cmd Frame checksum C9
C8
Frame checksum
Code 18: I2CStdIO Rx/Tx buffers status Command frame Answer frame
This command allows the reading of the available space in the Module address 21 Module address21
transmission buffer and the number of characters received from the virtual Command 18 Command 18
standard I/O of the slave system whose vector address is returned in Frame checksum C7 Tx space 04
I2CStdIO. Rx characters 01
Tx space: Number of characters that it is possible to transfer to the C2
Frame checksum
transmission buffer (Range from 0 to 32). If the Tx buffer
is empty 0xFF is returned.
Rx characters: Number of characters been received (Range from 0 to 32).
Code 19: I2CStdIO Rx characters read Command frame Answer frame
This command allows the reading of the data, present in the reception 21
Module address Module address21
buffer of the virtual standard I/O of the slave system whose vector address Command 19 Command 19
is returned in I2CStdIO. Up to 32 bytes can be read. 03
Nr of characters Char (00) 41
C3
Frame checksum Char (01) 42
Char (02) 43
Frame checksum00
Code 1A: I2CStdIO Tx characters write Command frame Answer frame
This command allows the writing of the data, in the transmission buffer of 21
Module address Module address 21
the virtual standard I/O of the slave system whose vector address is Command 1A Command 1A
returned in I2CStdIO. Up to 32 bytes can be write. 02
Nr of characters Frame checksum C5
Char (00) 41
Char (01) 42
40
Frame checksum

http://192.168.0.61/Destination/Html/FctBlocks/FbI2CSlaveManager.htm (14 of 14) [06/10/2008 17.42.52]


Function blocks: FBIOComm

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbIOComm

This function block allows the data exchange between two systems, one master and one slave, using a
connection between logic I/Os. Two digital inputs and two digital outputs for every system are used, you can
define the number of data bytes to exchange to optimize the data exchange time.

Code:PFB043 History report


Prototype
FbIOComm.h

Declaration
void FbIOComm(FBIOCOMMDATA *S);

Parameters
FBIOCOMMDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 32 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL b1:1;
BOOL b2:1;
BOOL Reset:1; //Errors reset
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //Enabled
BOOL TransferEnd:1; //Data transfer end
BOOL TransmitEnd:1; //Data transmit end
BOOL ReceiveEnd:1; //Data reception end
BOOL ILowError:1; //Logic inputs low error
BOOL IHighError:1; //Logic inputs high error

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (1 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

BOOL CksError:1; //Reception checksum error


BOOL SincError:1; //Sincronization error
}Status;

struct
{
BOOL IStrobe:1; //Strobe input signal
BOOL IData:1; //Data input signal
BOOL b2:1;
BOOL b3:1;
BOOL OStrobe:1; //Strobe output signal
BOOL OData:1; //Data output signal
BOOL b6:1;
BOOL b7:1;
}IOSignals;

unsigned char Dummy;


unsigned int ModeVector; //Mode vector address
unsigned int TxAddress; //Transmit data address
unsigned char TxBytes; //Number of transmit bytes
unsigned char Dummy1;
unsigned int RxAddress; //Reception data address
unsigned char RxBytes; //Number of reception bytes

// --------------------------------------------[Internal use only members]--


...
}FBIOCOMMDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB. The communication stops and the output signals go to zero.
TRUE: It enables the FB and the communication starts.
4 Reset TRUE: Resets the error bits.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: It shows that the FB is enabled.
1 TransferEnd It's activated for a program loop at the end of the data exchange.
2 TransmitEnd It's activated for a program loop at the end of the data transmission.
3 ReceiveEnd It's activated for a program loop at the end of the data reception.
4 ILowError TRUE: It shows an error on the communication signals, they were checked as reset when
they had to be set. It can be reset by activating the Command.Reset bit.
5 IHighError TRUE: It shows an error on the communication signals, they were checked as set when they
had to be reset. It can be reset by activating the Command.Reset bit.
6 CksError TRUE: It shows an error of data reception, the received packet has an check sum error. It
can be reset by activating the Command.Reset bit.
7 SincError TRUE: It shows a synchronization error with the other system. It can be reset by activating
the Command.Reset bit.

02 IOSignals
IO signal bytes, the user program can manage these bits according to its needs.

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (2 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

0 IStrobe The hardware signal (Logic input) used as strobe input, has to be copied to this bit.
1 IData The hardware signal (Logic input) used as data input, has to be copied to this bit.
4 OStrobe This bit has to be copied to the hardware signal Logic output) used as strobe output.
5 OData This bit has to be copied to the hardware signal (Logic output) used as data output.

04 ModeVector
Loaded by user program it defines the mode management vector, the two possible values are:
Pfb043_Master: It defines the master mode.
Pfb043_Slave: It defines the slave mode.
06 TxAddress
Loaded by user program it defines the begin address of the data buffer to be transmit to the other system,
the range is from 0x0000 to 0xFFFF.
08 TxBytes
Loaded by user program it defines the number of bytes to transmit to the other system, the range is from
0x00 to 0xFF.
0A RxAddress
Loaded by user program it defines the begin address of the data buffer to receive from the other system, the
range is from 0x0000 to 0xFFFF.
0C RxBytes
Loaded by user program it defines the number of bytes to receive from the other system, the range is from
0x00 to 0xFF.

RIL example

In the example below, the FB is parametrized as master and is executed. By executing the same program on
another system and parametrizing it as slave it's possible to test the data exchange between the two systems
using the logic I/Os.

; ------------------------------------------------------------------------------
; @Section("Extern variables definition")
; ------------------------------------------------------------------------------

EXTR L FbIOCommMaster ; Master mode vector


EXTR L FbIOCommSlave ; Slave mode vector

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; Here define the data buffer to send to the other system.

DEFL Y TxD KD 4
DEFL Y TxDByte0 Y TxD KD 0 ; Tx data, Byte 0
DEFL Y TxDByte1 Y TxD KD 1 ; Tx data, Byte 1
DEFL W TxDWord0 Y TxD KD 2 ; Tx data, Word 0

; Here define the data buffer to receive from the other system.

DEFL Y RxD KD 4
DEFL Y RxDByte0 Y RxD KD 0 ; Rx data, Byte 0
DEFL Y RxDByte1 Y RxD KD 1 ; Rx data, Byte 1

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (3 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

DEFL W RxDWord0 Y RxD KD 2 ; Rx data, Word 0

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Logic I/O communication function block data structure.

DEFL Y IOC KD 32
DEFL Y IOCCommand Y IOC KH 0000 ; IOC.Command
DEFL Y IOCStatus Y IOC KH 0001 ; IOC.Status
DEFL Y IOCIOSignals Y IOC KH 0002 ; IOC.IOSignals
DEFL W IOCModeVector Y IOC KH 0004 ; IOC.ModeVector
DEFL W IOCTxAddress Y IOC KH 0006 ; IOC.TxAddress
DEFL Y IOCTxBytes Y IOC KH 0008 ; IOC.TxBytes
DEFL W IOCRxAddress Y IOC KH 000A ; IOC.RxAddress
DEFL Y IOCRxBytes Y IOC KH 000C ; IOC.RxBytes

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the logic I/O communication function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y IOCCommand K 0000 ; I/O Comm, Command.Enable
MOVA W IOCTxAddress Y TxD ; IOC.TxAddress
MOVI Y IOCTxBytes KD 4 ; IOC.TxBytes
MOVA W IOCRxAddress Y RxD ; IOC.RxAddress
MOVI Y IOCRxBytes KD 4 ; IOC.RxBytes

; Uncomment the statement that define the mode you want to use.

MOVA W IOCModeVector L FbIOCommMaster ; IOC.ModeVector


; MOVA W IOCModeVector L FbIOCommSlave ; IOC.ModeVector

; ------------------------------------------------------------------------------
; @Section("I/O communication")
; ------------------------------------------------------------------------------
; Copy the logical inputs to function blocks input bits.

ORGR
LODT I 0000 ; Strobe input
OUTT Y IOCIOSignals K 0000 ; IOC.IOSignals.IStrobe

ORGR
LODT I 0001 ; Data input
OUTT Y IOCIOSignals K 0001 ; IOC.IOSignals.IData

; Here the logic I/O communication function block is called.

ORGR
SETR
TASK L FbIOComm Y IOC ; I/O communication management

; Copy the function blocks output bits to logical outputs.

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (4 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

ORGR
LODT Y IOCIOSignals K 0004 ; IOC.IOSignals.OStrobe
OUTT O 0000 ; Strobe output

ORGR
LODT Y IOCIOSignals K 0005 ; IOC.IOSignals.OData
OUTT O 0001 ; Data output

; [End of file]

"C" example

In the example below, the FB is parametrized as master and is executed. By executing the same program on
another system and parametrizing it as slave it's possible to test the data exchange between the two systems
using the logic I/Os.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbIOComm.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

BOOL ErrorFlag; //A/D acquisition error


unsigned int AnalogValue; //A/D analog value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Logic inputs definition.

struct
{
BOOL Strobe:1; //Strobe input
BOOL Data:1; //Data input
BOOL Inp02:1; //Inp 02 bit
BOOL Inp03:1; //Inp 03 bit
BOOL Inp04:1; //Inp 04 bit
BOOL Inp05:1; //Inp 05 bit
BOOL Inp06:1; //Inp 06 bit
BOOL Inp07:1; //Inp 07 bit
}LogInp;

// Logic outputs definition.

struct
{

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (5 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

BOOL Strobe:1; //Strobe output


BOOL Data:1; //Data output
BOOL Out02:1; //Out 02 bit
BOOL Out03:1; //Out 03 bit
BOOL Out04:1; //Out 04 bit
BOOL Out05:1; //Out 05 bit
BOOL Out06:1; //Out 06 bit
BOOL Out07:1; //Out 07 bit
}LogOut;

// Here define the data buffer to send to the other system.

static struct
{
unsigned char TxDByte0; //Tx data, Byte 0
unsigned char TxDByte1; //Tx data, Byte 1
unsigned int TxDWord0; //Tx data, Word 0
}TxD;

//; Here define the data buffer to receive from the other system.

static struct
{
unsigned char RxDByte0; //Rx data, Byte 0
unsigned char RxDByte1; //Rx data, Byte 1
unsigned int RxDWord0; //Rx data, Word 0
}RxD;

static FBIOCOMMDATA IOC; //I/O communication data structure

// Here the logic I/O communication function block parameters are set.

if (PLCFirstLoop)
{
IOC.Command.Enable=TRUE; //Enable
IOC.TxAddress=(unsigned int)&TxD; //Transmit data address
IOC.TxBytes=sizeof(TxD); //Number of transmit bytes
IOC.RxAddress=(unsigned int)&RxD; //Reception data address
IOC.RxBytes=sizeof(RxD); //Number of Reception bytes

// Uncomment the statement that define the mode you want to use.

IOC.ModeVector=(unsigned int)FbIOCommMaster; //Mode vector address


// IOC.ModeVector=(unsigned int)FbIOCommSlave; //Mode vector address
}

// Here copy the logic input signals to the IOC data structure.

PeripheralInp(0x00, 0x00, (unsigned char*)&LogInp); //Inputs from 0 to 7


IOC.IOSignals.IStrobe=LogInp.Strobe; //Strobe input signal
IOC.IOSignals.IData=LogInp.Strobe; //Data input signal

// Manage the I/O communication function block.

FbIOComm(&IOC); //I/O communication management

// Here copy the the IOC data structure to the logic output signals.

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (6 of 7) [06/10/2008 17.42.54]


Function blocks: FBIOComm

LogOut.Strobe=IOC.IOSignals.OStrobe; //Strobe output


LogOut.Data=IOC.IOSignals.OData; //Data output
PeripheralOut(0x00, 0x00, *(unsigned char*)&LogOut); //Outputs from 0 to 7
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbIOComm.htm (7 of 7) [06/10/2008 17.42.54]


Function blocks: FbModbusAsciiMs

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbModbusAsciiMs

This function block allows the data exchange between two systems, one master and one slave, using a
MODBUS ASCII connection in serial line. For the communication with the slave system the function block uses the
MODBUS functions 41: Read memory bytes (User function) e 42: Write memory bytes (User function), see the
FbModbusAsciiSl block function information to have the full information of the used functions. For an example of
communication between a master system and two or more Slave systems, please refer to HT001.

Code:PFB044 History report


Prototype
FbModbusAsciiMs.h

Declaration
void FbModbusAsciiMs(FBMODBUSASCIIMSDATA* S);

Parameters
FBMODBUSASCIIMSDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members reported under the Internal
use only members label, are members used inside by the function block and they don't have to be changed by the
user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL ResetCtrs:1; //Resets all the counters
BOOL b2:1;
BOOL b3:1;
BOOL DoWrite:1; //Write memory bytes
BOOL DoRead:1; //Read memory bytes
BOOL DoWrRd:1; //Write/read memory bytes
BOOL b7:1;
}Command; //Command

struct
{
BOOL Enabled:1; //Enabled
BOOL JobDone:1; //Command executed
BOOL b2:1;
BOOL b3:1;
BOOL Timeouts:1; //Timeout error

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (1 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

BOOL Overruns:1; //Overrun error


BOOL CommErrs:1; //Communication error
BOOL Parameters:1; //Parameter error
}Status; //Status

unsigned char NodeAdd; //Node address


unsigned char Dummy1;
unsigned int WrLcStAd; //Master send data start address
unsigned int WrRmStAd; //Slave receive data start address
unsigned char WrBytes; //Number of bytes to send (from 0x00 to 0x20)
unsigned char Dummy2;
unsigned int RdLcStAd; //Master receive data start address
unsigned int RdRmStAd; //Slave send data start address
unsigned char RdBytes; //Number of bytes to receive (from 0x00 to 0x20)
unsigned char Dummy3;
unsigned int CommndWt; //Wait time before start (mSec)
unsigned int TimeOutCk; //Timeout Check (mSec)
unsigned char Dummy4;
unsigned int Timeouts; //Timeout error counter
unsigned int Overruns; //Overrun error counter
unsigned int CommErrs; //Communication error counter
unsigned int TxFrames; //Transmit string counter
unsigned int RxFrames; //Received string counter
unsigned int PLCMemStart; //Start PLC memory
unsigned char Dummy5;
unsigned char FrameLength; //Rx/Tx frame Length
unsigned char* FrameBuf; //Rx/Tx frame buffer

// --------------------------------------------[Internal use only members]--


...
}FBMODBUSASCIIMSDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB. The error bits in Status are reset and the communication is hung up.
TRUE: It enables the FB and the communication starts.
1 ResetCtrs TRUE: Resets all the counters, the bit is automatically reset.
4 DoWrite TRUE: It starts the data transfer to the slave system job. When the job starts the bit is
automatically reset.
5 DoRead TRUE: It orders the data read from the slave system job. When the job starts the bit is
automatically reset.
6 DoWrRd TRUE: It orders the data transfer to the slave system and the next reading job. When the job starts
the bit is automatically reset.

01 Status
Status bits, the user program can test these bits.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (2 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

0 Enabled TRUE: It shows that the FB is enabled.


1 JobDone It is activated for a program loop at the end of the of the requested job.
4 Timeouts TRUE: It shows a timeout error, the slave system did not answer to the request sent. To reset it
clear the Command.Enable bit.
5 Overruns TRUE: It shows an overrun error in answer reception from serial line, a number of characters
bigger than the reception buffer length has been received. To reset it clear the Command.
Enable bit.
6 CommErrs TRUE: It shows an error in answer reception from serial line, a wrong character or a number of
characters diffrent from the requested has been received. To reset it clear the Command.
Enable bit.
7 Parameters TRUE: It shows an error in FB data structure parameters set. To reset it clear the Command.
Enable bit.

02 NodeAdd
Loaded by user program it defines the address of the slave node, that you need to communicate to (From 0x00
to 0xFF).
04 WrLcStAd
Loaded by user program it defines the begin address of the data area on master system to be transferred to the
slave system(From 0x0000 to 0xFFFF).
06 WrRmStAd
Loaded by user program it defines the begin address of the data area on slave system, where the data read
from the master system are written (From 0x0000 to 0xFFFF). The address used in the MODBUS command to
write the data to the Slave system will be the sum between this value and the value of PLCMemStart.
08 WrBytes
Loaded by user program it defines the number of bytes to transfer to the slave system (From 1 to 32).
0A RdLcStAd
Loaded by user program it defines the begin address of the area on master system where the data readed from
the slave system are stored (From 0x0000 to 0xFFFF).
0C RdRmStAd
Loaded by user program it defines the begin address of the area on slave system, from where the data to be
transferred to the master system are read (From 0x0000 to 0xFFFF). The address used in the MODBUS
command to read the data from the Slave system will be the sum between this value and the value of
PLCMemStart.
0E RdBytes
Loaded by user program it defines the number of bytes to read from the slave system (From 1 to 32).
10 CommndWt
Loaded by user program it defines the waiting time expressed in mSec between the end of the job (we remind
that every job, ends after the command frame transmission and the proper answer frame reception) and the
start of the next job. In case of DoWrRd job, it represents the time between the end of the write control and the
execution of the next read control. (From 0x0000 to 0xFFFF).
12 TimeOutCk
Loaded by user program it defines the available time to execute the job, expressed in mSec (From 0x0000 to
0xFFFF).
16 Timeouts
It returns the count of the timeouts errors occurred both in reception and transmission. It can be preset to 0 by
the user program or reset by activating the Command.ResetCtrs bit.
18 Overruns

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (3 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

It returns the count of the overrun errors occurred in reception (From 0x0000 to 0xFFFF). It can be preset to 0
by the user program or reset by activating the Command.ResetCtrs bit.
1A CommErrs
It returns the count of the communication errors occurred both in reception and transmission (From 0x0000 to
0xFFFF). It can be preset to 0 by the user program or reset by activating the Command.ResetCtrs bit.
1C TxFrames
It returns the count of the command strings transmitted (From 0x0000 to 0xFFFF). It can be preset to 0 by the
user program or reset by activating the Command.ResetCtrs bit.
1E RxFrames
It returns the count of the number of answer strings received (From 0x0000 to 0xFFFF). It can be preset to 0 by
the user program or reset by activating the Command.ResetCtrs bit.
20 PLCMemStart
Loaded by user program it defines the allocation address of the PLC variables in the slave systemmemory
(From 0x0000 to 0xFFFF).The address used in the MODBUS command to write the data to the Slave system
will be the sum between this value and the value of WrRmStAd. The address used in the MODBUS command
to read the data from the Slave system will be the sum between this value and the value of WrRmStAd.
23 FrameLength
Loaded by user program it defines the dimension of the frame reception/transmission buffer (From 12 to 255).
To maintain compatibility with the previous versions a buffer of at least 40 bytes must be defined.
24 FrameBuf
Loaded by user program it defines the allocation address of the frame reception/transmission buffer (From
0x0000 to 0xFFFF).

RIL example

In the following example the Modbus communication with a slave system is executed, the master system and the
slave system automatically exchange banks of data. To test the working, you just need to connect the master
system to a slave, on which run a program that manages the FbModbusAsciiSl function block.

; ------------------------------------------------------------------------------
; @Section("Communication buffer")
; ------------------------------------------------------------------------------
; Here define the data buffer to communicate with the slave system.

DEFG Y ToSlave KD 4
DEFG Y ToY0000 Y ToSlave KH 0000 ; ToSlave, Y 0000
DEFG Y ToY0001 Y ToSlave KH 0001 ; ToSlave, Y 0001
DEFG W ToW0002 Y ToSlave KH 0002 ; ToSlave, W 0002

DEFG Y FromSlave KD 2
DEFG Y FromY0020 Y FromSlave KH 0000 ; FromSlave, Y 0020
DEFG Y FromY0021 Y FromSlave KH 0001 ; FromSlave, Y 0021

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; MODBUS master communication, data structure.

DEFL Y Mdb KD 64
DEFL Y MdbCommand Y Mdb KH 0000 ; Mdb.Command
DEFL Y MdbStatus Y Mdb KH 0001 ; Mdb.Status

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (4 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

DEFL Y MdbNodeAdd Y Mdb KH 0002 ; Mdb.NodeAdd


DEFL W MdbWrLcStAd Y Mdb KH 0004 ; Mdb.WrLcStAd
DEFL W MdbWrRmStAd Y Mdb KH 0006 ; Mdb.WrRmStAd
DEFL Y MdbWrBytes Y Mdb KH 0008 ; Mdb.WrBytes
DEFL W MdbRdLcStAd Y Mdb KH 000A ; Mdb.RdLcStAd
DEFL W MdbRdRmStAd Y Mdb KH 000C ; Mdb.RdRmStAd
DEFL Y MdbRdBytes Y Mdb KH 000E ; Mdb.RdBytes
DEFL W MdbCommndWt Y Mdb KH 0010 ; Mdb.CommndWt
DEFL W MdbTimeOutCk Y Mdb KH 0012 ; Mdb.TimeOutCk
DEFL W MdbTimeouts Y Mdb KH 0016 ; Mdb.Timeouts
DEFL W MdbOverruns Y Mdb KH 0018 ; Mdb.Overruns
DEFL W MdbCommErrs Y Mdb KH 001A ; Mdb.CommErrs
DEFL W MdbTxFrames Y Mdb KH 001C ; Mdb.TxFrames
DEFL W MdbRxFrames Y Mdb KH 001E ; Mdb.RxFrames
DEFL W MdbPLCMemStart Y Mdb KH 0020 ; Mdb.PLCMemStart
DEFL Y MdbFrameLength Y Mdb KH 0023 ; Mdb.FrameLength
DEFL W MdbFrameBuf Y Mdb KH 0024 ; Mdb.FrameBuf

; Rx/Tx frame buffer definition.

DEFL Y FrameBuf KD 40

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------
; MODBUS master communication, variables settings.

ORGR
LODT F PLCFirstLoop
MOVI Y MdbNodeAdd KD 0 ; Mdb.NodeAdd
MOVA W MdbWrLcStAd Y ToSlave ; Mdb.WrLcStAd
MOVI W MdbWrRmStAd KH 0000 ; Mdb.WrRmStAd
MOVI Y MdbWrBytes KD 4 ; Mdb.WrBytes
MOVA W MdbRdLcStAd Y FromSlave ; Mdb.RdLcStAd
MOVI W MdbRdRmStAd KH 0020 ; Mdb.RdRmStAd
MOVI Y MdbRdBytes KD 2 ; Mdb.RdBytes
MOVI W MdbCommndWt KD 40 ; Mdb.CommndWt
MOVI W MdbTimeOutCk KD 500 ; Mdb.TimeOutCk
MOVI W MdbPLCMemStart KH 0000 ; Mdb.PLCMemStart
MOVI Y MdbFrameLength KD 40 ;Mdb.FrameLength
MOVA W MdbFrameBuf Y FrameBuf ;Mdb.FrameBuf
LTCH Y MdbCommand BD 1 ;Mdb.Command.ResetCtrs

; ------------------------------------------------------------------------------
; @Section("MODBUS communication, master management")
; ------------------------------------------------------------------------------
; MODBUS master communication management.

ORGR
SETR
SETV KE IOSerialPortA
TASK L FbModbusAsciiMs Y Mdb ; MODBUS master management
LTCH Y MdbCommand BD 0 ;Mdb.Command.Enable
LTCH Y MdbCommand BD 6 ;Mdb.Command.DoWrRd+

; [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (5 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

"C" example

In the following example the Modbus communication with a slave system is executed, the master system and the
slave system automatically exchange banks of data. To test the working, you just need to connect the master
system to a slave, on which run a program that manages the FbModbusAsciiSl function block.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModbusAsciiMs.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define MDBFRAMELENGTH 40 //Modbus frame length

// -----------------------------------------------------------------------------
// DATA BUFFER DEFINITIONS
// -----------------------------------------------------------------------------
// Here define the data buffer to communicate with the slave system.

struct
{
unsigned char Byte0; //To slave system, byte 0
unsigned char Byte1; //To slave system, byte 1
unsigned int Word2; //To slave system, word 2
}ToSlave; //Data buffer to slave

struct
{
unsigned char Byte0; //From slave system, byte 0
unsigned char Byte1; //From slave system, byte 1
}FromSlave; //Data buffer from slave

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBMODBUSASCIIMSDATA Mdb; //MODBUS master data structure


static unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the system init at first program execution loop.

if (PLCFirstLoop)
{

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (6 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusAsciiMs

// Set variables to manage the MODBUS master communication.

Mdb.NodeAdd=0; //Node address


Mdb.WrLcStAd=(unsigned int)&ToSlave; //Master send data start address
Mdb.WrRmStAd=0x0000; //Slave receive data start address
Mdb.WrBytes=sizeof(ToSlave); //Number of bytes to send
Mdb.RdLcStAd=(unsigned int)&FromSlave; //Master receive data start address
Mdb.RdRmStAd=0x0004; //Slave send data start address
Mdb.RdBytes=sizeof(FromSlave); //Number of bytes to receive
Mdb.TimeOutCk=500; //Timeout Check (mSec)
Mdb.CommndWt=0; //Wait time before start (mSec)
Mdb.PLCMemStart=0x0000; //Start PLC memory
Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=&FrameBuf; //Rx/Tx frame buffer
Mdb.Command.Enable=FALSE; //Enable
Mdb.Command.ResetCtrs=TRUE; //Resets all the counters
}

// -------------------------------------------------------------------------
// MODBUS MASTER COMMUNICATION
// -------------------------------------------------------------------------
// MODBUS master communication call.

SetTermIOVectors(IOSerialPortA);
FbModbusAsciiMs(&Mdb); //MODBUS master management
Mdb.Command.Enable=TRUE; //Enable
Mdb.Command.DoWrite=TRUE; //Write memory bytes
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusAsciiMs.htm (7 of 7) [06/10/2008 17.42.57]


Function blocks: FbModbusRtuMs

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbModbusRtuMs

This function block allows the data exchange between two systems, one master and one slave, using a
MODBUS ASCII connection in serial line. For the communication with the slave system the function block uses the
MODBUS functions Code 03: Read holding registers, Code 04: Read input registers and Code 10: Preset
multiple registers, see the FbModbusRtuSl block function information to have the full information of the used
functions. For an example of communication between a master system and two or more Slave systems, please refer to
HT001.

Code:PFB069 History report


Prototype
FbModbusRtuMs.h

Declaration
void FbModbusRtuMs(FBMODBUSRTUMSDATA* S);

Parameters
FBMODBUSRTUMSDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members reported under the Internal
use only members label, are members used inside by the function block and they don't have to be changed by the
user program.

typedef struct
{
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable
BOOL ResetCtrs:1; //Resets all the counters
BOOL FctSelect:1; //Function select
BOOL b3:1;
BOOL DoWrite:1; //Write memory bytes
BOOL DoRead:1; //Read memory bytes
BOOL DoWrRd:1; //Write/read memory bytes
BOOL b7:1;
}Command; //Command

struct
{
BOOL Enabled:1; //Enabled
BOOL JobDone:1; //Command executed
BOOL b2:1;
BOOL b3:1;
BOOL Timeouts:1; //Timeout error

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (1 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

BOOL b5:1;
BOOL CommErrs:1; //Communication error
BOOL Parameters:1; //Parameter error
}Status; //Status

unsigned char Node; //Node address


unsigned char Dummy1;
unsigned int WrBuffer; //Write data buffer
unsigned int WrAddress; //Register address to write
unsigned char WrRegisters; //Number of registers to write
unsigned char Dummy2;
unsigned int RdBuffer; //Read data buffer
unsigned int RdAddress; //Register address to read
unsigned char RdRegisters; //Number of registers to read
unsigned char Dummy3;
unsigned int CommndWt; //Wait time before start (mSec)
unsigned int TimeOutCk; //Timeout Check (mSec)
unsigned int Dummy4;
unsigned int Timeouts; //Timeout error counter
unsigned int Dummy5;
unsigned int CommErrs; //Communication error counter
unsigned int TxFrames; //Transmit string counter
unsigned int RxFrames; //Received string counter
unsigned int Dummy6;
unsigned char Dummy7;
unsigned char FrameLength; //Rx/Tx frame Length
unsigned char* FrameBuf; //Rx/Tx frame buffer

// --------------------------------------------[Internal use only members]--


...
}FBMODBUSRTUMSDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB. The error bits in Status are reset and the communication is hung up.
TRUE: It enables the FB and the communication starts.
1 ResetCtrs TRUE: Resets all the counters, the bit is automatically reset.
2 FctSelect FALSE: To read the registers from the slave device the MODBUS function Code 03: Read holding
registers is used.
TRUE: To read the registers from the slave device the MODBUS function Code 04: Read input
registers is used.
4 DoWrite TRUE: It starts the data transfer to the slave system job. When the job starts the bit is automatically
reset.
5 DoRead TRUE: It orders the data read from the slave system job. When the job starts the bit is automatically
reset.
6 DoWrRd TRUE: It orders the data transfer to the slave system and the next reading job. When the job starts
the bit is automatically reset.

01 Status
Status bits, the user program can test these bits.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (2 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

0 Enabled TRUE: It shows that the FB is enabled.


1 JobDone It is activated for a program loop at the end of the of the requested job.
4 Timeouts TRUE: It shows a timeout error, the slave system did not answer to the request sent. To reset it
clear the Command.Enable bit.
6 CommErrs TRUE: It shows an error in answer reception from serial line, a wrong character or a number of
characters different from the requested has been received. To reset it clear the Command.Enable
bit.
7 Parameters TRUE: It shows an error in FB data structure parameters set.To reset it clear the Command.
Enable bit.

02 Node
Loaded by user program it defines the address of the slave node, that you need to communicate to (From 0x00 to
0xFF).
04 WrBuffer
Loaded by user program it defines the begin address of the write data buffer to be transferred to the slave system
(From 0x0000 to 0xFFFF).
06 WrAddress
Loaded by user program it defines the begin address of the data area on slave system, where the data read from
the master system are written (From 0x0000 to 0xFFFF).
08 WrRegisters
Loaded by user program it defines the number of registers to be preset on the slave system. The maximum
number of registers to be preset can be calculated with the formula: (FrameLength-9)/2.
0A RdBuffer
Loaded by user program it defines the begin address of the read data buffer where the data readed from the slave
system are stored (From 0x0000 to 0xFFFF).
0C RdAddress
Loaded by user program it defines the begin address of the area on slave system, from where the data to be
transferred to the master system are read (From 0x0000 to 0xFFFF).
0E RdRegisters
Loaded by user program it defines the number of registers to read from the slave system. The maximum number
of registers that can be read can be calculated with the formula: (FrameLength-5)/2.
10 CommndWt
Loaded by user program it defines the waiting time expressed in mSec between the end of the job (we remind that
every job, ends after the command frame transmission and the proper answer frame reception) and the start of the
next job. In case of DoWrRd job, it represents the time between the end of the write control and the execution of
the next read control. (From 0x0000 to 0xFFFF).
12 TimeOutCk
Loaded by user program it defines the available time to execute the job, expressed in mSec (From 0x0000 to
0xFFFF).
16 Timeouts
It returns the count of the timeouts errors occurred both in reception and transmission. It can be preset to 0 by the
user program or reset by activating the Command.ResetCtrs bit.
1A CommErrs
It returns the count of the communication errors occurred both in reception and transmission (From 0x0000 to
0xFFFF). It can be preset to 0 by the user program or reset by activating the Command.ResetCtrs bit.
1C TxFrames
It returns the count of the command strings transmitted (From 0x0000 to 0xFFFF). It can be preset to 0 by the user
program or reset by activating the Command.ResetCtrs bit.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (3 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

1E RxFrames
It returns the count of the number of answer strings received (From 0x0000 to 0xFFFF). It can be preset to 0 by
the user program or reset by activating the Command.ResetCtrs bit.
20 PLCMemStart
Loaded by user program it defines the allocation address of the PLC variables in the slave systemmemory (From
0x0000 to 0xFFFF).The address used in the MODBUS command to write the data to the Slave system will be the
sum between this value and the value of WrRmStAd. The address used in the MODBUS command to read the
data from the Slave system will be the sum between this value and the value of WrRmStAd.
23 FrameLength
Loaded by user program it defines the dimension of the frame reception/transmission buffer (From 12 to 255). To
maintain compatibility with the previous versions a buffer of at least 40 bytes must be defined.
24 FrameBuf
Loaded by user program it defines the allocation address of the frame reception/transmission buffer (From 0x0000
to 0xFFFF).

RIL example

In the following example the Modbus communication with a slave system is executed, the master system executes the
read of two registers and preset two registers on the slave system. To test the working, you just need to connect the
master system to a slave, on which run a program that manages the FbModbusRtuSl function block.

; ------------------------------------------------------------------------------
; @Section("Communication buffer")
; ------------------------------------------------------------------------------
; Here define the data buffer to communicate with the slave system.

DEFL Y WriteBuffer KD 4
DEFL W Reg0000 Y WriteBuffer KH 0000 ;Register 0000
DEFL W Reg0002 Y WriteBuffer KH 0002 ;Register 0002

DEFL Y ReadBuffer KD 4
DEFL W Reg0010 Y ReadBuffer KH 0000 ;Register 0010
DEFL W Reg0012 Y ReadBuffer KH 0002 ;Register 0012

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; MODBUS master communication, data structure.

DEFL Y Mdb KD 64
DEFL Y MdbCommand Y Mdb KH 0000 ;Mdb.Command
DEFL Y MdbStatus Y Mdb KH 0001 ;Mdb.Status
DEFL Y MdbNode Y Mdb KH 0002 ;Mdb.Node
DEFL W MdbWrBuffer Y Mdb KH 0004 ;Mdb.WrBuffer
DEFL W MdbWrAddress Y Mdb KH 0006 ;Mdb.WrAddress
DEFL Y MdbWrRegisters Y Mdb KH 0008 ;Mdb.WrRegisters
DEFL W MdbRdBuffer Y Mdb KH 000A ;Mdb.RdBuffer
DEFL W MdbRdAddress Y Mdb KH 000C ;Mdb.RdAddress
DEFL Y MdbRdRegisters Y Mdb KH 000E ;Mdb.RdRegisters
DEFL W MdbCommndWt Y Mdb KH 0010 ;Mdb.CommndWt
DEFL W MdbTimeOutCk Y Mdb KH 0012 ;Mdb.TimeOutCk
DEFL W MdbTimeouts Y Mdb KH 0016 ;Mdb.Timeouts
DEFL W MdbCommErrs Y Mdb KH 001A ;Mdb.CommErrs
DEFL W MdbTxFrames Y Mdb KH 001C ;Mdb.TxFrames

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (4 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

DEFL W MdbRxFrames Y Mdb KH 001E ;Mdb.RxFrames


DEFL Y MdbFrameLength Y Mdb KH 0023 ;Mdb.FrameLength
DEFL W MdbFrameBuf Y Mdb KH 0024 ;Mdb.FrameBuf

; Rx/Tx frame buffer definition.

DEFG Y FrameBuffer KD 40 ;Frame buffer

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------
; MODBUS master communication, variables settings.

ORGR
LODT F PLCFirstLoop
MOVI Y MdbNode KD 0 ;Mdb.Node
MOVA W MdbWrBuffer Y WriteBuffer ;Mdb.WrBuffer
MOVI W MdbWrAddress KH 0000 ;Mdb.WrAddress
MOVI Y MdbWrRegisters KD 2 ;Mdb.WrRegisters
MOVA W MdbRdBuffer Y ReadBuffer ;Mdb.RdBuffer
MOVI W MdbRdAddress KH 0010 ;Mdb.RdAddress
MOVI Y MdbRdRegisters KD 2 ;Mdb.RdRegisters
MOVI W MdbCommndWt KD 100 ;Mdb.CommndWt
MOVI W MdbTimeOutCk KD 500 ;Mdb.TimeOutCk
MOVI Y MdbFrameLength KD 40 ;Mdb.FrameLength
MOVA W MdbFrameBuf Y FrameBuffer ;Mdb.FrameBuf
LTCH Y MdbCommand BD 1 ;Mdb.Command.ResetCtrs
UTCH Y MdbCommand BD 2 ;Mdb.Command.FctSelect

; ------------------------------------------------------------------------------
; @Section("MODBUS communication, master management")
; ------------------------------------------------------------------------------
; MODBUS master communication management.

ORGR
SETR
SETV KE IOSerialPortB
TASK L FbModbusRtuMs Y Mdb ;MODBUS master management
LTCH Y MdbCommand BD 0 ;Mdb.Command.Enable
LTCH Y MdbCommand BD 6 ;Mdb.Command.DoWrRd

; [End of file]

"C" example

In the following example the Modbus communication with a slave system is executed, the master system executes the
read of two registers and preset two registers on the slave system. To test the working, you just need to connect the
master system to a slave, on which run a program that manages the FbModbusRtuSl function block.

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (5 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModbusRtuMs.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define MDBFRAMELENGTH 40 //Modbus frame length

// -----------------------------------------------------------------------------
// DATA BUFFER DEFINITIONS
// -----------------------------------------------------------------------------
// Here define the data buffer to communicate with the slave system.

struct
{
unsigned int Reg0000; //Register 0000
unsigned int Reg0002; //Register 0002
}WriteBuffer; //Write buffer

struct
{
unsigned int Reg0010; //Register 0010
unsigned int Reg0012; //Register 0012
}ReadBuffer; //Read buffer

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBMODBUSRTUMSDATA Mdb; //MODBUS master data structure


static unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the system init at first program execution loop.

if (PLCFirstLoop)
{
// Set variables to manage the MODBUS master communication.

Mdb.Node=0; //Node address


Mdb.WrBuffer=(unsigned int)&WriteBuffer; //Write data buffer
Mdb.WrAddress=0x0000; //Register address to write
Mdb.WrRegisters=sizeof(WriteBuffer)/2; //Number of registers to write
Mdb.RdBuffer=(unsigned int)&ReadBuffer; //Read data buffer
Mdb.RdAddress=0x0010; //Register address to read
Mdb.RdRegisters=sizeof(ReadBuffer)/2; //Number of registers to read
Mdb.CommndWt=100; //Wait time before start (mSec)

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (6 of 7) [06/10/2008 17.43.00]


Function blocks: FbModbusRtuMs

Mdb.TimeOutCk=500; //Timeout Check (mSec)


Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=&FrameBuf; //Rx/Tx frame buffer
Mdb.Command.ResetCtrs=TRUE; //Resets all the counters
Mdb.Command.FctSelect=FALSE; //Function select
}

// -------------------------------------------------------------------------
// MODBUS MASTER COMMUNICATION
// -------------------------------------------------------------------------
// MODBUS master communication call.

SetTermIOVectors(IOSerialPortB);
FbModbusRtuMs(&Mdb); //MODBUS master management
Mdb.Command.Enable=TRUE; //Enable
Mdb.Command.DoWrRd=TRUE; //Write/read memory bytes
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbModbusRtuMs.htm (7 of 7) [06/10/2008 17.43.00]


Function blocks: FbModemMng

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbModemMng

This function block allows the management of a MODEM for switched telephone network or GSM. The FB manages all the
MODEM set operations, executes calls, sends SMS messages, answers to the incoming calls, receives SMS messages. To
check if the MODEM works correctly, we suggest to execute the tests regarding the PSTN or GSM MODEMs. A complete
demo which use this FB is available in the demo programs.

Code:PFB053 History report


Prototype
FbModemMng.h

Declaration
void FbModemMng(FBMODEMMNGDATA* S);

Parameters
FBMODEMMNGDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members reported under the Internal use
only members label, are members used inside by the function block and they don't have to be changed by the user
program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Active enables the function block
BOOL Dial:1; //Active force the number dial
BOOL SMSSend:1; //Active force the SMS send
BOOL HangUp:1; //Active force the hang up
BOOL b04:1;
BOOL b05:1;
BOOL AnswerDisable:1; //Active disable the call answer
BOOL ResetError:1; //Active force error field reset
}Command;

unsigned char Dummy;

struct
{
BOOL ModemOk:1; //Active if the MODEM is working
BOOL CLIPRxd:1; //Pulse active at every CLIP received
BOOL b0A:1;
BOOL Connect:1; //Active if the MODEM is connect
BOOL b0C:1;
BOOL b0D:1;
BOOL PowerOn:1; //Active if is powering on the MODEM
BOOL SwitchModemOn:1; //Used to switch MODEM On/Off

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (1 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

BOOL Enabled:1; //Active if the function block is enabled


BOOL Init:1; //Active if is initializing the MODEM
BOOL Check:1; //Active if is checking the MODEM
BOOL Dial:1; //Active if the MODEM is dialing the number
BOOL SMSSend:1; //Active if the MODEM is sending an SMS
BOOL SMSReceived:1; //Pulse active if an SMS is received
BOOL Ring:1; //Pulse active at every detected ring
BOOL RingFlag:1; //1 Sec active at every detected ring
}Status;

struct
{
BOOL CLIPReceive:1; //Active if error in CLIP receive
BOOL b09:1;
BOOL b0A:1;
BOOL b0B:1;
BOOL b0C:1;
BOOL b0D:1;
BOOL b0E:1;
BOOL b0F:1;

BOOL Init:1; //Active if error in MODEM init


BOOL Check:1; //Active if error in MODEM check
BOOL SwitchToCommand:1; //Active if error in MODEM switch to command
BOOL HangUp:1; //Active if error in MODEM hang up
BOOL CallAnswer:1; //Active if error in call answer
BOOL Dial:1; //Active if error in dialing the number
BOOL SMSReceive:1; //Active if error in SMS receive
BOOL SMSSend:1; //Active if error in SMS send
}Error;

unsigned char RingCtr; //Incoming ring counter


unsigned char Dummy1;
code FBMODEMMNGCONFIG* ModemCfg; //MODEM configuration structure

// --------------------------------------------[Internal use only members]--


...
}FBMODEMMNGDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: It disables the FB, resets the Command, Status and Error and the MODEM is switched off.
TRUE: It enables the FB.
1 Dial TRUE: It commands the dialing of the number pointed by DialNumber.
When the command is activated the Status.Dial is set, and it remain active for the time required to
dial the number, to wait remote system answers and synchronization. When the connection is done,
both Command.Dial and Status.Dial are automatically reset.
If the command doesn't end within the time defined in ModemCfg->DialCommandTimeout, after the
delay time defined in ModemCfg->InterDialTime multiplied for a number from 1 to 4, another try is
made, and so on, until you reach the number of tries defined in ModemCfg->DialRetries. If the
operation cannot end positevely, both Command.Dial and Status.Dial are automatically reset and
Error.Dial is activated.

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (2 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

2 SMSSend TRUE: It commands sending of the message in the buffer pointed by SMSSend to the number in the
buffer pointed by DialNumber.
When the command is activated the Status.SMSSend is set, and it remain active for the time required
to send the message. When the message is send, both Command.SMSSend and Status.SMSSend
are automatically reset.
If the command doesn't end within the time defined in ModemCfg->SMSSendTimeout, after the
delay time defined in ModemCfg->InterSMSSendTime multiplied for a number from 1 to 4, another
try is made, and so on, until you reach the number of tries defined in ModemCfg->SMSSendRetries.
If the operation cannot end positively, both Command.SMSSend and Status.SMSSend are
automatically reset and Error.SMSSend is activated.
3 HangUp TRUE: It commands the MODEM hung-up and the Status.Connect is reset.
When the command is activated, the MODEM hangs-up, when the commands finishes the Command.
HangUp is automatically reset .
If the command doesn't end within the time defined in ModemCfg->HangUpTimeout, the Command.
HangUp are automatically reset and Error.HangUp is activated.
6 AnswerDisable TRUE: Disables and reset the count of the received ring. However the Status.Ring and Status.
RingFlag bits are managed and is returned the CLIP of the caller. Disabling the bit, after the number
of defined ring, the call its answered.
7 ResetError TRUE: It reset all the Error.
The command is automatically reset.

02 Status
Status bits, the user program can test these bits. they are reset, to forcing Command.Enable to FALSE.
0 Enabled TRUE: It shows that the FB is enabled.
1 Init TRUE: It shows that the initialization sequence is running. It's automatically set enabling the FB or if
an error occurs during the command management. It's reset at the end of the sequence.
2 Check TRUE: It shows that the MODEM cheek sequence is running. The sequence is automatically
activated during the execution of some commands or after the time defined in ModemCfg-
>CheckTime, it's reset at the end of the sequence.
3 Dial TRUE: It shows that the number dial sequence is running. It's activates on the Command.Dial
command, it's reset at the end of the sequence.
4 SMSSend TRUE: It shows that the SMS message send sequence is running. It's activates on the Command.
SMSSend command, it's reset at the end of the sequence.
5 SMSReceived It is activated for a program loop at the reception of a SMS message, The text of the received
message is in the buffer pointed by SMSRxBuf.
6 Ring It is activated for a program loop at every ring of an incoming call.
7 RingFlag It is activated for 1 second at every ring of an incoming call.
8 ModemOk TRUE: It shows that the MODEM has been correctly initialized and it's operative.
9 CLIPRxd It is activated for a program loop at the reception of a CLIP number. The received number is in the
buffer pointed by CLIPRxNumber.
B Connect TRUE: It shows that the MODEM is connected to a remote system.
It is activated after the execution of a Command.Dial or at the reception of a call after the number
of rings defined in ModemCfg->RingNr, only if the synchronization sequence between the two
MODEMs is correctly terminated.
When this bit is active, the FB doesn't use the serial line, that will be available for a dialog with the
remote system. No commands will be accepted except the Command.HangUp.
E PowerOn TRUE: It shows that the MODEM power on sequence is running. It's automatically set enabling the
FB or if an error occurs during the command management. It's reset at the end of the sequence.
F SwitchModemOn TRUE: It commands the MODEM switch on.
It must be copied by the user program to a logic output, it allows to manage the MODEM switch on
and off guaranteeing the possibility to completely reset the MODEM in case of errors.

04 Error
Error bits, the user program can test these bits. they are reset, to setting Command.ResetError or to forcing Command.
Enable to FALSE.

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (3 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

0 Init TRUE: It shows an error in the initialization sequence.


1 Check TRUE: It shows an error in the MODEM check sequence.
2 SwitchToCommand TRUE: It shows an error in the switch from data mode to command mode sequence.
3 HangUp TRUE: It shows an error in the hang-up sequence.
4 CallAnswer TRUE: It shows an error in the answer to an incoming call sequence.
5 Dial TRUE: It shows an error in the dialing number sequence.
6 SMSReceive TRUE: It shows an error in the SMS reception sequence.
7 SMSSend TRUE: It shows an error in the SMS sending sequence.
8 CLIPReceive TRUE: It shows an error in the CLIP reception sequence

06 RingCtr
It returns the number of rings, the MODEM has received (Range from 0 to 255).
08 ModemCfg
Loaded by the user program, it defines the address on CODE memory, where the of MODEM configuration data
structure is defined.

MODEM configuration structure

For the MODEM configuration parameters a data structure is reported. The user program has to load in the data structure all
the initialization strings and the times needed by the MODEM used. We suggest to refer to the MODEM manual. The
initialization strings can contain many commands, commands are subdivided with the '\r' code, to every command the reply
string is waited. All the ' ' characters before the command are ignored.

typedef struct
{
// --------------------------------------------------------------[General]--

unsigned int OffTime; //Modem off time [mSec]


unsigned int PowerOnTime; //Modem power on time [mSec]
unsigned int CmdWaitTime; //Command wait time [mSec]

// --------------------------------------------------------[Init sequence]--

generic char* InitCommand; //Init command string


generic char* InitAnswer; //Init answer string
unsigned int InitTimeout; //Init sequence timeout [mSec]

// -------------------------------------------------------[Check sequence]--

generic char* CheckCommand; //Check command string


generic char* CheckAnswer; //Check answer string
unsigned int CheckTime; //Check execution time [Sec]
unsigned int CheckTimeout; //Check sequence timeout [mSec]

// --------------------------------------------------[Command mode switch]--

generic char* SwitchToCommandModeCommand; //Command mode command switch string


generic char* SwitchToCommandModeAnswer; //Command mode answer switch string
unsigned int SwitchToCommandModePause; //Command mode command pause time [mSec]
unsigned int SwitchToCommandModeTimeout; //Command mode sequence timeout [mSec]

// --------------------------------------------------------------[Hang up]--

generic char* HangUpCommand; //Hang up command string


generic char* HangUpAnswer; //Hang up answer string
unsigned int HangUpTimeout; //Hang up sequence timeout [mSec]

// -----------------------------------------------[Incoming call sequence]--

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (4 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

generic char* IncomingCallHeader; //Incoming call header string


generic char* IncomingCallAccept; //Incoming call accept string
generic char* IncomingCallConnect; //Incoming call connected string
unsigned char RingNr; //Rings number before to accept call
unsigned int IncomingCallTimeout; //Incoming call sequence timeout [mSec]

// ---------------------------------------------------------[Dial command]--

generic char* DialCommand; //Dial command header string


generic char* DialAnswer; //Dial command answer string
generic char* DialNumber; //Number to be dialed
unsigned char DialTries; //Dial tries
unsigned int DialCommandTimeout; //Dial command sequence timeout [mSec]
unsigned int InterDialTime; //Waiting time between dials [Sec]

// -----------------------------------------------[SMS receive management]--

generic char* SMSHeader; //Incoming SMS header string


generic char* SMSReadCommand; //Read SMS message from SIM card command
generic char* SMSReadAnswer; //Read SMS message from SIM card answer
generic char* SMSReadEnd; //SMS message from SIM card end
generic char* SMSRxBuf; //SMS received message buffer
unsigned char SMSRxLgt; //SMS message received length

// --------------------------------------------------[SMS send management]--

generic char* SMSSendCommand; //SMS send command string


generic char* SMSSendTerminator; //SMS send terminator string
generic char* SMSPrompt; //SMS prompt string
generic char* SMSSendAnswer; //SMS send answer string
generic char* SMSTxBuf; //SMS message to send
generic char* SMSNumber; //Number to send the message
unsigned char SMSSendTries; //SMS send tries
unsigned int SMSPromptWaitTime; //SMS prompt waiting time [mSec]
unsigned int SMSSendTimeout; //SMS send sequence timeout [mSec]
unsigned int InterSMSSendTime; //Waiting time between SMS send [Sec]

// -------------------------------------------------------[CLIP reception]--

generic char* CLIPHeader; //CLIP header string


generic char* CLIPRxNumber; //CLIP received number
unsigned char CLIPRxLgt; //CLIP received number length
}FBMODEMMNGCONFIG;

00 OffTime
It defines the time in which the MODEM remains switched off after an error, Status.SwitchModemOn=FALSE. The
value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 5000 mSec.
02 PowerOnTime
It defines the pause time between the MODEM switching on, Status.SwitchModemOn=TRUE and the send of the
initialization string InitCommand. The value is expressed in mSec (Range from 0 to 65535). At the the MODEM
switching on, it's necessary a relatively long time for the SIM card reading, so we suggest to set this value to 60000
mSec.
04 CmdWaitTime
It defines the pause time between the reception of an answer from the MODEM and the sending of a new command.
The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 500 mSec.
06 InitCommand

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (5 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

It defines the string to send to the MODEM to init it, it is sent after the MODEM is switched on Status.
SwitchModemOn=TRUE and the time defined in PowerOnTime.
Typically for the PSTN MODEM the initialization string is "ATV1\r AT&B1\r AT&K0\r ATH0X4E1L1\r".
Typically for the GSM MODEM the initialization string is "AT&F\r ATV1H0X3E1L1\r ATS0=0\r AT&D0\r AT+CLIP=1\r
AT+CMGF=1\r AT+CSMS=1\r AT+CNMI=3,3,0,0,1\r AT+CMGD=1\r".

ATTENTION! The MODEM must be always set in verbal answer mode, we suggest to insert in the initialization string the
command "ATV1" to set it.
09 InitAnswer
It defines the string the MODEM sends at the reception of the initialization string InitCommand. Typically this string is
"OK".
0C InitTimeout
It defines the initialization MODEM timeout time, when the time ends, the Error.Init is set and the initialization sequence
restarts. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 2000 mSec.
0E CheckCommand
It defines the string to send to the MODEM to check it, it is sent cyclically according to the defined delay time
CheckTime. Typically this string is "AT\r".
11 CheckAnswer
It defines the string the MODEM sends at the reception of the control string CheckCommand. Typically this string is
"OK".
14 CheckTime
It defines the pause time between the sending of the check strings to the MODEM CheckCommand. The check
assures that the MODEM is always active, if an error in check is detect, the MODEM is initialized again. The value is
expressed in Sec (Range from 0 to 65535). Typically this value is set to 120 Sec.
16 CheckTimeout
It defines the check MODEM timeout time, when the time ends, the Error.Check is set and the MODEM is initialized
again. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 2000 mSec.
18 SwitchToCommandModeCommand
It defines the string to send to the MODEM to switch it from data mode to control mode. Typically this string is "+++".
1B SwitchToCommandModeAnswer
It defines the string the MODEM sends at the reception of the switch to command mode command
SwitchToCommandModeCommand. Typically this string is "OK".
1E SwitchToCommandModePause
It defines the waiting time before sending the switch to command mode string to the MODEM. The value is expressed in
mSec (Range from 0 to 65535). Typically this value is set to 2000 mSec.
20 SwitchToCommandModeTimeout
It defines the switch to command mode timeout time, when the time ends, the Error.SwitchToCommand is set and the
MODEM is initialized again. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 5000
mSec.
22 HangUpCommand
It defines the string to send to the MODEM to hang-up the line. Typically this string is "ATH0\r".
25 HangUpAnswer
It defines the string the MODEM answers at the reception of the hang-up command HangUpCommand. Typically this
string is "OK".
28 HangUpTimeout
It defines the hang-up command timeout time, when the time ends, the Error.HangUp is set and the MODEM is
initialized again. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 2000 mSec.
2A IncomingCallHeader
It defines the string the MODEM sends when a phone call is received. Typically this string is "RING".

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (6 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

2D IncomingCallAccept
It defines the string to send to the MODEM to accept the incoming call. Typically this string is "ATA\r".
30 IncomingCallConnect
It defines the string the MODEM sends when the connection with the remote MODEM is established after an incoming
call. Typically this string is "CONNECT".
33 RingNr
it defines the number of expected rings before answering to an incoming call (Range from 0 to 255). If the value is set to
0, no answer to the incoming calls is executed.
34 IncomingCallTimeout
It defines the answer to an incoming call command timeout time, when the time ends, the Error.CallAnswer is set and
the MODEM is initialized again. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to
30000 mSec.
36 DialCommand
It defines the string to send to the MODEM to make a call. Typically this string is "ATDT".
39 DialAnswer
It defines the string the MODEM sends when the connection with the remote MODEM is established after a dial.
Typically this string is "CONNECT".
3C DialNumber
It defines the phone number string to call, on the Command.Dial command.
3F DialTries
It defines the number of tries if the connection with a remote system is not established before abort the call. (Range from
0 to 255). If the value is set to 0, the dial is repeated forever.
40 DialCommandTimeout
It defines the dial command timeout time, when the time ends, the time defined in InterDialTime is waited and then a
new call is made. After the defined number of tries defined in DialRetries, the Error.Dial is set and the MODEM is
initialized again. The value is expressed in mSec (Range from 0 to 65535). Typically this value is set to 60000 mSec.
42 InterDialTime
It defines the waiting time between a call in error and another try. The waiting time is from 1 to 4 times the value set. The
value is expressed in Sec (Range from 0 to 65535). Typically this value is set to 120 Sec.
44 SMSHeader
It defines the string the MODEM sends when a SMS message is received. Typically this string is "+CMTI: ".
47 SMSReadCommand
It defines the string to send to the MODEM to read the received SMS message. Typically this string is "AT+CMGR=1\r".
4A SMSReadAnswer
It defines the string the MODEM sends at the reception of the message read command SMSReadCommand. If the time
between the read string SMSReadCommand send and the reception of the read end string SMSReadEnd is more than
2 sec, the message reception sequence is aborted, the Error.SMSReceive is is set and the MODEM is initialized again.
Typically this string is "+CMGR:".
4D SMSReadEnd
It defines the string the MODEM sends at the end of the SMS read command. Typically this string is "OK".
50 SMSRxBuf
It defines the memory buffer address where the received SMS has to be transferred (Range from 0x0000 to 0xFFFF).
It's necessary to define a buffer of length suitable to contain the whole message (maximum 160 bytes). If not defined the
SMS reception isn't executed.
53 SMSRxLgt
It defines the memory buffer dimension where the received SMS has to be transferred (From 0 to 255). If the received
SMS message has length greather than the buffer dimension, the mesage is cropped and the bit Error.SMSReceive is
activated.

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (7 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

54 SMSSendCommand
It defines the string to send to the MODEM to send a SMS message. Typically this string is "AT+CMGS=".
57 SMSSendTerminator
It defines the string to send to the MODEM to end a SMS message. Typically this string is"\r\x1A".
5A SMSPrompt
It defines the string the MODEM sends to request the SMS text. Typically this string is ">".
5D SMSSendAnswer
It defines the string the MODEM sends at the end of the SMS sending. Typically this string is "+CMGS:".
60 SMSTxBuf
It defines the memory buffer address where the SMS to be transmit has to be transferred (Range from 0x0000 to
0xFFFF).
63 SMSNumber
It defines the phone number string to send the SMS, on the Command.SMSSend command.
66 SMSSendTries
It defines the number of tries if the SMS is non sent before abort the send. (Range from 0 to 255). If the value is set to 0,
the send is repeated forever.
67 SMSPromptWaitTime
It defines the prompt string SMSPrompt waiting timeout timet. Some models of MODEM don't send any prompt, so after
the defined time the message text is sent anyway. The value is expressed in mSec (Range from 0 to 65535). Typically
this value is set to 1000 mSec.
69 SMSSendTimeout
It defines the SMS send command timeout time, when the time ends, the time defined in InterSMSSendTime is waited
and then a new SMS send command is made. After the defined number of tries defined in SMSSendRetries, the Error.
SMSSend is set and the MODEM is initialized again. The value is expressed in mSec (Range from 0 to 65535).
Typically this value is set to 30000 mSec.
6B InterSMSSendTime
It defines the waiting time between a SMS send in error and another try. The waiting time is from 1 to 4 times the value
set. The value is expressed in Sec (Range from 0 to 65535). Typically this value is set to 120 Sec.
6D CLIPHeader
It defines the string the MODEM sends as a CLIP identifier. Typically this string is "+CLIP:".
70 CLIPNumber
It defines the memory buffer address where the received CLIP or the SMS sender numbr has to be transferred (Range
from 0x0000 to 0xFFFF). If not defined the CLIP management and the SMS reception aren't executed.
73 CLIPRxLgt
It defines the memory buffer dimension where the received CLIP has to be transferred (From 0 to 255). If the received
number has length greather than the buffer dimension, the number is cropped and the bit Error.CLIPReceive is
activated.

Examples

It's reported an example realized both in RIL and C language, it manages a TC35I Siemens GSM MODEM, the example
works on a PICOLOG Millennium system static version, with 16 inputs and 16 outputs. Connect the MODEM to the serial
port A with a Modem cable (Our code CBL055*000), to test the MODEM connect the logic I/O according the following table:

Logic inputs Logic outputs


I 0000 FB enable command O 0000 FB enabled status
I 0001 Dial command O 0001 MODEM init status
I 0002 SMS send command O 0002 MODEM check status
I 0003 Hang up command O 0003 MODEM dial status

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (8 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

I 0004 O 0004 MODEM SMS send status


I 0005 O 0005 MODEM SMS received
I 0006 O 0006 Ring status
I 0007 Reset errors command O 0007
I 0008 O 0008 MODEM ok
I 0009 O 0009 CLIPRxd
I 000A O 000A
I 000B O 000B MODEM connect
I 000C O 000C
I 000D O 000D
I 000E O 000E
I 000F O 000F Switch MODEM on

RIL example

The FB can be used in a RIL program however it's necessary a C file with the MODEM configuration parameters, following
we report the TC35I Siemens configuation parameters.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModemMng.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

static char SMSRxBuf[160]; //SMS received message buffer


static char CLIPNumber[16]; //CLIP number received buffer

// -----------------------------------------------------------------------------
// MODEM CONFIGURATION STRUCTURE
// -----------------------------------------------------------------------------
// In this structure are reported all the commands and answer strings used to
// set up the MODEM. In order to correctly configure your MODEM please refer to
// the MODEM manual.
// -----------------------------------------------------------------------------

code FBMODEMMNGCONFIG MdmCfg=


{
// --------------------------------------------------------------[General]--

5000, //OffTime
60000, //PowerOnTime
500, //CmdWaitTime

// --------------------------------------------------------[Init sequence]--

"AT&F\r ATV1H0X3E1L1\r ATS0=0\r AT&D0\r AT+CLIP=1\r AT+CMGF=1\r AT+CSMS=1\r \


AT+CNMI=3,3,0,0,1\r AT+CMGD=1\r", //Init command
"OK", //InitAnswer
2000, //InitTimeout

// -------------------------------------------------------[Check sequence]--

"AT\r", //CheckCommand
"OK", //CheckAnswer

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (9 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

120, //CheckTime
2000, //CheckTimeout

// --------------------------------------------------[Command mode switch]--

"+++", //SwitchToCommandModeCommand
"OK", //SwitchToCommandModeAnswer
2000, //SwitchToCommandModePause
5000, //SwitchToCommandModeTimeout

// --------------------------------------------------------------[Hang up]--

"ATH0\r", //HangUpCommand
"OK", //HangUpAnswer
2000, //HangUpTimeout

// -----------------------------------------------[Incoming call sequence]--

"RING", //IncomingCallHeader
"ATA\r", //IncomingCallAccept
"CONNECT", //IncomingCallConnect
3, //RingNr
30000, //IncomingCallTimeout

// ---------------------------------------------------------[Dial command]--

"ATDT", //DialCommand
"CONNECT", //DialAnswer
"+390142451987", //DialNumber
3, //DialTries
60000, //DialCommandTimeout
120, //InterDialTime

// -----------------------------------------------[SMS receive management]--

"+CMTI:", //SMSHeader
"AT+CMGR=1\r", //SMSReadCommand
"+CMGR:", //SMSReadAnswer
"OK", //SMSReadEnd
&SMSRxBuf, //SMSRxBuf
sizeof(SMSRxBuf), //SMSRxLgt

// --------------------------------------------------[SMS send management]--

"AT+CMGS=", //SMSSendCommand
"\r\x1A", //SMSSendTerminator
">", //SMSPrompt
"+CMGS:", //SMSSendAnswer
"This is a message", //SMSTxBuf
"+390142451987", //SMSNumber
3, //SMSSendTries
1000, //SMSPromptWaitTime
30000, //SMSSendTimeout
120, //InterSMSSendTime

// -------------------------------------------------------[CLIP reception]--

"+CLIP:", //CLIP header string


&CLIPNumber, //CLIP received number
sizeof(CLIPNumber), //CLIP received number length
};

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (10 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

// [End of file]

Following the RIL program.

; ------------------------------------------------------------------------------
; @Section("External definitions")
; ------------------------------------------------------------------------------

EXTR L MdmCfg ;MODEM configuration

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Set serial parameters function block data structure.

DEFL Y SetS KD 16
DEFL Y SetSMode Y SetS KH 0000 ;SetS.Mode
DEFL Y SetSBaud Y SetS KH 0001 ;SetS.Baud
DEFL Y SetSDTRMng Y SetS KH 0002 ;SetS.DTRMng
DEFL W SetSDTROnTime Y SetS KH 0004 ;SetS.DTROnTime
DEFL W SetSDTROffTime Y SetS KH 0006 ;SetS.DTROffTime

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Modem management function block data structure.

DEFG Y Mdm KD 64
DEFG Y MdmCommand Y Mdm KH 0000 ;Mdm.Command
DEFG W MdmStatus Y Mdm KH 0002 ;Mdm.Status
DEFG W MdmError Y Mdm KH 0004 ;Mdm.Error
DEFG Y MdmRingCtr Y Mdm KH 0006 ;Mdm.RingCtr
DEFG W MdmModemCfg Y Mdm KH 0008 ;Mdm.ModemCfg

; ------------------------------------------------------------------------------
; @Section("Serial port definition")
; ------------------------------------------------------------------------------
; Here the serial port is set.

ORGR
SETR
SETV KE IOSerialPortA

; ------------------------------------------------------------------------------
; @Section("Set the serial parameters")
; ------------------------------------------------------------------------------
; Here the serial parameters "9600, n, 8" are set on the serial port "A".

ORGR
LODT F PLCFirstLoop
UTCH Y SetSMode BH 0000 ;SetS.Mode.DTRComplement
UTCH Y SetSMode BH 0001 ;SetS.Mode.EchoFlush
LTCH Y SetSMode BH 0002 ;SetS.Mode.RxCtrlDisable
UTCH Y SetSMode BH 0003 ;SetS.Mode.ParityEnabled
UTCH Y SetSMode BH 0004 ;SetS.Mode.ParityType
LTCH Y SetSMode BH 0005 ;SetS.Mode.BitNumber
UTCH Y SetSMode BH 0006 ;SetS.Mode.WaitLoop
MOVI Y SetSBaud KD 5 ;SetS.Baud
MOVI Y SetSDTRMng KD 0 ;SetS.DTRMng
MOVI W SetSDTROnTime KD 0 ;SetS.DTROnTime

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (11 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

MOVI W SetSDTROffTime KD 0 ;SetS.DTROffTime


TASK L FbSetSerialPar Y SetS ;Set serial parameters
TASK L TermIOOpen ;Open the serial port

; Here assign the Modem configuration data structure address.

MOVA W MdmModemCfg L MdmCfg ;Mdm.ModemCfg

; ------------------------------------------------------------------------------
; @Section("Modem management")
; ------------------------------------------------------------------------------
; The logic inputs are copied to the modem management function block commands.

ORGR
SETR
IOAQ K 0000
STRA Y MdmCommand ;Mdm.Command

; The modem management function block is called.

ORGR
SETR
TASK L FbModemMng Y Mdm ;Modem managent function block

; The modem management function block status is copied to the logic outputs.

ORGR
SETR
LODA W MdmStatus ;Mdm.Status
IOAQ K 0100
LODA W MdmStatus ;Mdm.Status
RORA K 0008
IOAQ K 0101

; [End of file]

"C" example

Following the C program.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <string.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModemMng.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

static char SMSRxBuf[160]; //SMS received message buffer


static char CLIPNumber[16]; //CLIP number received buffer

// Define here the phone numbers you would like to be checked.

code char* code PhoneTable[]=


{

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (12 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

"+390142451988",
"+390142451987",
};

// -----------------------------------------------------------------------------
// MODEM CONFIGURATION STRUCTURE
// -----------------------------------------------------------------------------
// In this structure are reported all the commands and answer strings used to
// set up the MODEM. In order to correctly configure your MODEM please refer to
// the MODEM manual.
// -----------------------------------------------------------------------------

static code FBMODEMMNGCONFIG MdmCfg=


{
// --------------------------------------------------------------[General]--

5000, //OffTime
60000, //PowerOnTime
500, //CmdWaitTime

// --------------------------------------------------------[Init sequence]--

"AT&F\r ATV1H0X3E1L1\r ATS0=0\r AT&D0\r AT+CLIP=1\r AT+CMGF=1\r AT+CSMS=1\r \


AT+CNMI=3,3,0,0,1\r AT+CMGD=1\r", //Init command
"OK", //InitAnswer
2000, //InitTimeout

// -------------------------------------------------------[Check sequence]--

"AT\r", //CheckCommand
"OK", //CheckAnswer
120, //CheckTime
2000, //CheckTimeout

// --------------------------------------------------[Command mode switch]--

"+++", //SwitchToCommandModeCommand
"OK", //SwitchToCommandModeAnswer
2000, //SwitchToCommandModePause
5000, //SwitchToCommandModeTimeout

// --------------------------------------------------------------[Hang up]--

"ATH0\r", //HangUpCommand
"OK", //HangUpAnswer
2000, //HangUpTimeout

// -----------------------------------------------[Incoming call sequence]--

"RING", //IncomingCallHeader
"ATA\r", //IncomingCallAccept
"CONNECT", //IncomingCallConnect
3, //RingNr
30000, //IncomingCallTimeout

// ---------------------------------------------------------[Dial command]--

"ATDT", //DialCommand
"CONNECT", //DialAnswer
"+390142451987", //DialNumber
3, //DialTries
60000, //DialCommandTimeout

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (13 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

120, //InterDialTime

// -----------------------------------------------[SMS receive management]--

"+CMTI:", //SMSHeader
"AT+CMGR=1\r", //SMSReadCommand
"+CMGR:", //SMSReadAnswer
"OK", //SMSReadEnd
&SMSRxBuf, //SMSRxBuf
sizeof(SMSRxBuf), //SMSRxLgt

// --------------------------------------------------[SMS send management]--

"AT+CMGS=", //SMSSendCommand
"\r\x1A", //SMSSendTerminator
">", //SMSPrompt
"+CMGS:", //SMSSendAnswer
"This is a message", //SMSTxBuf
"+390142451987", //SMSNumber
3, //SMSSendTries
1000, //SMSPromptWaitTime
30000, //SMSSendTimeout
120, //InterSMSSendTime

// -------------------------------------------------------[CLIP reception]--

"+CLIP:", //CLIP header string


&CLIPNumber, //CLIP received number
sizeof(CLIPNumber), //CLIP received number length
};

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

unsigned char i; //Auxiliary counter


static BOOL NumberFound; //The Clip number matches one of the phone numbers defined
static BOOL CommandBit; //SMS received command
static SERIALSTRUCT SerialStruct; //Serial port data structure
static FBMODEMMNGDATA Mdm; //MODEM management data structure

// -------------------------------------------------------------------------
// SERIAL LINE DEFINITION
// -------------------------------------------------------------------------
// Here define the serial line used to manage the MODEM.

SetTermIOVectors(IOSerialPortB);

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the system init.

if (PLCFirstLoop)
{
// Set the serial communication parameters: "9600, n, 8".

GetSerialMode(&SerialStruct); //get communication mode

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (14 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

SerialStruct.Mode.DTRComplement=FALSE; //Complement the DTR signal


SerialStruct.Mode.EchoFlush=FALSE; //Flush the echo
SerialStruct.Mode.RxCtrlDisable=TRUE; //Disable Rx control characters
SerialStruct.Mode.DTRManagement=1; //Define the DTR management
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.ParityEnabled=FALSE; //Enables the parity management
SerialStruct.Mode.ParityType=FALSE; //FALSE:Odd parity, TRUE:Even parity
SerialStruct.Mode.BitNumber=TRUE; //FALSE:7 bit, TRUE:8 bit
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.Baud=5; //Baud rate
SerialStruct.DTROnTime=0; //Tempo attesa DTR On
SerialStruct.DTROffTime=0; //Tempo attesa DTR Off
SetSerialMode(&SerialStruct); //set communication mode
TermIOOpen(); //Open the serial port

// Set variables to manage the MODEM management.

Mdm.ModemCfg=&MdmCfg; //MODEM configuration structure


}

// -------------------------------------------------------------------------
// LOGIC I/O MANAGEMENT
// -------------------------------------------------------------------------
// Here acquire the 8 logic input from I 0000 to I 0007.

PeripheralInp(0, 0, (unsigned char*)&Mdm.Command);

// Here copy the Mdm.Status to the 16 logic output from O 0000 to O 000F.

PeripheralOut(0, 1, *(unsigned char*)&Mdm.Status);


PeripheralOut(0, 0, *((unsigned char*)&Mdm.Status+1));

// -------------------------------------------------------------------------
// MODEM MANAGEMENT
// -------------------------------------------------------------------------
// Execute the modem management function block.

FbModemMng(&Mdm); //MODEM management

// -------------------------------------------------------------------------
// RESULTS MANAGEMENT
// -------------------------------------------------------------------------
// Compare the CLIP with the defined numbers and if it matches a bit is set.

if (Mdm.Status.CLIPRxd)
{
NumberFound=FALSE; //The Clip number matches one of the phone numbers defined

for (i=0; i<sizeof(PhoneTable); i++)


if (!strcmp(&CLIPNumber, PhoneTable[i]))
NumberFound=TRUE; //Clip number matches one of the phone numbers defined
}

// Check the received message, if the message is "On" a bit is set, if the
// message is "Off" the bit is reset.

if (Mdm.Status.SMSReceived)
{
if (!strcmp(&SMSRxBuf, "On"))
CommandBit=TRUE; //SMS received command

if (!strcmp(&SMSRxBuf, "Off"))

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (15 of 16) [06/10/2008 17.43.07]


Function blocks: FbModemMng

CommandBit=FALSE; //SMS received command


}
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbModemMng.htm (16 of 16) [06/10/2008 17.43.07]


Function blocks: FbNetlogAD

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbNetlogAD

This function block allows the analog input acquisition on Netlog systems, there are 4 analog inputs with range
from 0 to 10 volts, the resolution of the converter is 12 bits.

ATTENTION! Because of the input divider, the full scale of 10 volts in input corresponds to an acquired value of
3810.

Code:PFB050 History report


Prototype
FbNetlogAD.h

Declaration
void FbNetlogAD(FBNETLOGADDATA* S);

Parameters
FBNETLOGADDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 12 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //FB enable
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL DataReady:1; //Data ready
BOOL b2:1;
BOOL b3:1;
BOOL Timeout:1; //Conversion timeout error
BOOL ModuleAddress:1; //Module address error
BOOL BusRetry:1; //Bus access retry
BOOL BusFault:1; //Extension bus error
}Status;

unsigned char Module; //Module address

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogAD.htm (1 of 4) [06/10/2008 17.43.08]


Function blocks: FbNetlogAD

unsigned char ADChannel; //A/D channel


unsigned int ADValue; //A/D value

// --------------------------------------------[Internal use only members]--


...
}FBNETLOGADDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB to acquire the analog input.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 DataReady TRUE: The analog value has been acquired and it is available.
4 Timeout TRUE: Conversion timeout error
5 ModuleAddress TRUE: Module address error, the specified Module is not available.
6 BusRetry TRUE: Repeated the access to the peripheral bus.
7 BusFault TRUE: Access to the peripheral bus error.

02 Module
Loaded by user program it defines the module address from which execute the analog acquisition (Range
from 0x00 to 0x07). The value 0x00 is the base module, 0x01 is the first extension module and so on. The
setting of a module address that is not present, aborts the acquisition and sets the proper error bit in Status.
03 ADChannel
Loaded by user program it defines the channel on the module from which execute the analog acquisition,
(Range from 0x00 to 0x03).
04 ADValue
Returns the acquired value expressed in bits. Netlog modules acquire only positive values of tension with
range between 0 to 10 volt. To calculate the voltage value it is necessary to consider the reading error
introduced by the input divider, to calculate the voltage value the formula Voltage=
(10*Value acquired )/3810 must be used (Range from 0x0000 to 0x0FFF).

RIL example

In the following example is acquired the analog input channel 0 of the base module. Debugging the operand
FL VoltageIn it's possible to display the analog value acquired, expressed in volt.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogAD.htm (2 of 4) [06/10/2008 17.43.08]


Function blocks: FbNetlogAD

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG FL VoltageIn ; Input voltage

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; Netlog A/D data structure.

DEFL Y ADs KD 12
DEFL Y ADsCommand Y ADs KH 0000 ; ADs.Command
DEFL Y ADsStatus Y ADs KH 0001 ; ADs.Status
DEFL Y ADsModule Y ADs KH 0002 ; ADs.Module
DEFL Y ADsADChannel Y ADs KH 0003 ; ADs.ADChannel
DEFL W ADsADValue Y ADs KH 0004 ; ADs.ADValue

; ------------------------------------------------------------------------------
; @Section("A/D acquisition")
; ------------------------------------------------------------------------------
; Function block setup parameters.

ORGR
LODT F PLCFirstLoop
MOVI Y ADsModule K 0000 ; ADs.Module
MOVI Y ADsADChannel K 0000 ; ADs.ADChannel

; Here the Netlog A/D function block is called.

ORGR
SETR
OUTT Y ADsCommand K 0000 ; ADs.Command.Enable
TASK L FbNetlogAD Y ADs ; Netlog A/D function block

; Store the acquired A/D value.

ORGR
LODT Y ADsStatus K 0001 ; ADs.Status.DataReady
LODA KF 381.000000
LODA W ADsADValue ; ADs.ADValue
FLTC
FDIV
STRA FL VoltageIn ; Input voltage

; [End of file]

"C" example

In the following example is acquired the analog input channel 0 of the base module. Debugging the variable
VoltageIn it's possible to display the analog value acquired, expressed in volt.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogAD.htm (3 of 4) [06/10/2008 17.43.08]


Function blocks: FbNetlogAD

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogAD.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

float VoltageIn; //Voltage value (V)

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBNETLOGADDATA ADs; //A/D channel 0 data structure

// Set the A/D channel 0 variables at first program execution loop.

if (PLCFirstLoop)
{
ADs.Command.Enable=TRUE; //FB enable
ADs.Module=0; //Module address
ADs.ADChannel=0; //A/D channel
}

// Acquire the analog signal.

FbNetlogAD(&ADs); //A/D channel 0 acquisition

// Execute the voltage calculation.

if (ADs.Status.DataReady)
VoltageIn=(10.0*ADs.ADValue)/3810.0; //Voltage value (V)
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogAD.htm (4 of 4) [06/10/2008 17.43.08]


Function blocks: FbNetlogDA

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbNetlogDA

This function block allows the analog output management on Netlog systems, there are 2 analog outputs with
range from 0 to 2.5 volts, the resolution of the converter is 12 bits.

Code:PFB051 History report


Prototype
FbNetlogDA.h

Declaration
void FbNetlogDA(FBNETLOGDADATA *S);

Parameters
FBNETLOGDADATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 12 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //FB enable
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL ModuleAddress:1; //Module address error
BOOL BusRetry:1; //Bus access retry
BOOL BusFault:1; //Extension bus error
}Status;

unsigned char Module; //Module address


unsigned char DAChannel; //D/A channel
unsigned int DAValue; //D/A value

// --------------------------------------------[Internal use only members]--

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogDA.htm (1 of 4) [06/10/2008 17.43.09]


Function blocks: FbNetlogDA

...
}FBNETLOGDADATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB to manage the analog output.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
5 ModuleAddress TRUE: Module address error, the specified Module is not available.
6 BusRetry TRUE: Repeated the access to the peripheral bus.
7 BusFault TRUE: Access to the peripheral bus error.

02 Module
Loaded by user program it defines the module address to which manage the analog output (Range from
0x00 to 0x07). The value 0x00 is the base module, 0x01 is the first extension module and so on. The setting
of a module address that is not present, aborts the acquisition and sets the proper error bit in Status.
03 DAChannel
Loaded by user program it defines the channel on the module to which manage the analog output, (Range
from 0x00 to 0x01).
04 DAValue
Loaded by user program it defines the output value expressed in bits. The Netlog modules manage only
positive values of tension with range between 0 to 2,5 volt. To calculate the value to be set, the formula
Value to be set=(Voltage*4095)/2.5 must be used (Range from 0x0000 to 0x0FFF).

RIL example

In the following example is managed the analog output channel 0 of the base module. Debugging the operand
FL VoltageOut it's possible to set the analog value expressed in volt.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG FL VoltageOut ; Output voltage

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; Function block data structure.

DEFL Y DAs KD 12
DEFL Y DAsCommand Y DAs KH 0000 ; DAs.Command
DEFL Y DAsStatus Y DAs KH 0001 ; DAs.Status
DEFL Y DAsModule Y DAs KH 0002 ; DAs.Module
DEFL Y DAsDAChannel Y DAs KH 0003 ; DAs.DAChannel
DEFL W DAsDAValue Y DAs KH 0004 ; DAs.DAValue

; ------------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogDA.htm (2 of 4) [06/10/2008 17.43.09]


Function blocks: FbNetlogDA

; @Section("D/A management")
; ------------------------------------------------------------------------------
; Function block setup parameters.

ORGR
LODT F PLCFirstLoop
MOVI Y DAsModule K 0000 ; DAs.Module
MOVI Y DAsDAChannel K 0000 ; DAs.DAChannel

; Set the D/A value.

ORGR
SETR
LODA FL VoltageOut ; Output voltage
LODA KF 4095.000000
FMUL
LODA KF 2.500000
XCHA
FDIV
FIXC
STRA W DAsDAValue ; DAs.DAValue

; Function block call.

ORGR
SETR
OUTT Y DAsCommand K 0000 ; DAs.Command.Enable
TASK L FbNetlogDA Y DAs ; D/A channel management

; [End of file]

"C" example

In the following example is managed the analog output channel 0 of the base module. Debugging the variable
VoltageOut it's possible to set the analog value expressed in volt.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogDA.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

float VoltageOut; //Voltage value (V)

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogDA.htm (3 of 4) [06/10/2008 17.43.09]


Function blocks: FbNetlogDA

{
// Local variable definitions.

static FBNETLOGDADATA DAs; //D/A channel 0 data structure

// Set the D/A channel 0 variables at first program execution loop.

if (PLCFirstLoop)
{
DAs.Command.Enable=TRUE; //FB enable
DAs.Module=0; //Module address
DAs.DAChannel=0; //D/A channel
}

// Execute the D/A value calculation.

DAs.DAValue=(VoltageOut*4095.0)/2.5; //D/A value

// Execute the D/A management.

FbNetlogDA(&DAs); //D/A channel management


}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogDA.htm (4 of 4) [06/10/2008 17.43.09]


Function blocks: FbNetlogIIAD

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbNetlogIIAD

This function block allows the analog input acquisition on NetlogII systems, are present 4 analog inputs with different
possibility of acquisition, voltage, current and temperature. If the configuration data area has an error SystemErrors.
SystemCfg=TRUE, the acquisition is disabled and it returns the value 0. If the module address is not set properly the
acquisition is disabled, the value 0 is returned and the SystemErrors.FBParameters bit is set.

Code:PFB065 History report


Prototype
FbNetlogIIAD.h

Declaration
void FbNetlogIIAD(FBNETLOGIIADDATA* S);

Parameters
FBNETLOGIIADDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 80 bytes data structure, we report a prototype. The members reported under the Internal use
only members label, are members used inside by the function block and they don't have to be changed by the user
program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Enable
BOOL Calibration:1; //Calibration command
BOOL UnipolarAcq:1; //Unipolar acquisition
BOOL b3:1;
BOOL Adjustment:1; //Adjustment command
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //Enabled
BOOL DataReady:1; //Data ready
BOOL b2:1;
BOOL b3:1;
BOOL Timeout:1; //Conversion timeout error
BOOL ModuleAddress:1; //Module address error
BOOL b6:1;
BOOL BusFault:1; //Extension bus error
}Status;

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIAD.htm (1 of 5) [06/10/2008 17.43.11]


Function blocks: FbNetlogIIAD

unsigned char Module; //Module address


unsigned char Dummy1[1];
unsigned char Mode[4]; //Mode
unsigned char Filter[4]; //Filter
unsigned char Dummy2[4];
float Value[4]; //Input value

// --------------------------------------------[Internal use only members]--

unsigned char Im[49]; //Internal members area

}FBNETLOGADDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB to acquire the analog inputs. When enabled it's automatically executed a
calibration cycle.
1 Calibration Activated it forces the execution of the calibration sequence, it's automatically reset. When it's
activated the Status.DataReady will not be activated until the calibration sequence is end.
2 UnipolarAcq Activated it dforces the unipolar acquisition. All negatives values acquired will be zeroed.
4 Adjustment TRUE: Force the FB to be used in adjustment mode. It should not be used by the user program.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 DataReady TRUE: The analog value has been acquired and it's available. It's active only for a program loop at
every acquisition end.
4 Timeout TRUE: Conversion timeout error
5 ModuleAddress TRUE: Module address error, the specified Module is not available.
6 BusRetry TRUE: Repeated the access to the peripheral bus.
7 BusFault TRUE: Access to the peripheral bus error.

02 Module
Loaded by user program it defines the module address from which execute the analog acquisition (Range from 0x00
to 0x07). The value 0x00 is the base module, 0x01 is the first extension module and so on. The setting of a module
address that is not present, aborts the acquisition and sets the proper error bit in Status.
04 Mode (Channel 0)
05 Mode (Channel 1)
06 Mode (Channel 2)
07 Mode (Channel 3)
It's necessary to specify the analog acquisition mode, according to the following table. If the acquisition mode is
changed during the acquisition, it's executed a new calibration with the new acquisition mode. In differential mode
only two channels are used Channel 0 e Channel 1.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIAD.htm (2 of 5) [06/10/2008 17.43.11]


Function blocks: FbNetlogIIAD

Mode Acquisition Channels Output value

00 Channel not used 4 Always 0


01 Voltage from 0 to 1.25 V (Common mode) 4 From 0 to 1.25 volts
02 Voltage from 0 to 10 V (Common mode) 4 From 0 to 10 volts
03 Current from 0 to 20 mA (Common mode) 4 From 0 to 20 milliamps
08 Voltage from 0 to 1.25 V (Differential mode) 2 From 0 to 1.25 volts
09 Voltage from 0 to 10 V (Differential mode) 2 From 0 to 10 volts
0A Pt100 sensor (Differential mode) 2 From -100 to +700 centigrade degrees
0B Pt1000 sensor (Differential mode) 2 From -100 to +300 centigrade degrees

08 Filter (Channel 0)
09 Filter (Channel 1)
0A Filter (Channel 2)
0B Filter (Channel 3)
It's necessary to specify the value of the filter to be applied on the acquired value. Values less than 2 exclude the
filter (Range from 0x00 to 0xFF).
10 Value (Channel 0)
14 Value (Channel 1)
18 Value (Channel 2)
1C Value (Channel 3)
Returns the acquisition value expressed in the measure unit defined by the acqisition mode.

Calibration

The analog acquisition is made by a 24 bits converter, so to avoid offset and gain errors, it's necessary to execute a
calibration cycle before to acquire the analog value. Calibration it's automatically executed when the FB is enableb, when
the Command.Calibration bit is set and when the acquisition mode is changed on a channel.

RIL example

In the following example it's executed the acquisition of all the 4 channels of the base module. The acquisition is executed
on mode 1 from 0 to 10 volts. The analog value acquired from every channel is visible by executing the debug of the
operands FL ADsValue0, FL ADsValue1, FL ADsValue2, FL ADsValue3.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG FL VoltageIn0 ;Input voltage Ch 0


DEFG FL VoltageIn1 ;Input voltage Ch 1
DEFG FL VoltageIn2 ;Input voltage Ch 2
DEFG FL VoltageIn3 ;Input voltage Ch 3

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; NetlogII A/D data structure.

DEFL Y ADs KD 80
DEFL Y ADsCommand Y ADs KH 0000 ;ADs.Command
DEFL Y ADsStatus Y ADs KH 0001 ;ADs.Status
DEFL Y ADsModule Y ADs KH 0002 ;ADs.Module
DEFL Y ADsMode0 Y ADs KH 0004 ;ADs.Mode[0]
DEFL Y ADsMode1 Y ADs KH 0005 ;ADs.Mode[1]

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIAD.htm (3 of 5) [06/10/2008 17.43.11]


Function blocks: FbNetlogIIAD

DEFL Y ADsMode2 Y ADs KH 0006 ;ADs.Mode[2]


DEFL Y ADsMode3 Y ADs KH 0007 ;ADs.Mode[3]
DEFL Y ADsFilter0 Y ADs KH 0008 ;ADs.Filter[0]
DEFL Y ADsFilter1 Y ADs KH 0009 ;ADs.Filter[1]
DEFL Y ADsFilter2 Y ADs KH 000A ;ADs.Filter[2]
DEFL Y ADsFilter3 Y ADs KH 000B ;ADs.Filter[3]
DEFL FL ADsValue0 Y ADs KH 0010 ;ADs.Value[0]
DEFL FL ADsValue1 Y ADs KH 0014 ;ADs.Value[1]
DEFL FL ADsValue2 Y ADs KH 0018 ;ADs.Value[2]
DEFL FL ADsValue3 Y ADs KH 001C ;ADs.Value[3]

; ------------------------------------------------------------------------------
; @Section("A/D acquisition")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.
; All channels are set in acquisition mode "2".

ORGR
LODT F PLCFirstLoop
LTCH Y ADsCommand BD 0 ;ADs.Command.Enable
MOVI Y ADsModule KH 0000 ;ADs.Module
MOVI Y ADsMode0 KH 0002 ;ADs.Mode[0]
MOVI Y ADsMode1 KH 0002 ;ADs.Mode[1]
MOVI Y ADsMode2 KH 0002 ;ADs.Mode[2]
MOVI Y ADsMode3 KH 0002 ;ADs.Mode[3]

; Here the NetlogII A/D functional block is called.

ORGR
SETR
TASK L FbNetlogIIAD Y ADs ;Netlog A/D functional block

; Store the acquired A/D value.

ORGR
LODT Y ADsStatus K 0001 ;ADs.Status.DataReady
MOVM FL VoltageIn0 FL ADsValue0 ;Input voltage Ch 0
MOVM FL VoltageIn1 FL ADsValue1 ;Input voltage Ch 1
MOVM FL VoltageIn2 FL ADsValue2 ;Input voltage Ch 2
MOVM FL VoltageIn3 FL ADsValue3 ;Input voltage Ch 3

; [End of file]

"C" example

In the following example it's executed the acquisition of all the 4 channels of the base module. The acquisition is executed
on mode 1 from 0 to 10 volts.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIAD.htm (4 of 5) [06/10/2008 17.43.11]


Function blocks: FbNetlogIIAD

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogIIAD.h>

// -----------------------------------------------------------------------------
// Global variables definition.
// -----------------------------------------------------------------------------

float VoltageIn[4]; //Voltage value (V)

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

unsigned char i; //Auxiliary counter


static FBNETLOGIIADDATA ADs; //NetlogII A/D data structure

// Here the function block parameters are set.

if (PLCFirstLoop)
{
ADs.Command.Enable=TRUE; //FB enable
ADs.Module=0; //Module address
ADs.Mode[0]=0x02; //Mode
ADs.Mode[1]=0x02; //Mode
ADs.Mode[2]=0x02; //Mode
ADs.Mode[3]=0x02; //Mode
}

// Here the NetlogII A/D functional block is called.

FbNetlogIIAD(&ADs); //A/D channel 0 acquisition

// Execute the voltage calculation.

if (ADs.Status.DataReady)
for (i=0; i<4; i++)
VoltageIn[i]=ADs.Value[i]; //Voltage value (V)
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIAD.htm (5 of 5) [06/10/2008 17.43.11]


Function blocks: FbNetlogIIDA

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbNetlogIIDA

This function block allows the analog output management on NetlogII systems, there are 2 analog outputs with
range from 0 to 10 volts, the resolution of the converter is 12 bits. If the configuration data area has an error
SystemErrors.HardwareCfg=TRUE, the management is disabled and the output value is set to 0. If the module
address is not set properly the management is disabled, the output value is set to 0 and the SystemErrors.
FBParameters is set.

Code:PFB066 History report


Prototype
FbNetlogIIDA.h

Declaration
void FbNetlogIIDA(FBNETLOGIIDADATA *S);

Parameters
FBNETLOGIIDADATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 32 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Enable
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL Adjustment:1; //Adjustment command
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL DataSet:1; //Data set
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIDA.htm (1 of 4) [06/10/2008 17.43.13]


Function blocks: FbNetlogIIDA

BOOL ModuleAddress:1; //Module address error


BOOL BusRetry:1; //Bus access retry
BOOL BusFault:1; //Extension bus error
}Status;

unsigned char Module; //Module address


unsigned char Dummy1;
unsigned char Mode[2]; //Mode
unsigned char Dummy2[2];
float Value[2]; //Output value

// --------------------------------------------[Internal use only members]--

unsigned char Im[16]; //Internal members area


}FBNETLOGIIDADATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB to manage the analog output.
4 Adjustment TRUE: Force the FB to be used in adjustment mode. It should not be used by the user program.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 DataSet TRUE: The analog value was transferred to the output (one shot, it remains active for a
program loop to every transfer on all the channels).
5 ModuleAddress TRUE: Module address error, the specified Module is not available.
6 BusRetry TRUE: Repeated the access to the peripheral bus.
7 BusFault TRUE: Access to the peripheral bus error.

02 Module
Loaded by user program it defines the module address to which manage the analog output (Range from 0x00
to 0x07). The value 0x00 is the base module, 0x01 is the first extension module and so on. The setting of a
module address that is not present, aborts the acquisition and sets the proper error bit in Status.
The module address 0x00 can be set only on target systems based on ADuC845 microcontroller.

04 Mode (Channel 0)
05 Mode (Channel 1)
It's necessary to specify the analog output mode, according to the following table.
Mode Function Channels Output value

00 Channel not used 2 Always 0


01 Voltage from 0 to 10 V 2 From 0 to 10 volts

08 Value (Channel 0)
0C Value (Channel 1)
Loaded by user program it defines the output value expressed in measure unit defined by the selected mode.

RIL example

In the following example is managed the analog output channels of the base module. By debugging the operands
FL Ch0Voltage and FL Ch1Voltage it's possible to set the analog value expressed in volt.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIDA.htm (2 of 4) [06/10/2008 17.43.13]


Function blocks: FbNetlogIIDA

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG FL Ch0Voltage ;Output voltage ch 0


DEFG FL Ch1Voltage ;Output voltage ch 1

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; Function block data structure.

DEFL Y DAs KD 32
DEFL Y DAsCommand Y DAs KH 0000 ;DAs.Command
DEFL Y DAsStatus Y DAs KH 0001 ;DAs.Status
DEFL Y DAsModule Y DAs KH 0002 ;DAs.Module
DEFL Y DAsMode0 Y DAs KH 0004 ;DAs.Mode[0]
DEFL Y DAsMode1 Y DAs KH 0005 ;DAs.Mode[1]
DEFL FL DAsValue0 Y DAs KH 0008 ;DAs.Value[0]
DEFL FL DAsValue1 Y DAs KH 000C ;DAs.Value[1]

; ------------------------------------------------------------------------------
; @Section("D/A management")
; ------------------------------------------------------------------------------
; Function block setup parameters.

ORGR
LODT F PLCFirstLoop
LTCH Y DAsCommand BD 0 ;DAs.Command.Enable
MOVI Y DAsModule KH 0000 ;DAs.Module
MOVI Y DAsMode0 KH 0001 ;DAs.Mode[0]
MOVI Y DAsMode1 KH 0001 ;DAs.Mode[1]

; Set the D/A value and call the function block.

ORGR
LODT Y DAsStatus BD 1 ;DAs.Status.DataSet
MOVM FL DAsValue0 FL Ch0Voltage ;DAs.Value[0]
MOVM FL DAsValue1 FL Ch1Voltage ;DAs.Value[1]

ORGR
SETR
TASK L FbNetlogIIDA Y DAs ;D/A channel management

; [End of file]

"C" example

In the following example are managed the analog output channels of the base module. By debugging the variables
Ch0Voltage and Ch1Voltage it's possible to set the analog value expressed in volt.

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIDA.htm (3 of 4) [06/10/2008 17.43.13]


Function blocks: FbNetlogIIDA

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogIIDA.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

float Ch0Voltage; //Output voltage ch 0


float Ch1Voltage; //Output voltage ch 1

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBNETLOGIIDADATA DAs; //D/A data structure

// Set the D/A channel 0 variables at first program execution loop.

if (PLCFirstLoop)
{
DAs.Command.Enable=TRUE; //FB enable
DAs.Module=0; //Module address
DAs.Mode[0]=1; //Mode
DAs.Mode[1]=1; //Mode
}

// Set the D/A value.

DAs.Value[0]=Ch0Voltage; //Output value


DAs.Value[1]=Ch1Voltage; //Output value

// Execute the D/A management.

FbNetlogIIDA(&DAs); //D/A channels management


}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbNetlogIIDA.htm (4 of 4) [06/10/2008 17.43.13]


Function blocks: FbPicofaceSerial

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPicofaceSerial

This function block allows the management of a Picoface terminal connected thru the serial line on any target system. The
Picoface terminal must be the serial type and the proper serial driver Sfw106 must run on it. The terminal is managed as it
is directly connected to the system and it's possible to use also the FbSysTerminal FB to manage it.

Code:PFB055 History report


Prototype
FbPicofaceSerial.h

Declaration
void FbPicofaceSerial(FBPICOFACESERIALDATA* S);

Parameters
FBPICOFACESERIALDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 128 bytes data structure, we report a prototype. The members reported under the Internal use
only members label, are members used inside by the function block and they don't have to be changed by the user
program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //FB enable
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL CommOk:1; //Communication ok
BOOL TimeoutError:1; //Terminal timeout error
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned char TrmCommand; //Terminal commands byte

http://192.168.0.61/Destination/Html/FctBlocks/FbPicofaceSerial.htm (1 of 5) [06/10/2008 17.43.15]


Function blocks: FbPicofaceSerial

unsigned char TrmStatus; //Terminal status byte


TERMIOVECTORS* IOVector; //I/O console vector address

// --------------------------------------------[Internal use only members]--

unsigned char Im[122]; //Internal members area


}FBPICOFACESERIALDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
4 CommOk TRUE: The communication with the Picoface terminal is ok.
5 TimeoutError TRUE: Timeout error on Picoface terminal serial communication.

02 TrmCommand
Loaded by user program, the loaded value is sent to the Picoface terminal as command byte (Range from 0x00 to
0xFF).
03 TrmStatus
Returns the status byte read from the Picoface terminal (Range from 0x00 to 0xFF).
04 IOVector
Returns the TERMIOVECTORS vector address.

RIL example

The following example inserted in a Remoter project, by using the terminal management graphic utility with the vector set
as W PcSIOVector, the display target Picoface and terminal address 0, allows to manage a Picoface terminal connected
to the serial port A.

Figure 1

http://192.168.0.61/Destination/Html/FctBlocks/FbPicofaceSerial.htm (2 of 5) [06/10/2008 17.43.15]


Function blocks: FbPicofaceSerial

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; FbPicofaceSerial driver, function block data structure.

DEFG Y PcS KD 128


DEFG Y PcSCommand Y PcS KH 0000 ;PcS.Command
DEFG Y PcSStatus Y PcS KH 0001 ;PcS.Status
DEFG Y PcSTrmCommand Y PcS KH 0002 ;PcS.TrmCommand
DEFG Y PcSTrmStatus Y PcS KH 0003 ;PcS.TrmStatus
DEFG W PcSIOVector Y PcS KH 0004 ;PcS.IOVector

; ------------------------------------------------------------------------------
; @Section("PICOFACE serial management")
; ------------------------------------------------------------------------------
; Set the port where the serial Picoface is connected and open it.

ORGR
SETR
SETV KE IOSerialPortA

ORGR
LODT F PLCFirstLoop
TASK L TermIOOpen ;Open the I/O console

; Manage the serial Picoface terminal.

ORGR
SETR
OUTT Y PcSCommand BD 0 ;PcS.Command.Enable
TASK L FbPicofaceSerial Y PcS ;FbPicofaceSerial management

ORGR
LODT F PLCFirstLoop
SETV W PcSIOVector ;PcS.IOVector
TASK L TermIOOpen ;Open the I/O console

; [End of file]

"C" example

In the following example a Picoface terminal connected to the serial port A is managed. Two variables are displayed and
data entry can be made on them.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPicofaceSerial.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int VarInt; //Unsigned int variable


float VarFloat; //Float variable

http://192.168.0.61/Destination/Html/FctBlocks/FbPicofaceSerial.htm (3 of 5) [06/10/2008 17.43.15]


Function blocks: FbPicofaceSerial

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static BOOL ParameterPtr; //Input parameter pointer


static TERMINALSTRUCT Ts; //Terminal data structure
static FBPICOFACESERIALDATA Trm; //PicofaceSerial data

// -------------------------------------------------------------------------
// MANAGE THE SERIAL PICOFACE TERMINAL
// -------------------------------------------------------------------------
// Set the serial port used to manage the Picoface terminal.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

// Execute the variables init.

if (PLCFirstLoop)
{
TermIOOpen(); //Open the I/O console
PcS.Command.Enable=TRUE; //FB enable
Ts.TerminalAddress=0x00; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

// Set the terminal as standard I/O console and call the terminal
// management function, it must be called after the variables init.

FbPicofaceSerial(&PcS); //I2C serial driver


SetTermIOVectors(PcS.IOVector); //Set the terminal as I/O console
SetTermIOData(&Ts); //Terminal data structure
if (PLCFirstLoop) TermIOOpen(); //Open the I/O console

// Copy the Keyboard status to the LED for keys [0] and [1].

Ts.LEDCommand.LED0=Ts.KeyStatus.K0; //Key [0] led command


Ts.LEDCommand.LED1=Ts.KeyStatus.K1; //Key [1] led command

// Display the variable values on the terminal display.


// +----------------+
// |VarInt : ----- |
// |VarFloat: ---.- |
// +----------------+

if (Ts.Status.RefreshEnd)
printf("\nVarInt : %05d VarFloat: %05.1f ", VarInt, VarFloat);

// By pressing the [CLR] key, it's possible to select the parameter must be
// set. Please note that the parameter is select only if the [CLR] key is
// pressed as a first key.

if (Ts.Status.InputDataSkipped)
ParameterPtr^=TRUE; //Input parameter pointer

// If no keys are pressed, after the set timeout time the data input is

http://192.168.0.61/Destination/Html/FctBlocks/FbPicofaceSerial.htm (4 of 5) [06/10/2008 17.43.15]


Function blocks: FbPicofaceSerial

// automatically aborted and the parameter pointer is reset.

if (Ts.Status.KeyboardTimeOut)
ParameterPtr=FALSE; //Input parameter pointer

// By pressing the [CLR] key, the data input sequence starts.

if ((Ts.Status.KeyPressed) && (Ts.KeyStatus.KCLR))


{
if (!ParameterPtr)
{
// Input the unsigned int variable.

SetCursorPos(0, 10); //Set the cursor position


Ts.InputDataDigit=5; //Number of digits
Ts.InputDataCommand=4; //Data input type
}
else
{
// Input the float variable.

SetCursorPos(1, 10); //Set the cursor position


Ts.InputDataDigit=5; //Number of digits
Ts.InputDataCommand=1; //Data input type
}
}

// When the data input is finished the value is stored into the variable.

if (Ts.Status.InputDataEnd)
if (!ParameterPtr)
scanf("%d", &VarInt);
else
scanf("%f", &VarFloat);
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPicofaceSerial.htm (5 of 5) [06/10/2008 17.43.15]


Function blocks: FbPIDMng

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPIDMng

This function block allows to manage a PID regulation loop.

Code:PFB056 History report


Prototype
FbPIDMng.h

Declaration
void FbPIDMng(FBPIDMNGDATA *S);

Parameters
FBPIDMNGDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 64 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Regulation enable
BOOL b1:1;
BOOL IRegEnable:1; //I regulation enable
BOOL DRegEnable:1; //D regulation enable
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //Regulation enabled
BOOL b1:1;
BOOL b2:1;
BOOL OutLimit:1; //Output limit reached
BOOL IRegWorks:1; //I correction works
BOOL DRegWorks:1; //D correction works
BOOL b6:1;
BOOL b7:1;

http://192.168.0.61/Destination/Html/FctBlocks/FbPIDMng.htm (1 of 5) [06/10/2008 17.43.16]


Function blocks: FbPIDMng

}Status;

unsigned char Dummy[2];

float St; //Regulator scansion time (mSec)


float Pe; //Process error
float Kp; //Proportional coefficent (Nr)
float It; //Integrative time (Sec)
float Dt; //Derivative time (Sec)
float Nb; //Near band
float OutLimit; //Output limit
float OutValue; //Output value

// --------------------------------------------[Internal use only members]--


...
}FBPIDMNGDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB.
2 IRegEnable TRUE: Enables the integrative regulation.
3 DRegEnable TRUE: Enables the derivative regulation.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
3 OutLimit TRUE: The output value OutValue as reached the OutLimit value.
4 IRegWorks TRUE: The integrative regulation is enabled.
5 DRegWorks TRUE: The derivative regulation is enabled.

04 St
Loaded by user program it defines the FB scansion time. If executed on the main program have the program
scansion time must be copied. If executed on temporal interrupt interrupt time must be copied. The value is
expressed in mSec.
08 Pe
Loaded by user program it defines the process error. Process error is obtained by the subtraction of the
feedback value from the set point value of the process to control Pe=SetPoint-Feedback. The value is
expressed in the process to control measure unit.
0C Kp
Loaded by user program it defines the proportional coefficient. We remind that bigger is the value faster is
the regulation with an increasing of the overshot effect. The value is expressed as a number.
10 It
Loaded by user program it defines the integrative time. We remind that bigger is the value slower is the
integrative regulation to minimize the error. The value is expressed in second.
14 Dt
Loaded by user program it defines the derivative time. We remind that the bigger is the value faster is the
derivative regulation to minimize the error. The value is expressed in second.
18 Nb

http://192.168.0.61/Destination/Html/FctBlocks/FbPIDMng.htm (2 of 5) [06/10/2008 17.43.16]


Function blocks: FbPIDMng

Loaded by user program it defines the near band value. This value defines the error value more than the
regulation is disabled and the output value is set to its limit OutLimit. The value is expressed in the measure
unit of the process to control.
1C OutLimit
Loaded by user program it defines the output value limit. When the PID loop has an outputs value bigger
than the limit, the output value is limited to the limit value. The value is expressed in the measure unit of the
process to control.
20 OutValue
Returns the PID loop correction value. This value has to be used to command the process. The value is
expressed in the measure unit of the process to control.

RIL example

In the following example a PID regulation loop is managed.

; ------------------------------------------------------------------------------
; @Section("Global definitions")
; ------------------------------------------------------------------------------
; Process variables.

DEFG FL ProcessSetPoint ;Process set point value


DEFG FL ProcessFeedback ;Process feddback value
DEFG FL ProcessCommand ;Process command value

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; PIDs management data structure.

DEFL Y PIDs KD 64
DEFL Y PIDsCommand Y PIDs KH 0000 ;PIDs.Command
DEFL Y PIDsStatus Y PIDs KH 0001 ;PIDs.Status
DEFL FL PIDsSt Y PIDs KH 0004 ;PIDs.St
DEFL FL PIDsPe Y PIDs KH 0008 ;PIDs.Pe
DEFL FL PIDsKp Y PIDs KH 000C ;PIDs.Kp
DEFL FL PIDsIt Y PIDs KH 0010 ;PIDs.It
DEFL FL PIDsDt Y PIDs KH 0014 ;PIDs.Dt
DEFL FL PIDsNb Y PIDs KH 0018 ;PIDs.Nb
DEFL FL PIDsOutLimit Y PIDs KH 001C ;PIDs.OutLimit
DEFL FL PIDsOutValue Y PIDs KH 0020 ;PIDs.OutValue

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Function block setup parameters.

ORGR
LODT F PLCFirstLoop
LTCH Y PIDsCommand K 0000 ;PIDs.Command.Enable
LTCH Y PIDsCommand K 0002 ;PIDs.Command.IRegEnable
LTCH Y PIDsCommand K 0003 ;PIDs.Command.DRegEnable
MOVI FL PIDsKp KF 10.000000 ;PIDs.Kp
MOVI FL PIDsIt KF 2.000000 ;PIDs.It

http://192.168.0.61/Destination/Html/FctBlocks/FbPIDMng.htm (3 of 5) [06/10/2008 17.43.16]


Function blocks: FbPIDMng

MOVI FL PIDsDt KF 1.000000 ;PIDs.Dt


MOVI FL PIDsNb KF 50.000000 ;PIDs.Nb
MOVI FL PIDsOutLimit KF 1000.000000 ;PIDs.OutLimit

; ------------------------------------------------------------------------------
; @Section("PIDs management")
; ------------------------------------------------------------------------------
; Here the scansion time is passed to the FB.

ORGR
SETR
LODA W PLCLoopTime
FLTC
STRA FL PIDsSt ;PIDs.St

; Here the process error is calculted.

LODA FL ProcessSetPoint ;Process set point value


LODA FL ProcessFeedback ;Process feddback value
FSUB
STRA FL PIDsPe ;PIDs.Pe

; Here the PIDs function block is called.

TASK L FbPIDMng Y PIDs

; Here the output value is sent to the process.

LODA FL ProcessSetPoint ;Process set point value


LODA FL PIDsOutValue ;PIDs.OutValue
FADD
STRA FL ProcessCommand ;Process command value

; [End of file]

"C" example

In the following example a PID regulation loop is managed.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPIDMng.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

float ProcessSetPoint; //Process set point value


float ProcessFeedback; //Process feddback value
float ProcessCommand; //Process command value

http://192.168.0.61/Destination/Html/FctBlocks/FbPIDMng.htm (4 of 5) [06/10/2008 17.43.16]


Function blocks: FbPIDMng

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
static FBPIDMNGDATA PIDs; //PID management data structure

// Here the PIDs function block parameters are set.

if (PLCFirstLoop)
{
PIDs.Command.Enable=TRUE; //Regulation enable
PIDs.Command.IRegEnable=TRUE; //I regulation enable
PIDs.Command.DRegEnable=TRUE; //D regulation enable
PIDs.Kp=10.0; //Proportional coefficent (Nr)
PIDs.It=2.0; //Integrative time (Sec)
PIDs.Dt=1.0; //Derivative time (Sec)
PIDs.Nb=50.0; //Near band
PIDs.OutLimit=1000.0; //Output limit
}

// Here the PIDs function block is called.

PIDs.St=PLCLoopTime; //Regulator scansion time (mSec)


PIDs.Pe=ProcessSetPoint-ProcessFeedback; //Process error
FbPIDMng(&PIDs); //PID management
ProcessCommand=ProcessSetPoint+PIDs.OutValue; //Process command value
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPIDMng.htm (5 of 5) [06/10/2008 17.43.16]


Function blocks: FbPsystADSubm

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPsystADSubm

This function block allows to manage the A/D submodule for the Picosyst family coprocessor module.

Code:PFB047 History report


Prototype
FbPsystADSubm.h

Declaration
void FbPsystADSubm(FBPSYSTADSUBMDATA* S);

Parameters
FBPSYSTADSUBMDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 24 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Channel enable
BOOL Reset:1; //Channel reset
BOOL EnableReadPulse:1; //Enable read pulse
BOOL ReadPulse:1; //Read pulse
BOOL Utility:2; //Channel utility
BOOL PostFiltering:1; //Channel post filtering
BOOL b7:1;
}Command; //Command

struct
{
BOOL Enabled:1; //Channel enabled
BOOL DataReady:1; //Readed data is valid
BOOL EndCycle:1; //End of read cycle
BOOL b3:1;
BOOL b4:1;
BOOL TimeoutError:1; //Channel timeout error
BOOL ConversionError:1; //Channel conversion error
BOOL b7:1;
}Status; //Status

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (1 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

unsigned char ModuleAddress; //Coprocessor module address


unsigned char DMACh; //DMA channel
unsigned char Function; //Function code
unsigned char NotUsed1;
unsigned char SlotChannel; //Slot & channel
unsigned char OutMode; //Output value mode
unsigned int ScaleFactor; //Scale factor
unsigned int Calibration; //Calibration factor
unsigned int AnalogValue; //A/D analog value
unsigned int TimeOut; //Timeout value

// --------------------------------------------[Internal use only members]--


...
}FBPSYSTADSUBMDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and stops the dialogue with the coprocessor module.
TRUE: Enables the FB and starts the dialogue with the coprocessor module.
1 Reset FALSE: Normal working.
TRUE: Commands a channel reset. This should be used to set new values for
OutMode, ScaleFactor, Calibration.The first time the FB is enabled, these settings
occur automatically.
2 EnableReadPulse FALSE: Allows the continuous acquisition of the analog value.
TRUE: Allows the acquisition of the analog value only on ReadPulse bit command.
3 ReadPulse Valid only if EnableReadPulse is set. It commands a pulse analog value acquisition,
the bit is automatically reset. The returned value AnalogValue valid when the Status.
EndCycle is set, is the analog value acquired when the bit has been set. With the pulse
reading, the PostFiltering bit has no action; so the filter is always disabled.
4 Utility Bit 5 Bit 4 Description
5
0 0 Normal acquisition
0 1 Self calibration
1 0 Zero system calibration
1 1 Full system calibration

Normal acquisition: Normal acquisition from the desired channel.

Self calibration: Activates the A/D converter internal calibration procedure. This
command could be used if a very precise acquisitions are desired, for which A/D
converter relative factors, could influence subsequent reading. At the FB enable the self
calibration automatically starts. The self calibration can be activated with every kind of
acquisition (voltage, Pt100, etc.). The calibration value is lost when the system is turned
off.

Zero system calibration: Is used to calibrate the offset (offset setting) when
acquisition from strain-gage is used (see value in Function). The calibration value is
lost when the system is turned off.

Full system calibration: Is used to calibrate the gain setting when acquisition from
strain-gage is used (see value in Function and in Calibration). The calibration value is
lost when the system is turned off.

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (2 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

6 PostFiltering TRUE: Enables the acquired analog value filtering, so the acquired value is less
affected by the noises. When the impulsive reading is used (with the ReadPulse), this
bit doesn't act.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 DataReady TRUE: Indicates that in AnalogValue a new value read by the A/D converter, is
available. This bit is one shot, it remains set only for a program loop.
2 EndCycle TRUE: Indicates that the acquisition cycle has been completed. To know if in
AnalogValue a valid data is available, it's necessary to verify the DataReady bit. For
impulsive readings, by calculating the time that goes from the ReadPulse bit setting and
the setting of this bit, you can obtain the analog value acquisition time. This bit is one
shot, it's set only for a program loop.
5 TimeoutError TRUE: Indicates a timeout error on the command given to the coprocessor module, it
could be verified if the coprocessor module is in STAND-BY.
6 ConversionError TRUE: Indicates a conversion error on the acquisition channel, it could be verified if the A/
D submodule is not present.

02 ModuleAddress
Loaded by user program it defines the coprocessor module address on witch the A/D submodule is mounted.
It must be set at the first program loop and cannot be changed (Range from 0x00 to 0x07).
03 DMACh
Loaded by user program it defines the DMA channel number, used to acquire the desired channel. It must be
set at the first program loop and cannot be changed. ATTENTION! Use different values of DMACh for every
channel managed from A/D or D/A submodule inserted in the same coprocessor module (Range from 0x00
to 0x0F).
04 Function
Loaded by user program it defines the function code to execute. The FB can be parameterized to read
different analog sources. It must be set at the first program loop and cannot be changed, the possible values
are reported in the table.
Value Description

0x08 Voltage 0-2.5 V


0x09 Voltage 0-10 V
0x0A Current 0-20 mA/4-20 mA
0x0C Pt100 DIN Sensor
0x0D Pt100 IAS Sensor
0x0E Pt100 ITS Sensor
0x10 Thermocouple B Sensor
0x11 Thermocouple Sensor
0x12 Thermocouple J Sensor
0x13 Thermocouple K Sensor
0x14 Thermocouple N Sensor
0x15 Thermocouple R Sensor
0x16 Thermocouple S Sensor
0x17 Thermocouple T Sensor
0x20 Pt1000 Sensor
0x21 Ni1000 Sensor
0x28 Strain-Gage Sensor

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (3 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

06 SlotChannel
Loaded by user program it defines the coprocessor module slot where the A/D submodule is inserted, and
the software channel of the A/D submodule. It must be set at the first program loop and cannot be changed.
For example to acquire the channel 0 connected to terminal blocks 1-2 (IN1COM-IN1) of the submodule
inserted in the slot 1 of the coprocessor module, the value 0x10 must be set.
Slot It's the number of the coprocessor module slot where the A/D submodule is inserted (Range from 1
to 3).
Channel It defines the number of the A/D software channel to be acquired. This number can be obtained
from the submodule documentation, it's related to the analog SourceCode to be acquired and to
the connection pins (Range from 0 to 6).

07 OutMode
Loaded by user program it defines the representation of the acquired value. After having modified this
parameter, it's necessary to set the Command.Reset, to let it recognized by the board.
Acquisition type Bit 5 Bit 4 Bit 3 OutMode value Acquired value representation

0 0 x 0x00 Centigrade tenth of degree


Pt100 DIN-IAS-ITS Pt1000, 0 1 x 0x10 Fahrenheit tenth of degree
Ni1000, Thermocouple 1 0 x 0x20 Centigrade degrees
1 1 x 0x30 Fahrenheit degrees
x 0 0 0x00 0-2500 mV o 0-10000 mV
Voltage 0-2.5V, Voltage 0-10V x 1 0 0x10 Depending by ScaleFactor
x x 8 0x08 Converter output on 16 bits
Current 0-20mA x 0 0 0x00 0-20000 mA
Depending by ScaleFactor and
Current 4-20mA x 1 0 0x10
Calibration
It doesn't use OutMode and it always
Strain-Gage x x x x
considers the ScaleFactor

08 ScaleFactor
Loaded by user program it has a real meaning only for voltage, current 4-20mA and strain-gage acquisitions.
After having modified this parameter, it's necessary to set the Command.Reset, to let it recognized by the
board.

For the voltage acquisition, the value in AnalogValue is given by the formula:
AnalogValue=Voltage value*ScaleFactor

For the 4-20mA current acquisitions, the value to insert is given by the formula:
ScaleFactor=Desired value/(Input current-4mA)+(Calibration/1000)

For the strain-gage acquisitions, the value to insert is given by the formula:
ScaleFactor=Maximum capacity of the strain-gage/ratio between outlet mV and strain-gage inlet Volt.
0A Calibration
Loaded by user program it has a real meaning only for strain-gage and 4-20mA acquisitions. After having
modified this parameter, it's necessary to set the Command.Reset, to let it recognized by the board.
0C AnalogValue
It returns the digital value acquired from the chosen channel. The value depends by the OutMode settings.
0E TimeOut
Loaded by user program it defines the number of milliseconds after that, if there is no answer from the
coprocessor module, the Status.TimeoutError bit is set. The value 0 is replaced with the value 5000. In the
timeout time it is necessary to consider the user program loop time.

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (4 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

Example RIL

The example uses a PCB085*000 A/D submodule mounted in the first slot of a PCB072*000 coprocessor
module set with address 1. To test the example it's necessary also the part of program that manages the
FbPsystAnaCp coprocessor module management FB.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Picosyst analog coprocessor module data structure.

DEFL Y Cpr KD 8
DEFL Y CprCommand Y Cpr KH 0000 ; Cpr.Command
DEFL Y CprModuleAddress Y Cpr KH 0002 ; Cpr.ModuleAddress

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block parameters are set.

ORGR
LODT F PLCFirstLoop
MOVI Y CprCommand KD 1 ; Cpr.Command
MOVI Y CprModuleAddress KD 1 ; Cpr.ModuleAddress

; ------------------------------------------------------------------------------
; @Section("Coprocessor management")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block is called.

ORGR
SETR
TASK L FbPsystAnaCp Y Cpr ; Coprocessor management

; [End of file]

In the example is executed a 0-10 Volt analog acquisition, of the voltage connected to the terminal blocks 1-2
(IN1COM-IN1). Debugging the operand W AnalogValue it's possible to read the analog value expressed in
millivolts from 0 to 10000. In case of conversion error the F ErrorFlag will be set.

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (5 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG F ErrorFlag ; A/D acquisition error


DEFG W AnalogValue ; A/D analog value

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Picosyst A/D submodule data structure.

DEFL Y ADs KD 24
DEFL Y ADsCommand Y ADs KH 0000 ; ADs.Command
DEFL Y ADsStatus Y ADs KH 0001 ; ADs.Status
DEFL Y ADsModuleAddress Y ADs KH 0002 ; ADs.ModuleAddress
DEFL Y ADsDMACh Y ADs KH 0003 ; ADs.DMACh
DEFL Y ADsFunction Y ADs KH 0004 ; ADs.Function
DEFL Y ADsSlotChannel Y ADs KH 0006 ; ADs.SlotChannel
DEFL Y ADsOutMode Y ADs KH 0007 ; ADs.OutMode
DEFL W ADsScaleFactor Y ADs KH 0008 ; ADs.ScaleFactor
DEFL W ADsCalibration Y ADs KH 000A ; ADs.Calibration
DEFL W ADsAnalogValue Y ADs KH 000C ; ADs.AnalogValue
DEFL W ADsTimeOut Y ADs KH 000E ; ADs.TimeOut

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the Picosyst A/D submodule function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y ADsCommand K 0000 ; ADs.Command.Enable
LTCH Y ADsCommand K 0006 ; ADs.Command.PostFiltering
MOVI Y ADsModuleAddress KD 1 ; ADs.ModuleAddress
MOVI Y ADsDMACh KH 0000 ; ADs.DMACh
MOVI Y ADsFunction KH 0009 ; ADs.Function
MOVI Y ADsSlotChannel KH 0010 ; ADs.SlotChannel
MOVI Y ADsOutMode KH 0000 ; ADs.OutMode
MOVI W ADsScaleFactor KH 0000 ; ADs.ScaleFactor
MOVI W ADsTimeOut KD 5000 ; ADs.TimeOut

; ------------------------------------------------------------------------------
; @Section("A/D acquisition")
; ------------------------------------------------------------------------------
; Here the Picosyst A/D submodule function block is called.

ORGR
SETR
TASK L FbPsystADSubm Y ADs ; A/D submodule management

; The acquisition ok is tested and the acquired value stored.

ORGR
LODT Y ADsStatus K 0002 ; ADs.Status.EndCycle
ANDT Y ADsStatus K 0001 ; ADs.Status.DataReady

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (6 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

LODA W ADsAnalogValue ; ADs.AnalogValue


STRA W AnalogValue ; A/D analog value

; The acquisition error is tested and the "ErrorFlag" is set.

ORGR
LODT Y ADsStatus K 0002 ; ADs.Status.EndCycle
ANDF Y ADsStatus K 0001 ; ADs.Status.DataReady
LTCH F ErrorFlag ; A/D acquisition error

; [End of file]

"C" example

The example uses a PCB085*000 A/D submodule mounted in the first slot of a coprocessor module
PCB072*000 set as address 1. In the example is executed an analog acquisition 0-10 Volt, of the voltage
connected to the clamps 1-2 (IN1COM-IN1). Debugging the operand unsigned int AnalogValue it's possible to
read the analog value expressed in millivolts from 0 to 10000. In case of conversion error the BOOL ErrorFlag
will be set. In the example also the FbPsystAnaCp coprocessor module management FB is reported.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPsystAnaCp.h>
#include <FbPsystADSubm.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

BOOL ErrorFlag; //A/D acquisition error


unsigned int AnalogValue; //A/D analog value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBPSYSTANACPDATA Cpr; //Cpr data structure


static FBPSYSTADSUBMDATA ADs; //A/D submodule data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first at first program execution loop.

if (PLCFirstLoop)
{
// Set the Cpr variables.

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (7 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystADSubm

Cpr.ModuleAddress=0x01; //Module address


Cpr.Command=1; //Command

// Set the A/D submodule variables.

ADs.Command.Enable=TRUE; //Channel enable


ADs.Command.PostFiltering=TRUE; //Channel post filtering
ADs.ModuleAddress=Cpr.ModuleAddress; //Module address
ADs.DMACh=0x00; //A/D, DMA channel
ADs.Function=0x09; //A/D, Function code
ADs.SlotChannel=0x10; //A/D, Slot & Channel
ADs.OutMode=0x00; //A/D, Output value mode
ADs.ScaleFactor=0x0000; //A/D, Scale factor
ADs.TimeOut=5000; //A/D, Timeout value
}

// -------------------------------------------------------------------------
// A/D ACQUISITION
// -------------------------------------------------------------------------
// Manage the Coprocessor module and the A/D submodule.

FbPsystAnaCp(&Cpr); //Coprocessor management


FbPsystADSubm(&ADs); //A/D submodule management

// Store the acquired value.

if (ADs.Status.EndCycle&ADs.Status.DataReady)
AnalogValue=ADs.AnalogValue; //A/D analog value

// Manage the acquisition error.

if (ADs.Status.EndCycle&!ADs.Status.DataReady)
ErrorFlag=TRUE; //A/D acquisition error
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystADSubm.htm (8 of 8) [06/10/2008 17.43.20]


Function blocks: FbPsystAnaCp

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPsystAnaCp

This function block allows to manage the Picosyst family coprocessor module.

Code:PFB033 History report


Prototype
FbPsystAnaCp.h

Declaration
void FbPsystAnaCp(FBPSYSTANACPDATA* S);

Parameters
FBPSYSTANACPDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 8 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

unsigned char Command; //Command byte


unsigned char NotUsed1;
unsigned char ModuleAddress; //Module address

// --------------------------------------------[Internal use only members]--


...
}FBPSYSTANACPDATA;

00 Command
Loaded by user program it defines the command that the module has to execute according to the table below.

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystAnaCp.htm (1 of 3) [06/10/2008 17.43.21]


Function blocks: FbPsystAnaCp

Value Description

0 STOP: Module waiting for the enable


The module remains in standby status, waiting for further commands. This status is reported by the
irregular flashing of the module led.
1 RUN: Module enabled
The module is enabled. This status is reported by the regular flashing of the module led.
2 ABORT: Module aborts the current function and restarts.
A "soft reset" is executed, the module restarts the DMA channels initialization cycle. This command
must be send only in case of fatal errors in the acquisition module management FB.
3 RESET: Module reset.
A "hard reset" is executed, the module waits the hardware reset of the microcontroller. this command
is the same as the ABORT command, but it is slower.

02 ModuleAddress
Loaded by user program it defines the module address (Range from 0x00 to 0x07).

RIL example

In the following example, the coprocessor module is parameterized and enabled. We remind that any
coprocessor module supports up to 3 A/D acquisition and/or D/A management submodules. For any A/D
acquisition channel the proper FbPsystADSubm FB must be used, for any D/A management channel the proper
FbPsystDASubm FB must be used.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Picosyst analog coprocessor module data structure.

DEFL Y Cpr KD 8
DEFL Y CprCommand Y Cpr KH 0000 ; Cpr.Command
DEFL Y CprModuleAddress Y Cpr KH 0002 ; Cpr.ModuleAddress

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block parameters are set.

ORGR
LODT F PLCFirstLoop
MOVI Y CprCommand KD 1 ; Cpr.Command
MOVI Y CprModuleAddress KD 1 ; Cpr.ModuleAddress

; ------------------------------------------------------------------------------
; @Section("Coprocessor management")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block is called.

ORGR
SETR
TASK L FbPsystAnaCp Y Cpr ; Coprocessor management

; [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystAnaCp.htm (2 of 3) [06/10/2008 17.43.21]


Function blocks: FbPsystAnaCp

"C" example

In the following example, the coprocessor module is parameterized and enabled. We remind that any
coprocessor module supports up to 3 A/D acquisition and/or D/A management submodules. For any A/D
acquisition channel the proper FbPsystADSubm FB must be used, for any D/A management channel the proper
FbPsystDASubm FB must be used.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPsystAnaCp.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBPSYSTANACPDATA Cpr; //Coprocessor data structure

// Set the coprocessor variables at first program execution loop.

if (PLCFirstLoop)
{
Cpr.Command=1; //Command
Cpr.ModuleAddress=0x01; //Module address
}

// Manage the coprocessor module.

FbPsystAnaCp(&Cpr); //Coprocessor management


}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystAnaCp.htm (3 of 3) [06/10/2008 17.43.21]


Function blocks: FbPsystDASubm

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPsystDASubm

This function block allows to manage the D/A submodule for the Picosyst family coprocessor module.

Code:PFB048 History report


Prototype
FbPsystDASubm.h

Declaration
void FbPsystDASubm(FBPSYSTDASUBMDATA* S);

Parameters
FBPSYSTDASUBMDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 20 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Channel enable
BOOL b1:1;
BOOL EnableWritePulse:1; //Enable write pulse
BOOL WritePulse:1; //Write pulse
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command; //Command

struct
{
BOOL Enabled:1; //Channel enabled
BOOL DataWritten:1; //Data was written
BOOL EndCycle:1; //End of write cycle
BOOL b3:1;
BOOL b4:1;
BOOL TimeoutError:1; //Channel timeout error
BOOL ConversionError:1; //Channel conversion error
BOOL b7:1;

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (1 of 6) [06/10/2008 17.43.23]


Function blocks: FbPsystDASubm

}Status; //Status

unsigned char ModuleAddress; //Module address


unsigned char DMACh; //DMA channel
unsigned char Function; //Function code
unsigned char NotUsed1;
unsigned char SlotChannel; //Slot & channel
unsigned char NotUsed2;
unsigned int AnalogValue; //D/A analog value
unsigned int TimeOut; //Timeout value

// --------------------------------------------[Internal use only members]--


...
}FBPSYSTDASUBMDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB no D/A conversions are executed.
TRUE: Enables the FB, it provides the management of the D/A channel.
2 EnableWritePulse FALSE: Commands the constant management of the analog value.
TRUE: Commands the management of the analog value only if the WritePulse bit is
set.
3 WritePulse Valid only if EnableWritePulse is set. It commands a pulse analog value management,
the bit is automatically reset. The Status.EndCycle bit set and the TimeoutError and
ConversionError bits not set indicates that the analog value is in output.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
1 DataWritten TRUE: The data in AnalogValue has been transferred to the D/A converter.
2 EndCycle TRUE: Indicates that the writing cycle has been completed. If the TimeoutError and
ConversionError bits not set with this bit set indicates that the analog value is in output.
For impulsive writings, by calculating the time that goes from the WritePulse bit setting
and the setting of this bit, you can obtain the analog value management time. This bit is
one shot, it's set only for a program loop.
5 TimeoutError TRUE: Indicates a timeout error on the command given to the coprocessor module, it
could be verified if the coprocessor module is in STAND-BY.
6 ConversionError TRUE: Indicates a conversion error on the acquisition channel, it could be verified if the
D/A submodule is not present.

02 ModuleAddress
Loaded by user program it defines the coprocessor module address on witch the D/A submodule is mounted.
It must be set at the first program loop and cannot be changed (Range from 0x00 to 0x07).
03 DMACh
Loaded by user program it defines the DMA channel number, used to acquire the desired channel. It must be
set at the first program loop and cannot be changed. ATTENTION! Use different values of DMACh for every
channel managed from A/D or D/A submodule inserted in the same coprocessor module (Range from 0x00
to 0x0F).
04 Function

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (2 of 6) [06/10/2008 17.43.23]


Function blocks: FbPsystDASubm

Loaded by user program it defines the function code to execute. The FB can be parameterized to manage
the output in voltage or in current. It must be set at the first program loop and cannot be changed, the
possible values are reported in the table.
Value Description

0x30 Voltage -10+10V


0x31 Current 0-20mA

06 SlotChannel
Loaded by user program it defines the coprocessor module slot where the D/A submodule is inserted, and
the software channel of the D/A submodule to which the analog value exits. It must be set at the first
program loop and cannot be changed.
Slot It's the number of the coprocessor module slot where the D/A submodule is inserted (Range from 1
to 3).
Channel It defines the number of the D/A software channel to be acquired. This number can be obtained
from the submodule documentation, it's related to the analog SourceCode to be acquired and to
the connection pins (Range from 0 to 3).

08 AnalogValue
Loaded by user program it defines the digital value to be converted to analogical value on the chosen
channel. For voltage conversion, this value is in millivolt (Range from -10000 to +10000 mV). For current
conversion, this value is in microampere (Range from 0 to 20000 uA).
0A TimeOut
Loaded by user program it defines the number of milliseconds after that, if there is no answer from the
coprocessor module, the Status.TimeoutError bit is set. The value 0 is replaced with the value 5000. In the
timeout time it is necessary to consider the user program loop time.

Example RIL

The example uses a PCB086*000 D/A submodule mounted in the first slot of a PCB072*000 coprocessor
module set with address 1. To test the example it's necessary also the part of program that manages the
FbPsystAnaCp coprocessor module management FB.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Picosyst analog coprocessor module data structure.

DEFL Y Cpr KD 8
DEFL Y CprCommand Y Cpr KH 0000 ; Cpr.Command
DEFL Y CprModuleAddress Y Cpr KH 0002 ; Cpr.ModuleAddress

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block parameters are set.

ORGR
LODT F PLCFirstLoop
MOVI Y CprCommand KD 1 ; Cpr.Command
MOVI Y CprModuleAddress KD 1 ; Cpr.ModuleAddress

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (3 of 6) [06/10/2008 17.43.23]


Function blocks: FbPsystDASubm

; ------------------------------------------------------------------------------
; @Section("Coprocessor management")
; ------------------------------------------------------------------------------
; Here the Picosyst analog coprocessor function block is called.

ORGR
SETR
TASK L FbPsystAnaCp Y Cpr ; Coprocessor management

In the example is executed an analog output 0-10 Volt, the output value will be available on the clamps 1-3
(EGND-V1). Debugging the operand W AnalogValue it's possible to set the analog value expressed in millivolts
from -10000 to +10000. In case of conversion error the F ErrorFlag will be set.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG F ErrorFlag ; A/D acquisition error


DEFG W AnalogValue ; A/D analog value

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Picosyst D/A submodule data structure.

DEFL Y DAs KD 20
DEFL Y DAsCommand Y DAs KH 0000 ; DAs.Command
DEFL Y DAsStatus Y DAs KH 0001 ; DAs.Status
DEFL Y DAsModuleAddress Y DAs KH 0002 ; DAs.ModuleAddress
DEFL Y DAsDMACh Y DAs KH 0003 ; DAs.DMACh
DEFL Y DAsFunction Y DAs KH 0004 ; DAs.Function
DEFL Y DAsSlotChannel Y DAs KH 0006 ; DAs.SlotChannel
DEFL W DAsAnalogValue Y DAs KH 0008 ; DAs.AnalogValue
DEFL W DAsTimeOut Y DAs KH 000A ; DAs.TimeOut

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the Picosyst D/A submodule function block is called.

ORGR
LODT F PLCFirstLoop
LTCH Y DAsCommand K 0000 ; DAs.Command.Enable
MOVI Y DAsModuleAddress KD 1 ; DAs.ModuleAddress
MOVI Y DAsDMACh KH 0005 ; DAs.DMACh
MOVI Y DAsFunction KH 0030 ; DAs.Function
MOVI Y DAsSlotChannel KH 0020 ; DAs.SlotChannel
MOVI W DAsTimeOut KD 5000 ; DAs.TimeOut

; ------------------------------------------------------------------------------
; @Section("D/A management")
; ------------------------------------------------------------------------------
; The "DataWritten" is tested and the output value is stored.

ORGR

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (4 of 6) [06/10/2008 17.43.23]


Function blocks: FbPsystDASubm

LODT Y DAsStatus K 0001 ; DAs.Status.DataWritten


LODA W AnalogValue ; A/D analog value
STRA W DAsAnalogValue ; DAs.AnalogValue

; Here the D/A submodule function block is called.

ORGR
SETR
TASK L FbPsystDASubm Y DAs ; D/A submodule management

; The management error is tested and the "ErrorFlag" is set.

ORGR
LODT Y DAsStatus K 0002 ; DAs.Status.EndCycle
ANDF Y DAsStatus K 0001 ; DAs.Status.DataWritten
LTCH F ErrorFlag ; D/A acquisition error

; [End of file]

"C" example

The example uses a PCB086*000 A/D submodule mounted in the first slot of a coprocessor module
PCB072*000 set as address 1. In the example is executed an analog output 0-10 Volt, the output value will be
available on the clamps 1-3 (EGND-V1). Debugging the operand unsigned int AnalogValue it's possible to set
the analog value expressed in millivolts from -10000 to +10000. In case of conversion error the BOOL ErrorFlag
will be set. In the example also the FbPsystAnaCp coprocessor module management FB is reported.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPsystAnaCp.h>
#include <FbPsystDASubm.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

BOOL ErrorFlag; //D/A management error


unsigned int AnalogValue; //D/A analog value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBPSYSTANACPDATA Cpr; //Cpr data structure


static FBPSYSTDASUBMDATA DAs; //D/A submodule data structure

// -------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (5 of 6) [06/10/2008 17.43.23]


Function blocks: FbPsystDASubm

// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first at first program execution loop.

if (PLCFirstLoop)
{
// Set the Cpr variables.

Cpr.ModuleAddress=0x01; //Module address


Cpr.Command=1; //Command

// Set the D/A submodule variables.

DAs.Command.Enable=TRUE; //Channel enable


DAs.ModuleAddress=Cpr.ModuleAddress; //Module address
DAs.DMACh=0x00; //D/A, DMA channel
DAs.Function=0x30; //D/A, Function code
DAs.SlotChannel=0x20; //D/A, Slot & Channel
DAs.TimeOut=5000; //D/A, Timeout value
}

// -------------------------------------------------------------------------
// D/A MANAGEMENT
// -------------------------------------------------------------------------
// Set the output value.

if (DAs.Status.DataWritten)
DAs.AnalogValue=AnalogValue; //D/A analog value

// Manage the coprocesor module and the D/A submodule.

FbPsystAnaCp(&Cpr); //Coprocesor management


FbPsystDASubm(&DAs); //D/A submodule management

// Manage the management error.

if (DAs.Status.EndCycle&!DAs.Status.DataWritten)
ErrorFlag=TRUE; //D/A management error
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPsystDASubm.htm (6 of 6) [06/10/2008 17.43.23]


Function blocks: FbPWMRegulation

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbPWMRegulation

This function block executes the PID regulation of a process using as output two PWM commands, up and dw.

Code:PFB072 History report


Prototype
FbPWMRegulation.h

Declaration
FbPWMRegulation(FBPWMREGULATIONDATA* S);

Parameters
FBPWMREGULATIONDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Struttura dati

The function block uses a 96 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //FB enable
BOOL b1:1;
BOOL IRegEnable:1; //I regulation enable
BOOL DRegEnable:1; //D regulation enable
BOOL UpLimit:1; //Up limit
BOOL DwLimit:1; //Dw limit
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL Enabled:1; //FB enabled
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL UpCmd:1; //Up command
BOOL DwCmd:1; //Dw command
BOOL b6:1;
BOOL b7:1;

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (1 of 6) [06/10/2008 17.43.25]


Function blocks: FbPWMRegulation

}Status;

unsigned char Dummy1[2];

float SetPoint; //Set point value


float Feedback; //Feedback value
unsigned char Dummy2[4];

unsigned int PWMTime; //PWM time (mSec)


unsigned char UpMaxWidth; //Up cmd max width (%)
unsigned char UpMinWidth; //Up cmd min width (%)
unsigned char DwMaxWidth; //Dw cmd max width (%)
unsigned char DwMinWidth; //Dw cmd min width (%)
unsigned char Dummy3[10];

float NearBand; //Near band


float DeadBand; //Dead band
float Kp; //Proportional coefficent (Nr)
float It; //Integrative time (Sec)
float Dt; //Derivative time (Sec)
unsigned char Dummy4[12];

// --------------------------------------------[Internal use only members]--

unsigned char Im[32]; //Internal members area

}FBPWMREGULATIONDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB and resets Status.
TRUE: Enables the FB.
2 IRegEnable TRUE:Enables the integrative regulation.
3 DRegEnable TRUE:Enables the derivative regulation.
4 UpLimit TRUE: Indicates that the actuator has reached its up limit.
5 DwLimit TRUE: Indicates that the actuator has reached its dw limit.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE:The FB is enabled.
4 UpCmd TRUE: Actuator up command.
5 DwCmd TRUE:Actuator dw command.

04 SetPoint
Loaded by user program it defines the process set point.
08 Feedback
Loaded by user program it defines the process feedback.
10 PWMTime
Loaded by user program it defines the PWM pulse duration on Up and Dw commands.The value is
expressed in mSec.
12 UpMaxWidth

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (2 of 6) [06/10/2008 17.43.25]


Function blocks: FbPWMRegulation

Loaded by user program it defines the maximum duration of the Up command as percentage value of the
defined PWMTime. If the Up command is greather than the defined value it's limited to it. The value is
expressed in %.
13 UpMinWidth
Loaded by user program it defines the minimum duration of the Up command as percentage value of the
defined PWMTime. If the Up command is less than the defined value the command is reset. The value is
expressed in %.
14 DwMaxWidth
Loaded by user program it defines the maximum duration of the Dw command as percentage value of the
defined PWMTime. If the Dw command is greather than the defined value it's limited to it. The value is
expressed in %.
15 DwMinWidth
Loaded by user program it defines the minimum duration of the Dw command as percentage value of the
defined PWMTime. If the Dw command is less than the defined value the command is reset. The value is
expressed in %.
20 NearBand
Loaded by user program it defines the near band value. When the process error given from the difference
between the SetPoint and the Feedback is less than the defined value the integrative and derivative
regulation are enabled.
24 DeadBand
Loaded by user program it defines the dead band value. When the process error given from the difference
between the SetPoint and the Feedback is less than the defined value the regulation are disabled.
28 Kp
Loaded by user program it defines the proportional coefficient. We remind that bigger is the value faster is
the regulation with an increasing of the overshot effect. The value is expressed as a number.
2C It
Loaded by user program it defines the integrative time. We remind that bigger is the value slower is the
integrative regulation to minimize the error. The value is expressed in Sec.
30 Dt
Loaded by user program it defines the derivative time. We remind that the bigger is the value faster is the
derivative regulation to minimize the error. The value is expressed in Sec.

Esempio RIL

In the following example it's managed a PWM regulation. In the example it's not reported the program part that
allow to define the set point and to read the feedback value.

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (3 of 6) [06/10/2008 17.43.25]


Function blocks: FbPWMRegulation

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------
; "FbPWMRegulation" data structure definition.

DEFG Y PWMr KD 96
DEFG Y PWMrCommand Y PWMr KH 0000 ;PWMr.Command
DEFG Y PWMrStatus Y PWMr KH 0001 ;PWMr.Status
DEFG FL PWMrSetPoint Y PWMr KH 0004 ;PWMr.SetPoint
DEFG FL PWMrFeedback Y PWMr KH 0008 ;PWMr.Feedback

DEFG W PWMrPWMTime Y PWMr KH 0010 ;PWMr.PWMTime


DEFG Y PWMrUpMaxWidth Y PWMr KH 0012 ;PWMr.UpMaxWidth
DEFG Y PWMrUpMinWidth Y PWMr KH 0013 ;PWMr.UpMinWidth
DEFG Y PWMrDwMaxWidth Y PWMr KH 0014 ;PWMr.DwMaxWidth
DEFG Y PWMrDwMinWidth Y PWMr KH 0015 ;PWMr.DwMinWidth

DEFG FL PWMrNearBand Y PWMr KH 0020 ;PWMr.NearBand


DEFG FL PWMrDeadBand Y PWMr KH 0024 ;PWMr.DeadBand
DEFG FL PWMrKp Y PWMr KH 0028 ;PWMr.Kp
DEFG FL PWMrIt Y PWMr KH 002C ;PWMr.It
DEFG FL PWMrDt Y PWMr KH 0030 ;PWMr.Dt

; ------------------------------------------------------------------------------
; @Section("FbPWMRegulation function block management")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.

ORGR
LODT F PLCFirstLoop
LTCH Y PWMrCommand BD 0 ;PWMr.Command.Enable
LTCH Y PWMrCommand BD 2 ;PWMr.Command.IRegEnable
LTCH Y PWMrCommand BD 3 ;PWMr.Command.DRegEnable

MOVI FL PWMrSetPoint KF 5.000000 ;PWMr.SetPoint


MOVI FL PWMrFeedback KF 4.000000 ;PWMr.Feedback

MOVI W PWMrPWMTime KD 2000 ;PWMr.PWMTime


MOVI Y PWMrUpMaxWidth KD 100 ;PWMr.UpMaxWidth
MOVI Y PWMrUpMinWidth KD 10 ;PWMr.UpMinWidth
MOVI Y PWMrDwMaxWidth KD 100 ;PWMr.DwMaxWidth
MOVI Y PWMrDwMinWidth KD 10 ;PWMr.DwMinWidth

MOVI FL PWMrNearBand KF 10.000000 ;PWMr.NearBand


MOVI FL PWMrDeadBand KF 0.100000 ;PWMr.DeadBand
MOVI FL PWMrKp KF 10.000000 ;PWMr.Kp
MOVI FL PWMrIt KF 0.000000 ;PWMr.It
MOVI FL PWMrDt KF 0.000000 ;PWMr.Dt

; Function block execution.

ORGR
SETR
TASK L FbPWMRegulation Y PWMr

; Here the command are copied to the logic outputs.

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (4 of 6) [06/10/2008 17.43.25]


Function blocks: FbPWMRegulation

ORGR
LODT Y PWMrStatus BD 4 ;PWMr.Status.UpCmd
OUTT O 0000 ;Up command

ORGR
LODT Y PWMrStatus BD 5 ;PWMr.Status.DwCmd
OUTT O 0001 ;Dw command

; [End of file]

Esempio "C"

In the following example it's managed a PWM regulation. In the example it's not reported the program part that
allow to define the set point and to read the feedback value.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbPWMRegulation.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void ExampleC(void)
{
// Local variable definitions.

static FBPWMREGULATIONDATA PWMr; //PWM regolation data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first program execution loop.

if (PLCFirstLoop)
{
PWMr.Command.Enable=TRUE; //FB enable
PWMr.Command.IRegEnable=TRUE; //I regulation enable
PWMr.Command.DRegEnable=TRUE; //D regulation enable

PWMr.SetPoint=5.0; //Set point value


PWMr.Feedback=4.0; //Feedback value

PWMr.PWMTime=2000; //PWM time (mSec)


PWMr.UpMaxWidth=100; //Up cmd max width (%)
PWMr.UpMinWidth=10; //Up cmd min width (%)
PWMr.DwMaxWidth=100; //Dw cmd max width (%)
PWMr.DwMinWidth=10; //Dw cmd min width (%)

PWMr.NearBand=10.0; //Near band

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (5 of 6) [06/10/2008 17.43.25]


Function blocks: FbPWMRegulation

PWMr.DeadBand=0.1; //Dead band


PWMr.Kp=10.0; //Proportional coefficent (Nr)
PWMr.It=0.0; //Integrative time (Sec)
PWMr.Dt=0.0; //Derivative time (Sec)
}

// -------------------------------------------------------------------------
// PWM MANAGEMENT
// -------------------------------------------------------------------------
// Function block execution.

FbPWMRegulation(&PWMr); //PWM regulation

// Here the command are copied to the logic outputs.

PLCOpO(0x0000)=PWMr.Status.UpCmd; //Up command


PLCOpO(0x0001)=PWMr.Status.DwCmd; //Dw command
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbPWMRegulation.htm (6 of 6) [06/10/2008 17.43.25]


Function blocks: FbQuoteMng

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbQuoteMng

This function block manages the quote value expressed on 32 bits. The FB is a useful complement in the
encoder acquisition operation, allowing to manage the revolution counter on the encoder value overflow.

Code:PFB059 History report


Prototype
FbQuoteMng.h

Declaration
void FbQuoteMng(FBQUOTEMNGDATA* S);

Parameters
FBQUOTEMNGDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 20 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// ----------------------[Members that can be managed by the user program]--

struct
{
BOOL Enable:1; //Enable quote management
BOOL Reverse:1; //Reverse quote counting
BOOL QuotePreset:1; //Quote preset
}Command;

struct
{
BOOL QuoteSign:1; //Quote sign
}Status;

unsigned int Transducer; //Transducer read value


unsigned long PresetValue; //Preset quote value
unsigned long Quote; //Quote value

// --------------------------------------------[Internal use only members]--


...
}FBQUOTEMNGDATA;

00 Command

http://192.168.0.61/Destination/Html/FctBlocks/FbQuoteMng.htm (1 of 4) [06/10/2008 17.43.27]


Function blocks: FbQuoteMng

Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB, the quote is not managed even if the value of the transducer
changes.
TRUE: Enables the FB to manage the quote.
1 Reverse TRUE: Commands the reverse quote counting.
2 QuotePreset TRUE: Copies the value of PresetValue on the quote value. The bit is automatically reset.

01 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: Indicates that the FB is enabled.

02 Transducer
Loaded by user program it is the value read by the quote transducer (Range da 0x0000 a 0xFFFF).

04 PresetValue
Loaded by user program it defines the value to which the quote is preset on Command.QuotePreset
command (Range from 0x00000000 to 0xFFFFFFFF).
08 Quote
Returns the quote value managed by the FB (Range from 0x00000000 to 0xFFFFFFFF).
0C Displacement
Returns the transducer displacement (Range from 0x0000 to 0xFFFF).

RIL example

In the following example it is acquired an encoder connected to the inputs INP 00 and INP 01 using the
FbEncoderOverIO FB, debugging the operand W EncoderQuote it's possible to display the encoder quote
expressed in pulses, it has range 0x0000-0xFFFF. The encoder quote value is passed to the FB that provide to
manage the revolution counter returning a quote value on Double (DW) operand, debugging the operand
DW AxleQuote it's possible to display the quote expressed in pulses.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG W EncoderQuote ; Encoder quote


DEFG DW AxleQuote ; Axle quote

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Encoder acquisition data structure.

DEFL Y Eacq KD 8
DEFL Y EacqInputs Y Eacq KH 0000 ; Eacq.Inputs
DEFL Y EacqError Y Eacq KH 0001 ; Eacq.Error
DEFL W EacqValue Y Eacq KH 0002 ; Eacq.Value

; Quote management data structure.

DEFL Y Qte KD 20
DEFL Y QteCommand Y Qte KH 0000 ; Qte.Command
DEFL Y QteStatus Y Qte KH 0001 ; Qte.Status

http://192.168.0.61/Destination/Html/FctBlocks/FbQuoteMng.htm (2 of 4) [06/10/2008 17.43.27]


Function blocks: FbQuoteMng

DEFL W QteTransducer Y Qte KH 0002 ; Qte.Transducer


DEFL DW QtePresetValue Y Qte KH 0004 ; Qte.PresetValue
DEFL DW QteQuote Y Qte KH 0008 ; Qte.Quote
DEFL W QteDisplacement Y Qte KH 000C ; Qte.Displacement

; ------------------------------------------------------------------------------
; @Section("Init")
; ------------------------------------------------------------------------------
; Here the function block parameters are set.

ORGR
LODT F PLCFirstLoop
MOVI Y EacqInputs KH 0000 ; Eacq.Inputs
LTCH Y QteCommand K 0000 ; Qte.Command.Enable
UTCH Y QteCommand K 0001 ; Qte.Command.Reverse

; ------------------------------------------------------------------------------
; @Section("Quote management")
; ------------------------------------------------------------------------------
; Here the encoder and the quote management function blocks are called.

ORGR
SETR
TASK L FbEncoderOverIO Y Eacq ; Encoder acquisition
MOVM W EncoderQuote W EacqValue ; Encoder quote
MOVM W QteTransducer W EncoderQuote ; Qte.Transducer
TASK L FbQuoteMng Y Qte ; Quote management
MOVM DW AxleQuote DW QteQuote ; Axle quote

; [End of file]

"C" example

In the following example it is acquired an encoder connected to the inputs INP 00 and INP 01 using the
FbEncoderOverIO FB, debugging the variable unsigned int EncoderQuote it's possible to display the encoder
quote expressed in pulses, it has range 0x0000-0xFFFF. The encoder quote value is passed to the FB that
provide to manage the revolution counter returning a quote value on unsigned long variable, debugging the
variable unsigned long AxleQuote it's possible to display the quote expressed in pulses. It's managed also an
auxiliary long variable AuxQuote it returns the quote with sign.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbEncoderOverIO.h>
#include <FbQuoteMng.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------

unsigned int EncoderQuote; //Encoder quote

http://192.168.0.61/Destination/Html/FctBlocks/FbQuoteMng.htm (3 of 4) [06/10/2008 17.43.27]


Function blocks: FbQuoteMng

unsigned long AxleQuote; //Axle quote


signed long AuxQuote; //Auxiliary quote

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static FBENCODEROVERIODATA Eacq; //Encoder acquisition data structure


static FBQUOTEMNGDATA Qte; //Quote management data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute variables init at first program execution loop.

if (PLCFirstLoop)
{
Eacq.Inputs=0x00; //Logic inputs selection
Qte.Command.Enable=TRUE; //Enable quote management
Qte.Command.Reverse=FALSE; //Reverse quote counting
}

// -------------------------------------------------------------------------
// QUOTE MANAGEMENT
// -------------------------------------------------------------------------
// When the quote sign is negative the quote is preset to 0.

if (Qte.Status.QuoteSign)
{
Qte.PresetValue=0; //Preset quote value
Qte.Command.QuotePreset=TRUE; //Quote preset
}

// Here the encoder and the quote management function blocks are called.

FbEncoderOverIO(&Eacq); //Acquisizione encoder


Qte.Transducer=Eacq.Value; //Transducer read value
FbQuoteMng(&Qte); //Quote management

// The following statements are written only to enable the debug of the
// encoder and axle quotes.

EncoderQuote=Eacq.Value; //Encoder quote


AxleQuote=Qte.Quote; //Axle quote

// Here an example how it's possible to manage a proper quote by using the
// displacement value.

AuxQuote+=(signed int)Qte.Displacement; //Auxiliary quote


}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbQuoteMng.htm (4 of 4) [06/10/2008 17.43.27]


Function blocks: FbRtuManager
ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbRtuManager

This function block executes the full management of a RTU (Remote Terminal Unit) telecontrol station. The main characteristics are:

Management up to 256 16 bits analog variables


Management up to 256 boolean variables
Management up to 256 16 bits counters
Management variable trend on programmable base time
Events on minimum/maximum variable value

Using this FB with the MODEM management FB and with the RTU and Ascii Modbus communication FB you can realize a
full telecontrol system on PSTN or GSM telephone.

Code:PFB061 History report


Prototype
FbRtuManager.h

Declaration
void FbRtuManager(FBRTUMANAGERDATA* S);

Parameters
FBRTUMANAGERDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Variables input

For the variables input the user program has to define three unsigned int data arrays. One is for the boolean variables, it must
have the same dimension as the number of variables defined FBRTUPROGRAMRPT.BooleanCh. One is for the analog variables,
it must have the same dimension as the number of variables defined FBRTUPROGRAMRPT.AnalogCh. One is for the counters,
it must have the same dimension as the number of variables defined FBRTUPROGRAMRPT.CounterCh.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (1 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

unsigned int BoolIdt[BOOLCH]; //Boolean variables


unsigned int AnaIdt[ANALOGCH]; //Analog variables
unsigned int CntrIdt[COUNTERCH]; //Counters

.. BoolIdt
Boolean variables copy array, an unsigned int is used for every variable. The user program has to copy the status of every variable
in the proper buffer.
.. AnaIdt
Analog variables copy array, an unsigned int is used for every variable. The user program has to copy the status of every variable
in the proper buffer.
.. CntrIdt
Counters copy array, an unsigned int is used for every counter. The user program has to copy the status of every counter in
the proper buffer.

Program configuration

For the program configuration the user program has to allocate in the backup memory a 32 bytes data structure
of FBRTUPROGRAMRPT type, here the prototype.

typedef struct
{
// ------------------------------[Members that can be managed from remote]--

struct
{
BOOL b8:1;
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL bC:1;
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL b0:1;
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (2 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

struct
{
BOOL b8:1;
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL bC:1;
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL b0:1;
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned int UnitNumber; //Unit identifier number


unsigned int TrendTiming; //Timed trend interval time (Min)
unsigned int MinAcq; //Minimal acquire (%)
unsigned char Dummy1[6]; //To maintain offset for backup

unsigned long NextTrendAddr; //Next trend address


unsigned long NextEventAddr; //Next event address
unsigned char Dummy2[8]; //To maintain offset for backup
}FBRTUPROGRAMRPT;

00 Command
RTU command bits.

02 Status
RTU status bits.
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (3 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

04 UnitNumber
Defines the number of the system, it can be read by the supervisor to identify the system in case of call from the remote
system (Range from 0x0000 to 0xFFFF).
06 TrendTiming
Defines the interval time between the execution of the temporal trend. The value is expressed in minutes (Range from 0 to 1080).
08 MinAcq
Defines the minimum number of acquisition to considered a variable value valid for the trend. The value is expressed in
percentage (Range from 0 to 100).
10 NextTrendAddr
Returns the next trend record memo address (Range from 0x00000000 to 0xFFFFFFFF).
14 NextEventAddr
Returns the next event record memo address (Range from 0x00000000 to 0xFFFFFFFF).

Boolean variable configuration

For the configuration of every boolean variable the user program has to allocate in the backup memory a 8 bytes data structure
of FBRTUBOOLCFG type, here the prototype. It's necessary to define a structure array equal to the number of variables to manage.

typedef struct
{
// ------------------------------[Members that can be managed from remote]--

struct
{
BOOL TrendOnTime:1; //Request trend on timing
BOOL EventOnMax:1; //Event on max value
BOOL EventOnMin:1; //Event on min value
BOOL bB:1;
BOOL CallOnMax:1; //Request call on max value
BOOL CallOnMin:1; //Request call on min value
BOOL bE:1;
BOOL bF:1;

BOOL Enable:1; //Enable variable management


BOOL b1:1;
BOOL b2:1;
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (4 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

unsigned int CallDelay; //Call delay time (Sec)


unsigned int Filter; //Filter factor
unsigned char Dummy[2]; //To maintain offset for backup
}FBRTUBOOLCFG;

00 Command
Logic variable command bits.
0 Enable TRUE: Enables the variable management.
8 TrendOnTime TRUE: Enables the variable trend on temporal time defined on TrendTiming.
9 EventOnMax TRUE: Enables the report of the event in case the variable reaches the maximum value. For the boolean variables the maximum
value is the condition TRUE.
A EventOnMin TRUE: Enables the report of the event in case the variable reaches the minimum value. For the boolean variables the minimum
value is the condition FALSE.
C CallOnMax TRUE: Enables the phone call in case the variable reaches the maximum value. For the boolean variables the maximum value is
the condition TRUE.
D CallOnMin TRUE: Enables the phone call in case the variable reaches the minimum value. For the boolean variables the minimum value is
the condition FALSE.

02 CallDelay
It defines the value of time during which the call should be enabled before to be executed. If the call condition doesn't last for
the definite time the call is not executed (Range from 0 to 65535 Sec).
04 Filter
Defines the time value, that the variable status has to be maintained to be considered valid. If the value is 0 the variable status
is immediately considered valid. The value is expressed in mSec (Range from 0 to 65535).

Analog variable configuration

For the configuration of every analog variable the user program has to allocate in the backup memory a FBRTUANALOGCFG type
16 bytes data structure, here the prototype. It's necessary to define a structure array equal to the number of variables to manage.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (5 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

typedef struct
{
// ------------------------------[Members that can be managed from remote]--

struct
{
BOOL TrendOnTime:1; //Request trend on timing
BOOL EventOnMax:1; //Event on max value
BOOL EventOnMin:1; //Event on min value
BOOL bB:1;
BOOL CallOnMax:1; //Request call on max value
BOOL CallOnMin:1; //Request call on min value
BOOL bE:1;
BOOL bF:1;

BOOL Enable:1; //Enable variable management


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

unsigned int CallDelay; //Call delay time (Sec)


unsigned int Filter; //Filter factor
unsigned int MaxValue; //Max value
unsigned int MaxValueReturn; //Value back from max
unsigned int MinValueReturn; //Value back from min
unsigned int MinValue; //Min value
unsigned char Dummy[2]; //To maintain offset for backup
}FBRTUANALOGCFG;

00 Command
Analog variable command bits

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (6 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

0 Enable TRUE: Enables the variable management.


8 TrendOnTime TRUE: Enables the variable trend on temporal time defined on TrendTiming.
9 EventOnMax TRUE: Enables the report of the event in case the variable reaches the maximum value defined in MaxValue.
A EventOnMin TRUE: Enables the report of the event in case the variable reaches the minimum value defined in MinValue.
C CallOnMax TRUE: Enables the phone call in case the variable reaches the maximum value defined in MaxValue. The phone call is enabled
also when the value of the variable comes down under to the return value defined in MaxValueReturn.
D CallOnMin TRUE: Enables the phone call in case the variable reaches the minimum value defined in MinValue. The phone call is enabled
also when the value of the variable go up over to the return value defined in MinValueReturn.

02 CallDelay
Defines the value of time during which the call should be enabled before to be executed. If the call condition doesn't last for the
definite time the call is not executed (Range from 0 to 65535 Sec).
04 Filter
Defines the filter value to apply to the variable value. If the value is 0, no filter is applied (Range from 0 to 65535).
06 MaxValue
Defines the maximum value the variable can reach, over than an event and/or a phone call will be made (Range from 0 to 65535).
08 MaxValueReturn
Defines the value under which a return from MaxValue value it's considered (Range from 0 to 65535).
0A MinValueReturn
Defines the value over which a return from MinValue value it's considered (Range from 0 to 65535).
0C MinValue
Defines the minimum value the variable can reach, under than an event and/or a phone call will be made (Range from 0 to 65535).

Counter configuration

For the configuration of every counter the user program has to allocate in the backup memory a FBRTUCOUNTERCFG type 16
bytes data structure, here the prototype. It's necessary to define a structure array equal to the number of variables to manage.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (7 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

typedef struct
{
// ------------------------------[Members that can be managed from remote]--

struct
{
BOOL TrendOnTime:1; //Request trend on timing
BOOL EventOnMax:1; //Event on max value
BOOL EventOnMin:1; //Event on min value
BOOL bB:1;
BOOL CallOnMax:1; //Request call on max value
BOOL CallOnMin:1; //Request call on min value
BOOL bE:1;
BOOL bF:1;

BOOL Enable:1; //Enable variable management


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Command;

unsigned int CallDelay; //Call delay time (Sec)


unsigned int MaxValue; //Max value
unsigned int MaxValueReturn; //Value back from max
unsigned int MinValueReturn; //Value back from min
unsigned int MinValue; //Min value
unsigned char Dummy[4]; //To maintain offset for backup
}FBRTUCOUNTERCFG;

00 Command
Counter command bits

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (8 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

0 Enable TRUE: Enables the counter management.


8 TrendOnTime TRUE: Enables the counter trend on temporal time defined on TrendTiming.
9 EventOnMax TRUE: Enables the report of the event in case the counter reaches the maximum value defined in MaxValue.
A EventOnMin TRUE: Enables the report of the event in case the counter reaches the minimum value defined in MinValue.
C CallOnMax TRUE: Enables the phone call in case the variable reaches the maximum value defined in MaxValue. The phone call is enabled
also when the value of the variable comes down under to the return value defined in MaxValueReturn.
D EventOnMin TRUE: Enables the phone call in case the variable reaches the minimum value defined in MinValue. The phone call is enabled
also when the value of the variable go up over to the return value defined in MinValueReturn.

02 CallDelay
Defines the value of time during which the call should be enabled before to be executed. If the call condition doesn't last for the
definite time the call is not executed (Range from 0 to 65535 Sec).
04 MaxValue
Defines the maximum value the counter can reach, over than an event and/or a phone call will be made (Range from 0 to 65535).
06 MaxValueReturn
Defines the value under which a return from MaxValue value it's considered (Range from 0 to 65535).
08 MinValueReturn
Defines the value over which a return from MinValue value it's considered (Range from 0 to 65535).
0A MinValue
Defines the minimum value the counter can reach, under than an event and/or a phone call will be made (Range from 0 to 65535).

Boolean variable status

For the status of every boolean variable the user program has to allocate a FBRTUBOOLSTS type 4 bytes data structure, here
the prototype. It's necessary to define a structure array equal to the number of variables to manage.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (9 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

typedef struct
{
// ---------------------------------[Members that can be read from remote]--

struct
{
BOOL MaxValue:1; //Max value
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL MinValue:1; //Min value
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL Enabled:1; //Variable management enabled


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned int OutputValue; //Output value


}FBRTUBOOLSTS;

00 Status
Returns the boolean variable status bits.
0 Enabled TRUE: The variable management is enabled. It is the answer to the FBRTUBOOLCFG.Command.Enable bit.
8 MaxValue TRUE: The variable is at high level. For the boolean variable is considered as high level the the condition TRUE.
C MinVaule TRUE: The variable is at low level. For the boolean variable is considered as low level the the condition FALSE.

02 OutputValue
Returns the boolean variable value (Range from 0 to 1).

Analog variable status

For the status of every analog variable the user program has to allocate a FBRTUANALOGSTS type 4 bytes data structure, here

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (10 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

the prototype. It's necessary to define a structure array equal to the number of variables to manage.

typedef struct
{
// ---------------------------------[Members that can be read from remote]--

struct
{
BOOL MaxValue:1; //Max value
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL MinValue:1; //Min value
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL Enabled:1; //Variable management enabled


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned int OutputValue; //Output value


}FBRTUANALOGSTS;

00 Status
Returns the analog variable status bits.
0 Enabled TRUE: The variable management is enabled. It is the answer to the FBRTUANALOGCFG.Command.Enable bit.
8 MaxValue TRUE: The variable value is equal or bigger than the value set in FBRTUANALOGCFG.MaxValue.
C MinValue TRUE: The variable value is equal orslower than the value set in FBRTUANALOGCFG.MinValue.

02 OutputValue
Returns the analog variable value (Range from 0 to 65535).

Counter status
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (11 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

For the status of every counter the user program has to allocate a FBRTUCOUNTERSTS type 4 bytes data structure, here
the prototype. It's necessary to define a structure array equal to the number of variables to manage.

typedef struct
{
// ---------------------------------[Members that can be read from remote]--

struct
{
BOOL MaxValue:1; //Max value
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL MinValue:1; //Min value
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL Enabled:1; //Variable management enabled


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL b7:1;
}Status;

unsigned int OutputValue; //Output value


}FBRTUCOUNTERSTS;

00 Status
Returns the counter variable status bits.
0 Enabled TRUE: The counter management is enabled. It is the answer to the FBRTUCOUNTERCFG.Command.Enable bit.
8 MaxValue TRUE: The counter value is equal or bigger than the value set in FBRTUCOUNTERCFG.MaxValue.
C MinValue TRUE: The counter value is equal or lower than the value set in FBRTUCOUNTERCFG.MinValue.

02 OutputValue
Returns the counter value (Range from 0 to 65535).

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (12 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

Boolean variable management

For the management of every boolean variable the user program has to allocate a FBRTUBOOLMNG type data structure, here
the prototype. It's necessary to define a structure array equal to the number of variables to manage.

typedef struct
{
// --------------------------------------------[Internal use only members]--

...
}FBRTUBOOLMNG;

Analog variable management

For the management of every analog variable the user program has to allocate a FBRTUANALOGMNG type data structure, here
the prototype. It's necessary to define a structure array equal to the number of variables to manage.

typedef struct
{
// --------------------------------------------[Internal use only members]--

...
}FBRTUANALOGMNG;

Counter management

For the management of every counter the user program has to allocate a FBRTUCOUNTERMNG type data structure, here
the prototype. It's necessary to define a structure array equal to the number of counters to manage.

typedef struct
{
// --------------------------------------------[Internal use only members]--

...
}FBRTUCOUNTERMNG;

Data structure

The function block uses a 192 bytes data structure, we report a prototype. The members reported under the Internal use
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (13 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

only members label, are members used inside by the function block and they don't have to be changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL UserTrend:1; //Start trend by user
BOOL b9:1;
BOOL bA:1;
BOOL bB:1;
BOOL bC:1;
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL Enable:1; //Enable


BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
BOOL TrendLock:1; //Trend lock
BOOL EventInit:1; //Event init
BOOL b6:1;
BOOL Acknowledge:1; //Acknowledge
}Command;

struct
{
BOOL TrendAddressError:1; //Trend address error
BOOL TrendWriteError:1; //Trend write error
BOOL TrendTimeError:1; //Trend time error
BOOL bB:1;
BOOL EventAddressError:1; //Event address error
BOOL EventWriteError:1; //Event write error
BOOL bE:1;
BOOL bF:1;

BOOL Enabled:1; //Enabled


BOOL b1:1;
BOOL b2:1;
BOOL TrendEnabled:1; //Trend on time enabled
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (14 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager
BOOL b4:1;
BOOL b5:1;
BOOL b6:1;
BOOL Call:1; //Call request
}Status;

// -----------------------------[Members that must be set by user program]--

unsigned char BooleanCh; //Boolean channels


unsigned char AnalogCh; //Analog channels
unsigned char CounterCh; //Counter channels
unsigned char Dummy1[1]; //To maintain binary length

unsigned int* BoolIdt; //Boolean input data table


unsigned int* AnaIdt; //Analog input data table
unsigned int* CntrIdt; //Counter input data table
unsigned char Dummy2[2]; //To maintain binary length

unsigned char TrendAreaType; //Trend area type


unsigned char Dummy3[3]; //To maintain binary length
unsigned long TrendAreaBegin; //Trend area origin address
unsigned long TrendAreaEnd; //Trend area end address

unsigned char EventAreaType; //Event area type


unsigned char Dummy4[3];
unsigned long EventAreaBegin; //First address for event area
unsigned long EventAreaEnd; //Last address for event area
unsigned char Dummy5[4]; //To maintain binary length

unsigned char ChAtLoop; //Channels managed at every loop


unsigned char Dummy6[3]; //To maintain binary length

FBRTUPROGRAMRPT xdata* Pr; //Program report

FBRTUBOOLCFG xdata* Bc; //Boolean configurations


FBRTUANALOGCFG xdata* Ac; //Analog configurations
FBRTUCOUNTERCFG xdata* Cc; //Counter configurations

FBRTUBOOLSTS xdata* Bs; //Boolean status


FBRTUANALOGSTS xdata* As; //Analog status
FBRTUCOUNTERSTS xdata* Cs; //Counter status

FBRTUBOOLMNG xdata* Bm; //Boolean management


FBRTUANALOGMNG xdata* Am; //Analog management
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (15 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

FBRTUCOUNTERMNG xdata* Cm; //Counter management

PLCRTCDATA xdata* Rtc; //Real time clock


unsigned char Dummy7[2]; //To maintain binary length

// -----------------------------[Members that can be read by user program]--

unsigned int TrendRecordSize; //Trend record size (Byte)


unsigned int TrendRecords; //Number of trend records
unsigned int EventRecordSize; //Event record size (Byte)
unsigned int EventRecords; //Number of event records

char FbCode[11]; //Function block code


unsigned char FbDataSize; //Function block data structure size (Byte)
unsigned char PrSize; //Program report data structure size (Byte)

unsigned char BcSize; //Boolean configurations data structure size (Byte)


unsigned char AcSize; //Analog configurations data structure size (Byte)
unsigned char CcSize; //Counter configurations data structure size (Byte)

unsigned char BsSize; //Boolean status data structure size (Byte)


unsigned char AsSize; //Analog status data structure size (Byte)
unsigned char CsSize; //Counter status data structure size (Byte)

unsigned char BmSize; //Boolean management data structure size (Byte)


unsigned char AmSize; //Analog management data structure size (Byte)
unsigned char CmSize; //Counter management data structure size (Byte)

unsigned char Dummy8[10]; //To maintain binary length

// --------------------------------------------[Internal use only members]--

}FBRTUMANAGERDATA;

00 Command
Command bits, the user program can manage these bits according to its needs.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (16 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

0 Enable FALSE: Disable the FB.


TRUE: Enable the FB.
4 TrendLock TRUE: Locks the variables trend execution. On the reset front it's executed the trend variables calculation.
5 EventInit TRUE: Clears the event memory. It's automatically reset.
7 Acknowledge TRUE: Forces the FB status acknowledgement, it's automatically reset. When active it resets Status.Call,
Status.TrendAddressError, Status.TrendWriteError, Status.EventAddressError, Status.EventWriteError.
8 UserTrend TRUE: Forces a trend record memorization. It's automatically reset.

02 Status
Status bits, the user program can test these bits.
0 Enabled TRUE: The FB is enabled.
3 TrendEnabled TRUE: The trend management is enabled.
7 Call TRUE: MODEM call in progress. It remains active until the Command.Acknowledge bit is set.
8 TrendAddressError TRUE: At system power up the value of FBRTUPROGRAMRPT.NextTrendAddr is outside the defined trend memory address
range, the value is set to the begin address. It remains active until the Command.Acknowledge bit is set.
9 TrendWriteError TRUE: Trend write error. It remains active until the Command.Acknowledge bit is set.
A TrendTimeError TRUE: It's not possible of to save the trend because the definite time value of in TrendTiming is greater of 18 hours.
C EventAddressError TRUE: At system power up the value of FBRTUPROGRAMRPT.NextEventAddr is outside the defined event memory address
range, the value is set to the begin address. It remains active until the Command.Acknowledge bit is set.
D EventWriteError TRUE: Event write error. It remains active until the Command.Acknowledge bit is set.

04 BooleanCh
Loaded by user program it defines the number of boolean variables to manage (Range from 1 to 255).
05 AnalogCh
Loaded by user program it defines the number of analog variables to manage (Range from 1 to 255).
06 CounterCh
Loaded by user program it defines the number of counters to manage (Range from 1 to 255).
08 BoolIdt
Loaded by user program it defines the allocation address of the boolean variable in input (Range from 0x0000 to 0xFFFF).

0A AnaIdt
Loaded by user program it defines the allocation address of the analog variable in input (Range from 0x0000 to 0xFFFF).

0C CntrIdt
Loaded by user program it defines the allocation address of the counters in input (Range from 0x0000 to 0xFFFF).

10 TrendAreaType

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (17 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

Loaded by user program it defines the memory type used as trend memory. Please refer to SystemMemoryRead
e SystemMemoryWrite functions. ATTENTION! The user code memory cannot be useed.

14 TrendAreaBegin
Loaded by user program it defines the trend memory start address (Range from 0x00000000 to0xFFFFFFFF).
18 TrendAreaEnd
Loaded by user program it defines the trend memory end address (Range from 0x00000000 to0xFFFFFFFF).
1C EventAreaType
Loaded by user program it defines the memory type used as event memory. Please refer to SystemMemoryRead
e SystemMemoryWrite functions. ATTENTION! The user code memory cannot be useed.

20 EventAreaBegin
Loaded by user program it defines the event memory start address (Range from 0x00000000 to 0xFFFFFFFF).
24 EventAreaEnd
Loaded by user program it defines the event memory end address (Range from 0x00000000 to 0xFFFFFFFF).
2C ChAtLoop
Loaded by user program it defines the number of channels for every variable type (boolean, analog, counter) that should be
managed at every program loop. If the value is "0" it will be automatically set to "1" (Range from 0x00 to 0xFF).
30 Pr
Loaded by user program it defines the FBRTUPROGRAMRPT program report data structure allocation address (Range from
0x0000 to 0xFFFF).
32 Bc
Loaded by user program it defines the FBRTUBOOLCFG boolean variables configuration data structure (Range from 0x0000
to 0xFFFF).
34 Ac
Loaded by user program it defines the FBRTUANALOGCFG analog variables configuration data structure allocation address
(Range from 0x0000 to 0xFFFF).
36 Cc
Loaded by user program it defines the FBRTUCOUNTERCFG counters configuration data structure allocation address (Range
from 0x0000 to 0xFFFF).
38 Bs
Loaded by user program it defines the FBRTUBOOLSTS boolean variables status data structure allocation address (Range
from 0x0000 to 0xFFFF).
3A As
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (18 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

Loaded by user program it defines the FBRTUANALOGSTS analog variables status data structure allocation address (Range
from 0x0000 to 0xFFFF).
3C Cs
Loaded by user program it defines the FBRTUCOUNTERSTS counters status data structure allocation address (Range from
0x0000 to 0xFFFF).
3E Bm
Loaded by user program it defines the FBRTUBOOLMNG boolean variables management data structure allocation address
(Range from 0x0000 to 0xFFFF).
40 Am
Loaded by user program it defines the FBRTUANALOGMNG analog variables management data structure allocation address
(Range from 0x0000 to 0xFFFF).
42 Cm
Loaded by user program it defines the FBRTUCOUNTERMNG counters management data structure allocation address (Range
from 0x0000 to 0xFFFF).
44 Rtc
Loaded by user program it defines the real time clock data structure allocation address (Range from 0x0000 to 0xFFFF).
48 TrendRecordSize
Returns the trend record length in bytes (Range from 0 to 65535).
4A TrendRecords
Returns the number of trend records that can be contained in the defined trend memory area (Range from 0 to 65535).
4C EventRecordSize
Returns the event record length in bytes (Range from 0 to 65535).
4E EventRecords
Returns the number of event records that can be contained in the defined event memory area (Range from 0 to 65535).
50 FbCode[11]
String that contains the FB version, i.e.: "PFB061D000".
5B FbDataSize
Returns the FBRTUMANAGERDATA FB data structure size, in bytes (Range from 0 to 255).

5C PrSize
Returns the FBRTUPROGRAMRPT program report data structure size in bytes (Range from 0 to 255).

5D BcSize

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (19 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

Returns the FBRTUBOOLCFG boolean configurations data structure size in bytes (Range from 0 to 255).

5E AcSize
Returns the FBRTUANALOGCFG analog configurations data structure size in bytes (Range from 0 to 255).

5F CcSize
Returns the FBRTUCOUNTERCFG counter configurations data structure size in bytes (Range from 0 to 255).

60 BsSize
Returns the FBRTUBOOLSTS boolean status data structure size in bytes (Range from 0 to 255).

61 AsSize
Returns the FBRTUANALOGSTS analog status data structure size in bytes (Range from 0 to 255).

62 CsSize
Returns the FBRTUCOUNTERSTS counter status data structure size in bytes (Range from 0 to 255).

63 BmSize
Returns the FBRTUBOOLMNG boolean management data structure size in bytes (Range from 0 to 255).

64 AmSize
Returns the FBRTUANALOGMNG analog management data structure size in bytes (Range from 0 to 255).

65 CmSize
Returns the FBRTUCOUNTERMNG counter management data structure size in bytes (Range from 0 to 255).

Trend record

As seen before, the FB can save any defined time FBRTUPROGRAMRPT.TrendTiming the trend data for every variable. Must
be defined the memory type FBRTUMANAGERDATA.TrendAreaType, the start address FBRTUMANAGERDATA.
TrendAreaBegin and the end address FBRTUMANAGERDATA.TrendAreaEnd of the system memory area where the trends
are saved. The defined area is divided in a number of records FBRTUMANAGERDATA.TrendRecords everyone of the dimension
to contain all the variables in trend FBRTUMANAGERDATA.TrendRecordSize. At every trend execution it will be write a
record, starting from the trend memory begin address till the trend memory end address. Reached the memory end address the
next trend will be write to starting from the trend memory begin again.

The trend record starts with a FBRTUSYSTEMTIME data structure, it contains informations about date and time.

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (20 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

typedef struct
{
unsigned char Year; //Year, range from 0 to 99
unsigned char Month; //Month, range from 1 to 12
unsigned char Day; //Day, range from 1 to 31
unsigned char Hour; //Hour, range from 0 to 23
unsigned char Minute; //Minute, range from 0 to 59
unsigned char Second; //Second, range from 0 to 59
}FBRTUSYSTEMTIME;

00 Year
Year (Range from 0 to 99).
01 Month
Month (Range from 1 to 12).
02 Day
Day (Range from 1 to 31).
03 Hour
Hour (Range from 0 to 23).
04 Minute
Minutes (Range from 0 to 59).
05 Second
Seconds (Range from 0 to 59).

For every boolean variable defined in trend FBRTUBOOLCFG.Command.TrendOnTime=TRUE, a FBRTUTRENDBOOL


data structure will be memorized with the following data:

typedef struct
{
unsigned char Value; //Entry value
unsigned char EdgeCntr; //EdgeCntr
unsigned int HighLevelTime; //High level Time [sec]
}FBRTUTRENDBOOL;

00 Value
Entry value of the variable (Range from 0 to 1).
01 EdgeCntr
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (21 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

Number of changes of the variable during the trend interval (Range from 0 to 255).
02 HighLevelTime
Time on wich the variable was in the level TRUE during the trend interval, expressed in Sec (Range from 0 to 65535).

For every analog variable defined in trend FBRTUANALOGCFG.Command.TrendOnTime=TRUE, a FBRTUTRENDANALOG


data structure will be memorized with the following data:

typedef struct
{
unsigned int Value; //Entry value
unsigned int MinValue; //Min value
unsigned int MaxValue; //High level
unsigned int AverageValue; //Average value
unsigned int OfsTimeMinVal; //Offset time for min value
unsigned int OfsTimeMaxVal; //Offset time for max value
}FBRTUTRENDANALOG;

00 Value
Entry value of the variable (Range from 0 to 65535).
02 MinValue
Minimum value reached during the trend interval (Range from 0 to 65535).
04 MaxValue
Maximum value reached during the trend interval (Range from 0 to 65535).
06 AverageValue
Average value during the trend interval (Range from 0 to 65535).
08 OfsTimeMinVal
Offset time to which the variable has reached its minimum value starting at the trend interval, expressed in second (Range from 0
to 65535).
0A OfsTimeMaxVal
Offset time to which the variable has reached its maximum value starting at the trend interval, expressed in second (Range from 0
to 65535).

For every counter defined in trend FBRTUCOUNTERSTS.Command.TrendOnTime=TRUE, a FBRTUTRENDCOUNTER


data structure will be memorized with the following data:

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (22 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

typedef struct
{
unsigned int Value; //Entry value
signed int CntrIncr; //Partial increment
}FBRTUTRENDCOUNTER;

00 Value
Entry value of the counter (Range from 0 to 65535).
02 CntrIncr
Variation value from the entry value during the trend interval (Range from -32768 to +32767).

The trend record terminates with the whole record CRC value. It's calculated by using the MemCRC function defining as init CRC
the 0xFFFF value (Range from 0 to 65535).

Event record

As seen before, the FB can save events. Must be defined the memory type FBRTUMANAGERDATA.EventAreaType, the
start address FBRTUMANAGERDATA.EventAreaBegin and the end address FBRTUMANAGERDATA.EventAreaEnd of
the system memory area where the events are saved. The defined area is divided in a number of records
FBRTUMANAGERDATA.EventRecords everyone of the dimension to contain the event FBRTUMANAGERDATA.
EventRecordSize. At every event it will be write a record, starting from the event memory begin address till the event memory
end address. Reached the memory end address the next event will be write to starting from the event memory begin again. Any
event is stored in the FBRTUEVENT event data structure.

typedef struct
{
FBRTUSYSTEMTIME Date; //Event record time
unsigned char Type; //Variable type
unsigned char Nr; //Variable number
unsigned int Value; //Variable value
unsigned int CRC; //Event record CRC
}FBRTUEVENT;

00 Date
Contains informations about day, month, year and hour, minute, second when the event is happened, refer to
FBRTUSYSTEMTIME data structure.
06 Type

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (23 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

Variable type (Range from 0 to 255).


0:Bolean variable, 1:Analog variable, 2:Counter
07 Nr
Progressive variable number (Range from 0 to 255).
08 Value
Variable value (Range from 0 to 65535).
0A CRC
Event record CRC. It's calculated by using the MemCRC function defining as init CRC the 0xFFFF value (Range from 0 to 65535).

RIL example

No examples available.

"C" example

In the following example are managed 4 bolean variables, 4 analog variables and 4 counters. The program transferred on a
NetlogII system allows to verify the operation of the function block.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbNetlogAD.h>
#include <FbModbusAsciiSl.h>
#include "Source\FbRtuManager.h"

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define BOOLCH 4 //Number of boolean channels


#define ANALOGCH 4 //Number of analog channels
#define COUNTERCH 4 //Number of counter channels
#define TRENDBUFFSIZE 4096 //Number of byte for trend array
#define EVENTBUFFSIZE 4096 //Number of byte for event array
#define MDBFRAMELENGTH 40 //Modbus frame length
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (24 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager

// ByteBit data structure prototype.

typedef struct
{
BOOL b00:1; //Bit 00
BOOL b01:1; //Bit 01
BOOL b02:1; //Bit 02
BOOL b03:1; //Bit 03
BOOL b04:1; //Bit 04
BOOL b05:1; //Bit 05
BOOL b06:1; //Bit 06
BOOL b07:1; //Bit 07
}BYTEBIT;

// -----------------------------------------------------------------------------
// VARIABLES DECLARATION
// -----------------------------------------------------------------------------

// ------------------------------------------------------------[Backup memory]--
// The memory area from 0x0500 to 0x05FF it's sets as backup memory. Please
// refer to project PLC settings.

at (0x0500) FBRTUPROGRAMRPT Pr; //Program report


at (0x0540) FBRTUBOOLCFG Bc[BOOLCH]; //Boolean configuration
at (0x0560) FBRTUANALOGCFG Ac[ANALOGCH]; //Analog configuration
at (0x05A0) FBRTUCOUNTERCFG Cc[COUNTERCH]; //Counter configuration

// ----------------------------------------------------------[Assigned memory]--
// The following variables are located in assigned memory. This enables the
// access by the MODBUS communication.

at (0x0600) FBRTUMANAGERDATA Rtu; //"FbRtuManager" data structure

// -------------------------------------------------------------[Event memory]--
// The following memory area it's used as a trend and events buffer, so it
// must be declared as "noinit". This means that it isn't initialized at system
// startup. So data stored in it will remain even the system is switched off.

#pragma noinitstaticvar
at (0x3000) unsigned char TrendBuff[TRENDBUFFSIZE]; //Trend buffer
at (0x4000) unsigned char EventBuff[EVENTBUFFSIZE]; //Event buffer
#pragma initstaticvar

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (25 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static unsigned char ADCh; //A/D channel acquisition sequencer


static unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer
static unsigned int Boolean[BOOLCH]; //Boolean variables
static unsigned int Analog[ANALOGCH]; //Analog variables
static unsigned int Counter[COUNTERCH]; //Counters
static BYTEBIT LogInp; //Logic input buffer
static BYTEBIT InpOneShot; //Logic input one shot buffer
static FBNETLOGADDATA ADs[4]; //A/D channels data structure
static FBMODBUSASCIISLDATA Mdb; //MODBUS slave data structure
static FBRTUBOOLMNG Bm[BOOLCH]; //Boolean management
static FBRTUANALOGMNG Am[ANALOGCH]; //Analog management
static FBRTUCOUNTERMNG Cm[COUNTERCH]; //Boolean management
static FBRTUBOOLSTS Bs[BOOLCH]; //Boolean status
static FBRTUANALOGSTS As[ANALOGCH]; //Analog status
static FBRTUCOUNTERSTS Cs[COUNTERCH]; //Counter status

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Execute the function init at first program execution loop.

if (PLCFirstLoop)
{
// ---------------------------------------------------------------------
// Set the A/D channels variables.

ADs[0].Command.Enable=TRUE; //FB enable


ADs[0].Module=0; //Module address
ADs[0].ADChannel=0; //A/D channel

ADs[1].Command.Enable=TRUE; //FB enable


ADs[1].Module=0; //Module address
ADs[1].ADChannel=1; //A/D channel

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (26 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager
ADs[2].Command.Enable=TRUE; //FB enable
ADs[2].Module=0; //Module address
ADs[2].ADChannel=2; //A/D channel

ADs[3].Command.Enable=TRUE; //FB enable


ADs[3].Module=0; //Module address
ADs[3].ADChannel=3; //A/D channel

// ---------------------------------------------------------------------
// Set variables to manage the "FbRtuManager" function block.

Rtu.BooleanCh=BOOLCH; //Boolean channels


Rtu.AnalogCh=ANALOGCH; //Analog channels
Rtu.CounterCh=COUNTERCH; //Counter channels

Rtu.BoolIdt=&Boolean; //Boolean input data table


Rtu.AnaIdt=&Analog; //Analog input data table
Rtu.CntrIdt=&Counter; //Counter input data table

Rtu.TrendAreaType=0x00; //Trend area type


Rtu.TrendAreaBegin=(unsigned long)&TrendBuff; //First address for trend area
Rtu.TrendAreaEnd=(unsigned long)&TrendBuff+TRENDBUFFSIZE-1; //Last address for trend area

Rtu.EventAreaType=0x00; //Event area type


Rtu.EventAreaBegin=(unsigned long)&EventBuff; //First address for event area
Rtu.EventAreaEnd=(unsigned long)&EventBuff+EVENTBUFFSIZE-1; //Last address for event area

Rtu.ChAtLoop=1; //Channels managed at every loop

Rtu.Pr=&Pr; //Program report


Rtu.Bc=&Bc; //Boolean configuration
Rtu.Ac=&Ac; //Analog configuration
Rtu.Cc=&Cc; //Counter configuration

Rtu.Bs=&Bs; //Boolean status


Rtu.As=&As; //Analog status
Rtu.Cs=&Cs; //Counter status

Rtu.Bm=&Bm; //Boolean management


Rtu.Am=&Am; //Analog management
Rtu.Cm=&Cm; //Counter management

Rtu.Rtc=PLCRtcDataPtr; //Real time clock

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (27 of 29) [06/10/2008 17.43.35]


Function blocks: FbRtuManager
// ---------------------------------------------------------------------
// Set variables to manage the MODBUS slave communication.

Mdb.NodeAdd=0; //Node address


Mdb.AnswerWt=0; //Answer wait time (mSec)
Mdb.TimeOutCk=100; //Timeout Check (mSec)
Mdb.CmActiveDelay=2000; //Communication active delay (mSec)
Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=(unsigned char*)&FrameBuf; //Rx/Tx frame buffer
Mdb.CmdBit.ResetCtrs=TRUE; //Resets all the counters
}

// -------------------------------------------------------------------------
// BOOLEAN ACQUISITION
// -------------------------------------------------------------------------
// Acquire the boolean signals.

PeripheralInp(0x00, 0x00, (unsigned char*)&LogInp); //Inputs from 0 to 7

// Copy boolean signals to function block buffers.

Boolean[0]=LogInp.b00; //Boolean channel 0


Boolean[1]=LogInp.b01; //Boolean channel 1
Boolean[2]=LogInp.b02; //Boolean channel 2
Boolean[3]=LogInp.b03; //Boolean channel 3

// -------------------------------------------------------------------------
// A/D ACQUISITION
// -------------------------------------------------------------------------
// Acquire the analog signal.

if (++ADCh >= 4)
ADCh=0; //A/D channel acquisition sequencer

FbNetlogAD(&ADs[ADCh]); //A/D channel acquisition

// Copy the AD converter values to function block buffers.

if (ADs[ADCh].Status.DataReady)
Analog[ADCh]=ADs[ADCh].ADValue; //Input value

// -------------------------------------------------------------------------
// COUNTER ACQUISITION
// -------------------------------------------------------------------------
http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (28 of 29) [06/10/2008 17.43.35]
Function blocks: FbRtuManager
// Acquire the counter signal.

if (LogInp.b04 != InpOneShot.b04)
Counter[0]++; //Counter channel 0

if (LogInp.b05 != InpOneShot.b05)
Counter[1]++; //Counter channel 1

if (LogInp.b06 != InpOneShot.b06)
Counter[2]++; //Counter channel 2

if (LogInp.b07 != InpOneShot.b07)
Counter[3]++; //Counter channel 3

InpOneShot=LogInp; //Logic input one shot buffer

// -------------------------------------------------------------------------
// RTU MANAGER
// -------------------------------------------------------------------------
// Execute the "FbRtuManager" function block.

FbRtuManager(&Rtu);
Rtu.Command.Enable=TRUE; //Enable

// -------------------------------------------------------------------------
// MODBUS SLAVE COMMUNICATION
// -------------------------------------------------------------------------
// Here define the serial line must be used.

SetTermIOVectors(IOSerialPortA);
TermIOTick(); //Execute the tick

// MODBUS slave communication management.

FbModbusAsciiSl(&Mdb); //MODBUS slave management


Mdb.CmdBit.Enable=TRUE; //Enable
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbRtuManager.htm (29 of 29) [06/10/2008 17.43.35]


Function blocks: FbSetSerialPar

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbSetSerialPar

This function block allows to set the communication parameters of the serial line. The FB allows to set the
communication mode as to the SMOD instruction and the DTR signal management as the DTRE instruction.

Code:PFB058 History report


Prototype
FbSetSerialPar.h

Declaration
void FbSetSerialPar(FBSETSERIALPARDATA *S);

Parameters
FBSETSERIALPARDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 16 bytes data structure, we report a prototype. The members reported under the
Internal use only members label, are members used inside by the function block and they don't have to be
changed by the user program.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL DTRComplement:1; //Complement the DTR signal
BOOL EchoFlush:1; //Flush the echo
BOOL RxCtrlDisable:1; //Disable Rx control characters
BOOL ParityEnabled:1; //Enables the parity management
BOOL ParityType:1; //FALSE:Odd parity, TRUE:Even parity
BOOL BitNumber:1; //FALSE:7 bit, TRUE:8 bit
BOOL WaitLoop:1; //FALSE:No wait, TRUE:Wait
BOOL b7:1;
}Mode;

unsigned char Baud; //Baud rate


unsigned char DTRMng; //Define the DTR management
unsigned char Dummy;
unsigned int DTROnTime; //DTR On wait time
unsigned int DTROffTime; //DTR Off delay time

// --------------------------------------------[Internal use only members]--


...
}FBSETSERIALPARDATA;

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (1 of 6) [06/10/2008 17.43.38]


Function blocks: FbSetSerialPar

00 Mode
Communication mode selection bits, the user program can manage these bits according to its needs.
0 DTRComplement TRUE: Complements the status of the DTR signal.
1 EchoFlush TRUE: Enables the automatic deletion of the received characters as echo during the
transmission on RS485 line.
2 RxCtrlDisable TRUE: Disables the control character management during the reception. The XON and
XOFF characters are not automatically managed by the communication drivers but the
are returned as received characters. It must be set in case of binary communications, for
example MODBUS Rtu.
3 ParityEnabled TRUE: Enables the parity control management in reception and the transmission of the
parity bit.
4 ParityType This bit is managed only if the ParityEnabled bit is set, it defines the parity type:
FALSE: Odd parity.
TRUE: Even parity.
5 BitNumber FALSE: It is managed the 7 bits communication.
TRUE: It is managed the 8 bits communication.
6 WaitLoop FALSE: Is not waited the character in reception and is not waited the space in the
transmission buffer.
TRUE: Is waited the character in reception and the space in transmision buffer.

01 Baud
Loaded by user program it defines the desired baud rate, please refer to the table.
Hex Baud Hex Baud Hex Baud Hex Baud

0 300 4 4800 8 57600 C 115200


1 600 5 9600 9 76800 D 115200
2 1200 6 19200 A 115200 E 115200
3 2400 7 38400 B 115200 F 115200

02 DTRMng
Loaded by user program it defines the DTR signal management. The DTR signal on the serial port is used to
command the devices connected to it. In the targets that has the RS485 line in multidrop, the signal is used
to connect the transmission driver to the serial line. To set it please refer to to table.
0 Set the DTR signal to the FALSE logic level.
1 Set the DTR signal to the TRUE logic level.
2 Set the DTR signal in automatic working without any time. The signal is set to the TRUE logic level just
before the data transmission, and it is set to the FALSE logic level after the transmission of the last data.
3 Set the DTR signal in automatic working with time delay. Before start the data transmission the signal is
set to the TRUE logic level, the time defined in DTROnTime is waited, and then the data transmission is
started. When the last data is sent, the time defined in DTROffTime is waited and the signal is set to the
FALSE logic level.

04 DTROnTime
Loaded by user program it defines the waiting time between the activation of the DTR signal and the
transmission of data, the value is expressed mSec. It works only if the DTRMng is set to 3 (Range from 0 to
65535).
06 DTROffTime
Loaded by user program it defines the waiting time between the transmission of the last data and the
deactivation of the DTR signal, the value is expressed mSec. It works only if the DTRMng is set to 3 (Range
from 0 to 65535).

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (2 of 6) [06/10/2008 17.43.38]


Function blocks: FbSetSerialPar

RIL example

In the following example the communication parameters on the A and B ports are set, by activating the input
I 0000 the string "Hello!" will be sent to the serial port A . By activating the input I 0001 the string "Hello!" will be
sent to the serial port B.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; Set serial parameters function block data structure.

DEFL Y SetS KD 16
DEFL Y SetSMode Y SetS KH 0000 ; SetS.Mode
DEFL Y SetSBaud Y SetS KH 0001 ; SetS.Baud
DEFL Y SetSDTRMng Y SetS KH 0002 ; SetS.DTRMng
DEFL W SetSDTROnTime Y SetS KH 0004 ; SetS.DTROnTime
DEFL W SetSDTROffTime Y SetS KH 0006 ; SetS.DTROffTime

; ------------------------------------------------------------------------------
; @Section("Serial port tick call")
; ------------------------------------------------------------------------------
; To manage the DTR times it's necessary to call the device tick function. Here
; both functions for port "A" and "B" are called.

ORGR
SETR
SETV KE IOSerialPortA
TASK L TermIOTick
SETV KE IOSerialPortB
TASK L TermIOTick

; ------------------------------------------------------------------------------
; @Section("Set the serial parameters")
; ------------------------------------------------------------------------------
; Here the serial parameters "19200, e, 8" are set on the serial port "A".

ORGR
LODT F PLCFirstLoop
UTCH Y SetSMode BH 0000 ; SetS.Mode.DTRComplement
UTCH Y SetSMode BH 0001 ; SetS.Mode.EchoFlush
LTCH Y SetSMode BH 0002 ; SetS.Mode.RxCtrlDisable
LTCH Y SetSMode BH 0003 ; SetS.Mode.ParityEnabled
LTCH Y SetSMode BH 0004 ; SetS.Mode.ParityType
LTCH Y SetSMode BH 0005 ; SetS.Mode.BitNumber
UTCH Y SetSMode BH 0006 ; SetS.Mode.WaitLoop
MOVI Y SetSBaud KD 6 ; SetS.Baud
MOVI Y SetSDTRMng KD 3 ; SetS.DTRMng
MOVI W SetSDTROnTime KD 500 ; SetS.DTROnTime
MOVI W SetSDTROffTime KD 500 ; SetS.DTROffTime
SETV KE IOSerialPortA
TASK L FbSetSerialPar Y SetS ; Set serial parameters

; Here the serial parameters "9600, n, 7" are set on the serial port "B".

ORGR

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (3 of 6) [06/10/2008 17.43.38]


Function blocks: FbSetSerialPar

LODT F PLCFirstLoop
UTCH Y SetSMode BH 0000 ; SetS.Mode.DTRComplement
UTCH Y SetSMode BH 0001 ; SetS.Mode.EchoFlush
LTCH Y SetSMode BH 0002 ; SetS.Mode.RxCtrlDisable
UTCH Y SetSMode BH 0003 ; SetS.Mode.ParityEnabled
UTCH Y SetSMode BH 0004 ; SetS.Mode.ParityType
UTCH Y SetSMode BH 0005 ; SetS.Mode.BitNumber
UTCH Y SetSMode BH 0006 ; SetS.Mode.WaitLoop
MOVI Y SetSBaud KD 5 ; SetS.Baud
MOVI Y SetSDTRMng KD 0 ; SetS.DTRMng
MOVI W SetSDTROnTime KD 0 ; SetS.DTROnTime
MOVI W SetSDTROffTime KD 0 ; SetS.DTROffTime
SETV KE IOSerialPortB
TASK L FbSetSerialPar Y SetS ; Set serial parameters

; ------------------------------------------------------------------------------
; @Section("Send strings")
; ------------------------------------------------------------------------------
; By activating the "I 0000", "Hello!" string is sent on the serial port "A".

ORGR
LODT I 0000
PULS
SETV KE IOSerialPortA
STXI KH 0048
STXI KH 0065
STXI KH 006C
STXI KH 006C
STXI KH 006F
STXI KH 0021
STXI KH 000D
STXI KH 000A

; By activating the "I 0001", "Hello!" string is sent on the serial port "B".

ORGR
LODT I 0001
PULS
SETV KE IOSerialPortB
STXI KH 0048
STXI KH 0065
STXI KH 006C
STXI KH 006C
STXI KH 006F
STXI KH 0021
STXI KH 000D
STXI KH 000A

; [End of file]

"C" example

In the following example the communication parameters on the A and B ports are set. Every second the string
"Hello World! (Port A)" will be sent to the serial port A and the string "Hello World! (Port B)" will be sent to the

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (4 of 6) [06/10/2008 17.43.38]


Function blocks: FbSetSerialPar

serial port B.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbSetSerialPar.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

FBSETSERIALPARDATA SetS; //SetS driver data structure

// To manage the DTR times it's necessary to call the device tick function.
// Here both functions for port "A" and "B" are called.

SetTermIOVectors(IOSerialPortA);
TermIOTick();
SetTermIOVectors(IOSerialPortB);
TermIOTick();

// Here the SetS driver function block parameters are set.

if (PLCFirstLoop)
{
// The parameters "19200, e, 8" are set on the serial port "A".

SetTermIOVectors(IOSerialPortA);
SetS.Mode.DTRComplement=FALSE; //Complement the DTR signal
SetS.Mode.EchoFlush=FALSE; //Flush the echo
SetS.Mode.RxCtrlDisable=FALSE; //Disable Rx control characters
SetS.Mode.ParityEnabled=TRUE; //Enables the parity management
SetS.Mode.ParityType=TRUE; //FALSE:Odd parity, TRUE:Even parity
SetS.Mode.BitNumber=TRUE; //FALSE:7 bit, TRUE:8 bit
SetS.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SetS.Baud=6; //Baud rate
SetS.DTRMng=3; //Define the DTR management
SetS.DTROnTime=100; //DTR On wait time
SetS.DTROffTime=100; //DTR Off delay time
FbSetSerialPar(&SetS); //Set serial parameters

// The parameters "9600, n, 7" are set on the serial port "B".

SetTermIOVectors(IOSerialPortB);
SetS.Mode.DTRComplement=FALSE; //Complement the DTR signal
SetS.Mode.EchoFlush=FALSE; //Flush the echo
SetS.Mode.RxCtrlDisable=FALSE; //Disable Rx control characters
SetS.Mode.ParityEnabled=FALSE; //Enables the parity management

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (5 of 6) [06/10/2008 17.43.38]


Function blocks: FbSetSerialPar

SetS.Mode.ParityType=FALSE; //FALSE:Odd parity, TRUE:Even parity


SetS.Mode.BitNumber=FALSE; //FALSE:7 bit, TRUE:8 bit
SetS.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SetS.Baud=5; //Baud rate
SetS.DTRMng=0; //Define the DTR management
SetS.DTROnTime=0; //DTR On wait time
SetS.DTROffTime=0; //DTR Off delay time
FbSetSerialPar(&SetS); //Set serial parameters
}

// Here the "Hello World!" string is sent at every 1 Second.

if (PLCPulse1000)
{
// The string is sent on the serial port "A".

SetTermIOVectors(IOSerialPortA);
printf("Hello World! (Port A)\r\n");

// The string is sent on the serial port "B".

SetTermIOVectors(IOSerialPortB);
printf("Hello World! (Port B)\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbSetSerialPar.htm (6 of 6) [06/10/2008 17.43.38]


Function blocks: FbSle44x2Card

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

FbSle44x2Card

This function block manages the reading and writing up to 256 data bytes on Sle4432 and Sle4442 chip cards on the
Netreader systems, based on both the processor P89C664 and P89C664. The FB manages the chip card data access in
two modes, normal and advanced.

In normal mode the chip card is read and written without any control on the data. The available area of memory for the
data is up to 256 bytes.
In advanced mode is used a double structure data with a CRC of control on every structure, in this way the chip card
can be extracted from the reader/writer at any time even during the writing and reading operations, without damaging
the data memorized in it. The available area of memory for the data is up to 110 bytes.

The FB automatically manages the LED on the reader, at the insertion of the card if it's read correctly the LED is switched
on, during the writing the LED is switched off. In case of anomaly the number of LED flashes indicates the anomaly.

1: The inserted card is virgin.


2: The inserted card has an ATR wrong code.
3: The inserted card has the data areas in error, it cannot be read. The data on the chip card are however transferred in
the buffer defined by the use.
4: Wrong PSC control in writing, the PSC of the card is different from that one indicated. It does not write any data on the
chip card. After 3 wrongs PSC verification attempts the chip card becomes unusable.
5: Data writing on card error.

By using the FB in C program, a series of functions for a low level access to the chip card are available, you can manage
the whole memory area of 256 bytes, protect in writing some areas and change the PSC access code (only Sle4442). We
provide a demo program Sfw111 for an example of FB use in C language. This program accepts a series of commands
by the serial line, it's possible to unlock the card (through the PSC code), to read and write the protection memory and the
main memory, to duplicate the card.

Code:PFB063 History report


Prototype
FbSle44x2Card.h

Declaration
void FbSle44x2Card(FBSLE44X2CARDDATA* S);

Parameters
FBSLE44X2CARDDATA* S Data structure address (Range from 0x0000 to 0xFFFF)

Return value
None

Data structure

The function block uses a 40 bytes data structure, we report a prototype. The members reported under the Internal use
only members label, are members used inside by the function block and they don't have to be changed by the user
program.

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (1 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

typedef struct
{
// --------------------------[Members that can be managed by user program]--

struct
{
BOOL Enable:1; //Enable chip card management
BOOL WriteData:1; //Write data to chip card
BOOL DisableLEDMng:1; //Disable LED management
BOOL ChipCardLED:1; //LED on chip card reader
BOOL AdvancedMode:1; //Advanced mode selection
BOOL DisablePSC:1; //Disable PSC management
}Command;

struct
{
BOOL ReadDataOk:1; //Chip card read data ok
BOOL ReadDataError:1; //Chip card read data error
BOOL WriteDataOk:1; //Chip card write data ok
BOOL WriteDataError:1; //Chip card write data error
BOOL bC:1;
BOOL bD:1;
BOOL bE:1;
BOOL bF:1;

BOOL CardIn:1; //Chip card has been inserted


BOOL CardReadEnd:1; //Chip card has been read
BOOL CardWriteEnd:1; //Chip card has been write
BOOL WrongATR:1; //Chip card with wrong ATR
BOOL VirginCard:1; //Chip card is virgin
BOOL NoPSCCard:1; //Chip card without PSC code
BOOL PSCFault:1; //PSC test fault
BOOL b7:1;
}Status;

unsigned char ChipCardStart; //Chip card start address


unsigned char CardDataLength; //Card data length
unsigned char PSCCheckAddress; //PSC check address
unsigned char xdata* CardData; //Card data buffer address

unsigned char ATRCode[4]; //Chip card ATR code


unsigned char ProtectionMem[4]; //Protection memory data
unsigned char SecurityMem[4]; //Security memory data

void (*CardReset)(void);
unsigned char (*PSCVerification)(void);
unsigned char (*UpdateSecurityMemory)(void);
unsigned char (*MainMemoryRead)(unsigned char Address, unsigned char* Data);
unsigned char (*MainMemoryWrite)(unsigned char Address, unsigned char Data);
void (*ProtectionMemoryRead)(void);
unsigned char (*ProtectionMemoryWrite)(unsigned char Address, unsigned char Data);

// --------------------------------------------[Internal use only members]--

unsigned char Im[6]; //Internal members area

}FBSLE44X2CARDDATA;

00 Command

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (2 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

Command bits, the user program can manage these bits according to its needs.
0 Enable FALSE: Disables the FB, all the Status bits are reset.
TRUE: Enables the FB.
1 WriteData TRUE: Forces the chip card writing with the data of the memory buffer pointed by CardData. It
will be automatically reset at the end of writing, if a writing error occurs or if the chip card is
extracted from the reader.
2 DisableLEDMng TRUE: Disables the automatic management of the LED on the chip card reader.
3 ChipCardLED Commands the LED on the chip card reader. The command is valid only if the automatic
management of the LED is disabled Command.DisableLEDMng=TRUE. Otherwise the LED is
managed automatically from the FB.
4 AdvancedMode FALSE: Normal mode, no controls on the data. Can be managed up to 256 bytes.
TRUE: Advanced mode, double writing of data with CRC control. Can be managed up to 126
bytes.
5 DisablePSC TRUE: Disables the PSC control, to use only for the Sle4432 cards avoids that the PSC control
might damage the chip card data.

01 Status
Status bits, the user program can test these bits.
0 CardIn TRUE: The chip card has been inserted in the reader.
1 CardReadEnd It's activated for a program loop at the end of the data reading from the chip card. When it's active
the: Status.WrongATR, Status.NoPSCCard, Status.VirginCard, Status.ReadDataOk, Status.
ReadDataError bits, can be checked.
2 CardWriteEnd It is activated for a program loop at the end of the data writing to the chip card. When it's active
the: Status.PSCFault, Status.WriteDataOk, Status.WriteDataError bits, can be checked.
3 WrongATR TRUE: The inserted chip card has an ATR code different from that one accepted 0xA2, 0x13,
0x10, 0x91, the card it isn't read. It's reset by extracting the card from the reader or setting
Command.Enable=FALSE.
4 VirginCard TRUE: The inserted chip card is virgin, the card it isn't read. It's reset by extracting the card from
the reader or setting Command.Enable=FALSE.
5 NoPSCCard TRUE: The inserted chip card doesn't manage the data protection with the PSC code (it is a
Sle4432). All the access operations are guaranteed anyway. It's reset by extracting the card from
the reader or setting Command.Enable=FALSE.
6 PSCFault TRUE: The card unlock operation with PSC code to allow its writing, have a fault. The PSC value
is not correct.
ATTENTION! After 3 wrong card unlock operations, the card becomes useless. It's reset at every
writing command Command.WriteData=TRUE, by extracting the card from the reader or setting
Command.Enable=FALSE.
8 ReadDataOk TRUE: Ther reading of the card inserted in the reader has been executed, the readed data has
been transferred from the chip card to the memory buffer pointed by CardData. It's reset by
extracting the card from the reader or setting Command.Enable=FALSE.
9 ReadDataError TRUE: Ther reading of the card inserted in the reader has an error. It's reset by extracting the card
from the reader or setting Command.Enable=FALSE.
A WriteDataOk TRUE: Ther writing of the card inserted in the reader has been executed, the data from the
memory buffer pointed by CardData has been write to the chip card. It's reset by extracting the
card from the reader setting Command.Enable=FALSE or at every set of the Command.
WriteData bit.
B WriteDataError TRUE: Ther writing of the card inserted in the reader has an error. It's reset by extracting the card
from the reader setting Command.Enable=FALSE or at every set of the Command.WriteData bit.

03 ChipCardStart
Loaded by the user program, it defines the user data allocation address on the chip card memory (Range da 0x00 a
0xFF).
04 CardDataLength

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (3 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

Loaded by the user program, it defines the user data area length to be managed on the chip card (Range da 0x00 a
0xFF).
05 PSCCheckAddress
Loaded by the user program, it defines the chip card address on wich the PSC control is executed. If the user
program has to manages both the chip card types (with PSC and without) to avoid that the PSC control can
deteriorate the data present on the card, it's possible to define an address outside of the used data area. Not used if
Command.DisablePSC=TRUE (Range from 0x00 to 0xFF).
06 CardData
Loaded by the user program, it defines the memory buffer address where the FB stores the data read or reads the
data to write to the chip card, a buffer with the same length of the data to be managed on the chip card
CardDataLength must be defined on RAM memory (Range from 0x0000 to 0xFFFF).
08 ATRCode[4]
Returns the 4 bytes ATR code read by the chip card, the code is 0xA2, 0x13, 0x10, 0x91.
0C ProtectionMem[4]
Copy buffer protection memory on chip card data. The ProtectionMemoryRead function reads the value of the 32
bits protection memory in this 4 bytes buffer.
10 SecurityMem[4]
Chip card security memory buffer. The PSCVerification function compares the value of the 3 bytes SecurityMem[1-
2-3] to the PSC code of the chip card and if they are the same it unlocks the chip card. The UpdateSecurityMemory
function replaces the current PSC code on the chip card with value in the 3 bytes SecurityMem[1-2-3].
14 CardReset
Returns the address of the chip card reset function. This function reads the ATR code and returns it in ATRCode[4].
The function normally has to be executed on the insertion of the card in the reader.
void CardReset(void);
Parameters
None
Return value
None

16 PSCVerification
Returns the address of the PSC verification function. This functions compares the code reported in SecurityMem[1-2-
3] with the PSC code of the chip card. If the code corresponds the chip card is unlocked. ATTENTION! After 3 wrong
unlock operations the card gets useless.
unsigned char PSCVerification(void);
Parameters
None
Return value
unsigned char 0 PSC code verified 4 Code verify error
1 Write start error 5 Chip card locked
2 Write timeout error 6 Procedure error
3 Write protected area

18 UpdateSecurityMemory

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (4 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

Returns the address of the update security memory function. This function changes the value of the PSC on chip
card using the the value reported in SecurityMem[1-2-3]. Of course, the operation is possible only if the card was
previously unlocked with the PSCVerification function. ATTENTION! After having updated the code, the card
remains unlocked until it is extracted from the reader. At the following insertion you have the use the new PSC code
to unlock it
unsigned char UpdateSecurityMemory(void);
Parameters
None
Return value
unsigned char 0 PSC code verified 2 Write timeout error
1 Write start error 3 Write protected area

1A MainMemoryRead
Returns the address of the main memory read. This functions reads a byte from the chip card main memory.

unsigned char MainMemoryRead(unsigned char Address, unsigned char* Data);


Parameters
unsigned char Address Data reading Address on chip card (From 0x00 to 0xFF)
unsigned char* Data Data buffer address where to store da data read (From 0x0000 to 0xFFFF)
Return value
unsigned char Data read from chip card (From 0x00 to 0xFF)

1C MainMemoryWrite
Returns the address of the main memory write. This function writes a byte to the chip card main memory. The
operation is possible only if the card was previously unlocked with the PSCVerification function. Before execute the
writing it's verified if the data is already present in the chip card, so the write is non executed minimizing the number
of write cycles.
unsigned char MainMemoryWrite(unsigned char Address, unsigned char Data);
Parameters
unsigned char Address Data writing address on chip card (From 0x00 to 0xFF)
unsigned char Data Data to write on chip card (From 0x00 to 0xFF)
Return value
unsigned char 0 Write ok 3 Write protected area
1 Write start error 4 Error improper write
2 Write timeout error

1E ProtectionMemoryRead
Returns the address of the protection memory read function. This function reads the 4 bytes of the protection memory
on the chip card and transfer them to the ProtectionMem[4] buffer.
void ProtectionMemoryRead(void);
Parameters
None
Return value
None

20 ProtectionMemoryWrite

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (5 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

Returns the address of the protection memory write function. This function writes the protection memory on the chip
card.The operation is possible only if the card was previously unlocked with the PSCVerification function.
unsigned char ProtectionMemoryWrite(unsigned char Address, unsigned char Data);
Parameters
unsigned char Address Data writing address on chip card (From 0x00 to 0x1F)
unsigned char Data Data to write on chip card (From 0x00 to 0xFF)
Return value
unsigned char 0 Write ok 2 Write timeout error
1 Write start error 3 Write protected area

RIL example

In the following example a chip card reader is managed. The chip card data are memorized starting from the byte Y 0000
till the byte Y 000F. When the card is inserted in the reader, it is automatically read and if the data in it are correct, the
LED on the reader is switched on. Otherwise it blinks according to the number of error found.

By activating the input I 0000, the data in the buffer are write on the chip card, be sure to have set the right value of the
PSC code in SecurityMem[1-2-3] before execute the command. In the example, we suppose to use a virgin card, whose
PSC is 0xFF, 0xFF, 0xFF.

; ------------------------------------------------------------------------------
; @Section("Local definitions")
; ------------------------------------------------------------------------------
; FbSle44x2Card function block, data structure.

DEFG Y Chc KD 40
DEFG Y ChcCommand Y Chc KH 0000 ;Chc.Command
DEFG W ChcStatus Y Chc KH 0001 ;Chc.Status

DEFG Y ChcChipCardStart Y Chc KH 0003 ;Chc.ChipCardStart


DEFG Y ChcCardDataLength Y Chc KH 0004 ;Chc.CardDataLength
DEFG Y ChcPSCCheckAddress Y Chc KH 0005 ;Chc.PSCCheckAddress
DEFG W ChcCardData Y Chc KH 0006 ;Chc.CardData

DEFG DW ChcATRCode Y Chc KH 0008 ;Chc.ATRCode


DEFG DW ChcProtectionMem Y Chc KH 000C ;Chc.ProtectionMem
DEFG DW ChcSecurityMem Y Chc KH 0010 ;Chc.SecurityMem

DEFG W ChcCardReset Y Chc KH 0014 ;Chc.CardReset


DEFG W ChcPSCVerification Y Chc KH 0016 ;Chc.PSCVerification
DEFG W ChcUpdateSecurityMemory Y Chc KH 0018 ;Chc.UpdateSecurityMemory
DEFG W ChcMainMemoryRead Y Chc KH 001A ;Chc.MainMemoryRead
DEFG W ChcMainMemoryWrite Y Chc KH 001C ;Chc.MainMemoryWrite
DEFG W ChcProtectionMemoryRead Y Chc KH 001E ;Chc.ProtectionMemoryRead
DEFG W ChcProtectionMemoryWrite Y Chc KH 0020 ;Chc.ProtectionMemoryWrite

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------
; FbSle44x2Card function block, variables settings.
; Set the chip card data buffer at address Y 0000.

ORGR
LODT F PLCFirstLoop
MOVA W ChcCardData Y 0000 ;Chc.CardData

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (6 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

MOVI Y ChcChipCardStart KH 0020 ;Chc.ChipCardStart


MOVI Y ChcCardDataLength KD 16 ;Chc.CardDataLength
LTCH Y ChcCommand BD 4 ;Chc.Command.AdvancedMode
LTCH Y ChcCommand BD 0 ;Chc.Command.Enable

; ------------------------------------------------------------------------------
; @Section("FbSle44x2Card function block management")
; ------------------------------------------------------------------------------
; When card is inseterted in the reader the chip card data from 0x20 to 0x2F are
; automatically copied to the memory from Y 0000 to Y 000F.

ORGR
SETR
TASK L FbSle44x2Card Y Chc ;Sle44x2Card management

; By activating the input I 0000 the data from Y 0000 to Y 000F are stored in the
; chip card from address 0x20 to 0x2F.

ORGR
LODT I 0000
PULS
MOVI DW ChcSecurityMem KH FFFFFF ;Chc.SecurityMem
LTCH Y ChcCommand BD 1 ;Chc.Command.WriteData

; [End of file]

"C" example

In the following example a chip card reader is managed. The chip card data are memorized in the CardData buffer. When
the card is inserted in the reader, it is automatically read and if the data in it are correct, the LED on the reader is
switched on. Otherwise it blinks according to the number of error found.

By activating the input I 0000, the data in the CardData buffer are write on the chip card, be sure to have set the right
value of the PSC code in SecurityMem[1-2-3] before execute the command. In the example, we suppose to use a virgin
card, whose PSC is 0xFF, 0xFF, 0xFF.

By activating the input I 0001 the PSC code of the card is updated, setting it to 0x12, 0x34, 0x56. The new code is valid
only after having extracted the card from the reader. ATTENTION! do not execute the I 0000 writing command on the
card with the PSC updated, after 3 tries the card becomes useless.

By activating the input I 0002, the PSC code is updated, it returns as a virgin card 0xFF, 0xFF, 0xFF.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <string.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbSle44x2Card.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (7 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

// Local variable definitions.

unsigned char ErrorCode; //Error code


static unsigned char LogInput; //Logic inputs
static unsigned char OneShot; //Logic inputs one shot
static unsigned char CardData[110]; //Chip card data buffer
static FBSLE44X2CARDDATA Chc; //Chip card data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// At first program loop initialize all variables.

if (PLCFirstLoop)
{
Chc.CardData=&CardData; //Card data address
Chc.ChipCardStart=0x20; //Chip card start address
Chc.CardDataLength=sizeof(CardData); //Card data length
Chc.PSCCheckAddress=0x20; //PSC check address
Chc.Command.AdvancedMode=TRUE; //Advanced mode selection
Chc.Command.DisablePSC=FALSE; //Disable PSC management
Chc.Command.Enable=TRUE; //Enable chip card management
}

// -------------------------------------------------------------------------
// CHIP CARD MANAGEMENT
// -------------------------------------------------------------------------
// Execute the logic input read and manages the one shot buffer.

OneShot=LogInput; //Logic inputs one shot


PeripheralInp(0, 0, &LogInput);

// Execute the chip card reader management.

ErrorCode=0; //Error code


FbSle44x2Card(&Chc); //Chip card management

// By activating the logic input I 0000 the chip card is written using data
// from "CardData" buffer.

if (((LogInput^OneShot)&LogInput)&0x01)
{
// Set the PSC code to unlock the chip card and command the data write.

memcpy(&Chc.SecurityMem[1], "\xFF\xFF\xFF", 3);


Chc.Command.WriteData=TRUE; //Write data to chip card
}

// By activating the logic input I 0001 the chip card PSC is modified from
// the previous value 0xFF, 0xFF, 0xFF to the new value 0x12, 0x34, 0x56.

if (((LogInput^OneShot)&LogInput)&0x02)
{
// Set the previous PSC code and unlock the chip card.

memcpy(&Chc.SecurityMem[1], "\xFF\xFF\xFF", 3);


ErrorCode|=Chc.PSCVerification(); //Error code

// Set the new PSC code on the chip card.

memcpy(&Chc.SecurityMem[1], "\x12\x34\x56", 3);

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (8 of 9) [06/10/2008 17.43.42]


Function blocks: FbSle44x2Card

ErrorCode|=Chc.UpdateSecurityMemory(); //Error code


}

// By activating the logic input I 0002 the chip card PSC is modified from
// the previous value 0x12, 0x34, 0x56 to the new value 0xFF, 0xFF, 0xFF.

if (((LogInput^OneShot)&LogInput)&0x04)
{
// Set the previous PSC code and unlock the chip card.

memcpy(&Chc.SecurityMem[1], "\x12\x34\x56", 3);


ErrorCode|=Chc.PSCVerification(); //Error code

// Set the new PSC code on the chip card.

memcpy(&Chc.SecurityMem[1], "\xFF\xFF\xFF", 3);


ErrorCode|=Chc.UpdateSecurityMemory(); //Error code
}

// Printout a message if an error is detected.

if (ErrorCode)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console
printf("An error is detected.\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/FctBlocks/FbSle44x2Card.htm (9 of 9) [06/10/2008 17.43.42]


Operand definition instructions: DEFL

ELSIST Srl, www.elsist.it MNL041Q100

Operand definition instructions

DEFL

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, T, C, Y, W, DW, FL
DEFL DEFine Local operand None Y KD No A
Y Y KD

The instruction DEFine Local operand has to be used to define a new mnemonic operand, having a local
visibility only inside the file where it's defined. The instruction doesn't have any logical function in the
program so it has to be inserted without any definition of the logical branch, we suggest to insert the
instruction at the beginning of the RIL file. Instructions can access to the defined operand only in the
RIL file in which it is defined.

ATTENTION! You cannot define two operands with the same name even though they are of different type
in the same file, but the same name can be used to define another operand with the same or different type
in other files of the same project. You cannot define local operand with names used before to define global
operands DEFG, backup operands DEFB or operands from external files EXTR.

Examples

In the following example, the F IsGreather is activated if the operand W 0000 is greater that 50, the status
of F IsGreather can be tested only in the file where it is defined. You can define operands IsGreather in
other files, but only if you use local assignment.

Ladder RIL "C" language


DEFL F IsGreather void Example(void)
{
ORGR BOOL IsGreather;
GRTC W 100 KD 50
OUTT F IsGreather IsGreather=(PLCOpW(0x0100) > 50);
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition/Defl.htm [06/10/2008 17.43.42]


Operand definition instructions: DEFG

ELSIST Srl, www.elsist.it MNL041Q100

Operand definition instructions

DEFG

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, T, C, Y, W, DW,
FL
DEFG DEFine Global operand None No A
Y KD
Y Y KD

The instruction DEFine Global operand has to be used to define a new mnemonic operand, having a global
visibility inside the project. The instruction doesn't have any logical function in the program so it has to be
inserted without any definition of the logical branch, we suggest to insert the instruction at the beginning of
the RIL file. Instructions can access to the defined operand from any RIL file of the project by only
indicating its type and name.

ATTENTION! You cannot define two operands with the same name in the same project (even they are in
different files) even they have different type. So you cannot define local operands DEFL, or backup
operands DEFB using names defined as global operands.

Examples

in the following example, the F IsGreather is activated if the operand W 0000 is greater that 50, the status
of F IsGreather can be tested in any RIL file of the project. You cannot define an operand with the name
IsGreather in any other file of the same project.

Ladder RIL "C" language


DEFG F IsGreather BOOL IsGreather;

ORGR void Example(void)


GRTC W 100 KD 50 {
OUTT F IsGreather IsGreather=(PLCOpW(0x0100) > 50);
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition/Defg.htm [06/10/2008 17.43.43]


Macro: ASCIIToHEX

ELSIST Srl, www.elsist.it MNL041Q100

Macro

ASCIIToHEX

This macro function executes the conversion of an ASCII character to a hexadecimal number. Given to the
macro an ASCII character between 0 to 9 and between A to F, it returns its value expressed as an hexadecimal
number included between 0x00 to 0x0F.

Examples

The ASCII character A hex code 0x41 present in the AsciiValue variable, comes converted in the hexadecimal
value 0x0A and transferred in the HexValue variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

char AsciiValue; //ASCII value


unsigned char HexValue; //Hexadecimal value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
AsciiValue='A'; //ASCII value
HexValue=ASCIIToHEX(AsciiValue); //Hexadecimal value
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/AsciiToHex.htm [06/10/2008 17.43.43]


Macro: DisableEnableInt

ELSIST Srl, www.elsist.it MNL041Q100

Macro

DISABLEINT
ENABLEINT

These macrofunctions execute the disable and the enable of all interrupt sources. They must be used to prevent the
interruption of normal program execution when it access to a variable managed by an interrupt function.

Examples

In the interrupt function executed every 100 mSec it's increased the InterruptCounter variable, to copy its value to the
MainCounter variable that can be access by the main program, the interrupt must be disabled and enabled at the copy end.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

static unsigned long InterruptCounter; //Counter value (Interrupt)


static unsigned long MainCounter; //Counter value (Main)

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN INTERRUPT
// -----------------------------------------------------------------------------
// Function executed on interrupt, it increments the Counter.

#pragma AUTO //Memory overlay disable

static void InterruptFunct(void)


{
InterruptCounter++; //Counter value (Interrupt)
}

#pragma NOAUTO //Memory overlay enable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN MAIN
// -----------------------------------------------------------------------------

void Example(void)
{
// Enable the "InterruptFunct" execution on external interrupt.

if (PLCFirstLoop)
{
SetClockIntTime(100); //Set the clock interrupt time at 100 mSec
SetClockIntVector(TRUE, (code*)&InterruptFunct); //Set the clock interrupt vector
}

// To copy the "InterruptCounter" variable, the interrupt must be disabled.

DISABLEINT; //Disable interrrupt

http://192.168.0.61/Destination/Html/CLanguage/Macros/DisableEnableInt.htm (1 of 2) [06/10/2008 17.43.44]


Macro: DisableEnableInt

MainCounter=InterruptCounter; //Counter value (Main)


ENABLEINT; //Enable interrrupt
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/DisableEnableInt.htm (2 of 2) [06/10/2008 17.43.44]


Macro: HEXToASCII

ELSIST Srl, www.elsist.it MNL041Q100

Macro

HEXToASCII

This macro function executes the conversion of a hexadecimal number to an ASCII character. Given to the
macro a hexadecimal number between 0x00 to 0x0F, it returns an ASCII character between 0 to 9 and between
A to F.

Examples

The hexadecimal value 0x0A present in the HexValue variable, comes converted in the ASCII character A and
transferred in the AsciiValue variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

char AsciiValue; //ASCII value


unsigned char HexValue; //Hexadecimal value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
HexValue=0x0A; //Hexadecimal value
AsciiValue=HEXToASCII(HexValue); //ASCII value
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/HexToAscii.htm [06/10/2008 17.43.44]


Macro: HICHAR

ELSIST Srl, www.elsist.it MNL041Q100

Macro

HICHAR

This macrofunction returns an unsigned char number that rapresent the high nibble of an unsigned int number.

Examples

It's returned the exadecimal value 0x12 in the HighNibble variable that represent the high nibble of the Value
variable. Please refer also to the example in HIINT macro.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char HighNibble; //High nibble


unsigned int Value; //Value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x1234; //Value
HighNibble=HICHAR(Value); //High nibble (0x12)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/HiChar.htm [06/10/2008 17.43.45]


Macro: HIINT

ELSIST Srl, www.elsist.it MNL041Q100

Macro

HIINT

This macrofunction returns an unsigned int number that rapresent the high nibble of an unsigned long number.

Examples

It's returned the exadecimal value 0x1234 in the HighNibble variable that represent the high nibble of the Value
variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char Array[4]; //Array value


unsigned int HighNibble; //High nibble
unsigned long Value; //Value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x12345678; //Value
HighNibble=HIINT(Value); //High nibble (0x1234)

// Split the unsigned long value into a char array.

Array[0]=HICHAR(HIINT(Value)); //Array value (0x12)


Array[1]=LOCHAR(HIINT(Value)); //Array value (0x34)
Array[2]=HICHAR(LOINT(Value)); //Array value (0x56)
Array[3]=LOCHAR(LOINT(Value)); //Array value (0x78)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/HiInt.htm [06/10/2008 17.43.46]


Macro: LOCHAR

ELSIST Srl, www.elsist.it MNL041Q100

Macro

LOCHAR

This macrofunction returns an unsigned char number that rapresent the low nibble of an unsigned int number.

Examples

It's returned the hexadecimal value 0x34 in the LowNibble variable that represent the low nibble of the Value
variable. Please refer also to the example in LOINT macro.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char LowNibble; //Low nibble


unsigned int Value; //Value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x1234; //Value
LowNibble=LOCHAR(Value); //Low nibble (0x34)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/LoChar.htm [06/10/2008 17.43.46]


Macro: LOINT

ELSIST Srl, www.elsist.it MNL041Q100

Macro

LOINT

This macrofunction returns an unsigned int number that rapresent the low nibble of an unsigned long number.

Examples

It's returned the hexadecimal value 0x5678 in the LowNibble variable that represent the low nibble of the Value
variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char Array[4]; //Array value


unsigned int LowNibble; //Low nibble
unsigned long Value; //Value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x12345678; //Value
LowNibble=LOINT(Value); //Low nibble (0x5678)

// Split the unsigned long value into a char array.

Array[0]=HICHAR(HIINT(Value)); //Array value (0x12)


Array[1]=LOCHAR(HIINT(Value)); //Array value (0x34)
Array[2]=HICHAR(LOINT(Value)); //Array value (0x56)
Array[3]=LOCHAR(LOINT(Value)); //Array value (0x78)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/LoInt.htm [06/10/2008 17.43.47]


Macro: MAKEINT

ELSIST Srl, www.elsist.it MNL041Q100

Macro

MAKEINT

This macrofunction returns an unsigned int number from two unsigned char numbers.

Examples

The hexadecimal values 0x12 and 0x34 present in the HighNibble and LowNibble variables, are converted in
the hexadecimal value 0x1234 and transferred in the Result variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char HighNibble; //High nibble


unsigned char LowNibble; //Low nibble
unsigned int Result; //Result value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
HighNibble=0x12; //High nibble
LowNibble=0x34; //Low nibble
Result=MAKEINT(HighNibble, LowNibble); //Result value (0x1234)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/MakeInt.htm [06/10/2008 17.43.47]


Macro: MAKELONG

ELSIST Srl, www.elsist.it MNL041Q100

Macro

MAKELONG

This macrofunction returns an unsigned long number from two unsigned int numbers.

Examples

The hexadecimal values 0x1234 and 0x5678 present in the HighNibble and LowNibble variables, are
converted in the hexadecimal value 0x12345678 and transferred in the Result variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int HighNibble; //High nibble


unsigned int LowNibble; //Low nibble
unsigned long Result; //Result value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
HighNibble=0x1234; //High nibble
LowNibble=0x5678; //Low nibble
Result=MAKELONG(HighNibble, LowNibble); //Result value (0x12345678)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/MakeLong.htm [06/10/2008 17.43.48]


Macro: PLCOp(x)

ELSIST Srl, www.elsist.it MNL041Q100

Macro

PLCOp(x)

Special macrofunctions suited for each type of operand allow to read and write to all the numerical operands of
the RIL language, it's necessary to define the operand address in hexadecimal.

The Flag (F), Byte (Y), Word (W), Double (DW) and Float (FL) operands, share the same memory so the
operand PLCOpW(0x0100) uses the same memory location of the operands PLCOpF(0x0100), PLCOpF
(0x0101) or the operands PLCOpY(0x0100), PLCOpW(0x0100).

Examples

Are shown accesses to different RIL operands.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES DEFINITION
// -----------------------------------------------------------------------------

BOOL InputValue;
BOOL OutputValue;
BOOL FlagValue;
unsigned char ByteValue;
unsigned int WordValue;
unsigned long DoubleValue;
float FloatValue;

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
InputValue=PLCOpI(0x0001); //To read the input 0001
PLCOpI(0x0001)=InputValue; //To write the input 0001

PLCOpO(0x0001)=OutputValue; //To read the output 0001


OutputValue=PLCOpO(0x0001); //To write the output 0001

FlagValue=PLCOpF(0x0010); //To read the flag 0010


PLCOpF(0x0010)=FlagValue; //To write the flag 0010

ByteValue=PLCOpY(0x000A); //To read the Byte 000A


PLCOpY(0x000A)=ByteValue; //To write the Byte 000A

http://192.168.0.61/Destination/Html/CLanguage/Macros/PLCOpx.htm (1 of 2) [06/10/2008 17.43.48]


Macro: PLCOp(x)

WordValue=PLCOpW(0x001C); //To read the word 001C


PLCOpW(0x001C)=WordValue; //To write the word 001C

DoubleValue=PLCOpDW(0x0004); //To read the double word 0008


PLCOpDW(0x0004)=DoubleValue; //To write the double word 0008

FloatValue=PLCOpFL(0x0010); //To read the float 0010


PLCOpFL(0x0010)=FloatValue; //To read the float 0010
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/PLCOpx.htm (2 of 2) [06/10/2008 17.43.48]


Macro: SWCHAR

ELSIST Srl, www.elsist.it MNL041Q100

Macro

SWCHAR

This macrofunction swaps an unsigned char number.

Examples

It's returned the exadecimal value 0x21 in the Value variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char Value; //Value


unsigned char Result; //Result value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x12; //Value
Result=SWCHAR(Value); //Result value (0x21)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/SwChar.htm [06/10/2008 17.43.49]


Macro: SWINT

ELSIST Srl, www.elsist.it MNL041Q100

Macro

SWINT

This macrofunction swaps an unsigned int number.

Examples

It's returned the exadecimal value 0x3412 in the Value variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int Value; //Value


unsigned int Result; //Result value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x1234; //Value
Result=SWINT(Value); //Result value (0x3412)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/SwInt.htm [06/10/2008 17.43.49]


Macro: SWLONG

ELSIST Srl, www.elsist.it MNL041Q100

Macro

SWLONG

This macrofunction swaps an unsigned long number.

Examples

It's returned the exadecimal value 0x56781234 in the Value variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned long Value; //Value


unsigned long Result; //Result value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Value=0x12345678; //Value
Result=SWLONG(Value); //Result value (0x56781234)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Macros/SwLong.htm [06/10/2008 17.43.50]


"C" data types: ACSPOINTFUNCTIONS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

ACSPOINTFUNCTIONS

This data structure it's used to define all the access point function vectors.

typedef struct
{
USERFLAGS (*GetUserFlags)(void);
void (*F01)(void);
void (*F02)(void);
void (*F03)(void);
void (*F04)(void);
void (*F05)(void);
void (*F06)(void);
void (*F07)(void);
void (*F08)(void);
void (*F09)(void);
void (*F0A)(void);
void (*F0B)(void);
void (*F0C)(void);
void (*F0D)(void);
void (*F0E)(void);
void (*F0F)(void);
}ACSPOINTFUNCTIONS;

Some fields of the data structure are not managed in some libraries. In the following table the indication of
the different fields is reported with reference to the supported libraries.

Ofs Description

00 USERFLAGS (*GetUserFlags)(void) - - - - - - D
GetUserFlags device function address
02 void (*F01)(void) - - - - - - D
Space for future allocations.
04 void (*F02)(void) - - - - - - D
Space for future allocations.
06 void (*F03)(void) - - - - - - D
Space for future allocations.
08 void (*F04)(void) - - - - - - D
Space for future allocations.
0A void (*F05)(void) - - - - - - D
Space for future allocations.
0C void (*F06)(void) - - - - - - D
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/ACSPOINTFUNCTIONS.htm (1 of 2) [06/10/2008 17.43.51]


"C" data types: ACSPOINTFUNCTIONS

0E void (*F07)(void) - - - - - - D
Space for future allocations.
10 void (*F08)(void) - - - - - - D
Space for future allocations.
12 void (*F09)(void) - - - - - - D
Space for future allocations.
14 void (*F0A)(void) - - - - - - D
Space for future allocations.
16 void (*F0B)(void) - - - - - - D
Space for future allocations.
18 void (*F0C)(void) - - - - - - D
Space for future allocations.
1A void (*F0D)(void) - - - - - - D
Space for future allocations.
1C void (*F0E)(void) - - - - - - D
Space for future allocations.
1E void (*F0F)(void) - - - - - - D
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/ACSPOINTFUNCTIONS.htm (2 of 2) [06/10/2008 17.43.51]


"C" data types: BLINKBITDATA

ELSIST Srl, www.elsist.it MNL041Q100

Data types

BLINKBITDATA

This data type (structure) is provided for the use with the BlinkBit function.

typedef struct
{
// --------------------------[Members that can be managed by user program]--

BOOL OutBit; //Output bit


unsigned char BlinkNr; //Number of blinking

// --------------------------------------------[Internal use only members]--

}BLINKBITDATA;

In the following table the indication of the different field are reported with reference to the supported libraries.

Ofs Name Description

00 OutBit Bit status output (FALSE or TRUE) D C - A A A A


01 BlinkNr It defines the number of blinking for the output bit (Range from 0 to 255) D C - A A A A

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/BLINKBITDATA.htm [06/10/2008 17.43.51]


"C" functions: BlinkBit

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

BlinkBit

This function executes the blinking of the specified number of a bit variable. The function operates on a
BLINKBITDATA data structure wich address must be passed to the function.

Prototype
ElSystemLib.h
Declaration
void BlinkBit(BLINKBITDATA* S);
Parameters
BLINKBITDATA* S Data structure address (Range da 0x0000 a 0xFFFF)
Return value
None

Examples

Are executed 5 blinks (250 mSec on/off) followed by a off pause of 2 Sec of the logic outputOUT 0000.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables declaration.

static BLINKBITDATA Blk; //Blink data structure

// -------------------------------------------------------------------------
// BLINK A LOGIC OUTPUT
// -------------------------------------------------------------------------
// Initialize the data structure.

if (PLCFirstLoop)
Blk.BlinkNr=5; //Number of blinking

// Execute the function.

BlinkBit(&Blk);

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/BlinkBit.htm (1 of 2) [06/10/2008 17.43.52]


"C" functions: BlinkBit

// Manage the logic output

PeripheralOut(0x00, 0x00, Blk.OutBit); //Outputs from 0 to 7


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/BlinkBit.htm (2 of 2) [06/10/2008 17.43.52]


"C" data types: CANINITDATA

ELSIST Srl, www.elsist.it MNL041Q100

Data types

CANINITDATA

This data type (structure) is provided for the use with the CANInit function.

typedef struct
{
BOOL FrameFormat; //Frame format selection
unsigned char Baud; //Baud rate
unsigned long Filter; //Acceptance filter
unsigned long Mask; //Acceptance mask
}CANINITDATA;

In the following table the indication of the different field are reported with reference to the supported libraries.

Ofs Name Description

00 FrameFormat FALSE: SFF, Standard format (11 bit) - - - - - - A


TRUE: EFF, Extended format (29 bit)
01 Baud Defines the desired baud rate: - - - - - - A
0: 125 Kb, 1: 250 Kb
02 Filter Defines the acceptance frame filter. - - - - - - A
06 Mask Defines the acceptance frame mask. Defining the 0xFFFFFFFF value - - - - - - A
all received frames will be accepted.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/CANINITDATA.htm [06/10/2008 17.43.52]


"C" functions: CANInit

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

CANInit

This function executes the CAN controller init by setting all the operating parameters. It's necessary to define the
parameters in the CANINITDATA structure wich address is passed to the function.

Prototype
ElSystemLib.h
Declaration
BOOL CANInit(CANINITDATA* S);
Parameters
CANINITDATA* S Data structure address (Range da 0x0000 a 0xFFFF)
Return value
BOOL FALSE: CAN controller init error
TRUE: CAN controller initialized

Esempi

The CAN controller is initialized.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// CAN init data structure initialization.

static CANINITDATA Init=


{
FALSE, //SFF, Standard format (11 bit)
0, //Baud rate (125 Kb)
0x00000000, //Acceptance filter
0xFFFFFFFF, //Acceptance mask
};

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// At the first program loop the CAN controller is initialized.

if (PLCFirstLoop)

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANInit.htm (1 of 2) [06/10/2008 17.43.53]


"C" functions: CANInit

{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

if (!CANInit(&Init))
printf("Error in the CAN module initialization\r\n");
else
printf("The CAN module is correctly initialized\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANInit.htm (2 of 2) [06/10/2008 17.43.53]


"C" data types: I2CMNGFUNCTIONS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

I2CMNGFUNCTIONS

This data structure it's used to define all the I2C communication function vectors.

typedef struct
{
void (*I2CSWriteCommand)(void);
unsigned char (*I2CSReadCommand)(void);
void (*I2CSDataReceive)(unsigned char Data);
unsigned char (*I2CSDataSend)(void);
}I2CMNGFUNCTIONS;

Some fields of the data structure are not managed in some libraries. In the following table the indication of
the different fields is reported with reference to the supported libraries.

Ofs Description

00 void (*I2CSWriteCommand)(void) - - - - B C A
I2CSWriteCommand function address, this function is executed when a write
command with correct address has been received from I2C bus.
02 unsigned char (*I2CSReadCommand) - - - - B C A
I2CSReadCommand function address, this function is executed when a read
command with correct address has been received from I2C bus. The function must
return the data to be sent to the master system.
04 void (*I2CSDataReceive)(unsigned char Data) - - - - B C A
I2CSDataReceive function address, this function is executed when a data has been
received from I2C bus. The received data is passed to the function.
06 unsigned char (*I2CSDataSend)(void) - - - - B C A
I2CSDataSend function address, this function is executed when a data is request
on I2C bus. The function must return the data to be sent to the master system.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/I2CMNGFUNCTIONS.htm [06/10/2008 17.43.54]


"C" data types: MODEMSTRUCT

ELSIST Srl, www.elsist.it MNL041Q100

Data types

MODEMSTRUCT

The modem management requires a data structure of 48 bytes, we report a prototype. The user program
can access to the variable defined in this structure to interact with the modem management.

typedef struct
{
struct
{
BOOL b00:1;
BOOL Dial:1; //Active force the number dial
BOOL SMSSend:1; //Active force the SMS send
BOOL HangUp:1; //Active force the hang up
BOOL b04:1;
BOOL b05:1;
BOOL b06:1;
BOOL ResetError:1; //Active force error field reset
}Command;

unsigned char Dummy1;

struct
{
BOOL b08:1;
BOOL CLIPRxd:1; //Pulse active at every CLIP received
BOOL b0A:1;
BOOL Connect:1; //Active if the modem is connect
BOOL b0C:1;
BOOL b0D:1;
BOOL PowerOn:1; //Active if is powering on the modem
BOOL SwitchModemOn:1; //Used to switch modem On/Off

BOOL ModemOk:1; //Active if the modem is working


BOOL Init:1; //Active if is initializing the modem
BOOL Check:1; //Active if is checking the modem
BOOL Dial:1; //Active if the modem is dialing the number
BOOL SMSSend:1; //Active if the modem is sending an SMS
BOOL SMSReceived:1; //Pulse active if an SMS is received
BOOL Ring:1; //Pulse active at every detected ring
BOOL RingFlag:1; //1 Sec active at every detected ring
}Status;

struct
{
BOOL CLIPReceive:1; //Active if error in CLIP receive
BOOL NoOperator:1; //Active if no operator available
BOOL b0A:1;

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/MODEMSTRUCT.htm (1 of 4) [06/10/2008 17.43.55]


"C" data types: MODEMSTRUCT

BOOL b0B:1;
BOOL b0C:1;
BOOL b0D:1;
BOOL b0E:1;
BOOL b0F:1;

BOOL Init:1; //Active if error in modem init


BOOL Check:1; //Active if error in modem check
BOOL b02:1;
BOOL HangUp:1; //Active if error in modem hang up
BOOL CallAnswer:1; //Active if error in call answer
BOOL Dial:1; //Active if error in dialing the number
BOOL SMSReceive:1; //Active if error in SMS receive
BOOL SMSSend:1; //Active if error in SMS send
}Error;

unsigned char Dummy2[2];


unsigned char Rssi; //Received signal strength
unsigned char Dummy3;
char* DialNumber; //Number to be dialed
char* SMSRxBuf; //SMS received message buffer
unsigned char SMSRxLgt; //SMS message received length
unsigned char Dummy4;
char* SMSTxBuf; //SMS message to send
unsigned char Dummy5[2];
char* SMSNumber; //Number to send the message
unsigned char Dummy6[2];
char* CLIPRxNumber; //CLIP received number
unsigned char CLIPRxLgt; //CLIP received number length
unsigned char Dummy7[21];
}MODEMSTRUCT;

Some fields of the data structure are not managed in some libraries because the type of terminal supported
by the library does not have all the functionality provided. In the table below the indication of the different
fields is reported with reference to the supported libraries.

Ofs Name Description

00 Command MODEM management command bits - - - - - - D


1 Dial Force the call of the number present in the buffer
pointed by DialNumber. It will be automatically reset
when the connection with the remote system is been
established. If reset by user program the dial
sequence is aborted.
2 SMSSend Force the send of SMS to the number present in the
buffer pointed by SMSNumber. The bit is
automatically reset when the SMS is sent. If reset by
user program the dial sequence is aborted.
3 HangUp Hang up the modem
7 ResetError Reset all error bits. It's automatically reset

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/MODEMSTRUCT.htm (2 of 4) [06/10/2008 17.43.55]


"C" data types: MODEMSTRUCT

02 Status MODEM management status bits - - - - - - D


0 ModemOk Active if the modem is correctly initialized and
is active
1 Init Active during the modem init sequence
2 Check Active during the modem test sequence
3 Dial Active during the dialing sequence
4 SMSSend Active during the SMS send sequence
5 SMSReceived Active for a program loop when an SMS is
received. The SMS text is stored in the buffer
pointer by SMSRxBuf
6 Ring Active for a program loop at every ring
7 RingFlag Active for 1 second ad every ring
9 CLIPRxd Active for a program loop when a CLIP is
received. The Clip number is store in the buffer
pointed by CLIPRxNumber
B Connect Active if the modem is connected to a remote
system. It's activated after the execution of a
Command.Dial or at the reception of a call
after the number of defined rings, only if the
synchronization sequence between the two
modems is correctly terminated
E PowerOn Active during the power on sequence. It's
automatically set at system startup or if an
error occurs during the command
management. It's reset at the end of the
sequence
F SwitchModemOn It commands the modem switch on. It must be
copied by the user program to a logic output, it
allows to manage the modem switch on and off
guaranteeing the possibility to completely reset
the modem in case of errors
04 Error MODEM management error bits - - - - - - D
0 Init Indicates an error on init sequence
1 Check Indicates an error on check sequence
3 HangUp Indicates an error on hang-up sequence
4 CallAnswer Indicates an error on answer call sequence
5 Dial Indicates an error on number dial
6 SMSReceive Indicates an error on SMS reception
7 SMSSend Indicates an error on SMS send
8 CLIPReceive Indicates an error on CLIP reception
9 NoOperator Indicates that the operator is missing, the modem
is not connected to the network

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/MODEMSTRUCT.htm (3 of 4) [06/10/2008 17.43.55]


"C" data types: MODEMSTRUCT

08 Rssi Received signal strength, returns the strength of the signal - - - - - - D


received
Value Signal level

0 -113 dBm or less


1 -111 dBm
From 2 to 30 From -109 dBm to -53 dBm
31 -51 dBm or greater
From 32 to 99 Not supported
0A DialNumber It define the address of the buffer that contains the number to call - - - - - - D
0C SMSRxBuf It define the address of the buffer where should be transferred the - - - - - - D
text of the SMS received
0E SMSRxLgt It define the dimension of the SMS reception buffer - - - - - - D
10 SMSTxBuf It define the address of the buffer where is the text of the SMS to be - - - - - - D
sent
14 SMSNumber It define the address of the buffer that contains the number to send - - - - - - D
the SMS
18 CLIPRxNumber It define the address of the buffer where should be transferred the - - - - - - D
CLIP received
1A CLIPRxLgt It define the dimension of the CLIP buffer - - - - - - D

An example of use can be reached here.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/MODEMSTRUCT.htm (4 of 4) [06/10/2008 17.43.55]


"C" data types: NSYSTBUSIODATA

ELSIST Srl, www.elsist.it MNL041Q100

Data types

NSYSTBUSIODATA

This data type (structure) is provided for the use with the NSYSTBusIO function.

typedef struct
{
unsigned char Module; //NSYST module address
unsigned char Command; //Command to execute
unsigned char TxLength; //Tx buffer length
unsigned char RxLength; //Rx buffer length
void* TxFrame; //Tx frame buffer pointer
void* RxFrame; //Rx frame buffer pointer
}NSYSTBUSIODATA;

In the following table the indication of the different field are reported with reference to the supported libraries.

Ofs Name Description

00 Module Netsyst module address (Range from 0 to 7) - - - - E - B


01 Command Command to execute. Reference to the FbI2CSlaveManager function - - - - E - B
block I2C supported commands
02 TxLength Transmission command buffer length (Range from 0 to 64) - - - - E - B
03 RxLength Reception command buffer length (Range from 0 to 64) - - - - E - B
04 TxFrame Pointer to the command transmission buffer (Range from 0x0000 to - - - - E - B
0xFFFF)
06 RxFrame Pointer to the command reception buffer (Range from 0x0000 to 0xFFFF) - - - - E - B

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/NSYSTBUSIODATA.htm [06/10/2008 17.43.56]


"C" functions: NSYSTBusIO

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTBusIO

This function execute the access to the Netsyst bus, the function completely manages the command write and
the return data read from Netsyst extension modules. The function operates on a NSYSTBUSIODATA data
structure which address must be passed to the function.

Prototype
ElSystemLib.h
Declaration
BOOL NSYSTBusIO(NSYSTBUSIODATA* S);
Parameters
NSYSTBUSIODATA* S Data structure address (Range da 0x0000 a 0xFFFF)
Return value
BOOL FALSE: No errors
TRUE: Access error

Examples

Are managed the logic outputs on the extension module with address 1.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

struct
{
BOOL Out00:1; //Out 00 bit
BOOL Out01:1; //Out 01 bit
BOOL Out02:1; //Out 02 bit
BOOL Out03:1; //Out 03 bit
BOOL Out04:1; //Out 04 bit
BOOL Out05:1; //Out 05 bit
BOOL Out06:1; //Out 06 bit
BOOL Out07:1; //Out 07 bit
}LogOut;

BOOL Error; //Peripheral output management error

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTBusIO.htm (1 of 2) [06/10/2008 17.43.56]


"C" functions: NSYSTBusIO

void Example(void)
{
// Local definitions.

NSYSTBUSIODATA NsD; //Data structure

// -------------------------------------------------------------------------
// COMMAND 09, WRITE LOGIC OUTPUT
// -------------------------------------------------------------------------
// The master system writes to the slave system the command frame:
//
// +-----+---------+-----+
// | CMD | OUT 0-7 | CKS |
// +-----+---------+-----+
//
// The master system reads from the slave system the command frame:
//
// +-----+-----+
// | CMD | CKS |
// +-----+-----+
//
// Where:
// CMD: Command to be executed (0x09).
// OUT 0-7: Output value to be set.
// CKS: Check sum value
//
// CMD: Command to be executed (0x09).
// CKS: Check sum value
// -------------------------------------------------------------------------
// Execute the write logic output command on module "1".

LogOut.Out00=PLCTimeBase400; //Out 00 bit


NsD.Module=1; //NSYST module address
NsD.Command=0x09; //Command to execute
NsD.TxLength=1; //Tx buffer length
NsD.RxLength=0; //Rx buffer length
NsD.TxFrame=&LogOut; //Tx frame buffer pointer
Error=NSYSTBusIO(&NsD); //Peripheral output management error
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTBusIO.htm (2 of 2) [06/10/2008 17.43.56]


"C" data types: NSYSTEXTMODSTS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

NSYSTEXTMODSTS

This data type (structure) it's returned reading the state of a Netsyst extension module.

typedef struct
{
BOOL InputChanged:1; //Logic inputs on module are changed
BOOL b1:1;
BOOL b2:1;
BOOL b3:1;
unsigned char Check:4;
}NSYSTEXTMODSTS;

This data structure is returned by the NSYSTModSts function and contains the information about the state
of the Netsyst extension module.

Bit Name Description

00 InputChanged TRUE: The state of the logic inputs on the extension module are - - - - - - D
changed from the last reading by the master system with the
NSYSTExtModuleInp function that resets the bit.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/NSYSTEXTMODSTS.htm [06/10/2008 17.43.57]


"C" data types: PLCRTCDATA

ELSIST Srl, www.elsist.it MNL041Q100

Data types

PLCRTCDATA

This data type (structure) is provided for the information inherent the real time clock. It's used in the PLC
section only.

typedef struct
{
unsigned char Year; //Year, range from 0 to 99
unsigned char Month; //Month, range from 1 to 12
unsigned char Day; //Day, range from 1 to 31
unsigned char WeekDay; //Week day, range from 0 to 6
unsigned char Hour; //Hour, range from 0 to 23
unsigned char Minute; //Minute, range from 0 to 59
unsigned char Second; //Second, range from 0 to 59
unsigned char Hundred; //Hundred, range from 0 to 99
}PLCRTCDATA;

In the following table the indication of the different field are reported with reference to the supported libraries.

Ofs Name Description

00 Year Year value (Range from 0 to 99) - - C - - - A


01 Month Month value (Range from 1 to 12) - - C - - - A
02 Day Day value (Range from 1 to 31) - - C - - - A
03 WeekDay Day of the week value (Range from 0 to 6) - - C - - - A
(0:Sunday, 1:Monday, 2:Tuesday, 3:Wednsday, 4:Thursday, 5:Friday, 6:
Saturday)
04 Hour Hour value (Range from 0 to 23) - - C - - - A
05 Minute Minute value (Range from 0 to 59) - - C - - - A
06 Second Second value (Range from 0 to 59) - - C - - - A
07 Hundred Hundred of second value (Range from 0 to 99) - - C - - - A

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/PLCRTCDATA.htm [06/10/2008 17.43.57]


"C" data types: RTCDATA

ELSIST Srl, www.elsist.it MNL041Q100

Data types

RTCDATA

This data type (structure) is provided for the information inherent the real time clock.

typedef struct
{
unsigned char Year; //Year, range from 0 to 99
unsigned char Month; //Month, range from 1 to 12
unsigned char Day; //Day, range from 1 to 31
unsigned char WeekDay; //Week day, range from 0 to 6
unsigned char Hour; //Hour, range from 0 to 23
unsigned char Minute; //Minute, range from 0 to 59
unsigned char Second; //Second, range from 0 to 59
unsigned char Hundred; //Hundred, range from 0 to 99
}RTCDATA;

Some fields of the data structure are not managed in some libraries because the target system has not the
real time clock. In the following table the indication of the different field are reported with reference to the
supported libraries.

Ofs Name Description

00 Year Year value (Range from 0 to 99) B C - A A A A


01 Month Month value (Range from 1 to 12) B C - A A A A
02 Day Day value (Range from 1 to 31) B C - A A A A
03 WeekDay Day of the week value (Range from 0 to 6) B C - A A A A
(0:Sunday, 1:Monday, 2:Tuesday, 3:Wednsday, 4:Thursday, 5:Friday, 6:
Saturday)
04 Hour Hour value (Range from 0 to 23) B C - A A A A
05 Minute Minute value (Range from 0 to 59) B C - A A A A
06 Second Second value (Range from 0 to 59) B C - A A A A
07 Hundred Hundred of second value (Range from 0 to 99) B C - A A A A

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/RTCDATA.htm [06/10/2008 17.43.58]


"C" data types: SERIALFUNCTIONS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

SERIALFUNCTIONS

This data structure it's used to define all the serial device function vectors.

typedef struct
{
void (*GetSerialMode)(SERIALSTRUCT* S);
void (*SetSerialMode)(SERIALSTRUCT* S);
void (*SerialDTRMng)(BOOL Value);
void (*F03)(void);
void (*F04)(void);
void (*F05)(void);
void (*F06)(void);
void (*F07)(void);
void (*F08)(void);
void (*F09)(void);
void (*F0A)(void);
void (*F0B)(void);
void (*F0C)(void);
void (*F0D)(void);
void (*F0E)(void);
void (*F0F)(void);
}SERIALFUNCTIONS;

Some fields of the data structure are not managed in some libraries. In the following table the indication of
the different fields is reported with reference to the supported libraries.

Ofs Description

00 void (*GetSerialMode)(SERIALSTRUCT* S) D E - C A B A
GetSerialMode device function address.
02 void (*SetSerialMode)(SERIALSTRUCT* S D E - C A B A
SetSerialMode device function address.
04 void (*SerialDTRMng)(BOOL Value) D E - C A B A
SerialDTRMng device function address.
06 void (*F03)(void) - - - - E - A
Space for future allocations.
08 void (*F04)(void) - - - - E - A
Space for future allocations.
0A void (*F05)(void) - - - - E - A
Space for future allocations.
0C void (*F06)(void) - - - - E - A
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALFUNCTIONS.htm (1 of 2) [06/10/2008 17.43.59]


"C" data types: SERIALFUNCTIONS

0E void (*F07)(void) - - - - E - A
Space for future allocations.
10 void (*F08)(void) - - - - E - A
Space for future allocations.
12 void (*F09)(void) - - - - E - A
Space for future allocations.
14 void (*F0A)(void) - - - - E - A
Space for future allocations.
16 void (*F0B)(void) - - - - E - A
Space for future allocations.
18 void (*F0C)(void) - - - - E - A
Space for future allocations.
1A void (*F0D)(void) - - - - E - A
Space for future allocations.
1C void (*F0E)(void) - - - - E - A
Space for future allocations.
1E void (*F0F)(void) - - - - E - A
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALFUNCTIONS.htm (2 of 2) [06/10/2008 17.43.59]


"C" data types: SERIALSTRUCT

ELSIST Srl, www.elsist.it MNL041Q100

Data types

SERIALSTRUCT

This data type (structure) is provided for the information inherent to the configuration of the serial line, it is used by the
functions of reading serial mode GetSerialMode and set serial mode SetSerialMode.

typedef struct
{
// -----------------------------------------------------------------[Mode]--
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0|
// +++++++++++++++++++++++++++++++++
// | +-+-+ | | | | | | | | | +-------------------+
// | | | | | | | | | | +-------------------+ |
// | | | | | | | | | +-------------------+ | |
// | | | | | | | | +-------------------+ | | |
// | | | | | | | | +-+-+-+-+-+---+-------+------+
// | | | | | | | +- 0=Parity disabled| Binary | Hx| Baud | Port |
// | | | | | | | 1=Parity enabled +---------+---+-------+------+
// | | | | | | | | 0 0 0 0 | 0 | 300 | A, 1 |
// | | | | | | +- 0=Odd parity | 0 0 0 1 | 1 | 600 | A, B |
// | | | | | | 1=Even parity | 0 0 1 0 | 2 | 1200 | A, B |
// | | | | | | | 0 0 1 1 | 3 | 2400 | A, B |
// | | | | | +- 0=7 bits data | 0 1 0 0 | 4 | 4800 | A, B |
// | | | | | 1=8 bits data | 0 1 0 1 | 5 | 9600 | A, B |
// | | | | | | 0 1 1 0 | 6 | 19200 | A, B |
// | | | | +- 0=DTR normal | 0 1 1 1 | 7 | 38400 | A, B |
// | | | | 1=DTR complemented | 1 0 0 0 | 8 | 57600 | A, B |
// | | | | | 1 0 0 1 | 9 | 76800 | A, 2 |
// | | | +- 0=Normal | 1 0 1 0 | A |115200 | A, 2 |
// | | | 1=Echo flushed +---------+---+-------+------+
// | | |
// | | +- 0= Rx control characters enabled
// | | 1= Rx control characters disabled
// | |
// | +- 0=Reset DTR, it must be managed by the user program
// | 1=Set DTR, it must be managed by the user program
// | 2=DTR automatically managed without any time
// | 3=DTR automatically managed with defined time
// |
// +- 0:No wait
// 1:Wait
//
// Note: The CPU016A000 module has only the port "A".
// Note 1: The baud rate is not supported on port "B".
// Note 2: The baud rate is valid on port "B" in CPU016A100, CPU016A200 modules.

struct
{
unsigned char DTRComplement:1; //Complement the DTR signal
unsigned char EchoFlush:1; //Flush the echo
unsigned char RxCtrlDisable:1; //Disable Rx control characters
unsigned char NotUsed2:1; //Not used

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALSTRUCT.htm (1 of 4) [06/10/2008 17.44.01]


"C" data types: SERIALSTRUCT

unsigned char DTRManagement:3; //Define the DTR management


unsigned char WaitLoop:1; //FALSE:No wait, TRUE:Wait
unsigned char Baud:4; //Baud rate
unsigned char ParityEnabled:1; //Enables the parity management
unsigned char ParityType:1; //FALSE:Odd parity, TRUE:Even parity
unsigned char BitNumber:1; //FALSE:7 bit, TRUE:8 bit
unsigned char NotUsed1:1; //Not used
}Mode;

// -----------------------------------------------------------------[Status]--
// It contains the serial communication status.

struct
{
BOOL RxParityFault:1; //Parity error in received data
BOOL RxOverlapFault:1; //Overlap error in received data
BOOL LostCharOnRead:1; //Lost character on read
BOOL LostCharOnWrite:1; //Lost character on write
}Status;

// --------------------------------------------------------------[DTR Times]--

unsigned int DTROnTime; //DTR On wait time


unsigned int DTROffTime; //DTR Off delay time
}SERIALSTRUCT;

Some fields of the dates structure are not managed in some libraries. In the table underneath the indication of the
diffrent fields is reported with reference to the supported libraries.

Ofs Name Description

00 Mode Baud: It defines the communication baud rate B C - A A A A


0: 300 4: 4800 8: 57600 C: 115200
1: 600 5: 9600 9: 76800 D: 115200
2: 1200 6: 19800 A: 115200 E: 115200
3: 2400 7: 38400 B: 115200 F: 115200
ParityEnabled: Set it enables the communication parity management . B C - A A A A
ParityType: It defines the parity type. B C - A A A A
FALSE: Odd parity (Odd)
TRUE: Even parity (Even)
BitNumber: It defines the number of bit. B C - A A A A
FALSE: 7 bit
TRUE: 8 bit
DTRComplement: Set it complements the status of the DTR signal. B C - A A A A
EchoFlush: Set it automatically executes the flush of the received data at the end B C - A A A A
of the tansmission. It can be activated to cancel the echo of the tranmission from
the reception buffer on RS485 connections.
NOTE: The characters echo is executed only at the end of the Tx buffer
transmission, GetTxSpace function returns 0xFFFF.
RxCtrlDisable: Set it disables the automatic management of the control B C - A A A A
character (Xon, Xoff) in reception, all the received characters will be trasferred in
the reception buffer. It must be set in case of communication with binary protocol.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALSTRUCT.htm (2 of 4) [06/10/2008 17.44.01]


"C" data types: SERIALSTRUCT

DTRManagement: It defines the management way of the DTR signal. B C - A A A A


0: The signal is inactive, it could be managed by user program with the
SerialDTRMng function.
1: The signal is active, it could be managed by user program with the
SerialDTRMng function.
2: The signal is automatically activated before the transmission and inactivated at
the end, without interposition of any time.
3: The signal is automatically activated before the transmission and inactivated at
the end, using the times defined in DTROnTime, DTROffTime.
WaitLoop: It defines if waiting character in reception buffer and space in the D E - C B A A
transmission buffer.
FALSE: In reception if no character in the buffer, the GetCh and scanf functions
return 0. In transmission, if there's no space in the buffer, the PutCh and
printf functions loose the charachter to be transmitted.
TRUE: In reception if no charachter in the buffer, the GetCh and scanf functions
wait for the reception of a character. In transmission, if there's no space
in the buffer, the PutCh and printf functions wait for a space in the
transmission buffer before to transmit the charachter.
02 Status RxParityFault: Set if reception of character with wrong parity. It's reset by the B C - A A - A
TermIORxClear function
RxOverlapFault: Set in case of reception overlap. It's reset by the B C - A A - A
TermIORxClear function
LostCharOnRead: Set if a character lost in reception. It's reset by the - - - - - - A
TermIORxClear function
LostCharOnWrite: Set if a character lost in transmission. It's reset by the - - - - - - A
TermIOTxClear function
03 DTROnTime It defines the delay time between the activation of the DTR signal and the B C - A A - A
beginning of the transmission, expressed in mSec (Range from 0 to 65535). The
delay is waited only if DTRManagement=3.
05 DTROffTime It defines the delay time between the transmission of the last data and the B C - A A - A
deactivation of the DTR signal, expressed in mSec (Range from 0 to 65535). The
delay is waited only if DTRManagement=3.

Examples

In the following example at the first loop of program execution the serial lines are set up.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

SERIALSTRUCT SerialStruct; //Serial data structure

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALSTRUCT.htm (3 of 4) [06/10/2008 17.44.01]


"C" data types: SERIALSTRUCT

// Example program executed on main.

void Example(void)
{
// Execute the set serials mode.

if (PLCFirstLoop)
{
// Enable the serial communication on serial port "A" and define
// parameters. Set serial at 19200, e, 8. DTR automatically managed
// without any time.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


GetSerialMode(&SerialStruct); //Get communication mode
SerialStruct.Mode.DTRComplement=FALSE; //Complement the DTR signal
SerialStruct.Mode.EchoFlush=FALSE; //Flush the echo
SerialStruct.Mode.RxCtrlDisable=TRUE; //Disable Rx control characters
SerialStruct.Mode.DTRManagement=2; //Define the DTR management
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.ParityEnabled=TRUE; //Enables the parity management
SerialStruct.Mode.ParityType=TRUE; //FALSE:Odd parity, TRUE:Even parity
SerialStruct.Mode.BitNumber=TRUE; //FALSE:7 bit, TRUE:8 bit
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.Baud=6; //Baud rate
SerialStruct.DTROnTime=0; //DTR On wait time
SerialStruct.DTROffTime=0; //DTR Off delay time
SetSerialMode(&SerialStruct); //Set communication mode

// Enable the serial communication on serial port "B" and define


// parameters. Set serial at 9600, o, 7. DTR automatically managed
// with DTROn 100 mSec and DTROff 50 mSec.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


GetSerialMode(&SerialStruct); //Get communication mode
SerialStruct.Mode.DTRComplement=FALSE; //Complement the DTR signal
SerialStruct.Mode.EchoFlush=FALSE; //Flush the echo
SerialStruct.Mode.RxCtrlDisable=TRUE; //Disable Rx control characters
SerialStruct.Mode.DTRManagement=3; //Define the DTR management
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.ParityEnabled=TRUE; //Enables the parity management
SerialStruct.Mode.ParityType=FALSE; //FALSE:Odd parity, TRUE:Even parity
SerialStruct.Mode.BitNumber=FALSE; //FALSE:7 bit, TRUE:8 bit
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.Baud=5; //Baud rate
SerialStruct.DTROnTime=100; //DTR On wait time
SerialStruct.DTROffTime=50; //DTR Off delay time
SetSerialMode(&SerialStruct); //Set communication mode
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/SERIALSTRUCT.htm (4 of 4) [06/10/2008 17.44.01]


"C" data tyes: TERMINALFUNCTIONS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

TERMINALFUNCTIONS

This data structure it's used to define all the terminal device function vectors.

typedef struct
{
void (*SetCursorPos)(unsigned char Row, unsigned char Column);
unsigned char (*GetCursorRow)(void);
unsigned char (*GetCursorColumn)(void);
void (*DisplayClear)(unsigned char CharNumber);
void (*F04)(void);
void (*F05)(void);
void (*F06)(void);
void (*F07)(void);
void (*F08)(void);
void (*F09)(void);
void (*F0A)(void);
void (*F0B)(void);
void (*F0C)(void);
void (*F0D)(void);
void (*F0E)(void);
void (*F0F)(void);
}TERMINALFUNCTIONS;

Some fields of the dates structure are not managed in some libraries. In the following table the indication of
the different fields is reported with reference to the supported libraries.

Ofs Description

00 void (*SetCursorPos)(unsigned char Row, unsigned char Column); D E - C A B A


SetCursorPos device function address.
02 unsigned char (*GetCursorRow)(void) D E - C A B A
GetCursorRow device function address.
04 unsigned char (*GetCursorColumn)(void) D E - C A B A
GetCursorColumn device function address.
06 void (*DisplayClear)(unsigned char CharNumber) D E - C A B A
DisplayClear device function address.
08 void (*F04)(void) - - - - E - A
Space for future allocations.
0A void (*F05)(void) - - - - E - A
Space for future allocations.
0C void (*F06)(void) - - - - E - A
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALFUNCTIONS.htm (1 of 2) [06/10/2008 17.44.02]


"C" data tyes: TERMINALFUNCTIONS

0E void (*F07)(void) - - - - E - A
Space for future allocations.
10 void (*F08)(void) - - - - E - A
Space for future allocations.
12 void (*F09)(void) - - - - E - A
Space for future allocations.
14 void (*F0A)(void) - - - - E - A
Space for future allocations.
16 void (*F0B)(void) - - - - E - A
Space for future allocations.
18 void (*F0C)(void) - - - - E - A
Space for future allocations.
1A void (*F0D)(void) - - - - E - A
Space for future allocations.
1C void (*F0E)(void) - - - - E - A
Space for future allocations.
1E void (*F0F)(void) - - - - E - A
Space for future allocations.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALFUNCTIONS.htm (2 of 2) [06/10/2008 17.44.02]


"C" data types: TERMINALSTRUCT

ELSIST Srl, www.elsist.it MNL041Q100

Data types

TERMINALSTRUCT

The terminal management requires a data structure of 16 bytes, we report a prototype. The user program can
works on the variable defined in this structure to reading the keys, to synchronize the display, to manage the LED
and to execute the data entry.

typedef struct
{
unsigned char TerminalAddress; //Terminal address

struct
{
BOOL LED0:1; //Key [0] led command
BOOL LED1:1; //Key [1] led command
BOOL LED2:1; //Key [2] led command
BOOL LED3:1; //Key [3] led command
BOOL LED4:1; //Key [4] led command
BOOL LED5:1; //Key [5] led command
BOOL LED6:1; //Key [6] led command
BOOL LCDBacklight:1; //LCD backlight command
}LEDCommand;

struct
{
BOOL K0:1; //Key [0] status
BOOL K1:1; //Key [1] status
BOOL K2:1; //Key [2] status
BOOL K3:1; //Key [3] status
BOOL K4:1; //Key [4] status
BOOL K5:1; //Key [5] status
BOOL K6:1; //Key [6] status
BOOL K7:1; //Key [7] status

BOOL K8:1; //Key [8] status


BOOL K9:1; //Key [9] status
BOOL KUP:1; //Key [UP] status
BOOL KDW:1; //Key [DW] status
BOOL KFUN:1; //Key [FUN] status
BOOL KESC:1; //Key [ESC] status
BOOL KCLR:1; //Key [CLR] status
BOOL KENT:1; //Key [ENT] status

BOOL KLEFT:1; //Key [KLEFT] status


BOOL KRIGHT:1; //Key [KRIGHT] status
}KeyStatus;

struct
{
BOOL InputDataSkipped:1; //Set if skipped the input data
BOOL InputDataAborted:1; //Set if aborted the input data

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (1 of 6) [06/10/2008 17.44.04]


"C" data types: TERMINALSTRUCT

BOOL InputDataEnd:1; //Set if the input data sequence end


BOOL RefreshEnd:1; //Set if the display refresh end
BOOL KeyPressed:1; //Set if a key is pressed
BOOL TimeoutError:1; //Display access timeout error
BOOL AccessError:1; //Display access error
BOOL KeyboardTimeOut:1; //Set if key use timeout
}Status;

unsigned char InputDataCommand; //Input data command type


unsigned char InputDataDigit; //Number of digit to be inputted
unsigned char TerminalType; //Terminal type
unsigned char Dummy[5];
}TERMINALSTRUCT;

Some fields of the data structure are not managed in some libraries because the type of terminal supported by
the library does not have all the functionalities provided. In the table below the indication of the different fields is
reported with reference to the supported libraries.

Ofs Name Description

00 TerminalAddress It defines the hardware address of the terminal, the default value is - C - - - - A
0x07
01 LEDCommand LED0: Key LED command - C - - - - A

LED1: Key LED command - C - - - - A

LED2: Key LED command - C - - - - A

LED3: Key LED command - C - - - - A

LED4: Key LED command - C - - - - A

LED5: Key LED command - C - - - - A

LED6: Key LED command - C - - - - A

LCDBacklight: Display backlight command - C - - - - A


02 KeyStatus K0: Key status - C - - - - A

K1: Key status - C - - - - A

K2: Key status - C - - - - A

K3: Key status - C - - - - A

K4: Key status - C - - - - A

K5: Key status - C - - - - A

K6: Key status - C - - - - A

K7: Key status - C - - - - A

K8: Key status - C - - - - A

K9: Key status - C - - - - A

KUP: Key , status B C - - A - A

KDW: Key , status B C - - A - A

KFUN: Key , status B C - - A - A

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (2 of 6) [06/10/2008 17.44.04]


"C" data types: TERMINALSTRUCT

KESC: Key status - C - - - - A

KCLR: Key status - C - - - - A

KENT: Key , status B C - - A - A

KLEFT: Key , status B C - - A - A

KRIGHT: Key , status B C - - A - A

05 Status InputDataSkipped: Set for a program loop if the data entry is - C - - - - A


skipped. This happens by pressing the key during data entry
before have inputted any value.
InputDataAborted: Set for a program loop if the data entry is - C - - - - A
aborted. This hapens by pressing the key during data entry.
InputDataEnd: Set for a program loop if the data entry is ended. B C - - A - A
This situation happens by pressing the , key during data
entry.
RefreshEnd: Set for a program loop at any display refresh. To avoid B C - A A A A
flickering it's necessary to sincronize with this bit all the wiriting data
to the display.
KeyPressed: Set for a program loop if the at any key pressing on B C - - A - A
the terminal.
TimeoutError: Set if a timeout error is detect during the access to B C - A A A A
the display. The bit must be reset by the user program.
KeyboardTimeOut: Set for a program loop if during the data entry B C - - A - A
no keys are pressed for a time longer than the one defined in
KeyboardTimeOut.
06 InputDataCommand The user program should transfer the value of the data entry type B C - - A - A
required according to the reported table. The value will be
automatically reset at the data entry end. Resetting the value by
user program it's possible to abort the data entry sequence.
1: Decimal numbers with sign, are accepted all numbers from 0 to 9
the '.' and the '-'
2: Password, are accepted al numbers from 0 to 9 and the '*' char is
shown
3: Hexadecimal numbers, are accepted all numbers from 0 to F
4: Decimal numbers without sign, are accepted all numbers from 0
to 9 and the '-'
5: Binary number, are accepted only the 0 and the 1
6: Binary enhanced, are accepted all numbers from 0 to F and the '-'
07 InputDataDigit It defines the digit number of the variable for data entry (Range from B C - - A - A
1 to 16)
08 KeyboardTimeOut It defines the keyboard timeout espressed in mSec. If during the B C - - A - A
data entry no keys are pressed for a time longer than the one
defined the bit KeyboardTimeOut is set for a program loop (Range
from 1 to 65536)
0A TerminalType Defines the terminal type, refer to table. - - - - - - D

TerminalType

Terminal type definitions table:

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (3 of 6) [06/10/2008 17.44.04]


"C" data types: TERMINALSTRUCT

Definition Description

TERMINALTYPEPICOFACE PICOFACE terminal


TERMINALTYPENETSYST NETSYST terminal
TERMINALTYPENETREADER NETREADER terminal

Examples

A PICOFACE terminal is managed with the display and the input of 2 variables.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int VarInt; //Unsigned int variable


float VarFloat; //Float variable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static BOOL ParameterPtr; //Input parameter pointer


static TERMINALSTRUCT Ts; //Terminal data structure

// -------------------------------------------------------------------------
// PICOFACE TERMINAL MANAGEMENT
// -------------------------------------------------------------------------
// Set the terminal "A" as standard I/O console.

SetTermIOVectors(IOTerminalA); //Set the terminal "A" as I/O console

// Execute the variables init and set the terminal data structure address.

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
Ts.TerminalType=TERMINALTYPEPICOFACE; //Terminal type
SetTermIOData(&Ts); //Terminal data structure
TermIOOpen(); //Open the terminal I/O

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (4 of 6) [06/10/2008 17.44.04]


"C" data types: TERMINALSTRUCT

// Copy the Keyboard status to the LED for keys [0] and [1].

Ts.LEDCommand.LED0=Ts.KeyStatus.K0; //Key [0] led command


Ts.LEDCommand.LED1=Ts.KeyStatus.K1; //Key [1] led command

// Display the variable values on the terminal display.


// +----------------+
// |VarInt : ----- |
// |VarFloat: ---.- |
// +----------------+

if (Ts.Status.RefreshEnd)
printf("\nVarInt : %05d VarFloat: %05.1f ", VarInt, VarFloat);

// By pressing the [CLR] key, it's possible to select the parameter must be
// set. Please note that the parameter is select only if the [CLR] key is
// pressed as a first key.

if (Ts.Status.InputDataSkipped)
ParameterPtr^=TRUE; //Input parameter pointer

// If no keys are pressed, after the set timeout time the data input is
// automatically aborted and the parameter pointer is reset.

if (Ts.Status.KeyboardTimeOut)
ParameterPtr=FALSE; //Input parameter pointer

// By pressing the [CLR] key, the data input sequence starts.

if ((Ts.Status.KeyPressed) && (Ts.KeyStatus.KCLR))


{
if (!ParameterPtr)
{
// Input the unsigned int variable.

SetCursorPos(0, 10); //Set the cursor position


Ts.InputDataDigit=5; //Number of digits
Ts.InputDataCommand=4; //Data input type
}
else
{
// Input the float variable.

SetCursorPos(1, 10); //Set the cursor position


Ts.InputDataDigit=5; //Number of digits
Ts.InputDataCommand=1; //Data input type
}
}

// When the data input is finished the value is stored into the variable.

if (Ts.Status.InputDataEnd)
if (!ParameterPtr)
scanf("%d", &VarInt);

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (5 of 6) [06/10/2008 17.44.04]


"C" data types: TERMINALSTRUCT

else
scanf("%f", &VarFloat);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMINALSTRUCT.htm (6 of 6) [06/10/2008 17.44.04]


"C" data types: TERMIOFUNCTIONS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

TERMIOFUNCTIONS

This data structure it's used to define all the I/O console function vectors.

typedef struct
{
unsigned char DeviceType[2];
void* LocalVectors;
void (*SetVectors)(void);
void (*SetTermIOData)(void* Address);
void* (*GetTermIOData)(void);
BOOL (*TermIOOpen)(void);
BOOL (*TermIOClose)(void);
BOOL (*TermIOIsOpen)(void);
char (*GetCh)(void);
void (*PutCh)(char Character);
void (*TermIOTick)(void);
unsigned int (*GetRxChars)(void);
unsigned int (*GetTxSpace)(void);
void (*TermIORxClear)(void);
void (*TermIOTxClear)(void);
void (*TermIORxFlush)(void);
void (*TermIOTxFlush)(void);
unsigned int (*InputStream)(char *Destination, unsigned int Length);
unsigned int (*OutputStream)(generic char *Source, unsigned int Length);
void (*F0F)(void);
void (*F10)(void);
void (*F11)(void);
void (*F12)(void);
void (*F13)(void);
void (*F14)(void);
void (*F15)(void);
}TERMIOFUNCTIONS;

Some fields of the data structure are not managed in some libraries. In the following table the indication of
the diffrent fields is reported with reference to the supported libraries.

Ofs Description

00 unsigned char DeviceType[0] D E - C A B A


It reports indication of the device, refer to table.
01 unsigned char DeviceType[1] D E - C A B A
Complement of the data in DeviceType[0].
02 void* LocalVector D E - C A B A
Address of the device local function vectors table.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMIOFUNCTIONS.htm (1 of 3) [06/10/2008 17.44.05]


"C" data types: TERMIOFUNCTIONS

04 void (*SetVectors)(void) D E - C A B A
Address of the set device vectors function.
06 void (*SetTermIOData)(void* Address) - - - - E - A
SetTermIOData device function address.
08 void* (*GetTermIOData)(void) - - - - E - A
GetTermIOData device function address.
0A BOOL (*TermIOOpen)(void) D E - C A B A
TermIOOpen device function address.
0C BOOL (*TermIOClose)(void) D E - C A B A
TermIOClose device function address.
0E BOOL (*TermIOIsOpen)(void) D E - C A B A
TermIOIsOpen device function address.
10 char (*GetCh)(void) D E - C A B A
GetCh device function address.
12 void (*PutCh)(char Character) D E - C A B A
PutCh device function address.
14 void (*TermIOTick)(void) D E - C A B A
TermIOTick device function address.
16 unsigned int (*GetRxChars)(void) D E - C A B A
GetRxChars device function address.
18 unsigned int (*GetTxSpace)(void) D E - C A B A
GetTxSpace device function address.
1A void (*TermIORxClear)(void) D E - C A B A
TermIORxClear device function address.
1C void (*TermIOTxClear)(void) D E - C A B A
TermIOTxClear device function address.
1E void (*TermIORxFlush)(void) D E - C A B A
TermIORxFlush device function address.
20 void (*TermIOTxFlush)(void) D E - C A B A
TermIOTxFlush device function address.
22 unsigned int (*InputStream)(char *Destination, unsigned int Length) D E - C A B A
InputStream device function address.
24 unsigned int (*OutputStream)(generic char *Source, unsigned int Length) D E - C A B A
OutputStream device function address.
26 void (*F11)(void) D E - C A B A
Space for future allocations.
28 void (*F12)(void) D E - C A B A
Space for future allocations.
2A void (*F13)(void) - - - - E - A
Space for future allocations.
2C void (*F14)(void) - - - - E - A
Space for future allocations.
2E void (*F15)(void) - - - - E - A
Space for future allocations.

DeviceType

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMIOFUNCTIONS.htm (2 of 3) [06/10/2008 17.44.05]


"C" data types: TERMIOFUNCTIONS

I/O console type definitions table:

Definition Description

IODEVICE_NONE I/O console device not defined


IODEVICE_SERIAL_LINE Serial line as I/O console
IODEVICE_TERMINAL Terminal as I/O console
IODEVICE_STANDARD Standard device as I/O console
IODEVICE_MODEM Modem as I/O console
IODEVICE_ACSPOINT Access point as I/O console

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMIOFUNCTIONS.htm (3 of 3) [06/10/2008 17.44.05]


Tipo dati "C": TERMIOVECTORS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

TERMIOVECTORS

This data structure is used for the definition of the I/O console functions vectors. By using the function
SetTermIOVectors it is possible to set the vector to the desired I/O console, while the function
GetTermIOVectors returns the value of the set vector.

typedef struct
{
xdata void* TermIOData;
code TERMIOFUNCTIONS* TermIOFunctions;
}TERMIOVECTORS;

Some fields of the dates structure are not managed in some libraries. In the following table the indication of
the different fields is reported with reference to the supported libraries.

Ofs Description

00 xdata void* TermIOData D E - C A B A


It reports the address of the data memory used for the I/O device management.
Typically for the FB driver it's the address of data structure allocation.
02 code TERMIOFUNCTIONS* TermIOFunctions D E - C A B A
It reports the allocation address of TERMIOFUNCTIONS data structure, it contains
all vectors for the I/O device function management.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/TERMIOVECTORS.htm [06/10/2008 17.44.05]


"C" data types: USERFLAGS

ELSIST Srl, www.elsist.it MNL041Q100

Data types

USERFLAGS

This data type (structure) is provided for the user flags.

typedef struct
{
unsigned char Dummy1:8;

unsigned char Type:3; //User type


unsigned char Dummy2:5;
}USERFLAGS;

This data structure is returned by the GetUserFlags function, it reports the user flags.

Bit Name Description

00 Type Defines the user type as the table reported below: - - - - - - D


01 Guest: User can only debug the program without changing the
USRGUEST
02 variable values.
User: User can only debug the program with access to variable
USRUSER
values in write.
Admin: User has full access to program either in debug and
USRADMIN
programming.

http://192.168.0.61/Destination/Html/CLanguage/DataTypes/USERFLAGS.htm [06/10/2008 17.44.06]


"C" variables: ExecutionErrors

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern EXECUTIONERRORS ExecutionErrors;

This variable contains the information inherent to all the errors of program execution, to every bit correspond the
indication of an error, the TRUE condition indicates the presence of the related error. The bits are set on the
appearance of the error and they must be reset by user program.

If at least one bit is set the RUN led on the target system will blink irregularly.

typedef struct
{
// ------------------------------------------------[Bit from 0x18 to 0x1F]--

BOOL RtcDataError:1; //Error on Rtc data


BOOL RtcAccess:1; //Error on Rtc access
BOOL I2CMClockTimout:1; //Timeout on I2C master clock
BOOL I2CMAckTimout:1; //Timeout on I2C master acknowledge
BOOL I2CMasterInit:1; //Error on I2C master initialization
BOOL b1D:1;
BOOL b1E:1;
BOOL KernelFctNotPresent:1; //Called a Kernel function not present

// ------------------------------------------------[Bit from 0x10 to 0x17]--

BOOL TermIOReadLostChar:1; //Terminal I/O read lost character


BOOL TermIOWriteLostChar:1; //Terminal I/O write lost character
BOOL b12:1;
BOOL b13:1;
BOOL b14:1;
BOOL b15:1;
BOOL b16:1;
BOOL b17:1;

// ------------------------------------------------[Bit from 0x08 to 0x0F]--

BOOL ClockInterruptLatency:1; //Clock interrupt latency


BOOL ExtInterruptLatency:1; //External interrupt latency
BOOL MemoryAccess:1; //Memory access error
BOOL I2CBusAccess:1; //I2C bus concurrent access
BOOL b0C:1;
BOOL b0D:1;
BOOL b0E:1;
BOOL b0F:1;

// ------------------------------------------------[Bit from 0x00 to 0x07]--

BOOL PSYSTInputFault:1; //PSYST peripheral input fault


BOOL PSYSTOutputFault:1; //PSYST peripheral output fault
BOOL NSYSTInputFault:1; //NSYST peripheral input fault
BOOL NSYSTOutputFault:1; //NSYST peripheral output fault
BOOL NSYSTBusAccess:1; //NSYST bus access error

http://192.168.0.61/Destination/Html/CLanguage/Variables/ExecutionErrors.htm (1 of 3) [06/10/2008 17.44.07]


"C" variables: ExecutionErrors

BOOL b05:1;
BOOL b06:1;
BOOL b07:1;
}EXECUTIONERRORS;

In the following table the indication of the different bits is reported with reference to the supported libraries.

Bit Name Description

00 PSYSTInputFault Input access error to the Picosyst BUS, it is managed by the C - A A - A


function PeripheralInp
01 PSYSTOutputFault Output access error to the Picosyst BUS, it is managed by the B C - A A - A
function PeripheralOut
02 NSYSTInputFault Input access error to the Netsyst BUS, it is managed by the B C - A A A A
functions PeripheralInp, NSYSTExtModuleInp
03 NSYSTOutputFault Output access error to the Netsyst BUS, it is managed by the B C - A A A A
function PeripheralOut
04 NSYSTBusAccess Access error to the Netsyst BUS , it is managed by the functions B C - A A A A
NSYSTExtModuleInp, NSYSTExtModuleOut, SetPeripheralReady
and by function blocks FbNetlogIIAD and FbNetlogIIDA.
05
06
07
08 ClockInterruptLatency Execution error user interrupt, an interrupt request took place B C - A A A A
during the execution of the routine defined by the user. The
duration of the user routine to be executed in interruption is longer
than the time defined with the SetClockIntTime function
09 ExtInterruptLatency Interrupt execution error on external interrupt, an interrupt request - - - - - A A
took place during the execution of the routine defined by the user.
The duration of the user routine to be executed in interruption is
longer than the time in which the interrupt is produced
0A MemoryAccess Memory access error, managed by the functions D E - C A B A
SystemMemoryRead and SystemMemoryWrite
0B I2CBusAccess Concurrent access between main and interrupt or between D E - C C B A
interrupts of different priority, of the I2C bus
0C
0D
0E
0F
10 TermIOReadLostChar Lost a character on reception from terminal I/O device. It is - - - - - - A
managed by all the functions that execute the data reception from
terminal I/O devices. If a serial line selected the SERIALSTRUCT.
Status.LostCharOnRead bit will be set.
11 TermIOWriteLostChar Lost a character on transmission to terminal I/O device. It is - - - - - - A
managed by all the functions that execute the data transmission to
terminal I/O devices. If a serial line selected the SERIALSTRUCT.
Status.LostCharOnWrite bit will be set.
12
13

http://192.168.0.61/Destination/Html/CLanguage/Variables/ExecutionErrors.htm (2 of 3) [06/10/2008 17.44.07]


"C" variables: ExecutionErrors

14
15
16
17
18 RtcDataError Rtc data error, the data read from the real time clock could be - - - - - - A
wrong. It's managed by the GetRtc function, it becames active if the
battery voltage drops down the 1 Volt. To reset the error in the Rtc
chip the SetRtc function must be called
19 RtcAccess Access error to the Rtc chip. It's managed by the functions that B C - A A A A
access to the real time clock chip GetRtc, SetRtc
1A I2CMClockTimout Timeout error on clock signal on I2C BUS in master mode. It is A A - A A A A
managed by the functions to access to the I2C BUS,
I2CMasterWrite, I2CMasterRead
1B I2CDataError Data signal error on I2C BUS in master mode. It is managed by the D E - C A B A
functions to access to the I2C BUS, I2CMasterWrite,
I2CMasterRead
1C I2CMAckTimout Timeout error on acknowledge by slave system on I2C BUS in A A - A A A A
master mode. It is managed by the functions to access to the I2C
BUS, I2CMasterWrite, I2CMasterRead
1D I2CMasterInit Init I2C BUS in master mode error. At the power on of the system A A - A A A A
the Clock and Data signals on I2C BUS are checked, if the test
does not have positive result error is signaled
1E
1F KernelFctNotPresent It's been called a function that is not present in the system kernel - - - - - - A

http://192.168.0.61/Destination/Html/CLanguage/Variables/ExecutionErrors.htm (3 of 3) [06/10/2008 17.44.07]


"C" variables: KernelErrors

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern KERNELERRORS KernelErrors;

This variable contains the information inherent to all the errors of Kernel, to every bit correspond the indication of
an error, the TRUE condition indicates the presence of the related error. The bits are set on the appearance of
the error and they must be reset by user program.

If at least one bit is set the RUN led on the target system will blink irregularly.

typedef struct
{
// ------------------------------------------------[Bit from 0x18 to 0x1F]--

BOOL b18:1;
BOOL b19:1;
BOOL b1A:1;
BOOL b1B:1;
BOOL b1C:1;
BOOL b1D:1;
BOOL b1E:1;
BOOL b1F:1;

// ------------------------------------------------[Bit from 0x10 to 0x17]--

BOOL I2CBusAccess:1; //Auxiliary I2C bus concurrent access


BOOL I2CMClockTimout:1; //Timeout on auxiliary I2C clock
BOOL I2CDataError:1; //Error on auxiliary I2C data
BOOL I2CMAckTimout:1; //Timeout on auxiliary I2C acknowledge
BOOL I2CMasterInit:1; //Error on auxiliary I2C initialization
BOOL b15:1;
BOOL b16:1;
BOOL b17:1;

// ------------------------------------------------[Bit from 0x08 to 0x0F]--

BOOL CodeScheme:1; //User library code scheme not compatible


BOOL DataScheme:1; //User library data scheme not compatible
BOOL b0A:1;
BOOL b0B:1;
BOOL SystemParameter:1; //Wrong Id in system parameter
BOOL KernelReadVar:1; //Wrong ID in kernel read var
BOOL KernelWriteVar:1; //Wrong ID in kernel write var
BOOL b0F:1;

// ------------------------------------------------[Bit from 0x00 to 0x07]--

BOOL KrnCfgWarning:1; //Kernel configuration warning


BOOL KrnCfgError:1; //Kernel configuration error
BOOL PrjCfgWarning:1; //Project configuration warning
BOOL PrjCfgError:1; //Project configuration error
BOOL InternalError:1; //Internal error

http://192.168.0.61/Destination/Html/CLanguage/Variables/KernelErrors.htm (1 of 3) [06/10/2008 17.44.09]


"C" variables: KernelErrors

BOOL b05:1;
BOOL b06:1;
BOOL b07:1;
}EXECUTIONERRORS;

In the following table the indication of the different bits is reported with reference to the supported libraries.

Bit Name Description

00 KrnCfgWarning Kernel configuration warning. The warning code is reported in the - - - - - - A


kernel variables
01 KrnCfgError Kernel configuration error. The error code is reported in the kernel - - - - - - A
variables
02 PrjCfgWarning Project configuration warning. The warning code is reported in the - - - - - - A
kernel variables
03 PrjCfgError Project configuration error. The error code is reported in the kernel - - - - - - A
variables
04 InternalError Kernel internal error, possibles causes are: - - - - - - A
- On a Netsyst system it's not been possible to set the the base module
address, the module doesn't work properly. Check if the LK24 jumper
is inserted and remove it.
05
06
07
08 CodeScheme The user code scheme is not compatible with the managed by the - - - - - - A
Kernel
09 DataScheme The user data scheme is not compatible with the managed by the - - - - - - A
Kernel
0A
0B
0C SystemParameter The SetSystemPar function has been executed with a wrong parameter - - - - - - A
Id
0D KernelReadVar KernelReadVar function error. The variable ID in error is returned in the - - - - - - A
KrnReadVarErID variable of kernel variables.
0E KernelWriteVar KernelWriteVar function error. The variable ID in error is returned in the - - - - - - A
KrnWriteVarErID variable of kernel variables.
0F
10 I2CBusAccess Auxiliary I2C bus error, it's managed from the functions that execute the - - - - - - A
access to the auxiliary bus
11 I2CMClockTimout Auxiliary I2C clock timeout, it's managed from the functions that - - - - - - A
execute the access to the auxiliary bus
12 I2CDataError Auxiliary I2C bus error, it's managed from the functions that execute the - - - - - - A
access to the auxiliary bus
13 I2CMAckTimout Auxiliary I2C acknowledge timeout, it's managed from the functions that - - - - - - A
execute the access to the auxiliary bus
14 I2CMasterInit Auxiliary I2C bus init error, at the power on the Clock and Data signals - - - - - - A
are tested and if the test has not positive result the error is set
15

http://192.168.0.61/Destination/Html/CLanguage/Variables/KernelErrors.htm (2 of 3) [06/10/2008 17.44.09]


"C" variables: KernelErrors

16
17
18
19
1A
1B
1C
1D
1E
1F

http://192.168.0.61/Destination/Html/CLanguage/Variables/KernelErrors.htm (3 of 3) [06/10/2008 17.44.09]


"C" variables: PLCErrors

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern PLCERRORS PLCErrors;

This variable contains the information iherent to all the PLC execution errors, to every bit correspond the
indication of an error, the TRUE condition indicates the presence of the related error. The bits are set on the
appearance of the error and they must be reset by user program.

If at least one bit is set the RUN led on the target system will blink irregularly.

typedef struct
{
// ------------------------------------------------[Bit from 0x18 to 0x1F]--

BOOL b18:1;
BOOL b19:1;
BOOL b1A:1;
BOOL b1B:1;
BOOL b1C:1;
BOOL b1D:1;
BOOL b1E:1;
BOOL b1F:1;

// ------------------------------------------------[Bit from 0x10 to 0x17]--

BOOL FBParameters:1; //Error on FB parameters


BOOL FBManagement:1; //Error on FB management
BOOL b12:1;
BOOL b13:1;
BOOL b14:1;
BOOL b15:1;
BOOL b16:1;
BOOL b17:1;

// ------------------------------------------------[Bit from 0x08 to 0x0F]--

BOOL DivaDivisionZero:1; //Division for "0" in DIVA instruction


BOOL FdivDivisionZero:1; //Division for "0" in FDIV instruction
BOOL RestoreFault:1; //Restore data fault
BOOL BackupFault:1; //Backup data fault
BOOL b0C:1;
BOOL b0D:1;
BOOL B0E:1;
BOOL b0F:1;

// ------------------------------------------------[Bit from 0x00 to 0x07]--

BOOL b00:1;
BOOL b01:1;
BOOL b02:1;
BOOL b03:1;
BOOL b04:1;

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCErrors.htm (1 of 3) [06/10/2008 17.44.10]


"C" variables: PLCErrors

BOOL b05:1;
BOOL b06:1;
BOOL b07:1;
}PLCERRORS;

In the following table the indication of the different bits is reported with reference to the supported libraries.

Bit Name Description

00
01
02
03
04
05
06
07
08 DivaDivisionZero It indicates the execution of a division for "0" in the execution of the - - C - - - -
instruction DIVA
09 FdivDivisionZero It indicates the execution of a division for "0" in the execution of the - - C - - - -
instruction FDIV
0A RestoreFault It indicates error in the restore of the backup data, it's activated at the - - C - - - -
system power on. In presence of this error all the backup data are
cleared
0B BackupFault It indicates error in the backup data - - C - - - -
0C
0D
0E
0F
10 FBParameters It indicates an error on function block parameters. It is managed by the - - D - - - -
FB: FbModbusAsciiSl, FbModbusRtuSl, FbI2CSerial, FbNetlogIIAD,
FbNetlogIIDA
11 FBManagement It indicates an error on function block execution. It is managed by the - - D - - - -
FB: FbI2CSlaveManager
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCErrors.htm (2 of 3) [06/10/2008 17.44.10]


"C" variables: PLCErrors

1F

http://192.168.0.61/Destination/Html/CLanguage/Variables/PLCErrors.htm (3 of 3) [06/10/2008 17.44.10]


"C" variables: SystemErrors

ELSIST Srl, www.elsist.it MNL041Q100

"C" variables

extern SYSTEMERRORS SystemErrors;

This variable contains the information iherent to all the system errors , to every bit correspond the indication of an
error, the TRUE condition indicates the presence of the related error. The bits are set on the appearance of the
error and they must be reset by user program.

If at least one bit is set the RUN led on the target system will blink irregularly.

typedef struct
{
// ------------------------------------------------[Bit from 0x18 to 0x1F]--

BOOL b18:1;
BOOL b19:1;
BOOL b1A:1;
BOOL b1B:1;
BOOL b1C:1;
BOOL b1D:1;
BOOL b1E:1;
BOOL b1F:1;

// ------------------------------------------------[Bit from 0x10 to 0x17]--

BOOL SystemCfg:1; //System configuration error


BOOL b11:1;
BOOL b12:1;
BOOL b13:1;
BOOL b14:1;
BOOL b15:1;
BOOL b16:1;
BOOL b17:1;

// ------------------------------------------------[Bit from 0x08 to 0x0F]--

BOOL b08:1;
BOOL TimerTimeSet:1; //Timer time set
BOOL MemoryType:1; //Memory type range error
BOOL MemoryAddress:1; //Memory address range error
BOOL IODeviceFctMissing:1; //I/O device function missing
BOOL IODeviceNotCorrect:1; //I/O device not correct
BOOL IODeviceLocalFctMissing:1; //I/O device local function missing
BOOL b0F:1;

// ------------------------------------------------[Bit from 0x00 to 0x07]--

BOOL PSYSTModAddress:1; //PSYST module address error


BOOL PSYSTStrobeAddress:1; //PSYST strobe address error
BOOL NSYSTModAddress:1; //NSYST module address error
BOOL NSYSTStrobeAddress:1; //NSYST strobe address error
BOOL b04:1;

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemErrors.htm (1 of 3) [06/10/2008 17.44.11]


"C" variables: SystemErrors

BOOL b05:1;
BOOL b06:1;
BOOL b07:1;
}SYSTEMERRORS;

In the following table the indication of the different bits is reported with reference to the supported libraries.

Bit Name Description

00 PSYSTModAddress Picosyst module address error


01 PSYSTStrobeAddress Strobe address error on Picosyst module
02 NSYSTModAddress Netsyst module address error, managed by the functions B C - A A A A
NSYSTExtModuleInp, NSYSTExtModuleOut,
NSYSTExtReadVar, NSYSTExtWriteVar and by function blocks
FbNetlogIIAD and FbNetlogIIDA. The address of the module on
error is saved in the NSystModError of kernel variables.
03 NSYSTStrobeAddress Strobe address error on Netsyst module, managed by the B C - A A A A
functions PeripheralInp, PeripheralOut
04
05
06
07
08 B C - A A A A
09 TimerTimeSet Time value to be set on timer out range, managed by the B C - A A A A
function SetTimer1Enable
0A MemoryType Error memory type, managed by the functions D E - C A B B
SystemMemoryRead e SystemMemoryWrite
0B MemoryAddress Error memory addresse , managed by the functions D E - C A B B
SystemMemoryRead e SystemMemoryWrite
0C IODeviceFctMissing Access error to standard function of management I/O console B C - A A A A
not existing. A calling to a function not provided for the I/O
device currently defined with the function SetTermIOVectors
has been executed
0D IODeviceNotCorrect Error in the definition of the vector address to the I/O console B C - A A A A
funtions, the specified vector does not point to a valid device.
The error is activated by the function SetTermIOVectors in the
kernel variables it's reported the I/O console address
0E IODeviceLocalFctMissing Access error to local function of I/O console management not B C - A A A A
existing. A calling to a function not provided for the I/O device
currently defined with the function SetTermIOVectors has been
executed
0F
10 SystemCfg Configuration data CRC error on NetlogII systems. It's set on - - - - A - -
the switching on when the system is initialized if the
configuration data area is in error. When this bit is set the A/D
acquisitions FbNetlogIIAD and the D/A management
FbNetlogIIDA function blocks are disabled
11
12

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemErrors.htm (2 of 3) [06/10/2008 17.44.11]


"C" variables: SystemErrors

13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F

http://192.168.0.61/Destination/Html/CLanguage/Variables/SystemErrors.htm (3 of 3) [06/10/2008 17.44.11]


"C" functions: HardwareConfig

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

HardwareConfig

This function returns the value of the configuration hardware word. The value is defined and is not modifiable, it
indicates the configuration present on the system.

Prototype
ElSystemLib.h
Declaration
unsigned int HardwareConfig(void);
Parameters
None
Return value
unsigned int Harware configuration

Example

In the following example it's saved in the HardwareCfg variable the hardware configuration of the system.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
static unsigned int HardwareCfg; //Hardware configuration

if (PLCFirstLoop)
HardwareCfg=HardwareConfig(); //Hardware configuration
}

// [End of file

http://192.168.0.61/Destination/Html/CLanguage/Functions/LoaderFcts/HardwareConfig.htm [06/10/2008 17.44.11]


"C" functions: ExecuteKernelFct

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

ExecuteKernelFct

This function allows to execute a kernel function, it's possible to pass a value to the function and to receive a
return value from the function.

Prototype
ElSystemLib.h
Declaration
unsigned int ExecuteKernelFct(unsigned char Idx, unsigned int Value);
Parameters
unsigned char Idx Kernel function identifier
unsigned int Value Value to be passed to the function
Return value
unsigned int Value returned from the function

Function identifier

IdxDescription

Force user module error Sets the module error flag. It sets the UserModuleError flag of - - - - E- - A
kernel variables. The call to this function, activating the flag, allows
the user program to force the run led to blink with error code. The
function it's called for example by the ElPLCLib library in case of
01 activation of one of the PLCErrors bit.

Parameter: None
Return: Status 0: Function correctly executed. 1: Execution error

Set run led blink Sets the code the run LED has to blink. The blink has two different - - - - E - -
code frequency, slow that identifies the tens, and fast that identifies the
units.
02
Parameter: Blink
Defines the blink code (Range from 0 to 99).
code
Return: Status 0: Function correctly executed. 1: Execution error

NSyst ready management It sets the ready signal on the Netsyst bus. The signal in the base - - - - E - A
module is managed from the function SetPeripheralReady, but in
the extension modules it must be possible to manage it by the
user program. Normally this management is executed by the
03 FbI2CSlaveManager function block.

Parameter: Command 0:The ready signal is deactivated . 1: The ready signal is


activated
Return: Status 0: Function correctly executed. 1: Execution error

Examples

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/ExecuteKernelFct.htm (1 of 2) [06/10/2008 17.44.12]


"C" functions: ExecuteKernelFct

In the following example the run LED is set to blink with the code 32.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Set the RUN led to blink with code 32.

if (PLCFirstLoop)
if (ExecuteKernelFct(0x02, 32)) printf("Error");
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/ExecuteKernelFct.htm (2 of 2) [06/10/2008 17.44.12]


"C" functions: GetUserFlags

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetUserFlags

This function returns the USERFLAGS data structure of the user.

Prototype
ElSystemLib.h
Declaration
USERFLAGS GetUserFlags(void);
Parameters
None
Return value
USERFLAGS User flags

Example

In the following example it's saved in the UserFlags variable the user flag value. If the user can stop the program
a message is print out.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static USERFLAGS UserFlags; //User flags

// -------------------------------------------------------------------------
// USER FLAGS READ
// -------------------------------------------------------------------------
// Execute the user flags read at first program execution loop.

if (PLCFirstLoop)
{
UserFlags=GetUserFlags();

// Print a message if the user can stop the program.

SetTermIOVectors(IOSerialPortA); //Set the serial port "A" as I/O console

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/GetUserFlags.htm (1 of 2) [06/10/2008 17.44.13]


"C" functions: GetUserFlags

if (UserFlags.CanStop)
printf("The user can stop the program");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/GetUserFlags.htm (2 of 2) [06/10/2008 17.44.13]


"C" functions: KernelReadVar

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

KernelReadVar

This function reads a variable from the kernel. If an error occurs in reading the function doesn't change the value
in Buffer, returns TRUE and set the KernelReadVar bit in the KernelErrors structure. The variable ID that
generates the error is returned in the KrnReadVarErID variable of the kernel variables.

Prototype
ElSystemLib.h
Declaration
BOOL KernelReadVar(unsigned int VarID, void* Buffer);
Parameters
unsigned int VarID Variable ID to be read, its value will be transferred to Buffer
char* Buffer Memory buffer address were the variable value will be transferred
Return value
BOOL FALSE: Execution ok
TRUE: Execution error

In the following table we report the managed IDs.

VarID Type Length Description

0x0010 R 4 System power on time ( mSec )


0x0011 R 4 User program running time ( mSec )
0x0020 R 11 Loader program version. It's returned the loader program code.
0x0021 R 11 Package program version. It's returned the package program code.
0x0022 R 11 Kernel program version. It's returned the kernel program code.

Examples

In the following example the kernel program version will be write in the Kernel variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
static char Kernel[11]; //Kernel program version
if (PLCFirstLoop) KernelReadVar(0x0022, &Kernel); //Kernel program version

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/KernelReadVar.htm (1 of 2) [06/10/2008 17.44.13]


"C" functions: KernelReadVar

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/KernelReadVar.htm (2 of 2) [06/10/2008 17.44.13]


"C" functions: KernelWriteVar

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

KernelWriteVar

This function writes a variable to the kernel. If an error occurs in writing the function doesn't change the
variable, returns TRUE and set the KernelWriteVar bit in the KernelErrors structure. The variable ID that
generates the error is returned in the KrnWriteVarErID variable of the kernel variables.

Prototype
ElSystemLib.h
Declaration
BOOL KernelWriteVar(unsigned int VarID, void* Buffer);
Parameters
unsigned int VarID Variable ID to be write, the valueof Buffer will be transferred to the variable
char* Buffer Memory buffer address were the variable value will be read
Return value
BOOL FALSE: Execution ok
TRUE: Execution error

For the list if variables IDs please refer to the table in KernelReadVar function.

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/KernelWriteVar.htm [06/10/2008 17.44.14]


"C" functions: StopUserProgram

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

StopUserProgram

This function stops the user program and returns the control to the kernel.

Prototype
ElSystemLib.h
Declaration
void StopUserProgram(int Value);
Parameters
int
Action to be executed
Value
Return value
None

The function parameter defines the action to be executed on the stop:

EXECUTECATCH Stops the user program forcing the kernel to execute a catch sequence. If the catch
doesn't be executed the user program will restarts.
STOPTOKERNEL Stops the user program and forces the kernel execution.
RESTARTPROGRAM Stops and restarts the user program.
STOPBYCOMMAND Stops the user program identifying it as an stop by command.

Example

In the following example on StopCmd set the user program is stopped and is returned the control to the kernel.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static BOOL StopCmd; //Stop user program command

// -------------------------------------------------------------------------
// STOP USER PROGRAM
// -------------------------------------------------------------------------

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/StopUserProgram.htm (1 of 2) [06/10/2008 17.44.15]


"C" functions: StopUserProgram

// Execute the user program stop.

if (StopCmd) StopUserProgram(STOPTOKERNEL);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/StopUserProgram.htm (2 of 2) [06/10/2008 17.44.15]


"C" functions: UserPrgConfig

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

UserPrgConfig

This function returns the user program configuration.

Prototype
ElSystemLib.h
Declaration
unsigned long UserPrgConfig(void);
Parameters
None
Return value
unsigned User program
long configuration

Example

In the following example the user configuration is stored in the UserConfig variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

static unsigned long UserConfig; //User configuration

// -------------------------------------------------------------------------
// USER CONFIGURATION READ
// -------------------------------------------------------------------------
// Execute the user configuration read at first program execution loop.

if (PLCFirstLoop)
UserConfig=UserPrgConfig();
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/KernelFcts/UserPrgConfig.htm [06/10/2008 17.44.15]


"C" functions: ArrayBitCount

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

ArrayBitCount

This function executes the count of the bits set inside of an array, maximum 32 bytes array are managed (256
bit).

Prototype
ElSystemLib.h
Declaration
unsigned char ArrayBitCount(void* Array, unsigned char Length);
Parameters
void* Array It defines the array address (Range from 0x0000 to 0xFFFF)
unsigned char Length It defines the array length expressed in bytes (Range from 1 to 32)
Return value
unsigned char Number of bits set (Range da 0 a 255)

Examples

At every second a message like this is sent to the serial line:

The value 00000000, has: 0 bits set.


The value 80000000, has: 1 bits set.
The value 80000001, has: 2 bits set.
The value 01010101, has: 4 bits set.
The value FFFFFFFF, has: 32 bits set.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned long Variable; //Variable


unsigned char BitNr; //Number of bit set

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ArrayBitCount.htm (1 of 2) [06/10/2008 17.44.16]


"C" functions: ArrayBitCount

if (PLCPulse1000)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

Variable=0x00000000; //Variable
BitNr=ArrayBitCount(&Variable, sizeof(Variable)); //Number of bit set
printf("The value %08lX, has: %2d bits set.\n\r", Variable, BitNr);

Variable=0x80000000; //Variable
BitNr=ArrayBitCount(&Variable, sizeof(Variable)); //Number of bit set
printf("The value %08lX, has: %2d bits set.\n\r", Variable, BitNr);

Variable=0x80000001; //Variable
BitNr=ArrayBitCount(&Variable, sizeof(Variable)); //Number of bit set
printf("The value %08lX, has: %2d bits set.\n\r", Variable, BitNr);

Variable=0x01010101; //Variable
BitNr=ArrayBitCount(&Variable, sizeof(Variable)); //Number of bit set
printf("The value %08lX, has: %2d bits set.\n\r", Variable, BitNr);

Variable=0xFFFFFFFF; //Variable
BitNr=ArrayBitCount(&Variable, sizeof(Variable)); //Number of bit set
printf("The value %08lX, has: %2d bits set.\n\r", Variable, BitNr);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ArrayBitCount.htm (2 of 2) [06/10/2008 17.44.16]


"C" functions: ArrayBitSet

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

ArrayBitSet

This function permits to force the logical status of a bit in the inside of an array, maximum 32 bytes array are managed (256 bit).

Prototype
ElSystemLib.h
Declaration
void ArrayBitSet(void* Array, unsigned char Length, unsigned char Bit, BOOL Status);
Parameters
void* Array It defines the array address (Range from 0x0000 to0xFFFF)
unsigned char Length It defines the array length expressed in bytes (Range from 1 to 32)
unsigned char Bit It defines the number of bit to be forced (Range from 0 to 255)
BOOL Status It defines the status to which the bit will be forced
TRUE: The bit will be set.
FALSE: The bit will be reset.
Return value
None

Examples

4 bits of a long variable are set, the variable initially cleared, will take the value 0x01010101.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned long Variable; //Variable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
Variable=0; //Variable
ArrayBitSet(&Variable, sizeof(Variable), 0x00, TRUE); //Set the bit 0x00 of the variable
ArrayBitSet(&Variable, sizeof(Variable), 0x08, TRUE); //Set the bit 0x08 of the variable
ArrayBitSet(&Variable, sizeof(Variable), 0x10, TRUE); //Set the bit 0x10 of the variable
ArrayBitSet(&Variable, sizeof(Variable), 0x18, TRUE); //Set the bit 0x18 of the variable

// Now the variable has the value, 0x01010101.


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ArrayBitSet.htm [06/10/2008 17.44.16]


"C" functions: ArrayBitStatus

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

ArrayBitStatus

This function returns the logical status of a bit in the inside of an array, maximum 32 bytes array are managed
(256 bit).

Prototype
ElSystemLib.h
Declaration
BOOL ArrayBitStatus(void* Array, unsigned char Length, unsigned char Bit);
Parameters
void* Array It defines the array address (Range from 0x0000 to 0xFFFF)
unsigned char Length It defines the array length expressed in bytes (Range from 1 to 32)
unsigned char Bit It defines the number of the bit to be tested (Range from 0 to 255)
Return value
BOOL FALSE: Bit is reset
TRUE: Bit is set

Examples

At every second a message like this is sent to the serial line:

The bit 0 is TRUE.


The bit 8 is TRUE.
The bit 16 is TRUE.
The bit 31 is TRUE.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned long Variable; //Variable


unsigned char BitNr; //Number of bit set

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ArrayBitStatus.htm (1 of 2) [06/10/2008 17.44.17]


"C" functions: ArrayBitStatus

{
if (PLCPulse1000)
{
Variable=0x80010101; //Variable

for (BitNr=0; BitNr<32; BitNr++)


if (ArrayBitStatus(&Variable, sizeof(Variable), BitNr))
printf("The bit %2d is TRUE.\n\r", BitNr);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ArrayBitStatus.htm (2 of 2) [06/10/2008 17.44.17]


"C" functions: AsciiStringConvert

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

AsciiStringConvert

This function converts an ASCII string in an hexadecimal value.

Prototype
ElSystemLib.h
Declaration
BOOL AsciiStringConvert(unsigned char* Value, unsigned char* String, unsigned char Length);
Parameters
unsigned char* Value It defines the address of the converted hexadecimal value (Range from 0x0000 to 0xFFFF)
unsigned char* String It defines the address of the SourceCode ASCII string (Range from 0x0000 to 0xFFFF)
unsigned char Length It defines the length of string to be converted (Range from 0 to 255)
Return value
BOOL FALSE: Conversion correctly executed
TRUE: Conversion error

Example

It executes the conversion of an ASCII string in a 3 hexadecimal values on 3 different types of variables, at the
end of the conversion the variables will have the following values.

CharValue=0x12
IntValue=0x1234
LongValue=0x12345678

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char String[]="12345678"; //String to be converted


unsigned char CharValue; //Result char value
unsigned int IntValue; //Result int value
unsigned long LongValue; //Result long value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/AsciiStringConvert.htm (1 of 2) [06/10/2008 17.44.18]


"C" functions: AsciiStringConvert

{
AsciiStringConvert(&CharValue, &String, 2);
AsciiStringConvert(&IntValue, &String, 4);
AsciiStringConvert(&LongValue, &String, 8);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/AsciiStringConvert.htm (2 of 2) [06/10/2008 17.44.18]


"C" functions: Linearize
ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

Linearize

This function executes a value linearization. It is necessary pass to the function the linearization data table address, the
function searches the value in the table executing the linear interpolation between two points of the table.

Prototype
ElSystemLib.h
Declaration
float Linearize(LINEARIZERECORD *Table, unsigned char Records, float Value);
Parameters
LINEARIZERECORD *Table It is the linearization data table address (Range from 0x0000 to 0xFFFF)
unsigned char Records It is the number of records defined in the linearization data table (Range da 0 a 255)
float Value It is the value to be linearized
Return value
float It is the linearized value

Linearization data table

The linearization data, should be defined in a table mapped in code memory. The table must contains a sequence
of LINEARIZERECORD type records, where every record indicates the value in input to be linearized and the corresponding value
in output linearized. It is necessary to define the data in increasing way, so the data will be defined starting from the smallest value.

If the input value is smaller of the smaller definite value in the linearization table, the output value is calculated by considering a
slope calculated by the interpolation of the first two values of the table. If the input value is greater of the greatest definite value in
the linearization table, the output value is calculated by considering a slope calculated by the interpolation of the last two values of
the table.

// -----------------------------------------------------------------------------
// LINEARIZERECORD DATA STRUCTURE TYPE DEFINITION
// -----------------------------------------------------------------------------
// Each record reports the input value to be linearized and the corresponding
// linearized output value.

typedef struct
{
float Input; //Input value
float Output; //Output value
}LINEARIZERECORD;

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/Linearize.htm (1 of 2) [06/10/2008 17.44.19]


"C" functions: Linearize

Examples

In the following example it's executed a PTC temperature sensor linearization. In the table are defined the PTC resistance and
the corresponded temperature values.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// TEMPERATURE CONVERSION TABLE
// -----------------------------------------------------------------------------
// In the following table are reported the PTC resistance values at different
// temperatures and the corresponding temperature values.

code LINEARIZERECORD PTCTemperature[]= {


{322.850652, -5.0},
{340.436263, 0.0},
{362.318841, 5.0},
{389.217241, 10.0},
{422.138837, 15.0},
{509.915014, 25.0},
{712.777191, 40.0},
};

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

float Temperature; //Temperature (Degree)


float PTCResistance; //PTC resistance (Ohm)

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
Temperature=Linearize(&PTCTemperature, sizeof(PTCTemperature)/sizeof(LINEARIZERECORD), PTCResistance); //Temperature (Degree)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/Linearize.htm (2 of 2) [06/10/2008 17.44.19]


"C" functions: MemCrc

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

MemCrc

This function calculates the 16 bits CRC on a memory area, it is possible to define also an initial CRC value so
that you can divide the calculation in several parts.

Prototype
ElSystemLib.h
Declaration
unsigned int MemCrc(unsigned char* StartAdd, unsigned int ByteNr, unsigned int CrcIni);
Parameters
unsigned char* StartAdd It defines the address of the memory area of which you want to calculate the CRC
(Range from 0x0000 to 0xFFFF)
unsigned int ByteNr It defines the number of bytes of the memory area on which you want to execute the
calculation (Range from 0x0000 to 0xFFFF)
unsigned int CrcIni It defines the initial CRC value (Range from 0x0000 to 0xFFFF)
Return value
unsigned int Calculated CRC value (Range from 0x0000 to 0xFFFF)

Examples

The 16 bit CRC value of the MemoryBuffer area it is calculated and the result value 0xC849, it is transferred in
the CRC1st variable. The same calculation divided in 3 parts it is transferred in the CRC2nd variable. The
calculation it is initialized with 0XFFFF value.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

struct
{
unsigned char Variable1;
unsigned int Variable2;
unsigned long Variable3;
}MemoryBuffer=
{
0x01,
0x0002,
0x00000003,
};

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/MemCRC.htm (1 of 2) [06/10/2008 17.44.19]


"C" functions: MemCrc

unsigned int CRC1st; //First CRC value


unsigned int CRC2nd; //Second CRC value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Here the CRC of the "MemoryBuffer" is calculated. The calculation is
// started with 0xFFFF init value.

CRC1st=MemCrc((unsigned char*)&MemoryBuffer, sizeof(MemoryBuffer), 0xFFFF);

// The same result can be reached with the following. The calculation is
// started with 0xFFFF init value.

CRC2nd=MemCrc(&MemoryBuffer.Variable1, 1, 0xFFFF);
CRC2nd=MemCrc((unsigned char*)&MemoryBuffer.Variable2, 2, CRC2nd);
CRC2nd=MemCrc((unsigned char*)&MemoryBuffer.Variable3, 4, CRC2nd);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/MemCRC.htm (2 of 2) [06/10/2008 17.44.19]


"C" functions: ModbusCrc

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

ModbusCrc

This function calculates the 16 bits CRC on a memory area according to the format of the MODBUS Rtu protocol,
it's possible to define also an initial CRC value so that you can divide the calculation in several parts.

Prototype
ElSystemLib.h
Declaration
unsigned int ModbusCrc(unsigned char* StartAdd, unsigned int ByteNr, unsigned int CrcIni);
Parameters
unsigned char* StartAdd It defines the address of the memory area of which you want to calculate the CRC
(Range from 0x0000 to 0xFFFF)
unsigned int ByteNr It defines the number of bytes of the memory area on which you want to execute the
calculation (Range from 0x0000 to 0xFFFF)
unsigned int CrcIni It defines the initial CRC value (Range from 0x0000 to 0xFFFF)
Return value
unsigned int Calculated CRC value (Range from 0x0000 to 0xFFFF)

Examples

It's sent to the selected I/O console the MODBUS Rtu Read Holding Registers command. The CRC calculation
in initialized with the 0XFFFF value.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables declaration.

unsigned char FrameBuf[8]; //Frame buffer

// Prepare the Modbus command frame for the "03, Read Holding Registers",
// command. The command is:
// [Node][03][Register address][Number of registers][CRC]

FrameBuf[0]=0x00; //Load address node


FrameBuf[1]=0x03; //Load function number
*(unsigned int*)&FrameBuf[2]=0x0000; //Load register address

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ModbusCRC.htm (1 of 2) [06/10/2008 17.44.20]


"C" functions: ModbusCrc

*(unsigned int*)&FrameBuf[4]=3; //Load number of registers to read


*(unsigned int*)&FrameBuf[6]=MemCrc(&FrameBuf, 6, 0xFFFF); //Load CRC value

// Send the frame to the selected I/O console.

OutputStream((char*)&FrameBuf,8);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/ModbusCRC.htm (2 of 2) [06/10/2008 17.44.20]


"C" functions: Random

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

Random

This function return a random number. At every function call a random number in the range from 0 to 255 is
returned.

Prototype
ElSystemLib.h
Declaration
unsigned char Random(void);
Parameters
None
Return value
unsigned char Random number (Range from 0 to 255)

Examples

At every second to the serial line the acquired random number is sent with a string as which reported below:

The value is: 109


The value is: 042
The value is: 203
The value is: 070

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables declaration.

unsigned char RandomNr; //Random number

// -------------------------------------------------------------------------
// PRINTOUT A RANDOM NUMBER
// -------------------------------------------------------------------------
// Read a random number and printout it.

if (PLCPulse1000)

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/Random.htm (1 of 2) [06/10/2008 17.44.21]


"C" functions: Random

{
RandomNr=Random(); //Random number

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf("The value is: %03d\r\n", RandomNr);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Utilities/Random.htm (2 of 2) [06/10/2008 17.44.21]


"C" functions: NSYSTExtModuleAbort

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtModuleAbort

This function sends an abort sequence to the extension module addressed. The reception of the abort
sequences causes the init of the extension module that returns to be waiting for a new order.

Prototype
ElSystemLib.h
Declaration
void NSYSTExtModuleAbort(unsigned char ModuleAdd);
Parameters
unsigned char ModuleAdd It defines the address of the extension module to which the abort sequence is sent
(Range from 1 to 7)
Return value
None

Examples

An abort sequence is sent to the extension module with addresse 3.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
NSYSTExtModuleAbort(0x03);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleAbort.htm [06/10/2008 17.44.21]


"C" functions: NSYSTExtModuleInp

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtModuleInp

This function executes the acquisition of the logical inputs from a peripheral modules of the Netsyst family. In
case of module address error the function ends by returning 1 and setting the NSYSTModuleAddress bit in the
SystemErrors data structure. In case of acquisition error the function ends by returning 3 and setting the
NSYSTBusAccess, NSYSTInputFault bits in the ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char NSYSTExtModuleInp(unsigned char Module, unsigned int* Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned int* Value It defines the address of the memory buffer where the acquisition value must be
transferred (Range from 0x0000 to 0xFFFF)
Return value
unsigned char It returns the acquisition error
0: No error
1: Addresse module error
3: Acquisition error

Examples

The acquisition of all the 12 digital inoput from the extension module with addresse 1 is managed. The acquired
value is memorized in a date structure to permit an easier management of every single enrty.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable declarations.

struct
{
BOOL Inp08:1; //Inp 08 bit
BOOL Inp09:1; //Inp 09 bit
BOOL Inp0A:1; //Inp 0A bit
BOOL Inp0B:1; //Inp 0B bit
BOOL Inp0C:1; //Not used

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleInp.htm (1 of 2) [06/10/2008 17.44.22]


"C" functions: NSYSTExtModuleInp

BOOL Inp0D:1; //Not used


BOOL Inp0E:1; //Not used
BOOL Inp0F:1; //Not used
BOOL Inp00:1; //Inp 00 bit
BOOL Inp01:1; //Inp 01 bit
BOOL Inp02:1; //Inp 02 bit
BOOL Inp03:1; //Inp 03 bit
BOOL Inp04:1; //Inp 04 bit
BOOL Inp05:1; //Inp 05 bit
BOOL Inp06:1; //Inp 06 bit
BOOL Inp07:1; //Inp 07 bit
}LogInp;

unsigned char Error; //Peripheral input acquisition error

// Here the extension module logiv inputs are acquired.

Error=NSYSTExtModuleInp(0x01,(unsigned int*)&LogInp); //Inputs from 0 to F

// Here a message is print when the inp 01 is set.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

if (LogInp.Inp01)
printf("Input 01 is set.\r\n");
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleInp.htm (2 of 2) [06/10/2008 17.44.22]


"C" functions: NSYSTExtModuleNumber

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtModuleNumber

This function returns the number of Netsyst extension modules connected to the system. The extension modules
are authomatically recognized with the execution of the SetPeripheralReady function, which automatically gives
an address from 1 to 7 to every extension module.

Prototype
ElSystemLib.h
Declaration
unsigned char NSYSTExtModuleNumber(void);
Parameters
None
Return value
unsigned char Number of extension modules connected to the system (Range from 0 to 7)

Examples

The number of Netsyst extension modules at present connected to the system returns in the variable Modules.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned char Modules; //Number of Netsyst I/O extension modules

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Read the number of attached extensions.

Modules=NSYSTExtModuleNumber(); //Number of Netsyst I/O extension modules


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleNumber.htm [06/10/2008 17.44.23]


"C" functions: NSYSTExtModuleOut

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtModuleOut

This function executes the management of the logic outputs of the peripheral modules of the Netsyst family. In case
of error of module address the function ends by returning 1 and setting the NSYSTModuleAddress bit in the
SystemErrors data structure. In case of management error the function ends by returning 3 and setting the
NSYSTBusAccess, NSYSTOutputFault bits in the ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char NSYSTExtModuleOut(unsigned char Module, unsigned char Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned char Value It defines the value to be transferred on the logic outputs
Return value
unsigned char It returns the error
0: No error
1: Module address error
3: Management error

Examples

The 8 digital ouputs of the module with address 1 are managed. The value transferred on the output is read from a
data structure to permit an easier management of every single exit.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

struct
{
BOOL Out00:1; //Out 00 bit
BOOL Out01:1; //Out 01 bit
BOOL Out02:1; //Out 02 bit
BOOL Out03:1; //Out 03 bit
BOOL Out04:1; //Out 04 bit
BOOL Out05:1; //Out 05 bit
BOOL Out06:1; //Out 06 bit
BOOL Out07:1; //Out 07 bit
}LogOut;
unsigned char Error; //Peripheral output management error

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleOut.htm (1 of 2) [06/10/2008 17.44.23]


"C" functions: NSYSTExtModuleOut

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
LogOut.Out00=PLCTimeBase400; //Out 00 bit
Error=NSYSTExtModuleOut(0x01, *(unsigned char*)&LogOut); //Outputs from 0 to 7
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtModuleOut.htm (2 of 2) [06/10/2008 17.44.23]


"C" functions: NSYSTExtReadVar

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtReadVar

This function reads a variable from the peripheral modules of the Netsyst family. In case of error of module
address the function ends by returning 1 and sets the NSYSTModuleAddress bit in the SystemErrors data
structure. In case of error of variable read the function ends by returning 3 and sets the NSYSTBusAccess bit in
the ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char NSYSTExtReadVar(unsigned char Module, unsigned int VarAddress, unsigned char ByteNr, void*
Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned int VarAddress It defines the variable address in the module memory (Range from 0x0000 to 0xFFFF)
unsigned char ByteNr It defines the bytes number of variable length (Range from 1 to 4)
void* Value It defines the address of the memory buffer where the variable value must be
transferred (Range from 0x0000 to 0xFFFF)
Return value
unsigned char It returns the acquisition error
0: No error
1: Module address error
3: Read variable error

Note

La funzione utilizza il comando 04: Memory read su bus I2C gestito dal blocco funzione FbI2CSlaveManager sul
sistema slave. L'indirizzo della variabile VarAddress corrisponde all'indirizzo dell'operando numerico sul sistema
slave, pertanto se VarAddress=0x0010 e ByteNr=0x02 verrà ritornato il valore dell'operando W 0010 del
sistema slave. ATTENZIONE! Se l'indirizzo della variabile è maggiore del range definito sul sistema slave la
funzione ritornerà errore.

Examples

The reading of an unsigned long variable mapped at the addresse 0x200 is managed from the extension
module 1. The variable value is memorized in the ReadValue buffer.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtReadVar.htm (1 of 2) [06/10/2008 17.44.24]


"C" functions: NSYSTExtReadVar

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned char ReadErr; //Read error buffer


unsigned long ReadValue; //Buffer where the variable value is stored

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here un "unsigned long" variable at address "0x200" is read from the
// Netsyst extension module "1".

ReadErr=NSYSTExtReadVar(1, 0x200, sizeof(ReadValue), &ReadValue);


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtReadVar.htm (2 of 2) [06/10/2008 17.44.24]


"C" functions: NSYSTExtWriteVar

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTExtWriteVar

This function writes a variable on the peripheral modules of the Netsyst family. In case of error of module
address the function ends by returning 1 and sets the NSYSTModuleAddress bit in the SystemErrors data
structure. In case of error of variable write the function ends by returning 3 and sets the NSYSTBusAccess bit in
the ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char NSYSTExtWriteVar(unsigned char Module, unsigned int VarAddress, unsigned char ByteNr, void*
Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned int VarAddress It defines the variable address in the module memory (Range from 0x0000 to 0xFFFF)
unsigned char ByteNr It defines the bytes number of variable length (Range from 1 to 4)
void* Value It defines the address of the memory buffer which contains the value to be transferred
to the variable. (Range from 0x0000 to 0xFFFF)
Return value
unsigned char It returns the management error
0: No error
1: Module address error
3: Write variable error

Note

La funzione utilizza il comando 05: Memory write su bus I2C gestito dal blocco funzione FbI2CSlaveManager
sul sistema slave. L'indirizzo della variabile VarAddress corrisponde all'indirizzo dell'operando numerico sul
sistema slave, pertanto se VarAddress=0x0010 e ByteNr=0x02 verrà scritto il valore nell'operando W 0010 del
sistema slave. ATTENZIONE! Se l'indirizzo della variabile è maggiore del range definito sul sistema slave la
funzione ritornerà errore.

Examples

The writing of an unsigned long variable mapped at the addresse 0x200 is executed on the extension module 1.
The value to be written is in the WriteValue buffer.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtWriteVar.htm (1 of 2) [06/10/2008 17.44.25]


"C" functions: NSYSTExtWriteVar

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned char WriteErr; //Write error buffer


unsigned long WriteValue; //Buffer that contains the value to be written

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here un "unsigned long" variable at address "0x200" is write to the
// Netsyst extension module "1".

WriteErr=NSYSTExtWriteVar(1, 0x200, sizeof(WriteValue), &WriteValue);


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTExtWriteVar.htm (2 of 2) [06/10/2008 17.44.25]


"C" functions: NSYSTModSts

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTModSts

This function returns the Netsyst extension module status, it returns a NSYSTEXTMODSTS data structure.

Prototype
ElSystemLib.h
Declaration
NSYSTEXTMODSTS NSYSTModSts(unsigned char Module);
Parameters
unsigned char Module Module address (Range from 0 to 7)
Return value
NSYSTEXTMODSTS Module status data structure

Examples

It's read the state of the extension module with address 1, and if the logic inputs are changed, they are read and
the value is sent out to the serial line.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable declarations.

unsigned int LogInp; //Logic inputs


NSYSTEXTMODSTS Sts; //Netsyst extension status

// -------------------------------------------------------------------------
// CHECK EXTENSION STATUS AND ACQUIRE LOGIC INPUTS
// -------------------------------------------------------------------------
// Read the extension module status and check if logic inputs are changed.

Sts=NSYSTModSts(1); //Netsyst extension status

if (Sts.InputChanged)
{
// Acquire the logic inputs and print the value.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTModSts.htm (1 of 2) [06/10/2008 17.44.25]


"C" functions: NSYSTModSts

NSYSTExtModuleInp(1,&LogInp); //Acquire the logic inputs


SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console
printf("Input value: %04X\r\n", LogInp);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTModSts.htm (2 of 2) [06/10/2008 17.44.25]


"C" functions: NSYSTReadyIn

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

NSYSTReadyIn

This function returns the status of the RDYIN-N signal on the Netsyst extension bus. The signal has worthless
valence, so the function returns TRUE when the signal is active, that means that the signal is in the FALSE
status.

Prototype
ElSystemLib.h
Declaration
BOOL NSYSTReadyIn(void);
Parameters
None
Return value
BOOL FALSE: Ready signal on the Netsyst extension bus is not active
TRUE: Ready signal on the Netsyst extension bus is active

Examples

The status of the ready signal on the Netsyst extension bus is stored in the ReadySignal variable.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

BOOL ReadySignal; //Netsyst extension ready in signal

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here the ready in signal is stored in the "ReadySignal" variable.

ReadySignal=NSYSTReadyIn(); //Netsyst extension ready in signal


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/NSYSTReadyIn.htm [06/10/2008 17.44.26]


"C" functions: PeripheralInp

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

PeripheralInp

This function executes the acquisition of logic inputs from the peripheral modules. In case of access error to the peripheral
bus, on the Picosyst target the PSYSTInputFault bit is set, on the Netsyst targets the NSYSTInputFault bit is set, in the
ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char PeripheralInp(unsigned char Module, unsigned char Input, unsigned char* Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned char Input It defines the bank of input to be acquired (Range from 0 to 3)
unsigned char* Value It defines the address of the memory buffer where the acquired value must be transferred (Range
from 0x0000 to 0xFFFF)
Return value
unsigned char It returns the acquisition error
0: No error
1: Acquisition error

Examples

The acquisition of the 16 digital input from the module with addresse 0 is managed. The acquired value is memorized in a
data structure to permit an easier management of every single entry.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

struct
{
BOOL Inp08:1; //Inp 08 bit
BOOL Inp09:1; //Inp 09 bit
BOOL Inp0A:1; //Inp 0A bit
BOOL Inp0B:1; //Inp 0B bit
BOOL Inp0C:1; //Inp 0C bit
BOOL Inp0D:1; //Inp 0D bit
BOOL Inp0E:1; //Inp 0E bit
BOOL Inp0F:1; //Inp 0F bit
BOOL Inp00:1; //Inp 00 bit
BOOL Inp01:1; //Inp 01 bit
BOOL Inp02:1; //Inp 02 bit
BOOL Inp03:1; //Inp 03 bit
BOOL Inp04:1; //Inp 04 bit

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/PeripheralInp.htm (1 of 2) [06/10/2008 17.44.27]


"C" functions: PeripheralInp

BOOL Inp05:1; //Inp 05 bit


BOOL Inp06:1; //Inp 06 bit
BOOL Inp07:1; //Inp 07 bit
}LogInp;

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

unsigned char Error; //Peripheral input acquisition error

// Here execute the peripheral input acquisition.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


Error=PeripheralInp(0x00, 0x01, ((unsigned char*)&LogInp+0)); //Inputs from 8 to F
Error|=PeripheralInp(0x00, 0x00, ((unsigned char*)&LogInp+1)); //Inputs from 0 to 7

if (LogInp.Inp01)
printf("Input 01 is set.\r\n");
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/PeripheralInp.htm (2 of 2) [06/10/2008 17.44.27]


"C" functions: PeripheralOut

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

PeripheralOut

This function executes the management of the logic outputs on the peripheral modules. In case of access error to the
peripheral bus, on the Picosyst targets the PSYSTOutputFault bit is set, on the Netsyst targets the NSYSTOutputFault bit
is set, in the ExecutionErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char PeripheralOut(unsigned char Module, unsigned char Output, unsigned char Value);
Parameters
unsigned char Module It defines the address of the peripheral module (Range from 1 to 7)
unsigned char Output It defines the output bank to be managed (Range from 0 to 3)
unsigned char Value It defines the value to be tranferred to the output bank (Range from 0x00 to 0xFF)
Return value
unsigned char It returns the acquisition error
0: No error

Examples

The management of the 16 digital outputs on the module with address 0 is managed. The value to be transferred to the
outputs is read by a data structure to permit an easier management of every single output.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

struct
{
BOOL Out08:1; //Out 08 bit
BOOL Out09:1; //Out 09 bit
BOOL Out0A:1; //Out 0A bit
BOOL Out0B:1; //Out 0B bit
BOOL Out0C:1; //Out 0C bit
BOOL Out0D:1; //Out 0D bit
BOOL Out0E:1; //Out 0E bit
BOOL Out0F:1; //Out 0F bit
BOOL Out00:1; //Out 00 bit
BOOL Out01:1; //Out 01 bit
BOOL Out02:1; //Out 02 bit
BOOL Out03:1; //Out 03 bit
BOOL Out04:1; //Out 04 bit
BOOL Out05:1; //Out 05 bit
BOOL Out06:1; //Out 06 bit
BOOL Out07:1; //Out 07 bit
}LogOut;

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/PeripheralOut.htm (1 of 2) [06/10/2008 17.44.28]


"C" functions: PeripheralOut

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

unsigned char Error; //Peripheral output management error

// Here execute the peripheral output management.

LogOut.Out00=PLCTimeBase400; //Out 00 bit

Error=PeripheralOut(0x00, 0x01, *((unsigned char*)&LogOut+0)); //Outputs from 8 to F


Error|=PeripheralOut(0x00, 0x00, *((unsigned char*)&LogOut+1)); //Outputs from 0 to 7
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/PeripheralOut.htm (2 of 2) [06/10/2008 17.44.28]


"C" functions: RunLEDMng

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

RunLEDMng

This function forces the status of the run yellow LED.

Prototype
ElSystemLib.h
Declaration
void RunLEDMng(BOOL Command);
Parameters
BOOL Command FALSE: The LED is switched off
TRUE: The LED is switched on
Return value
None

Examples

The run yellow LED is blinking.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here Run yellow LED is blinking.

RunLEDMng(PLCTimaBase400);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/RunLEDMng.htm [06/10/2008 17.44.28]


"C" functions: SetPeripheralReady

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetPeripheralReady

This function manages the Ready signal on the peripheral bus, this signal is used to enable the modules
connected to the bus. The signal status is displayed by a green led on every target. In case of management error
the NSYSTBusAccess bit is set in the ExecutionErrors data structure.

The function also provides the automatical numbering of the Netsyst extension modules connected to the I2C
bus, the first module connected will take address 1, the second one 2 and so on until the module 7. the
numbering taken is a numbering used as reference in all the funcions of access to the peripheral modules, the
real I2C addresse of the module is 0x21 for the first module, 0x22 for the second one and so on.

Note: The operating system automatically provides the management of the Ready signal, with the user program
in run the signal is activated.

Prototype
ElSystemLib.h
Declaration
void SetPeripheralReady(BOOL Command);
Parameters
BOOL Command It defines the status in which the signal must be put
FALSE: The signal is inactivated, disabling the peripheral modules (Led off)
TRUE: The signal is activated, enabling the peripheral modules (Led on)
Return value
None

Examples

The Ready signal is inactivated disabling all the peripheral modules.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here the "Ready" signal is disabled.

SetPeripheralReady(FALSE); //Disable peripheral bus


}

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/SetPeripheralReady.htm (1 of 2) [06/10/2008 17.44.29]


"C" functions: SetPeripheralReady

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Hardware/SetPeripheralReady.htm (2 of 2) [06/10/2008 17.44.29]


"C" functions: SystemMemoryRead

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SystemMemoryRead

This function allows the reading of the system memory. In case of error on the memory type range the
MemoryType bit is set, in case of error on the memory address the MemoryAddress bit is set in the
SystemErrors data structure. In case of access error to the memory the MemoryAccess bit is ser in the
ExecutionErrors data structure.

Setting the bit MemoryAccessWait in the SystemConfig data structure, can be defined the behavior of the
function in case of access to EEPROM and FLASH memories when they are not ready.
FALSE: The read operation is not executed and the function returns error code 3.
TRUE: It is waited the memory ready and then the read operation is executed, if timeout error the function
returns error code 4.

Prototype
ElSystemLib.h
Declaration
unsigned char SystemMemoryRead(unsigned char Type, unsigned long Address, unsigned int Bytes, void*
Buffer);
Parameters
unsigned char Type 0: User data memory
1: User code memory
2: User storage memory
3: PCB088 mass memory module
4: PCB111 mass memory module
5: User I data memory
11: Kernel code memory
12: Kernel configuration memory
22: System configuration memory

Target 0 1 2 3 4 5 11 12 22

Netlog
Picosyst
Netreader T89C51ED2 Temic
NetlogII Lite
Netreader P89C664 Philips
PicosystME II
NetlogII
unsigned long Address It defines the reading address, its range changes according to the target system
unsigned int Bytes It defines the number of bytes to be read (Range from 0x0001 to 0xFFFF)
void* Buffer It defines the address where the read data is transferrred to (Range from 0x0000 to
0xFFFF)
Return value

http://192.168.0.61/Destination/Html/CLanguage/Functions/System/SystemMemoryRead.htm (1 of 3) [06/10/2008 17.44.30]


"C" functions: SystemMemoryRead

unsigned char 0, Ok: read executed


1, Wrong type: wrong memory type
2, Address out of range: address out range
3, Memory not ready: selected memory not ready
4, Memory access error: memory access error

Examples

At any second a memory dump of 32 bytes of user data memory is executed with a message like this:

DATA memory dump from 0x0000 to 0x001F

00: 0000 0000 0000 0000 0000 0000 0000 0000


10: 0000 0000 0000 0000 0000 0000 0000 0000

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define DATA 0

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

unsigned char i; //Auxiliary counter


unsigned char Error; //Error buffer
unsigned char ReadValue[2]; //Reading buffer
unsigned long Address; //Memory address

// Print out 32 bytes of DATA memory.

if (PLCPulse1000)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console
printf ("DATA memory dump from 0x0000 to 0x001F\r\n");
Address=0x0000; //Memory address

for (i=0; i<32; i+=2, Address+=2)


{
// It's an address print.

http://192.168.0.61/Destination/Html/CLanguage/Functions/System/SystemMemoryRead.htm (2 of 3) [06/10/2008 17.44.30]


"C" functions: SystemMemoryRead

if ((i&0X0F) == 0)
printf ("\r\n%02X: ", i);

// Print the memory values.

Error=SystemMemoryRead(DATA, Address, 2, &ReadValue);


printf ("%02X%02X ", ReadValue[0], ReadValue[1]);

// At every 8 bytes divide the values with one more space.

if ((i&0X0F) == 6)
PutCh (' ');
}

printf ("\r\n\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/System/SystemMemoryRead.htm (3 of 3) [06/10/2008 17.44.30]


"C" functions: SystemMemoryWrite

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SystemMemoryWrite

This function allows the writing of the system memory.In case of error on the memory type range the
MemoryType bit in the SystemErrors data structure is set. In case of error on the memory address the
MemoryAddress bit in the SystemErrors data structure is set. In case of access error to the memory the
MemoryAccess bit in the ExecutionErrors data structure is set.

Setting the bit MemoryAccessWait in the SystemConfig data structure, can be defined the behavior of the
function in case of access to EEPROM and FLASH memories when they are not ready.
FALSE: The write operation is not executed and the function returns error code 3.
TRUE: It is waited the memory ready and then the write operation is executed, if timeout error the function
returns error code 4.

Prototype
ElSystemLib.h
Declaration
unsigned char SystemMemoryWrite(unsigned char Type, unsigned long Address, unsigned int Bytes, void*
Buffer);
Parameters
unsigned char Type 0: User data memory
1: User code memory
2: User storage memory
3: PCB088 mass memory module
4: PCB111 mass memory module
5: User I data memory
11: Kernel code memory
12: Kernel configuration memory
22: System configuration memory

Target 0 1 2 3 4 5 11 12 22

Netlog
Picosyst
Netreader T89C51ED2 Temic
NetlogII Lite
Netreader P89C664 Philips
PicosystME II
NetlogII
unsigned long Address It defines the reading address, its range changes according to the target system
unsigned int Bytes It defines the number of bytes to be written (Range from 0x0001 to 0xFFFF)
voidr* Buffer It defines the addrese of the buffer that contains the data to be written (Range from
0x0000 to 0xFFFF)
Return value

http://192.168.0.61/Destination/Html/CLanguage/Functions/System/SystemMemoryWrite.htm (1 of 2) [06/10/2008 17.44.31]


"C" functions: SystemMemoryWrite

unsigned char 0, Ok: write executed


1, Wrong type: wrong memory type
2, Address out of range: address out range
3, Memory not ready: selected memory not ready
4, Memory access error: memory access error

Examples

To every second it is incremented the value of an one unsigned long variable, its value it is written in user data
memory. The memory is read back and the written value and the read value are printout.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define DATA 0

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static unsigned char Buffer[4]; //Buffer located by linker


static unsigned long WriteValue; //Value to be written
static unsigned long ReadValue; //Read value

// A long value is written in a DATA memory, after the value is read.

if (PLCPulse1000)
{
WriteValue++; //Value to be written
SystemMemoryWrite(DATA, (unsigned long)&Buffer, 4, &WriteValue);
SystemMemoryRead(DATA, (unsigned long)&Buffer, 4, &ReadValue);

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf ("Write: %l08X, Read: %l08X\r\n", WriteValue, ReadValue);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/System/SystemMemoryWrite.htm (2 of 2) [06/10/2008 17.44.31]


"C" functions: GetRtc

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetRtc

This function returns the time structure read from the real time clock. The value read from the real time clock
registers is transferred in the RTCDATA data structure whose address is passed to the function. If access error
to the real time clock chip the function returns TRUE and sets the RtcAccess bit in the ExecutionErrors data
structure without updating the data structure defined. If the real time clock are wrong, the RtcDataError bit in the
ExecutionErrors data structure is set, anyway the functions transfers the Rtc data in the data structure and
returns FALSE.

Prototype
ElSystemLib.h
Declaration
BOOL GetRtc(RTCDATA *Rtc);
Parameters
RTCDATA *Rtc Data structure address where value read from the RTC will be trasferred (Range from 0x0000 to
0xFFFF)
Return value
BOOL FALSE: RTC read executed
TRUE: RTC read error

Examples

The time data structure is read from the real time clock and a message is sent to the serial with the the current
date and time so as follows.

Date: 13/06/06,5 Time: 11:28:38

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variables definition.

static unsigned char SaveSecond; //Save the second buffer


static RTCDATA RtcData; //Rtc data structure

// Read the time data structure. To avoid loosing time the read is executed

http://192.168.0.61/Destination/Html/CLanguage/Functions/Rtc/GetRtc.htm (1 of 2) [06/10/2008 17.44.31]


"C" functions: GetRtc

// at every 500 mSec.

if (PLCPulse500)
GetRtc(&RtcData);

// When the time change the current time is printed out.

if (RtcData.Second != SaveSecond)
{
SaveSecond=RtcData.Second; //Save the second buffer

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf("Date: %02d/%02d/%02d,%1d Time: %02d:%02d:%02d\r\n",
RtcData.Day, RtcData.Month, RtcData.Year, RtcData.WeekDay,
RtcData.Hour, RtcData.Minute, RtcData.Second);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Rtc/GetRtc.htm (2 of 2) [06/10/2008 17.44.31]


"C" functions: SetRtc

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetRtc

This function set the time in the real time clock. The value read by the RTCDATA data structure whose address
is passed to the function is transferred to the registers of the real time clock. If access error to the real time clock
the function returns TRUE and sets the RtcAccess bit in the ExecutionErrors data structure, the time value set in
the real time chip is not determined.

Prototype
ElSystemLib.h
Declaration
BOOL SetRtc(RTCDATA *Rtc);
Parameters
RTCDATA *Rtc Data structure address that contains the values to be written to the RTC (Range from 0x0000 to
0xFFFF)
Return value
BOOL FALSE: RTC write executed
TRUE: RTC write error

Examples

The reception of a charachter from a serial line is controlled, if a charachter is received, the reading of the time
structure from the real time clock is managed and a message is sent on serial with indication of current date and
time so as follows.

Date: 13/06/06,5 Time: 11:28:38

If the received charachter is "+", the value of the hour in the real time clock is increased.
If the received charachter is "-", the value of the hour in the real time clock is decreased.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variables definition.

static RTCDATA RtcData; //Rtc data structure

http://192.168.0.61/Destination/Html/CLanguage/Functions/Rtc/SetRtc.htm (1 of 2) [06/10/2008 17.44.32]


"C" functions: SetRtc

// Check if a character is received from the serial line.

if (GetRxChars())
{
// Read the received character.

switch (GetCh())
{
GetRtc(&RtcData); //Read the current RTC registers

// -----------------------------------------------------------------
// If the "+" is received the RTC hour is increased by 1.

case '+':
if (RtcData.Hour != 23)
RtcData.Hour++; //Current hour
else
RtcData.Hour=0; //Current hour

SetRtc(&RtcData); //Write the RTC registers with the new values


break;

// -----------------------------------------------------------------
// If the "-" is received the RTC hour is decreased by 1.

case '-':
if (RtcData.Hour != 0)
RtcData.Hour--; //Current hour
else
RtcData.Hour=23; //Current hour

SetRtc(&RtcData); //Write the RTC registers with the new values


break;
}

// If a char has been received the current data and time is printed out.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf("Date: %02d/%02d/%02d,%1d Time: %02d:%02d:%02d\r\n",
RtcData.Day, RtcData.Month, RtcData.Year, RtcData.WeekDay,
RtcData.Hour, RtcData.Minute, RtcData.Second);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Rtc/SetRtc.htm (2 of 2) [06/10/2008 17.44.32]


"C" functions: GetClockIntTime

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetClockIntTime

This function returns the execution time of the interrupt clock function, the time is set with tthe
SetClockIntTime function.

Prototype
ElSystemLib.h
Declaration
unsigned cha GetClockIntTime(void);
Parameters
None
Return value
unsigned char Returns the execution time of the interrupt clock function (Range da 1 a 255 mSec)

Examples

Refer to the example in SetClockIntVector.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/GetClockIntTime.htm [06/10/2008 17.44.33]


"C" functions: GetSystemTime

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetSystemTime

This function returns the system time increased at every tick (1 mSec). The returned value is expressed on a 16 bit
variable and reached its maximum value it restarts automatically from the value 0.

Prototype
ElSystemLib.h
Declaration
unsigned int GetSystemTime(void);
Parameters
None
Return value
unsigned int System time (Range from 0x0000 to 0xFFFF)

Examples

The use of this function permits to calculate the duration of an event, in the following example it is calculed the time in
which the logic input 0 remains active. The time calculation it is correct only in the range from 0 to 65535 mSec.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static BOOL InputState; //Save the input state


unsigned char LogInp; //Logical inputs buffer
unsigned int OnTime; //The time while the input still active
static unsigned int SetTimeBuf; //Save the time when input becomes active

// Acquire the logic inputs from 0x00 to 0x07.

PeripheralInp(0x00, 0x00, &LogInp);

// Check if the logic input change its state.

if ((LogInp&0x01) != InputState)
{
InputState=(LogInp&0x01); //Save the input state

// Check if it's a set transition.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/GetSystemTime.htm (1 of 2) [06/10/2008 17.44.33]


"C" functions: GetSystemTime

if (LogInp&0x01)
SetTimeBuf=GetSystemTime(); //Save the time when input becomes active

// Check if it's a reset transition and calculate the time.

if (!(LogInp&0x01))
{
OnTime=GetSystemTime()-SetTimeBuf; //The time while the input still active

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf ("The input is still active: %5d mSec\r\n", OnTime);
}
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/GetSystemTime.htm (2 of 2) [06/10/2008 17.44.33]


"C" functions: IsMsecTimeOver

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

IsMsecTimeOver

This function controls if a defined time is passed from the reference time, you need to save the reference time
with the GetSystemTime function. The function permits the management of programmable delay times and/or the
control on defined timeouts. If you desire to make the control on times longer than 65 seconds using a risolution
in seconds, it is possible to use the IsSecTimeOver function.

Prototype
ElSystemLib.h
Declaration
BOOL IsMsecTimeOver(unsigned int* Reference, unsigned int mSecDelay);
Parameters
unsigned int* Reference It defines the address of the buffer where the reference time has been memorized
(Range from 0x0000 to 0xFFFF)
unsigned int mSecDelay It defines the time to be controlled (Range from 0 to 65535 mSec)
Return value
BOOL FALSE: Time not yet passed
TRUE: Time is passed

Examples

In the example is executed the inversion at every second (Blinking) of the logic output 0 status. To be noted the
init of the reference time executed at the first program loop to guarantee the correct time also at the system on.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static unsigned char LogOut; //Logical outputs buffer


static unsigned int RefTimeBuf; //Save the reference time

// Init the reference time at first program loop.

if (PLCFirstLoop)
RefTimeBuf=GetSystemTime(); //Save the reference time

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/IsMsecTimeOver.htm (1 of 2) [06/10/2008 17.44.34]


"C" functions: IsMsecTimeOver

// Check if the time is passed and invert the logic output 0 state.

if (IsMsecTimeOver(&RefTimeBuf, 1000))
{
RefTimeBuf=GetSystemTime(); //Save the reference time
LogOut^=0x01; //Logical output buffer
}

// Manage the logic outputs from 0x00 to 0x07.

PeripheralOut(0x00, 0x00, LogOut);


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/IsMsecTimeOver.htm (2 of 2) [06/10/2008 17.44.34]


"C" functions: IsSecTimeOver

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

IsSecTimeOver

This function controls if a defined time is passed from the reference time, you need to save the reference time
with the GetSystemTime function. The function permits the management of programmable delay times and/or the
control on defined timeouts. If you desire to make the control on time shorter than 65 seconds disposing of a
risolution in thousandseconds, it is possible to use the IsMsecTimeOver function.

Prototype
ElSystemLib.h
Declaration
BOOL IsSecTimeOver(unsigned long* Reference, unsigned int SecDelay);
Parameters
unsigned long* Reference It defines the address of the buffer where the reference time has been memorized
(Range from 0x0000 to 0xFFFF)
unsigned int SecDelay It defines the time to be controlled (Range from 0 to 65535 Sec)
Return value
BOOL FALSE: Time not yet passed
TRUE: Time is passed

Examples

In the example is executed the inversion at every second (Blinking) of the logic output 0 status. To be noted the
init of the reference time executed at the first program loop to guarantee the correct time also at the system on.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static unsigned char LogOut; //Logical outputs buffer


static unsigned long RefTimeBuf; //Save the reference time

// Init the reference time at first program loop.

if (PLCFirstLoop)
RefTimeBuf=GetSystemTime(); //Save the reference time

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/IsSecTimeOver.htm (1 of 2) [06/10/2008 17.44.35]


"C" functions: IsSecTimeOver

// Check if the time is passed and invert the logic output 0 state.

if (IsSecTimeOver(&RefTimeBuf, 1))
{
RefTimeBuf=GetSystemTime(); //Save the reference time
LogOut^=0x01; //Logical output buffer
}

// Manage the logic outputs from 0x00 to 0x07.

PeripheralOut(0x00, 0x00, LogOut);


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/IsSecTimeOver.htm (2 of 2) [06/10/2008 17.44.35]


"C" functions: SetClockIntTime

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetClockIntTime

This function defines the execution time of the interrupt clock function. The address of the function to be
executed on interrupt must be defined with the SetClockIntVector function.

Prototype
ElSystemLib.h
Declaration
void SetClockIntTime(unsigned char Time);
Parameters
unsigned char Time It defines the execution time of the interrupt clock function (Range da 1 a 255 mSec)
Return value
None

Examples

Refer to the example in SetClockIntVector.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/SetClockIntTime.htm [06/10/2008 17.44.35]


"C" functions: SetClockIntVector

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetClockIntVector

This function enables the clock interrupt and defines the address of the function to be executed on interrupt at the execution
time defined by the SetClockIntTime function. If the interrupt become active while the user function is still in execution, the
function is not executed and the ClockInterruptLatency bit in the ExecutionErrors variable is set. The user function will
continue to to be executed at the successive interrupts.

The user function it's executed with the microcontroller not in interrupt state, so all the interrupts independently from
their priority will be able to interrupt the execution of the function.

Prototype
ElSystemLib.h
Declaration
void SetClockIntVector(BOOL Enable, code *Address);
Parameters
BOOL Enable FALSE: Disables the interrupt.
TRUE: Enables the interrupt.
code *Address It defines the address of program to be executed on interruption (Range da 0x0000 a 0xFFFF)
Return value
None

Examples

The execution of the InterruptFunct function is executed every 1 mSec. In the function executed on interrupt the Counter
variable is increased, at every second the variable will be increased of 1000. In the main program are calculated the impulses
counted at every second (Frequency impulses), the value in the Frequency variable should be 1000 but it's possible to note
slightly different values due to the program loop execution time.

The functions executed in interrupt must not use memory overlays, they must be preceded by #pragma AUTO and
followed by #pragma NOAUTO.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned long Counter; //Counter value


unsigned int Frequency; //Pulses frequency

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN INTERRUPT
// -----------------------------------------------------------------------------
// Function executed on interrupt, it increases the counter.

#pragma AUTO //Memory overlay disable

static void InterruptFunct(void)


{

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/SetClockIntVector.htm (1 of 2) [06/10/2008 17.44.36]


"C" functions: SetClockIntVector

Counter++; //Counter value


}

#pragma NOAUTO //Memory overlay enable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN MAIN
// -----------------------------------------------------------------------------
// Function executed on main, it calculates how many pulses per second.

void Example(void)
{
static unsigned long AuxCounter; //Auxiliary counter buffer

// Enable the "InterruptFunct" execution at every 1 mSec.

if (PLCFirstLoop)
{
SetClockIntTime(1); //Set the clock interrupt time at 1 mSec
SetClockIntVector(TRUE, (code*)&InterruptFunct); //Set the clock interrupt vector
}

// To use in the main program the "Counter" variable, the interrupt must
// be disabled.

if (PLCPulse1000)
{
DISABLEINT; //Disable interrrupt
Frequency=(Counter-AuxCounter)*GetClockIntTime(); //Pulses frequency
AuxCounter=Counter; //Auxiliary counter buffer
ENABLEINT; //Enable interrrupt
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Tick/SetClockIntVector.htm (2 of 2) [06/10/2008 17.44.36]


"C" functions: SetTimerEnable

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetTimerEnable

This function enables and/or disables the timer, the timer can be used as times base to execute an
interruption function. If the Time value is out range the function sets the TimerTimeSet bit in the
SystemErrors data structure without changing the time value set. The address of the function to be
executed on interrupt must be defined with the SetTimerIntVector function.

Prototype
ElSystemLib.h
Declaration
void SetTimerEnable(BOOL Command, unsigned int Time);
Parameters
BOOL Command FALSE: Disables the timer
TRUE: Enables the timer
unsigned int Time It defines the interrupt interval time (Range from 0 to 65536 uSec)
Return value
None

Following we supply a table wich reports the maximum value to be set on the different target devices in
function of the microprocessor used. We remember that the version of the microprocessor can be known
from the product code or from the value reported in the SystemConfig variable.

In the target devices that have more than one serial port the use of the timer disables the operation of
the serial port reported in the table.

Target Microprocessor Value range (uSec) Serial port disabled

0x03, 0x08, 0x0D From 0 to 35555 Port B


Picosyst MEII
0x04, 0x05 From 0 to 17777 Port B
Picosyst MEIII 0x0C From 100 to 25000 Port B
Netlog II Lite 0x0A From 0 to 5208 None
Netlog II 0x0C From 0 to 19660 Port C

Examples

Refer to the example in SetTimerIntVector.

http://192.168.0.61/Destination/Html/CLanguage/Functions/Timer/SetTimerEnable.htm [06/10/2008 17.44.37]


"C" functions: SetTimerIntVector

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetTimerIntVector

This function enables the interrupt on timer and defines the address of the user function to be executed on interrupt at the
execution time defined by the SetTimerEnable function. The user function will be executed with the microcontroller in interrupt
status, therefore no interrupts with the same priority will be able to interrupt the execution of the function.

The user function it's executed with the microcontroller in interrupt state, so only the interrupts with greather priority will
be able to interrupt the execution of the function.

Prototype
ElSystemLib.h
Declaration
void SetTimerIntVector(BOOL Enable, code *Address);
Parameters
BOOL Enable FALSE: Disables the timer 1interrupt.
TRUE: Enables the timer 1 interrupt.
code *Address It defines the address of program to be executed on interruption (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

The timer is enabled and set to execute cyclically every 1 mSec on interrupt the InterruptFunct function. In the function
executed in interrupt the Counter variable is increased, at every second the variable will be increased of 1000.

The functions executed in interrupt must not use memory overlays, they must be preceded by #pragma AUTO and
followed by #pragma NOAUTO.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned long Counter; //Counter value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN INTERRUPT
// -----------------------------------------------------------------------------
// Function executed at every 1 mSec, it increments the Counter.

#pragma AUTO //Memory overlay disable

static void InterruptFunct(void)


{
Counter++; //Counter value
}

#pragma NOAUTO //Memory overlay enable

http://192.168.0.61/Destination/Html/CLanguage/Functions/Timer/SetTimerIntVector.htm (1 of 2) [06/10/2008 17.44.37]


"C" functions: SetTimerIntVector

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN MAIN
// -----------------------------------------------------------------------------

void Example(void)
{
// Enable the "InterruptFunct" execution at every 1 mSec.

if (PLCFirstLoop)
{
SetTimerEnable(TRUE, 1000); //Set the timer interrupt time at 1 mSec
SetTimerIntVector(TRUE, (code*) &InterruptFunct); //Set the timer interrupt vector
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Timer/SetTimerIntVector.htm (2 of 2) [06/10/2008 17.44.37]


"C" functions: SetEIntVector

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetEIntVector

This function enables the interrupt on external signal and defines the address of the user function to be executed on
interrupt. If the interrupt happens while the user function is still in execution the ExtInterruptLatency bit in the
ExecutionErrors variable is set and when the function ends it will be recalled. In the user function by checking this bit it's
possible to take all the necessary actions.

In case of interrupt overlap if the bit ExtInterruptLatency flag it's not reset by the user program in the function
executed on interrupt, the external interrrupt it's disabled. To enable it it's necessary to execute the SetEIntVector
function again.

The user function it's executed with the microcontroller not in interrupt state, so all the interrupts independently from
their priority will be able to interrupt the execution of the function.

Prototype
ElSystemLib.h
Declaration
void SetEIntVector(BOOL Enable, code *Address);
Parameters
BOOL Enable FALSE: Disables the interrupt.
TRUE: Enables the interrupt.
code *Address It defines the address of program to be executed on interruption (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

In the following example we assume to have joined to the external interrupt a pulses generator, the interrupt function provide
to the pulses count, while in the main it's calculated the number of pulses at every second (Pulses frequency) the value is
returned in the Frequency variable.

The functions executed in interrupt must not use memory overlays, they must be preceded by #pragma AUTO and
followed by #pragma NOAUTO.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned long Counter; //Counter value


unsigned int Frequency; //Pulses frequency

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN INTERRUPT
// -----------------------------------------------------------------------------
// Function executed on interrupt, it count the pulses.

#pragma AUTO //Memory overlay disable

http://192.168.0.61/Destination/Html/CLanguage/Functions/ExtInterrupt/SetEIntVector.htm (1 of 2) [06/10/2008 17.44.38]


"C" functions: SetEIntVector

static void InterruptFunct(void)


{
static BOOL IsOverlap; //Interrupt overlap
static unsigned char OvlCtr; //Overlap counter

// If one or more interrupt overlaps are accepted, it's possible to manage


// the error flag. In the example two overlaps are accepted.

if (!ExecutionErrors.ExtInterruptLatency)
OvlCtr=0; //Overlaps counter
else if (++OvlCtr > 2)
IsOverlap=TRUE; //Interrupt overlap

ExecutionErrors.ExtInterruptLatency=IsOverlap; //External interrupt latency

// Increase the value at every interrupt.

Counter++; //Counter value


}

#pragma NOAUTO //Memory overlay enable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED IN MAIN
// -----------------------------------------------------------------------------
// Function executed on main, it calculates how many pulses per second.

void Example(void)
{
static unsigned long AuxCounter; //Auxiliary counter buffer

// Enable the "InterruptFunct" execution on external interrupt.

if (PLCFirstLoop)
SetEIntVector(TRUE, (code*)&InterruptFunct); //Set the external interrupt vector

// To use in the main program the "Counter" variable, the interrupt must
// be disa?bled.

if (PLCPulse1000)
{
DISABLEINT; //Disable interrrupt
Frequency=Counter-AuxCounter; //Pulses frequency
AuxCounter=Counter; //Auxiliary counter buffer
ENABLEINT; //Enable interrrupt
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/ExtInterrupt/SetEIntVector.htm (2 of 2) [06/10/2008 17.44.38]


"C" functions: SetPwDownIntVector

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetPwDownIntVector

This function enables and defines the execution address of the program to be executed on power down.

Prototype
ElSystemLib.h
Declaration
void SetPwDownIntVector(BOOL Enable, code *Address);
Parameters
BOOL Enable FALSE: Disables the interrupt.
TRUE: Enables the interrupt.
code *Address It defines the address of program to be executed on interruption (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

The vector for the power down interrupt management is set to execute on interrupt the InterruptFunct function. When the power
supply come down under to the threshold value the function will be automatically executed. The use of this function is suggested to
expert users.

WARNING! The functions executed in interrupt must not use memory overlays, they must be preceded by #pragma AUTO and
followed by #pragma NOAUTO.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned long Counter; //Counter value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED ON INTERRUPT
// -----------------------------------------------------------------------------
// Function executed on power down interrupt, it increments the Counter.

#pragma AUTO //Memory overlay disable

static void InterruptFunct(void)


{
Counter++; //Counter value
}

#pragma NOAUTO //Memory overlay enable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM EXECUTED ON MAIN
// -----------------------------------------------------------------------------

void Example(void)
{
// Enable the "InterruptFunct" execution on power down interrupt.

http://192.168.0.61/Destination/Html/CLanguage/Functions/PowerDown/SetPwDownIntVector.htm (1 of 2) [06/10/2008 17.44.39]


"C" functions: SetPwDownIntVector

if (PLCFirstLoop)
SetPwDownIntVector(TRUE, (code*)&InterruptFunct); //Set the power down interrupt vector
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/PowerDown/SetPwDownIntVector.htm (2 of 2) [06/10/2008 17.44.39]


"C" functions: GetWDogTime

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetWDogTime

This function returns the defined watch dog circuit time.

Prototype
ElSystemLib.h
Declaration
unsigned int GetWDogTime(void);
Parameters
None
Return value
unsigned int Watch dog defined time (Range from 0 to 65535 mSec)

Examples

At the first program execution loop the watch dog defined time is read and its value is sent to the serial line with a
message like this:

The watch dog time is set to: 1400 mSec

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Print out the watch dog time currently set.

if (PLCFirstLoop)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console
printf("The watch dog time is set to:%5d mSec\r\n", GetWDogTime());
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/WatchDog/GetWDogTime.htm [06/10/2008 17.44.40]


"C" functions: HwWDogRefresh

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

HwWDogRefresh

This function executes the hardware refresh of the watch dog circuit. This function must be used only in
special cases, normally we suggest to use the WDogRefresh.

Prototype
ElSystemLib.h
Declaration
void HwWDogRefresh
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/WatchDog/HwWDogRefresh.htm [06/10/2008 17.44.40]


"C" functions: SetWDogTime

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetWDogTime

This function sets the watch dog time. If the watch dog circuit is not refreshed by the user program with a call to
the function WDogRefresh, within the defined time, all the logical exits are cleared and the system is reset. The
default watch dog time is set at 1400 mSec.

Prototype
ElSystemLib.h
Declaration
void SetWDogTime(unsigned int Time);
Parameters
unsigned int Time Watch dog time (Range from 0 to 65535 mSec)
Return value
None

Examples

The intervention time of the watch dog circuit is set at 1 second.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Set the wdog time a 1 second.

if (PLCFirstLoop)
SetWDogTime(1000);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/WatchDog/SetWDogTime.htm [06/10/2008 17.44.40]


"C" functions: WDogRefresh

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

WDogRefresh

This function executes the refresh of the watch dog circuit. If the watch dog circuit is not refreshed by the
user program with a call to this function, within the defined time, all the logical exits are cleared and the
system is reset.

The program execution is ciclical, and the operating system provides automatically to the refreshning of the
watch dog circuit with a call to this function before the execution of the program loop. Therefore the use of
this function is needed just in certain cases when for example the user program stops itself in a waiting loop.

Prototype
ElSystemLib.h
Declaration
void WDogRefresh
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/WatchDog/WDogRefresh.htm [06/10/2008 17.44.41]


"C" functions: I2CMasterNodeCheck

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CMasterNodeCheck

This functions checks if the specified peripheral device is connected to the I2C BUS. Passing to the function the
peripheral device address, it checks if the peripheral is connected to the BUS and returns the connection status.

Prototype
ElSystemLib.h
Declaration
BOOL I2CMasterNodeCheck(unsigned char I2CAddress);
Parameters
unsigned char I2CAddress It defines the address of the peripheral connected to the I2C bus (Range from 0x00
to 0X7F)
Return value
BOOL FALSE: Peripheral device not connected
TRUE: Peripheral device connected

Examples

Is checked the presence of the real time clock and the PCB111 memory mass module. If both the devices are
connected a string like this reported is sent from the serial line.

Here the list of the available devices.

The Real Time Clock is present.


The PCB111 mass memory module is present.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Execute the test every 1 second.

if (PLCPulse1000)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console
printf("\n\n\nHere the list of the available devices.\r\n\n");

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterNodeCheck.htm (1 of 2) [06/10/2008 17.44.42]


"C" functions: I2CMasterNodeCheck

// Check the presence of the real time clock (Address 0x51).

if (I2CMasterNodeCheck(0x51))
printf("The Real Time Clock is present.\r\n");

// Check the presence of the PCB111 mass memory module (Address 0x52).

if (I2CMasterNodeCheck(0x52))
printf("The PCB111 mass memory module is present.\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterNodeCheck.htm (2 of 2) [06/10/2008 17.44.42]


"C" functions: I2CMasterRead

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CMasterRead

This function allows the reading from peripherals connected to the I2C bus. The function manages the peripherals
stretching. In the case in which the peripheral does not returns the acknowledge of the sent date the function ends by
returning 1 and setting the I2CMNoAck bit in the SystemErrors data structure. In the case in which the peripheral
forces the low clock signal for a time longer than 1mSec the function ends by returning 2 and setting the
I2CMClockTimout bit in the SystemErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char I2CMasterRead(unsigned char I2CAddress, unsigned char NrOfBytes, unsigned char *DataBuffer);
Parameters
unsigned char I2CAddress It defines the address of the peripheral connected to the I2C bus (Range from 0x00 to
0X7F)
unsigned char NrOfBytes It defines the number of bytes to be read (Range from 0x00 to 0xFF)
unsigned char *DataBuffer It defines the address of the data buffer where the data read from the peripheral are
stored (Range from 0x0000 to 0xFFFF)
Return value
unsigned char 0: Ok, command executed
1: No Ack, the peripheral has not sent the acknowledge signal
2: BusFault, the I2C bus is busy

Examples

The logic input status is read from Netsyst extension module connected to the I2C bus. We remind you that the
Netsyst extension modules automatically take their address in function of their related position on the bus, the
module directly connected to the base module will have addresse 0x21, the following one 0x22 and so on.

CMD CKS Command frame to send to Netsyst extension to read logic input
CMD MSBVALUE LSBVALUE CKS Answer frame with logic inputs status

Where:

CMD Command to execute (0x06)


VALUE Value read from logic inputs
CKS Check sum frame

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterRead.htm (1 of 2) [06/10/2008 17.44.42]


"C" functions: I2CMasterRead

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL DEFINITIONS
// -----------------------------------------------------------------------------
// I2C device address definition.

#define MODULEADD 0x21

// Global variables definition.

BOOL ReadOk; //Ok read command


unsigned char FrameBuf[4]; //Frame buffer
unsigned int Value; //Input value

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here create the command frame to be sent.

FrameBuf[0]=0x06; //Command
FrameBuf[1]=-(MODULEADD+FrameBuf[0]); //Checksum

// The command frame is sent to the I2C device.

if (!I2CMasterWrite(MODULEADD, 2, &FrameBuf))
{
// If the command frame has been correctly sent the answer is read.

if (!I2CMasterRead(MODULEADD, 4, &FrameBuf))
{
// If the answer frame has been correctly received the data is checked.

if ((FrameBuf[0] == 0x06) &&


(!((MODULEADD+0x06+FrameBuf[1]+FrameBuf[2]+FrameBuf[3])&0xFF)))
{
Value=*(unsigned int*)&FrameBuf[1];
ReadOk=TRUE; //Ok read command
}
}
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterRead.htm (2 of 2) [06/10/2008 17.44.42]


Funzioni "C": I2CMasterWrite

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CMasterWrite

This function allows the writing on peripheral connected to the I2C bus. The function manages the stretching of the
peripherals. In the case in which the peripheral does not returns the acknowledge of the sent date the function ends
by returning 1 and setting the I2CMNoAck bit in the SystemErrors data structure. In the case in which the peripheral
forces the low clock signal for a time longer than 1mSec the function ends by returning 2 and setting the
I2CMClockTimout bit in the SystemErrors data structure.

Prototype
ElSystemLib.h
Declaration
unsigned char I2CMasterWrite(unsigned char I2CAddress, unsigned char NrOfBytes, unsigned char *DataBuffer);
Parameters
unsigned char I2CAddress It defines the address of the peripheral connected to the I2C bus (Range from 0x00 to
0X7F)
unsigned char NrOfBytes It defines the number of bytes to be write (Range from 0x00 to 0xFF)
unsigned char *DataBuffer It defines the address of the data buffer where the data written to the peripheral are read
(Range from 0x0000 to 0xFFFF)
Return value
unsigned char 0: Ok, command executed
1: No Ack, the peripheral has not sent the acknowledge signal
2: BusFault, the I2C bus is busy

Examples

At every second the Value variable is increased and its value is transferred on the logical exits of a Netsyst extension
module connected to the I2C bus. We remind you that the Netsyst extension modules automatically take their
address in function of their related position on the bus, the module directly connected to the base module will have
addresse 0x21, the following one 0x22 and so on.

CMD VALUE CKS Frame of order I2C to be sent to the extension module to set its logical exits
CMD CKS Frame of answer from extension module

Where:

CMD Order to be executed (0x09)


VALUE Value to be set on the logical exits
CKS Check sum frame

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterWrite.htm (1 of 2) [06/10/2008 17.44.43]


Funzioni "C": I2CMasterWrite

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL DEFINITIONS
// -----------------------------------------------------------------------------
// I2C device address definition.

#define MODULEADD 0x21

// Global variables definition.

BOOL WriteOk; //Ok write command


unsigned char Value; //Output value
unsigned char FrameBuf[4]; //Frame buffer

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Here the output value is increased every second.

if (PLCPulse1000)
Value++; //Output value

// Here create the command frame to be sent.

FrameBuf[0]=0x09; //Command
FrameBuf[1]=Value; //Value to be set to the ouptut
FrameBuf[2]=-(MODULEADD+FrameBuf[0]+FrameBuf[1]); //Checksum

// The command frame is sent to the I2C device.

if (!I2CMasterWrite(MODULEADD, 3, &FrameBuf))
{
// If the command frame has been correctly sent the answer is read.

if (!I2CMasterRead(MODULEADD, 2, &FrameBuf))
{
// If the answer frame has been correctly received the data is checked.

if ((FrameBuf[0] == 0x09) &&


(!((MODULEADD+0x09+FrameBuf[1])&0xFF)))
WriteOk=TRUE; //Ok write command
}
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CMaster/I2CMasterWrite.htm (2 of 2) [06/10/2008 17.44.43]


"C" functions: I2CSlaveAddress

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CSlaveAddress

This function sets the module I2C address.

We remember that all the Netsyst family modules have address between 0x21 and 0x27.

Prototype
ElSystemLib.h
Declaration
void I2CSlaveAddress(unsigned char Address);
Parameters
unsigned char Address I2C module address (Range from 0x00 to 0x7F)
Return value
None

Examples

For an example of use of this function please refer to I2CSlaveEnable function.

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CSlave/I2CSlaveAddress.htm [06/10/2008 17.44.44]


"C" functions: I2CSlaveEnable

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CSlaveEnable

This function enables the I2C communication on slave modules.

Prototype
ElSystemLib.h

Declaration
void I2CSlaveEnable(BOOL command);

Parameters
BOOL Command FALSE: Disables the I2C interrupt disabling the communication
TRUE: Enables the I2C interrupt enabling the communication

Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CSlave/I2CSlaveEnable.htm [06/10/2008 17.44.44]


"C" functions: I2CSlaveInit

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CSlaveInit

THis function initialize the I2C communication on slave module.

Prototype
ElSystemLib.h

Declaration
void I2CSlaveInit
(void);

Parameters
None

Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CSlave/I2CSlaveInit.htm [06/10/2008 17.44.44]


"C" functions: I2CSlaveVectors

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

I2CSlaveVectors

This function set the address to the I2CMNGFUNCTIONS data structure, it defines the vectors to the bus
I2C communication management functions.

Prototype
ElSystemLib.h

Declaration
void I2CSlaveVectors(code I2CMNGFUNCTIONS* Address);

Parameters
code I2CMNGFUNCTIONS* Address It defines the data structure address (Range from 0x0000 to
0xFFFF)

Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/I2CSlave/I2CSlaveVectors.htm [06/10/2008 17.44.45]


"C" functions: GetSerialMode

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetSerialMode

This function returns the communication mode set on the selected port. The value is transferred in the
SERIALSTRUCT data structure whose address is passed to the function.

Prototype
ElSystemLib.h
Declaration
void GetSerialMode(SERIALSTRUCT* S);
Parameters
SERIALSTRUCT* S IData structure address where the serial mode will be transferred (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

The presence of possible errors of parity and overrun on reception from serial line "A" is checked.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

BOOL ParityError; //Parity error in received data


BOOL OverlapFault; //Overlap error in received data
SERIALSTRUCT SerialStruct; //Serial structure

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Read the serial "A" parameters.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


GetSerialMode(&SerialStruct); //Read the parameters

// Check if there are errors on reception.

ParityError=SerialStruct.Status.RxParityFault; //Parity error in received data


OverlapFault=SerialStruct.Status.RxOverlapFault; //Overlap error in received data
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Serial/GetSerialMode.htm [06/10/2008 17.44.46]


"C" functions: SerialDTRMng

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SerialDTRMng

This function permits to set the status of the DTR signal available on the serial portc onnector, this signal is
usually used to command devices connected to the serial line. In the targets equipped with RS485 line in
multidrop connection, the DTR signal is used to connect the transmission driver to the line.

WARNING! The management of the DTR signal by using this function is possible only if DTRManagement in the
SERIALSTRUCT structure is defined with the value 0 or 1. On the contrary there is a conflict between the
automatical management of the signal and the value defined by the function.

Prototype
ElSystemLib.h
Declaration
void SerialDTRMng(BOOL Value);
Parameters
BOOL Value FALSE: The signal is set in the inactive logic
status
TRUE: The signal is set in the active logic status
Return value
None

Examples

It is managed the blinking every 400 mSec of the DTR signal on the "A" serial line.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// The DTR signal blink according to the "Toggle400" bit.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


SerialDTRMng(Toggle400);
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Serial/SerialDTRMng.htm [06/10/2008 17.44.46]


"C" functions: SetSerialMode

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetSerialMode

This function sets the communication mode on the selected serial port. You need to define the communication
mode by properly setting the SERIALSTRUCT data structure whose addresse is passed to the function.

Prototype
ElSystemLib.h
Declaration
void SetSerialMode(SERIALSTRUCT* S);
Parameters
SERIALSTRUCT* S Serial configuration data structure address (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

At the first loop of program execution loop the communication on the "A" serial line is set at 19200 baud, even
parity , 8 bits of date, DTR signal authomatically managed without times. At every second the "Hello world!"
message is sent on the serial.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable definitions.

SERIALSTRUCT SerialStruct; //Serial parameters

// -------------------------------------------------------------------------
// SET SERIAL PORT PARAMETERS AND SEND A MESSAGE
// -------------------------------------------------------------------------
// Define the serial port must be used A as I/O console.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

// Enable the serial communication on serial port "A" and define parameters.
// Set serial at 19200, e, 8. DTR automatically managed without any time

http://192.168.0.61/Destination/Html/CLanguage/Functions/Serial/SetSerialMode.htm (1 of 2) [06/10/2008 17.44.47]


"C" functions: SetSerialMode

if (PLCFirstLoop)
{
GetSerialMode(&SerialStruct); //Get communication mode
SerialStruct.Mode.DTRComplement=FALSE; //Complement the DTR signal
SerialStruct.Mode.EchoFlush=FALSE; //Flush the echo
SerialStruct.Mode.RxCtrlDisable=TRUE; //Disable Rx control characters
SerialStruct.Mode.DTRManagement=2; //Define the DTR management
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait
SerialStruct.Mode.ParityEnabled=TRUE; //Enables the parity management
SerialStruct.Mode.ParityType=TRUE; //FALSE:Odd parity, TRUE:Even parity
SerialStruct.Mode.BitNumber=TRUE; //FALSE:7 bit, TRUE:8 bit
SerialStruct.Mode.Baud=6; //Baud rate
SerialStruct.DTROnTime=0; //DTR On wait time
SerialStruct.DTROffTime=0; //DTR Off delay time
SetSerialMode(&SerialStruct); //Set communication mode
TermIOOpen(); //Open the set I/O console
}

// Send out the string "Hello world!" at every 1 Sec.

if (PLCPulse1000) printf("Hello world!\r\n");


}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Serial/SetSerialMode.htm (2 of 2) [06/10/2008 17.44.47]


"C" functions: DisplayClear

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

DisplayClear

This function clears the display (shows space 0x20 character) starting from the current position of the cursor for
the number of defined characters.

Prototype
ElSystemLib.h
Declaration
void DisplayClear(unsigned char CharNumber);
Parameters
unsigned char CharNumber Number of characters to be cleared (Range from 1 to 32)
Return value
None

Examples

The "Hello world!" text blink on the display.


At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be
executed at every program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit
to avoid flickering of the text on the display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

// Execute the variables init.

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/DisplayClear.htm (1 of 2) [06/10/2008 17.44.48]


"C" functions: DisplayClear

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Cursor positioning and blink the string "Hello world!" on the display.

if (Ts.Status.RefreshEnd)
{
SetCursorPos(0, 2); //Set cursor position

if (!PLCTimeBase800)
DisplayClear(12);
else
printf("Hello world!");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/DisplayClear.htm (2 of 2) [06/10/2008 17.44.48]


"C" functions: GetCursorColumn

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetCursorColumn

This function returns the column where the cursor is located on the display.

Prototype
ElSystemLib.h
Declaration
unsigned char GetCursorColumn(void);
Parameters
None
Return value
unsigned char Column where the cursor is located (Range from 0 to 15)

Examples

The cursor is located on the line 0 and column 10 of the display and the "Hello world!" text is displayed. The text
starting from the line 0 will continue in the line 1, the real position of the cursor is read now will be located on line
1 and column 6.
At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be
executed at every program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit
to avoid flickering of the text on the display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char CursorRow; //Row where the cursor is positioned


unsigned char CursorColumn; //Column where the cursor is positioned

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/GetCursorColumn.htm (1 of 2) [06/10/2008 17.44.48]


"C" functions: GetCursorColumn

// Execute the variables init.

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Execute the cursor positioning on the top line of the display, write
// "Hello world!" and read the new cursor position.

if (Ts.Status.RefreshEnd)
{
SetCursorPos(0, 10); //Set cursor position
printf("Hello world!");
CursorRow=GetCursorRow(); //Row where the cursor is positioned
CursorColumn=GetCursorColumn(); //Column where the cursor is positioned
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/GetCursorColumn.htm (2 of 2) [06/10/2008 17.44.48]


"C" function: GetCursorRow

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetCursorRow

This function returns the row where the cursor is located on the display.

Prototype
ElSystemLib.h
Declaration
unsigned char GetCursorRow(void);
Parameters
None
Return value
unsigned char Row where the cursor is located (Range from 0 to 1)

Examples

The cursor is located on the line 0 and column 10 of the display and the "Hello world!" text is displayed. The text
starting from the line 0 will continue in the line 1, the real position of the cursor is read now will be located on line
1 and column 6.
At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be
executed at every program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit
to avoid flickering of the text on the display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned char CursorRow; //Row where the cursor is positioned


unsigned char CursorColumn; //Column where the cursor is positioned

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/GetCursorRow.htm (1 of 2) [06/10/2008 17.44.49]


"C" function: GetCursorRow

// Execute the variables init.

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Execute the cursor positioning on the top line of the display, write
// "Hello world!" and read the new cursor position.

if (Ts.Status.RefreshEnd)
{
SetCursorPos(0, 10); //Set cursor position
printf("Hello world!");
CursorRow=GetCursorRow(); //Row where the cursor is positioned
CursorColumn=GetCursorColumn(); //Column where the cursor is positioned
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/GetCursorRow.htm (2 of 2) [06/10/2008 17.44.49]


"C" functions: SetCursorPos

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetCursorPos

This function permits to locate the cursor on the display. The following functions of writing on the display will work
starting from the current position of the cursor.

Prototype
ElSystemLib.h
Declaration
void SetCursorPos(unsigned char Row, unsigned char Column);
Parameters
unsigned char Row Row where the cursor must be located (Range from 0 to 1)
unsigned char Column Column where the cursor must be located (Range from 0 to 15)
Return value
None

Examples

The cursor is located in two different positions on the display and the "Hello!" and "Hello world!" texts are shown.
At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be
executed at every program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit
to avoid flickering of the text on the display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

// Execute the variables init.

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/SetCursorPos.htm (1 of 2) [06/10/2008 17.44.50]


"C" functions: SetCursorPos

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Write "Hello!" on the top line of the display.

if (Ts.Status.RefreshEnd)
{
SetCursorPos(0, 5); //Set cursor position
PutCh('H');
PutCh('e');
PutCh('l');
PutCh('l');
PutCh('o');
PutCh('!');
}

// Write "Hello world!" on the bottom line of the display.

if (Ts.Status.RefreshEnd)
{
SetCursorPos(1, 2); //Set cursor position
printf("Hello world!");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/Terminal/SetCursorPos.htm (2 of 2) [06/10/2008 17.44.50]


"C" functions: GetCh

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetCh

This function returns a charachter from the selected I/O console. If the selected I/O console is the serial line, in function of the
setting of the Mode.WaitLoop bit of the SERIALSTRUCT structure, the function has a different behaviour the character reception.
If the bit is FALSE, the function is not blocking, if no characters are available in the reception buffer, the function returns 0. If the
bit is TRUE, the function is blocking, if no characters are available in the reception buffer, it blocks waiting for a charachter from
the serial line.

WARNING! In the blocking mode, the calling to the function, if no charachters are available in the reception buffer, blocks the
program execution loop with intervention of the watch dog circuit. We suggest you before to call the function to check the
availability of at least one charachter in the reception buffer by using the GetRxChars function.

Prototype
ElSystemLib.h
Declaration
char GetCh(void);
Parameters
None
Return value
char Character received from the selected I/O console (Range from 0x00 to 0xFF)

Examples

The reception of a character from the serial line is controlled and a message with indication of the received character is sent. If the
ASCII A character is received a message like this reported below is sent to the serial line.

The "A" character, 0x41 ASCII, has been received

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

char RxChar; //Rx character

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Check if a character is received from the serial line.

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetCh.htm (1 of 2) [06/10/2008 17.44.51]


"C" functions: GetCh

if (GetRxChars())
{
// Read the received character.

RxChar=GetCh(); //Rx character

// Print out the received character.

printf("The \"%c\" character, 0x%02X ASCII, has been received\r\n", RxChar, RxChar);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetCh.htm (2 of 2) [06/10/2008 17.44.51]


"C" functions: GetRxChars

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetRxChars

This function returns the number of available characters from the selected I/O console. The function can be used to control if there
are available character in reception before executing the reading functions of the charachters.

Prototype
ElSystemLib.h
Declaration
unsigned int GetRxChars(void);
Parameters
None
Return value
unsigned int Number of available characters from the selected I/O console (Range from 0x0000 to 0xFFFF)

Examples

The reception of a character from the serial line is controlled and a message with indication of the received character is sent. If the
ASCII A character is received a message like this reported below is sent to the serial line.

The "A" character, 0x41 ASCII, has been received

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

char RxChar; //Rx character

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// -------------------------------------------------------------------------
// SET SERIAL PORT AND WAIT FOR A CHARACTER
// -------------------------------------------------------------------------
// Define the serial port must be used A as I/O console and open it.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


if (PLCFirstLoop) TermIOOpen(); //Open the set I/O console

// Check if a character is received from the serial line.

if (GetRxChars())
{
// Read the received character.

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetRxChars.htm (1 of 2) [06/10/2008 17.44.51]


"C" functions: GetRxChars

RxChar=GetCh(); //Rx character

// Print out the received character.

printf("The \"%c\" character, 0x%02X ASCII, has been received\r\n", RxChar, RxChar);
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetRxChars.htm (2 of 2) [06/10/2008 17.44.51]


"C" functions: GetTermIOData

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetTermIOData

This function returns the allocation address of the selected device data structure.

Prototype
ElSystemLib.h
Declaration
void* GetTermIOData(void);
Parameters
None
Return value
void* Allocation address of the selected device data structure (Range from 0x0000 to 0xFFFF)

Examples

In the example the function it's used to return the TERMINALSTRUCT terminal data structure allocation address. The user program
will be able to work on the variables defined in this structure to the reading the keys status, to the display synchronization, to the
LED management and for the data input.

The program displays the "Hello world!" text blinking on the display.
At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be executed at every
program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit to avoid flickering of the text on the
display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

// Execute the variables init.


// If Picosyst system the "Ts.TerminalAddress" must be set to 0x07 if
// Netlog system it must be set to 0x00;

if (PLCFirstLoop)
{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetTermIOData.htm (1 of 2) [06/10/2008 17.44.52]


"C" functions: GetTermIOData

SetTermIOData(&Ts); //Terminal data structure


TermIOTick(); //Manage the selected I/O console

// Blink the key[0] led only if Picoface terminal.

((TERMINALSTRUCT*)GetTermIOData())->LEDCommand.LED0=PLCTimeBase400; //Key [0] led command

// Cursor positioning and blink the string "Hello world!" on the display.

if (((TERMINALSTRUCT*)GetTermIOData())->Status.RefreshEnd)
if (!PLCTimeBase800)
printf("\n");
else
printf("\nHello world!");
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetTermIOData.htm (2 of 2) [06/10/2008 17.44.52]


"C" functions: GetTermIOVectors

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetTermIOVectors

This function returns the address of the TERMIOVECTORS data structure that defines the vectors to the I/O
console functions. Are defined I/O console functions all the functions that allow to manage the reading and the
writing of characters from and to the consoles for the interface with the user. Different types of I/O console are
provided like the serial lines, terminals or drivers made as function blocks.

Prototype
ElSystemLib.h
Declaration
TERMIOVECTORS* GetTermIOVectors(void);
Parameters
None
Return value
TERMIOVECTORS* Defined I/O console function vectors data structure address (Range from 0x0000 to 0xFFFF)

Examples

Are alternately defined as I/O console both the serial ports and a message is sent to any port.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

TERMIOVECTORS* SaveVectors[2]; //Save I/O console vector address

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Manage the serial port "B" tick.

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetTermIOVectors.htm (1 of 2) [06/10/2008 17.44.53]


"C" functions: GetTermIOVectors

SetTermIOVectors(IOSerialPortB);
TermIOTick();

if (PLCPulse1000)
{
// Set the serial "A" as I/O console and print out a message.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


printf("This is the serial port \"A\"\r\n");
SaveVectors[0]=GetTermIOVectors(); //Save I/O console vector address

// Set the serial "B" as I/O console and print out a message.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


printf("This is the serial port \"B\"\r\n");
SaveVectors[1]=GetTermIOVectors(); //Save I/O console vector address

// Set the serial "A" again as I/O console and print out a message.

SetTermIOVectors(SaveVectors[0]); //Restore I/O console vector address


printf("This is the serial port \"A\" again\r\n"); ????=?? ?A ????????????

// Sets the serial "B" again as I/O console and print out a message.

SetTermIOVectors(SaveVectors[1]); //Restore I/O console vector address


printf("This is the serial port \"B\" again\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetTermIOVectors.htm (2 of 2) [06/10/2008 17.44.53]


"C" functions: GetTxSpace

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

GetTxSpace

This function returns the available space in the transmission buffer of the selected I/O console. The function can
be used to control if there is space in the transmission buffer before executing the characters writing functions.

Prototype
ElSystemLib.h
Declaration
unsigned int GetTxSpace(void);
Parameters
None
Return value
unsigned int Number of characters tranferable in the transmission buffer of the selected I/O console (Range from
0x0000 to 0xFFFF). 0xFFFF: Means buffer empty.

Examples

Every 1 Sec if space in the serial transmission buffer the charachter 'a 'is tranfered.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// -------------------------------------------------------------------------
// SET SERIAL PORT AND SEND A CHARACTER
// -------------------------------------------------------------------------
// Define the serial port must be used A as I/O console and open it.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


if (PLCFirstLoop) TermIOOpen(); //Open the set I/O console

// Send a character to the serial line only if there is a space.

if (PLCPulse1000)
if (GetTxSpace()) PutCh('a');
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/GetTxSpace.htm [06/10/2008 17.44.53]


"C" functions: InputStream

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

InputStream

This function returns a characters string from the selected I/O console. The function ends after the reading of the
number of defined characters or after having read all the available characters in the reception buffer.

Prototype
ElSystemLib.h
Declaration
unsigned int InputStream(char *Destination, unsigned int Length);
Parameters
char *Destination It defines the buffer address of the read from the I/O console string destination (Range from
0x0000 to 0xFFFF)
unsigned int Length It defines the number of characters to be read from the I/O console (Range from 0x0000 to
0xFFFF)
0: Executes the reading of all the available characters in the reception buffer.
Return value
unsigned int Number of characters read from the I/O console. If an equal or higher number of charachters
to be read are available in the reception buffer a value equal to the Length is returned.

Examples

It is executed the reception of a number of characters equal to the length of the desired string. The received
string is read and compared with the reference stringh . If the comparison has positive result a message is sent
on serial line. It is managed a timeout of 5 seconds, if for this time no strings are received the reception buffer is
cleared.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <string.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

char RxString[5]; //Rx string


unsigned int TimBuf; //Timeout buffer

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/InputStream.htm (1 of 2) [06/10/2008 17.44.54]


"C" functions: InputStream

void Example(void)
{
// Timeout management, after 5 second with no string received the input
// buffer is cleared.

if (PLCFirstLoop)
TimBuf=GetSystemTime(); //Timeout buffer

if (IsMsecTimeOver(&TimBuf, 5000))
TermIORxClear(); //Clear the Rx buffer

// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Check if it has been received an equal number of characters to the length


// of the string is waiting.

if (GetRxChars() >= 4)
{
TimBuf=GetSystemTime(); //Timeout buffer

// Read the received string.

InputStream(&RxString, 4);
printf("The string \"%s\" has been received\r\n", RxString);

// Compare the received string

if (!strcmp(&RxString, "Is 1"))


printf("\"Is 1\" string match\r\n");

if (!strcmp(&RxString, "Is 2"))


printf("\"Is 2\" string match\r\n");

if (!strcmp(&RxString, "Is 3"))


printf("\"Is 3\" string match\r\n");

if (!strcmp(&RxString, "Is 4"))


printf("\"Is 4\" string match\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/InputStream.htm (2 of 2) [06/10/2008 17.44.54]


"C" functions: OutputStream

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

OutputStream

This function sends a characters string to the selected I/O console. The function ends when the defined number
of characters are sent or if the transmission buffer is full.

Prototype
ElSystemLib.h
Declaration
unsigned int OutputStream(generic char *Source, unsigned int Length);
Parameters
char *Source It defines the buffer address of the of string to be sent to the I/O console (Range from
0x0000 to 0xFFFF)
unsigned int Length It defines the number of characters to be sent to the I/O console (Range from 0x0000 to
0xFFFF)
0: It executes writing until the transmission buffer is full.
Return value
unsigned int Number of characters written to the I/O console (Range from 0x0000 to 0xFFFF). If the
transmission buffer has an equal or bigger space available than the number of characters to
be written a value equal to Length is returned.

Examples

A string is sent at every second on serial.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Print out the string.

if (PLCPulse1000)
OutputStream("This is a string\r\n", 18);

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/OutputStream.htm (1 of 2) [06/10/2008 17.44.55]


"C" functions: OutputStream

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/OutputStream.htm (2 of 2) [06/10/2008 17.44.55]


"C" functions: PutCh

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

PutCh

This function sends a character to the selected I/O console. If the selected I/O console is the serial line, in
function of the setting of the Mode.WaitLoop bit of the SERIALSTRUCT structure, the function has a different
behaviour on character transmission. If the bit is FALSE, the function is not blocking, if there is no space in the
transmission buffer, the character to be transmitted is lost. If the bit is TRUE, the function is blocking, if there is
no space in the transmission buffer, it blocks waiting for the buffer becomes free.

WARNING! In the blocking mode, the calling to the function, if there is no space in the tansmission buffer, blocks
the program execution loop with intervention of the watch dog circuit. We suggest you before to call the function
to check the space availability in the tansmission buffer by using the GetTxSpace function.

Prototype
ElSystemLib.h
Declaration
void PutCh(char Value);
Parameters
char Value Character to be sent to the selected I/O console (Range from 0x00 to 0xFF)
Return value
None

Examples

If space available in the serial transmission buffer charachter 'a' is trasferred every 1 Sec.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Send a character to the serial line.

if (PLCPulse1000)
if (GetTxSpace())

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/PutCh.htm (1 of 2) [06/10/2008 17.44.55]


"C" functions: PutCh

PutCh('a');
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/PutCh.htm (2 of 2) [06/10/2008 17.44.55]


"C" functions: SetTermIOData

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetTermIOData

This function sets the allocation address of the selected device data structure.

Prototype
ElSystemLib.h
Declaration
void SetTermIOData(void* Address);
Parameters
void* Allocation address of the selected device data structure (Range from 0x0000 to 0xFFFF)
Return value
None

Examples

In the example the function it's used to set the TERMINALSTRUCT terminal data structure allocation address.
The user program will be able to work on the variables defined in this structure to the reading the keys status, to
the display synchronization, to the LED management and for the data input.

The program displays the "Hello world!" text blinking on the display.
At the first program execution loop the variables of the terminal are initialized. The TermIOTick function must be
executed at every program loop. The writing on the display must be sinchronized with the Status.RefreshEnd bit
to avoid flickering of the text on the display.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definition.

static TERMINALSTRUCT Ts; //Terminal data structure

// Execute the variables init.


// If Picosyst system the "Ts.TerminalAddress" must be set to 0x07 if
// Netlog system it must be set to 0x00;

if (PLCFirstLoop)

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/SetTermIOData.htm (1 of 2) [06/10/2008 17.44.56]


"C" functions: SetTermIOData

{
Ts.TerminalAddress=0x07; //Terminal address
Ts.KeyboardTimeOut=5000; //Keyboard timeout definition
Ts.LEDCommand.LCDBacklight=TRUE; //LCD backlight command
}

// Set the terminal as standard I/O console and call the I/O tick.

SetTermIOVectors(IOTerminal); //Set the terminal as I/O console


SetTermIOData(&Ts); //Terminal data structure
TermIOTick(); //Manage the selected I/O console

// Cursor positioning and blink the string "Hello world!" on the display.

if (Ts.Status.RefreshEnd)
if (!PLCTimeBase800)
printf("\n");
else
printf("\nHello world!");
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/SetTermIOData.htm (2 of 2) [06/10/2008 17.44.56]


"C" functions: SetTermIOVectors

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

SetTermIOVectors

This function sets the pointer to the TERMIOVECTORS data structure which defines the vectors to the I/O
console functions. Are defined I/O console functions all the functions that allow to manage the reading and the
writing of characters from and to the consoles for the interface with the user. Different types of I/O console are
provided like the serial lines, terminals or drivers made as function blocks. In the case in which the defined vector
does not point to a valid device, a default device is defined and the IODeviceNotCorrect bit is set in the
SystemErrors data structure.

Prototype
ElSystemLib.h
Declaration
void SetTermIOVectors(TERMIOVECTORS* TermIOVectors);
Parameters
TERMIOVECTORS* TermIOVectors I/O console to be used function vectors data structure address (Range from
0x0000 to 0xFFFF)
Return value
None

Examples

Are alternately defined as I/O console both the serial ports and a message is sent to any port.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Manage the serial port "B" tick.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


TermIOTick(); //Manage the selected I/O console

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/SetTermIOVectors.htm (1 of 2) [06/10/2008 17.44.57]


"C" functions: SetTermIOVectors

if (PLCPulse1000)
{
// Sets the serial "A" as I/O console and print out a message.

SetTermIOVectors(IOSerialPortA); //Set the serial port "A"


printf("This is the serial port \"A\"\r\n");

// Sets the serial "B" as I/O console and print out a message.

SetTermIOVectors(IOSerialPortB); //Set the serial port "B"


printf("This is the serial port \"B\"\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/SetTermIOVectors.htm (2 of 2) [06/10/2008 17.44.57]


"C" functions: TermIOClose

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOClose

This function closes the selected I/O console. We remind you that the calling to the function is not needed
for some I/O consoles.

Prototype
ElSystemLib.h
Declaration
BOOL TermIOClose(void);
Parameters
None
Return value
BOOL FALSE: I/O console close error
TRUE: I/O console closed

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOClose.htm [06/10/2008 17.44.57]


Funzioni "C": TermIOOpen

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOOpen

This function opens the selected I/O console. The I/O console has to be open before executing operations
on it, otherwise the operation executed will not have any effect.

It's possible to execute the function cyclically, it opens the I/O console only if it's closed, if it's already
open no operations are executed.

Prototype
ElSystemLib.h
Declaration
BOOL TermIOOpen(void);
Parameters
None
Return value
BOOL FALSE: I/O console open error
TRUE: I/O console opened

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOOpen.htm [06/10/2008 17.44.58]


"C" functions: TermIORxClear

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIORxClear

This function empties the reception buffer and cleares all the errors in the selected I/O console.

Prototype
ElSystemLib.h
Declaration
void TermIORxClear
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIORxClear.htm [06/10/2008 17.44.58]


"C" functions: TermIORxFlush

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIORxFlush

This function flushes all the characters available in the reception buffer in the selected I/O console.

Prototype
ElSystemLib.h
Declaration
void TermIORxFlush
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIORxFlush.htm [06/10/2008 17.44.58]


"C" functions: TermIOTick

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOTick

This function manages the operations needed for the working of the selected I/O console. After having selected
the console with the SetTermIOVectors function you need to execute this function at least once per program loop.

Prototype
ElSystemLib.h
Declaration
void TermIOTick
(void);
Parameters
None
Return value
None

Examples

Both the serial ports are alternatively defined as I/O console and the tick function is executed.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Manage the serial port "A" tick.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Manage the serial port "B" tick.

SetTermIOVectors(IOSerialPortB); //Set the serial port B as I/O console


TermIOTick(); //Manage the selected I/O console
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOTick.htm [06/10/2008 17.44.59]


"C" functions: TermIOTxClear

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOTxClear

This function empties the transmission buffer and cleares all the errors in the selected I/O console.

Prototype
ElSystemLib.h
Declaration
void TermIOTxClear
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOTxClear.htm [06/10/2008 17.44.59]


"C" functions: TermIOTxFlush

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOTxFlush

This function flushes all the charachters available in the transmission buffer in the selected I/O console.

Prototype
ElSystemLib.h
Declaration
void TermIOTxFlush
(void);
Parameters
None
Return value
None

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOTxFlush.htm [06/10/2008 17.45.00]


"C" functions: CANRx

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

CANRx

This function receive a CAN frame.

Prototype
ElSystemLib.h
Declaration
BOOL CANRx(unsigned long* Idf, unsigned char* Length, unsigned char* RxData);
Parameters
unsigned long* Idf It defines the address of the CAN frame identifier buffer. The function at the reception of
a frame stores in the buffer the received frame identifier. If standard frame 11 bits are
returned. If extended frame 29 bits are returned.
unsigned char* Length It defines the address of the CAN frame length buffer. The function at the reception of a
frame stores in the buffer the received frame length.
unsigned char* RxData It defines the address of the CAN frame received data buffer. The function at the
reception of a frame stores in the buffer the received data.
Return value
BOOL FALSE: No frame received
TRUE: Frame received

Examples

The following example manages a Beckhoff system with a digital input and a digital output module connected to
the CAN controller. The system is set with NodeID 1. The state of input 0 is copied to the output 0 while to the
output 1is copied the state of an internal time base.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES DEFINITION
// -----------------------------------------------------------------------------
// Logic I/O definition.

struct
{
BOOL I0:1; //Input 0
BOOL I1:1; //Input 1
}CANInput;

struct
{
BOOL O0:1; //Output 0
BOOL O1:1; //Output 1

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANRx.htm (1 of 4) [06/10/2008 17.45.01]


"C" functions: CANRx

}CANOutput;

// -----------------------------------------------------------------------------
// BECKHOFF I/O MODULE MANAGEMENT
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variables definition.

static BOOL IsStarted; //Module is started


static unsigned char OutMemo; //Buffer memo output status
static unsigned char Length; //Frame length
static unsigned char TxBuffer[13]; //Transmission buffer
static unsigned char RxBuffer[8]; //Reception buffer
static unsigned long Idf; //Frame identifier

// Define the CAN controller parameters.

static CANINITDATA Init=


{
FALSE, //SFF, Standard format (11 bit)
0, //Baud rate (125 Kb)
0x00000000, //Acceptance filter
0xFFFFFFFF, //Acceptance mask
};

// -------------------------------------------------------------------------
// I/O MANAGEMENT
// -------------------------------------------------------------------------
// Here the I/O are managed.

CANOutput.O0=CANInput.I0; //Output 0
CANOutput.O1=PLCTimeBase400; //Output 1

// -------------------------------------------------------------------------
// CAN CONTROLLER INIT
// -------------------------------------------------------------------------
// The CAN controller is initialized.

if (PLCFirstLoop)
{
CANInit(&Init);
IsStarted=FALSE; //Module is started
}

// -------------------------------------------------------------------------
// FRAMES RECEPTION
// -------------------------------------------------------------------------
// The 11 bit frame identifier is divided as reported below:
// +---+---+---+---+---+---+---+---+---+---+---+
// | A | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// +---+---+---+---+---+---+---+---+---+---+---+
// | Function | Node ID |
// -------------------------------------------------------------------------
// Check if a frame has been received.

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANRx.htm (2 of 4) [06/10/2008 17.45.01]


"C" functions: CANRx

if (CANRx(&Idf, &Length, &RxBuffer))


{
switch (Idf)
{
// -----------------------------------------------------------------
// Wait for the boot-up message reception. After the initialisation
// phase and the self test, the bus coupler sends the boot-up
// message, a CAN message with no data bytes and with the identifier
// of the emergency message: CAN-ID=0x80+node ID.
// Function=0001
// Node ID=000001

case 0x81:
IsStarted=TRUE; //Module is started

// Only one CAN message is then required to start the module:


// "Start_Remote_Node": Identifier 0, 2 data bytes: 0x01, 0x00.
// It switches the node into the OPERATIONAL state.
// Function=0000
// Node ID=000000

*(unsigned long*)&TxBuffer[0]=0x00000000; //Frame idf


TxBuffer[4]=0x02; //Length
TxBuffer[5]=0x01; //Command "Start Remote Node"
TxBuffer[6]=0x00; //Node, "0" means all nodes
CANTx((unsigned long*)&TxBuffer[0], &TxBuffer[4], &TxBuffer[5]);
break;

// -----------------------------------------------------------------
// Logic input from the module.
// Function=0011
// Node ID=000001

case 0x181:
*(unsigned char*)&CANInput=RxBuffer[0]; //Logic input
break;
}
}

// -------------------------------------------------------------------------
// OUTPUTS MANAGEMENT
// -------------------------------------------------------------------------
// If the module is initialized the output are written.

if (IsStarted)
{
// The output write is executed only if they are changed.
// Function=0100
// Node ID=000001

if (*(unsigned char*)&CANOutput != OutMemo)


{
OutMemo=*(unsigned char*)&CANOutput; //Buffer memo output status
*(unsigned long*)&TxBuffer[0]=0x00000201; //Frame idf
TxBuffer[4]=0x01; //Length

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANRx.htm (3 of 4) [06/10/2008 17.45.01]


"C" functions: CANRx

TxBuffer[5]=*(unsigned char*)&CANOutput;
CANTx((unsigned long*)&TxBuffer[0], &TxBuffer[4], &TxBuffer[5]);
}
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANRx.htm (4 of 4) [06/10/2008 17.45.01]


"C" functions: CANTest

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

CANTest

This function executes the test of the CAN communication. The execution of the test checks the functionality of
the CAN driver and bus executing the transmission of a frame of 8 bytes long using as id the value of definite in
Filter member of CANINITDATA structure. The received frame is compared with the transmitted and if are equal
the test passed is returned.

Prototype
ElSystemLib.h
Declaration
BOOL CANTest(void)
Parameters
None
Return value
BOOL FALSE: Test not
passed
TRUE: Test passed

Examples

In the following example at every 1 Sec the CAN test is executed and a message with the result report is
returned.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variables definitions.

static CANINITDATA Init=


{
FALSE, //SFF, Standard format (11 bit)
0, //Baud rate (125 Kb)
0x00000001, //Acceptance filter
0xFFFFFFFF, //Acceptance mask
};

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANTest.htm (1 of 2) [06/10/2008 17.45.02]


"C" functions: CANTest

// -------------------------------------------------------------------------
// TEST EXECUTION
// -------------------------------------------------------------------------
// Initialize the CAN controller.

if (PLCFirstLoop)
CANInit(&Init);

// At every 1 Sec the CAN BUS is tested.

if (PLCPulse1000)
{
SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console

if (!CANTest())
printf("CAN BUS test error\r\n");
else
printf("CAN BUS test executed\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANTest.htm (2 of 2) [06/10/2008 17.45.02]


"C" functions: CANTx

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

CANTx

This function transmit a CAN frame.

Prototype
ElSystemLib.h
Declaration
BOOL CANTx(unsigned long* Idf, unsigned char* Length, unsigned char* TxData);
Parameters
unsigned long* Idf It defines the address of the CAN identifier buffer, the transmit frame identifier must
be loaded. If standard frame 11 bits are transmit. If extended frame 29 bits are
transmit.
unsigned char* Length It defines the address of the CAN frame length buffer. The transmit frame length
must be defined.
unsigned char* TxData It defines the address of the CAN frame transmit data buffer. The transmit frame
data must be defined.
Return value
BOOL FALSE: Frame not transmit
TRUE: Frame transmit

Examples

Please refer to the example reported in the CANRx function.

http://192.168.0.61/Destination/Html/CLanguage/Functions/CAN/CANTx.htm [06/10/2008 17.45.02]


"C" functions: PLCDebouncing

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

PLCDebouncing

This function executes the debouncing of a 8 bit value. It can be used to eliminate the rebounds of reading on
digital inputs.

Prototype
ElPLCLib.h
Declaration
unsigned char PLCDebouncing(unsigned char Value, unsigned char Time, unsigned char* Buffer);
Parameters
unsigned char Value It represents the 8 bits value to be debounced (Range from 0x00 to 0xFF)
unsigned char Time It represents the debouncing time (Range from 0 to 127 mSec)
unsigned char* Buffer It is the debouncing buffer address (Range from 0x0000 to 0xFFFF)
Return value
unsigned char It is the 8 bits value debounced (Range from 0x00 to 0xFF)

Examples

In the following example the logic inputs from 0 to 7 are acquired. On their status a 20 mSec debouncing are
executed and the result is transferred on the logic outputs from 0 to 7.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------

unsigned char DebouncingBuf[8]; //Debouncing buffer

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Local variable declarations.

unsigned char InputAcq; //Input acquisition buffer


unsigned char DbcValue; //Debounced value

// Here the logic input from 0 to 7 are acquired, their status is debounced
// and transferred to the logic outputs from 0 to 7.

http://192.168.0.61/Destination/Html/CLanguage/Functions/PLCFcts/PLCDebouncing.htm (1 of 2) [06/10/2008 17.45.03]


"C" functions: PLCDebouncing

PeripheralInp(0, 0, &InputAcq); //Acquire the logic inputs (From 0 to 7)


DbcValue=PLCDebouncing(InputAcq, 20, &DebouncingBuf); //Debounced value
PeripheralOut(0, 0, DbcValue); //Manage the logic outputs (From 0 to 7)
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/Functions/PLCFcts/PLCDebouncing.htm (2 of 2) [06/10/2008 17.45.03]


ANSI "C" functions: printf

ELSIST Srl, www.elsist.it MNL041Q100

ANSI "C" functions

printf

This function allows to send formatted data to the selected I/O console.

Prototype
stdio.h
Declaration
int printf(const char *format, …);
Parameters
const char *format Pointer to the format string
... The optional values that are to be printed under the control of format
Return value
int Function executed: The number of characters written
Execution error: A negative value

The format string can contain two types of elements, the first one consists in characters that are sent to the I/O
console unchanged. The second consists in conversion directives that describe how the arguments should be
visualized. The conversion directives begin with the % symbol and continue according to the format:

% [Flags] [Width] [.Precision] [Length] Conversion

Flags - Left adjusted field.


+ Signed values will always begin with + or - sign.
space Values will always begin with - sign or space.
x Non-zero values prefixed with 0X.
0 Zero padding to field width (For variables d, i, o, u, x, X, e, E, f, g, G).
Width Defines the number of characters to be printed in the field.
Precision Defines the number of digits to print for integers (For variables e, E, f).
Length h Before (d, i, u, x, X, o) denote a short int o unsigned short int variable.
l Before (d, i, u, x, X, o) denote long int o unsigned long int variable.
L Before (e, E, f, g, G) denote long double variable.
Conversion d Signed decimal value.
i Signed decimal value.
o Unsigned octal value.
u Unsigned decimal value.
x Unsigned hexadecimal value, using lower case (From 0 to 9, from a to f).
X Unsigned hexadecimal value, using upper case (From 0 to 9, from A to F).
e Double value, visualized with exponent (Example: [-]d.ddde+dd).
E Double value, visualized with exponent (Example: [-]d.dddE+dd).
f Decimal value in floating point (Example: [-]d.ddd).
c Single character constant.
s String.
p Pointer.

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Printf.htm (1 of 3) [06/10/2008 17.45.04]


ANSI "C" functions: printf

n No output, but store the number of characters written so far in the integer pointed to by the next
argument.
% % character.

Examples

In the following example are reported some printf function use.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int Rc[0x12]; //Return code

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Here assign values to some variables.

int i=6, j=-6; //Signed integer variable


char p[]="ABC"; //String variable
long l=100000; //Long variable
float f1=0.0000001, f2=750000; //Float variable
double d=2.2; //Double variable

// Select the serial port "A" as standard I/O console.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Here some examples, the character "Ð" represents space.

if (PLCPulse1000)
{
Rc[0x00]=printf("%c",p[1]); //Output "quot;B" and return "1"
printf("\r\n");

Rc[0x01]=printf("%d",i); //Output "6" and return "1"


printf("\r\n");

Rc[0x02]=printf("%3d",i); //Output "ÐÐ6" and return "3"


printf("\r\n");

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Printf.htm (2 of 3) [06/10/2008 17.45.04]


ANSI "C" functions: printf

Rc[0x03]=printf("%.3d",i); //Output "006" and return "3"


printf("\r\n");

Rc[0x04]=printf("%-10.3d",i); //Output "006ÐÐÐÐÐÐÐ" and return "10"


printf("\r\n");

Rc[0x05]=printf("%10.3d",i); //Output "ÐÐÐÐÐÐÐ006" and return "10"


printf("\r\n");

Rc[0x06]=printf("Value=%+3d",i); //Output "Value=Ð+6" and return "9"


printf("\r\n");

Rc[0x07]=printf("%10.*d",i,j); //Output "ÐÐÐ-000006" and return "10"


printf("\r\n");

Rc[0x08]=printf("String=[%s]",p); //Output "String=[ABC]" and return "12"


printf("\r\n");

Rc[0x09]=printf("Value=%lX",l); //Output "Value=186A0" and return "11"


printf("\r\n");

Rc[0x0A]=printf("%f",f1); //Output "0.000000" and return "8"


printf("\r\n");

Rc[0x0B]=printf("%f",f2); //Output "750000.000000" and return "13"


printf("\r\n");

Rc[0x0C]=printf("%e",f1);//Output "1.000000e-07" and return "12"


printf("\r\n");

Rc[0x0D]=printf("%16e",d); //Output "ÐÐÐÐ2.200000e+00" and return "16"


printf("\r\n");

Rc[0x0E]=printf("%.4e",d); //Output "2.2000e+00" and return "10"


printf("\r\n");

Rc[0x0F]=printf("%g",f1); //Output "1e-07" and return "5"


printf("\r\n");

Rc[0x10]=printf("%g",f2); //Output "750000" and return "6"


printf("\r\n");

Rc[0x11]=printf("%g",d); //Output "2.2" and return "3"


printf("\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Printf.htm (3 of 3) [06/10/2008 17.45.04]


ANSI "C" functions: scanf

ELSIST Srl, www.elsist.it MNL041Q100

ANSI "C" functions

scanf

This function read formatted data from the selected I/O console.

Prototype
stdio.h
Declaration
int scanf(const char *format, …);
Parameters
const char *format Pointer to a format string
... Argument list they must be readed according to the format string
Return value
int Function executed: It returns the number of conversion executed
Execution error: It returns a negative value

The format is a string consisting of a sequence of ordinary characters and conversion specifications. Each
ordinary character reads a matching character from the input. Each conversion specification accepts input
meeting the specification, converts it, and assigns it to the object pointed to by the next successive argument
following format.
If the format string contains white-space characters, input is scanned until a non-white-space character is found.

The conversion specifications start with the % symbol followed by the directions as the format:

% [Suppress] [Width] [Length] Conversion

Suppress * The field is scanned but no assignment is carried out.


Width It's the maximum field to be scanned. If not defined the source is scanned until no match occurs.
Length h Before (d, i, u, x, X, o) identify a short int or unsigned short int variable.
l Before (d, i, u, x, X, o) identify a long int or unsigned long int variable.
L Before (e, E, f, g, G) identify a long double variable.
Conversion d Signed decimal value.
i Signed decimal value.
o Unsigned octal value.
u Unsigned decimal value.
x Unsigned hexadecimal value, using lower case (From 0 to 9, from a to f).
X Unsigned hexadecimal value, using upper case (From 0 to 9, from A to F).
e Double value, visualized with exponent (Example: [-]d.ddde+dd).
E Double value, visualized with exponent (Example: [-]d.dddE+dd).
f Decimal value in floating point (Example: [-]d.ddd).
c Single character constant.
s String.
p Pointer.

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Scanf.htm (1 of 3) [06/10/2008 17.45.05]


ANSI "C" functions: scanf

n No read, but store number of characters read so far in the integer pointed to by the next
argument.
[ Any number of characters matching any of the characters before the terminating ]. For
example, [abc] means a, b, or c.
[] Any number of characters matching ] or any of the characters before the further, terminating ].
For example, []abc] means ], a, b, or c.
[^ Any number of characters not matching any of the characters before the terminating ]. For
example, [^abc] means not a, b, or c.
[^] Any number of characters not matching ] or any of the characters before the further,
terminating ]. For example, [^]abc] means not ], a, b, or c.
% % character.

Examples

In the following example some uses of the scanf function.

It has been used the sscanf function, it works exactly as the scanf function but it reads the input data
from a string variable instead of the selected I/O console.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Here define some variables.

int a, b, c; //Signed integer variable


char s[16], t[16], u[16]; //String variable
float x; //Float variable

// Select the serial port "A" as standard I/O console.

SetTermIOVectors(IOSerialPortA); //Set the serial port A as I/O console


TermIOTick(); //Manage the selected I/O console

// Here some examples.

if (PLCPulse1000)
{
// ---------------------------------------------------------------------

a=sscanf("25 54.32E-1 Hello World", "%d%f%s%3s", &b, &x, &s, &t);


printf("a=%d\r\n", a); //Print "a=4"
printf("b=%d\r\n", b); //Print "b=25"

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Scanf.htm (2 of 3) [06/10/2008 17.45.05]


ANSI "C" functions: scanf

printf("x=%f\r\n", x); //Print "x=5.432000"


printf("s=%s\r\n", s); //Print "s=Hello"
printf("t=%s\r\n", t); //Print "t=Wor"
printf("\r\n");

// ---------------------------------------------------------------------
// In the following example please note that the number 123 is read but
// not passed into the variables due the "%*d" format.

a=sscanf("56789 123 56a72", "%2d%f%*d%d", &b, &x, &c);


printf("a=%d\r\n", a); //Print "a=2"
printf("b=%d\r\n", b); //Print "b=56"
printf("x=%f\r\n", x); //Print "x=789.000000"
printf("c=%d\r\n", c); //Print "c=56"
printf("\r\n");

// ---------------------------------------------------------------------

a=sscanf("abcdefghijklmnopqrtsuvwxyz", "%10s%10s%s", &s, &t, &u);


printf("a=%d\r\n", a); //Print "a=2"
printf("s=%s\r\n", s); //Print "s=abcdefghij"
printf("t=%s\r\n", t); //Print "t=klmnopqrts"
printf("u=%s\r\n", u); //Print "u=uvwxyz"
printf("\r\n");
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/AnsiFunctions/Stdio/Scanf.htm (3 of 3) [06/10/2008 17.45.05]


ANSI "C" functions: malloc

ELSIST Srl, www.elsist.it MNL041Q100

ANSI "C" functions

malloc

Allocates a memory block for an object of the specified size, the functions returns NULL if the request cannot be satisfied.

To use this function, the dinamic memory buffer must be initialized. Please refer to mempool_init function.

Prototype
stdlib.h
Declaration
void *malloc(size_t size);
Parameters
size_t size Dimension of the memory to allocate (bytes)
Return value
void* Pointer to the allocated memory
NULL if the request cannot be satisfied

Examples

In the following example at every second will be send on the serial line a message like:
String is: Hello!, IntVar[0]=0066, IntVar[1]=0067

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Specify the alloc buffer length.

unsigned char AllocBuf[0x100]; //Alloc buffer

// -----------------------------------------------------------------------------
// MALLOC EXAMPLE
// -----------------------------------------------------------------------------

void MallocTest(void)
{
// Local variable definitions.

char* StringVar; //Pointer to string variable


int* IntVar; //Pointer to int array variable

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Check if first program loop.

if (PLCFirstLoop)
{
mempool_init((void *)AllocBuf, sizeof(AllocBuf)); //Initializes the memory pool
StringVar=(char*)malloc(10); //Allocates a 10 bytes string
IntVar=(int*)calloc(2, sizeof(int)); //Allocates an array of 2 variables

// Here initializes the variables.

IntVar[0]=0; //Initializes the integer at position [0]

http://192.168.0.61/Destination/Html/CLanguage/ANSIFunctions/Stdlib/Malloc.htm (1 of 2) [06/10/2008 17.45.06]


ANSI "C" functions: malloc

IntVar[1]=1; //Initializes the integer at position [1]


strcpy(StringVar, "Hello!"); //Initializes the string variable
}

// -------------------------------------------------------------------------
// PROGRAM EXECUTION
// -------------------------------------------------------------------------
// At every 1 second, print out a message.

if (PLCPulse1000)
{
printf("String is: %s, IntVar[0]=%04X, IntVar[1]=%04X\r\n", StringVar, IntVar[0], IntVar[1]);
IntVar[0]++; //Increases the integer at position [0]
IntVar[1]++; //Increases the integer at position [1]
}
}

// [End of file]

http://192.168.0.61/Destination/Html/CLanguage/ANSIFunctions/Stdlib/Malloc.htm (2 of 2) [06/10/2008 17.45.06]


Operandi: Bit

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Bit

the operand Bit can be used by the RIL language in the logic instructions to address a bit of an operand
Byte (Y), Word (W) o Double (DW).

Numerical range
Type Description
PSYST NSYST Netreader

Decimal bit address, allows to define the operand bit in decimal mode
For operand Byte (Y) range from 0 to 7
BD Decimal bit
For operand Word (W) range from 0 to 15
For operand Double (DW) range from 0 to 31
Hexadecimal bit address, allows to define the operand bit in hexadecimal
mode
BH Hexadecimal bit For operand Byte (Y) range from 0 to 7
For operand Word (W) range from 0 to F
For operand Double (DW) range from 0 to 1F

Example

Here some examples of Bit operand use.

Ladder RIL
ORGR
LODT Y 0000 BD 1
ANDT W 0002 BD 8
ANDT DW 0004 BD 10
OUTT DW 0004 BD 31

ORGR
LODT Y 0000 BH 0001
ANDT W 0002 BH 0008
ANDT DW 0004 BH 000A
OUTT DW 0004 BH 001F

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Bit.htm [06/10/2008 17.45.07]


Operandi: Constant

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Constant

The Constant operand can be used when it is necessary to define a constant value, it can be used in
different forms:

Numerical range
Type Description
PSYST NSYST Netreader

Utilizzata per definire bit all'interno di variabili byte (Y). Se utilizzato in


K Constant istruzioni che prevedono l'utilizzo di una costante assume il significato di KH
avremo range 0-FFFF
KD Decimal constant Permette di definire valori decimali interi. Range 0-4294967295
KH Hexadecimal constant Permette di definire valori esadecimali interi. Range 0-FFFFFFFF
KO Octal constant Permette di definire valori ottali interi. Range 0-37777777777
Permette di definire valori binari. Range 0-
KB Binary constant
11111111111111111111111111111111
Permette di definire valori in virgola mobile con segno. Range da -3.4028233e
KF Float constant
+38 a +3.4028233e+38
KE Enum constant Permette di selezionare valori predefiniti. Vedere tabella relativa.

"Enum" operands

The Enum KE operand identifies the default values according to the table below:

Instruction Enum Description

IOSerialPortA This value identify the A serial line


SETV
IOSerialPortB This value identify the B serial line
Base1mS This value sets the 1 millisecond timer base time
Base10mS This value sets the 10 millisecond timer base time
Base100mS This value sets the 100 millisecond timer base time
OUTM
Base1S This value sets the 1 second timer base time
Base10S This value sets the 10 second timer base time
Base60S This value sets the 60 second timer base time
SaveEnable This value enables the registry save
TINE
SaveDisable This value disables the registry save (Only for expert users)
Off This value sets the DTR signal at the FALSE logic state
On This value sets the DTR signal at the TRUE logic state
DTRE
Auto This value enables the automatic DTR signal management
Timed This value enables the automatic DTR signal management with defined times

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Constant.htm [06/10/2008 17.45.07]


Operandi: Label

ELSIST Srl, www.elsist.it MNL041Q100

Operands

Label

The Label operand represents a mnemonic label of program, it can be defined by the RIL language by
using the LABL instruction, allowing to insert a mnemonic name instead of a numerical. The use of this
operand it is necessary to allow the access from the RIL program to functions written in assembler and C
languages.

Examples

Example of call from RIL program of a function defined in a C program.

RIL "C" language


EXTR W Counter unsigned int Counter
EXTR L Compare
void Compare (void)
ORGR {
LODT I 0000 if (Counter >= 1000
PULS Counter=0;
LODA W Counter }
INCA K 0001
STRA W Counter
TASK L Compare

http://192.168.0.61/Destination/Html/RILLanguage/Operands/Label.htm [06/10/2008 17.45.08]


Serial instructions: SRXC

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

SRXC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SRXC Serial RX Characters received Close rung No A

The instruction Serial RX Characters received loads in AccA, the number of the characters received by the
serial line and transferred to the reception buffer, if the reception buffer is empty the Flag (F)
PLCRxBufEmpty of reserved operands is activated. The instruction is referred to the serial line, defined by
the SETV instruction.

We remind that the characters received by the serial line are buffered by the operating system, the user
program can read them from the reception buffer with the instruction SRXD, only if inside the buffer there
are characters.

Examples

In the following example the number of received characters on the serial line is placed in Y 0000.

Ladder RIL "C" language


ORGR
SETR
SETV KE IOSerialPortA
SRXC STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Srxc.htm [06/10/2008 17.45.08]


Serial instructions: STXC

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

STXC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

STXC Serial TX Characters space Close rung No A

The instruction Serial TX Characters space loads in AccA the available space in the serial transmission
buffer, the space is expressed in number of characters you can transfer. The instruction is referred to the
serial line, defined by the SETV instruction. The instruction execution operates on two reserved operands. It
sets the Flag (F) PLCTxBufEmpty if the transmission buffer is empty, It sets the Flag (F) PLCTxBufFull if
the transmission buffer is full.

To better understand the use of this instruction we remind that to transmit to the serial line, the characters
must be transferred to the transmission buffer by using the SRXD and STXI instructions. The operating
system will automatically provide to their transmission to the serial line.

Examples

In the following example the the available space in the serial transmission buffer is placed in Y 0000.

Ladder RIL "C" language


ORGR
SETR
SETV KE IOSerialPortA
STXC
STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Stxc.htm [06/10/2008 17.45.09]


Serial instructions: SRXD

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

SRXD

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SRXD Serial RX Data Close rung No A

The instruction Serial RX Data is to be used every time you want receive data from the serial line. When the
instruction is activated, the data present in the reception buffer is transferred to AccA. If a data is
transferred, the Flag (F) PLCChrReceived of reserved operands is activated, so you need to check this
flag, if it's set the data has been received. The instruction is referred to the serial line, defined by the SETV
instruction.

Examples

In the following example, when I 0000 gets activated if a data is received from the serial line, the received
character is transferred to Y 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
SRXD

ORGR
LODT I 0000
ANDT F PLCChrReceived
STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Srxd.htm [06/10/2008 17.45.09]


Mathematical instructions (Fixed): SUBA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

SUBA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SUBA SUBtract Accumulators Close rung No A

The instruction SUBtract Accumulators allows to subtract the value in AccB (subtrahend) from the value in
AccA (minuend), the result replaces the value in AccA. The instruction executes the operation
AccA=AccA-AccB.

If the value contained in AccA (minuend) is less than the value contained in AccB (subtrahend), the Flag
(F) PLCSubIsNegative of reserved operands is set.

Examples

In the following example, when I 0000 is activated, the value of W 0002 is subtracted from the value of
W 0000 and the result replaces the value in W 0004. W 0004=(W 0000-W 0002).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)-PLCOpW(0x0002);
LODA W 0002
LODA W 0000
SUBA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Suba.htm [06/10/2008 17.45.10]


Mathematical instructions (Float): FSUB

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FSUB

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FSUB Float SUBtract Accumulators Close rung No A

The instruction Float SUBtract Accumulators allows to subtract the value in AccB (subtrahend) from the
value in AccA (minuend) (AccA-AccB), the result replaces the value in AccA. The instruction executes the
operation AccA=AccA-AccB.

If the value contained in AccA (minuend) is less than the value contained in AccB (subtrahend), the Flag
(F) PLCSubIsNegative of reserved operands is set.

Examples

In the following example, when I 0000 is active the value of FL 0004 is subtracted to the value of FL 0000
and the result replaces the value in FL 0008. FL 0008=(FL 0000-FL 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0008)=PLCOpFL(0x0000)-PLCOpFL(0x0004);
LODA FL 0004
LODA FL 0000
FSUB
STRA FL 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fsub.htm [06/10/2008 17.45.10]


Data management instructions: CPRA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

CPRA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CPRA ComPaRe Accumulators Close rung No A

The instruction ComPaRe Accumulators compares the values of the two accumulators without change
them. The instruction manages thre reserved operands, the user program can test their status. To compare
operands directly without transfer them to the accumulators you can use the LESC, EQUC, GRTC
instructions.

F PLCLesFlag Active if AccA < AccB


F PLCGrtFlag Active if AccA > AccB
F PLCEquFlag Active if AccA = AccB

ATTENTION! The status of the reserved operands will be valid until another CPRA or FCPR or any other
instruction that manage these operands will be executed.

Examples

In the following example, when I 0000 gets activated, the value 100 is loaded in AccB, while the value in
W 0000 is loaded in AccA. The values of the two accumulators are compared and if the value in W 0000 is
bigger than 100, the output O 0000 gets activated.

Ladder RIL "C" language


ORGR if (!PLCOpI(0x0000))
LODT I 0000 PLCOpO(0x0000)=FALSE;
LODA KD 100 else
LODA W 0000 PLCOpO(0x0000)=(PLCOpW(0x0000) > 100);
CPRA

ORGR
LODT I OOO0
ANDT F PLCGrtFlag
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Cpra.htm [06/10/2008 17.45.11]


Data management instructions: FCPR

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

FCPR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FCPR Float ComPaRe accumulators Close rung No A

The instruction Float ComPaRe accumulators compares the float values in the two accumulators without
change them. The instruction manages thre reserved operands, the user program can test their status.To
compare operands directly without transfer them to the accumulators you can use the LESC, EQUC, GRTC
instructions.

F PLCLesFlag Active if AccA < AccB


F PLCGrtFlag Active if AccA > AccB
F PLCEquFlag Active if AccA = AccB

ATTENTION! The status of the reserved operands will be valid until another CPRA or FCPR or any other
instruction that manage these operands will be executed.

Examples

In the following example, when I 0000 gets activated, the value 100 is loaded in AccB, while the value in
FL 0000 is loaded in AccA. The values of the two accumulators are compared and if the value in FL 0000
is bigger than 100, the output O 0000 gets activated.

Ladder RIL "C" language


ORGR if (!PLCOpI(0x0000))
LODT I 0000 PLCOpO(0x0000)=FALSE;
LODA KF 100 else
LODA FL 0000 PLCOpO(0x0000)=(PLCOpFL(0x0000) > 100);
CPRA

ORGR
LODT I OOO0
ANDT F PLCGrtFlag
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Fcpr.htm [06/10/2008 17.45.11]


Operand definition instructions: EXTR

ELSIST Srl, www.elsist.it MNL041Q100

Operand definition instructions

EXTR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

EXTR EXTeRn operand None F, C, Y, W, DW, FL, L No A

The instruction EXTeRn operand has to be used to allow the access from RIL file to external mnemonic
operand in the same project defined in assembler or C. The instruction doesn't have any logical function in
the program so it has to be inserted without any definition of the logical branch, we suggest to insert the
instruction at the beginning of the RIL file. Instructions can access to the defined operand from any RIL file
of the project by only indicating its type and name.

ATTENTION! You cannot define two operands with the same name in the same project (even they are in
different files) even they have different type. So you cannot define local operands DEFL, global operands
DEFG or backup operands DEFB using names defined as extern operands.

Examples

In the following example, the W Counter operand defined in a file written in C language, is increased from
RIL language.

Ladder RIL "C" language


EXTR W Counter unsigned int Counter;

ORGR void Example(void)


LODT I 0000 {
PULS if (Counter >= 1000)
INCO W Counter Counter=0;
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition/Extr.htm [06/10/2008 17.45.12]


Operand definition instructions: SVIW

ELSIST Srl, www.elsist.it MNL041Q100

Operand definition instructions

SVIW

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SVIW Symbol VIeW None F, Y, W, DW, FL No A

The instruction Simbol VIeW has to be used to allow the visibility of a numerical operand. Unlike the
mnemonic operands that have to be defined before to be used in a RIL program, the numerical operand are
automatically defined when they are used. The instruction doesn't have any logical function in the program
so it has to be inserted without any definition of the logical branch, we suggest to insert the instruction at the
beginning of the RIL file.

Examples

In the following example, every time I 0000 is activated, the value of the W 0000 is increased, in the
example it is used the operand W 0000 without using the two operands Y 0000 MSB part and Y 0001 LSB
part of the word. If it is necessary to run the debug of the Byte (Y) operands or run their display on the
terminal, the operation would be impossible not using the SVIW instruction, because the operands are not
defined.

Ladder RIL "C" language


SVIW Y 0000
SVIW Y 0001

ORGR
LODT I 0000
PULS
INCO W 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Definition/Sviw.htm [06/10/2008 17.45.12]


Logic instructions: ORGR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ORGR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ORGR ORiGin Rung Open rung No A

The instruction ORiGin Rung should be used to begin a new rung. Every rung has to begin with an
ORGR instruction and end with one or more Close rung type instructions.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Orgr.htm [06/10/2008 17.45.13]


Logic instructions: LODT

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

LODT

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
LODT LOaD True Open branch No A
Y, W, DW K, BD, BH

The instruction LOaD True should be used to begin a new branch with a normally open contact. The
instruction has to be placed after the ORGR instruction or at the beginning of a new branch, that will be
closed with ANDR or ORLR instruction.

Examples

In the following example, if you activate the I 0000, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000);
LODT I 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Lodt.htm [06/10/2008 17.45.13]


Logic instructions: LODF

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

LODF

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
LODF LOaD False Open branch No A
Y, W, DW K, BD, BH

The instruction LOaD False should be used to begin a new branch with a normally close contact. The
instruction has to be placed after the ORGR instruction or at the beginning of a new branch, that will be
closed with ANDR or ORLR instruction.

Examples

In the following example, if you activate the I 0000, O 0000 becomes inactive.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=!PLCOpI(0x0000);
LODF I 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Lodf.htm [06/10/2008 17.45.14]


Logic instructions: ANDT

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ANDT

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
ANDT AND logic True Modify branch No A
Y, W, DW K

The instruction AND logic True should be used to insert a normally open contact in series to the previous circuit.

Examples

In the following example, if you activate the I 0000 and deactivate I 0001, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000)&PLCOpI(0x0001);
LODT I 0000
ANDT I 0001
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Andt.htm [06/10/2008 17.45.14]


Logic instructions: ANDF

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ANDF

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
ANDF AND logic False Modify branch No A
Y, W, DW K, BD, BH

The instruction AND logic False should be used to insert a normally close contact in series to the previous circuit.

Examples

In the following example, if you activate the I 0000 and deactivate I 0001, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000)&!PLCOpI(0x0001);
LODT I 0000
ANDF I 0001
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Andf.htm [06/10/2008 17.45.15]


Logic instructions: ORLT

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ORLT

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
ORLT OR Logic True Modify branch No A
Y, W, DW K

The instruction OR Logic True should be used to add a normally open contact in parallel with the previous circuit.

Examples

In the following examples, if you activate the I 0000 or activate I 0001, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000)|PLCOpI(0x0001);
LODT I 0000
ORLT I 0001
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Orlt.htm [06/10/2008 17.45.15]


Logic instructions: ORLF

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ORLF

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

C, F, I, O, T
ORLF OR Logic False Modify branch No A
Y, W, DW K

The instruction OR Logic False should be used to add a normally closed contact that in parallel with the previous
circuit.

Examples

In the following example, if you activate the I 0000 or disactivate I 0001, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000)|!PLCOpI(0x0001);
LODT I 0000
ORLF I 0001
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Orlf.htm [06/10/2008 17.45.16]


Logic instructions: ANDR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ANDR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ANDR None AND logic Rungs Close branch No A

The instruction AND logic Rungs should be used every time you want to link two logical branches in series each other.

Examples

In the following example, if you deactivate the I 0000 and activate I 0002 if I 0001 is active or if I 0003 is not active, O 0000
becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(!PLCOpI(0x0000)|PLCOpI(0x0002))&
LODF I 0000 (PLCOpI(0x0001)|!PLCOpI(0x0003));
ORLT I 0002
LODT I 0001
ORLF I 0003
ANDR
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Andr.htm [06/10/2008 17.45.16]


Logic instructions: ORLR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

ORLR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ORLR None OR Logic Rungs Close branch No A

The instruction OR logic Rungs should be used to link two logical branches in parallel each other.

Examples

In the following example, if you deactivate the I 0000 and activate I 0002 if I 0001 is active or if I 0003 is not active, O 0000
becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(!PLCOpI(0x0000)&PLCOpI(0x0001))|
LODF I 0000 (PLCOpI(0x0002)&!PLCOpI(0x0003));
ANDT I 0001
LODT I 0002
ANDF I 0003
ORLR
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Orlr.htm [06/10/2008 17.45.16]


Logic instructions: OUTT

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

OUTT

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, O
OUTT OUT True Close rung No A
Y, W, DW K

The instruction OUT True should be used activate an operand Output (O), Flag (F), or a bit of a Byte (Y),
Word (W) or Double (DW) when the rung is active. When the rung becomes inactive the operand is
deactivated.

Examples

In the following example, if you activate the I 0000, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpI(0x0000);
LODT I 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Outt.htm [06/10/2008 17.45.17]


Logic instructions: OUTF

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

OUTF

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, O
OUTF OUT False Close rung No A
Y, W, DW K

The instruction OUT False should be used to deactivate an operand Output (O), Flag (F), or a bit of a Byte
(Y), Word (W) or Double (DW) when the rung is active. When the rung becomes inactive the operand is
activated.

Examples

In the following example, if you activate the I 0000, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=!PLCOpI(0x0000);
LODT I 0000
OUTF O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Outf.htm [06/10/2008 17.45.17]


Logic instructions: LTCH

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

LTCH

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, O
LTCH LaTCH Close rung No A
Y, W, DW K, BD, BH

The instruction LaTCH should be used to activate an operand Output (O), Flag (F), or a bit of a Byte (Y),
Word (W) or Double (DW) when the rung is active. The operand will remain active even if the rung
becomes inactive. To reset the operand, the UTCH instruction with the same operand must be used.

Examples

In the following example, if you activate the I 0000, O 0000 becomes active and remains active even if the
I 0000 becomes inactive.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpO(0x0000)=TRUE;
LTCH O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Ltch.htm [06/10/2008 17.45.18]


UTCH instruction

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

UTCH

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, O
UTCH UnlaTCH Close rung No A
Y, W, DW K

The instruction UnlaTCH should be used to deactivate an operand Output (O), Flag (F), or a bit of a Byte
(Y), Word (W) or Double (DW) when the rung is active. The operand will remain inactive even if the rung
becomes inactive. To set the operand, the LTCH instruction with the same operand must be used.

Examples

In the following example, if you activate the I 0000, O 0000 becomes inactive.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpO(0x0000)=FALSE;
UTCH O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Utch.htm [06/10/2008 17.45.18]


Logic instructions: MCRS

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

MCRS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

MCRS Master Control Relay Start Close rung No A

The instruction Master Control Relay Start should be used to condition the execution and the activation of
the program branches included between the instruction and the MCRE instruction. The program branches
betweenMCRS and MCRE are conditioned to the branch status where the instruction MCRS is. This means
that these branches have a true logical meaning only if the branch, activating the MCRS instruction is true.

The use of this instruction allows to reduce the program execution time, indeed the logical branches
between MCRS and MCRE are not executed if the MCRS instruction is not active. The MCRS instructions
can be nested without limits.

ATTENTION! If between MCRS and MCRE there are branches containing PULS instructions it's necessary
to condition the PULS instruction at the status of the MCRS instruction.

Examples

In the following example, the operand I 0000 status conditions the execution of all the branches between
the MCR and MCRE instructions. If you activate I 0000 the the following branches are executed, when
I 0000 becomes inactive, O 0001 becomes inactive independently from the status of I 0001.

Please note the use of F 0000, it was inserted only to test the status of the branch that conditions the
MCRS instruction so it's possible to insert it in all the branches between MCRS and MCRE where that use
puls type instructions.

Ladder RIL "C" language


ORGR
LODT I 0000
OUTT F 0000
MCRS

ORGR
LODT I 0001
OUTT O 0001

ORGR
LODT I 0002
ANDT F 0000
PULS
LTCH F 0001

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Mcrs.htm (1 of 2) [06/10/2008 17.45.19]


Logic instructions: MCRS

ORGR
MCRE

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Mcrs.htm (2 of 2) [06/10/2008 17.45.19]


Logic instructions: MCRE

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

MCRE

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

MCRE Master Control Relay End Close rung No A

The instruction Master Control Relay End should be used to define the end of the program part conditioned
to the instruction MCRS.

Examples

See the example reported on the MCRS instruction.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Mcre.htm [06/10/2008 17.45.19]


Logic instructions: SBSR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

SBSR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

F, O
SBSR Step By Step Relay Close rung Yes A
Y, W, DW K

The instruction Step By Step Relay should be used to implement the step by step relay function. At every
rung activation the operand status changes.

Examples

In the following example, every time there is a transition from off to on status of the I 0000, O 0000 change
its status.

Ladder RIL "C" language


ORGR
LODT I 0000
SBSR O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Sbsr.htm [06/10/2008 17.45.20]


Logic instructions: INRG

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

INRG

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

INRG INvert RunG Modify branch No A

The instruction INvert RunG allows to invert the logical status of the branch. If the instruction is inserted
after an active branch, it will invert the status and the branch will becomes inactive, and vice versa.

Examples

In the following examples, if you activate the I 0000, O 0000 becomes inactive.

Ladder RIL "C" language


ORGR
LODT I 0000
INRG
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Inrg.htm [06/10/2008 17.45.20]


Logic instructions: PULS

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

PULS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

PULS PULSe Modify branch Yes A

The instruction PULSe allows to make impulsive (active for a program loop) the activation of the branch that
follow the instruction.

Examples

In the following example, if you activate the I 0000, O 0000 becomes active for a single program loop.

Ladder RIL "C" language


ORGR
LODT I 0000
PULS
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Puls.htm [06/10/2008 17.45.21]


Logic instructions: SETR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

SETR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SETR SET bRanch Open branch No A

The instruction SET bRanch allows to unconditionally activate the logical status of the branch.

Examples

In the following example O 0000 becomes unconditionally activated.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=TRUE;
SETR
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Setr.htm [06/10/2008 17.45.21]


Logic instructions: RESR

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

RESR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

RESR RESet bRanch Open branch No A

The instruction RESet bRanch allows to unconditionally deactivate the logical status of the branch.

Examples

In the following example O 0000 becomes unconditionally deactivated.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=FALSE;
RESR
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Resr.htm [06/10/2008 17.45.22]


Logic instructions: OUTM

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

OUTM

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

T KD, KH, Y, W, DW
OUTM OUt TiMer Close rung No A
KD, KH, Y, W, DW KE

The instruction OUt TiMer allows to create delays in the program. When the timer is activated, its contacts
will get activated after the programmed delay time. When the timer is deactivated its contacts will get
deactivated immediately.

The delay time value can be expressed as a decimal constant (KD) or hexadecimal (KH), or it can be
defined by using a Byte (Y), Word (W) or Double (DW) operand. The instruction can manage delays from
1 mSec to 4294967295 mSec (About 50 days).

The delay time is saved at the instruction activation, so if it's expressed in an operand it's possible to
change it the value only when the logical branch is not active.

You can define the base time by using the 3rd operand (KE) with the values reported in the following table.
If the 3rd operand is omitted, the time base is automatically fixed to 100mSec to maintain compatibility with
the previous versions.

Base1mS 1 Millisecond
Base10mS 10 Milliseconds
Base100mS 100 Milliseconds
Base1S 1 Second
Base10S 10 Seconds
Base60S 60 Seconds

Examples

In the following example, if you activate the I 0000, the T 0000 starts the time delay counting. O 0000 will
becomes active only after 1000x0,001S (1 Second). When you deactivate I 0000, T 0000 becomes inactive
immediately causing the deactivation of O 0000.

Ladder RIL "C" language

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Outm.htm (1 of 2) [06/10/2008 17.45.22]


Logic instructions: OUTM

ORGR
LODT I 0000
OUTM T 0000 KD 1000 KE Base1mS

ORGR
LODT T 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Outm.htm (2 of 2) [06/10/2008 17.45.22]


Logic instructions: CTUP

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

CTUP

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CTRS CounTer UP Close branch C KD, KH, KO, KB, Y No A

The instruction CounTer UP allows to increase the counter every time you activate the rung. The contacts
of the counter will becomes active when the counter reach the defined value. The value can be expressed
as a Constant (K) or it can be contained in a Byte (Y). To reset the counter the CTRS instruction must be
used. Obsolete instruction, we suggest to not use it in the new projects, in alternative use the INCO, DECO,
GRTC, EQUC, LESC instructions.

Examples

In the following example, every time the I 0000 is activated, the counter C 0000 is increased. After 10 times,
O 0000 will becomes active.

Ladder RIL "C" language


ORGR
LODT I 0000
CTUP C 0000 KD 10

ORGR
LODT C 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Ctup.htm [06/10/2008 17.45.23]


Logic instructions: CTRS

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

CTRS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CTRS CounTer ReSet Close branch C No A

The instruction CounTer ReSet allows to reset the counting value of a counter. Obsolete instruction, we
suggest to not use it in the new projects, in alternative use the INCO, DECO, GRTC, EQUC, LESC
instructions.

Examples

In the following examples, if you activate the I 0000, the counter C 0000 becomes reset.

Ladder RIL "C" language


ORGR
LODT I 0000
CTRS C 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Ctrs.htm [06/10/2008 17.45.23]


Logic instructions: SHFT

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

SHFT

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SHFT SHiFT Close rung F, O Yes A

The instruction SHiFT should be used to implement the shift register function. This function operates on 8
consecutive operands starting from the defined one. Every time you activate the rung, you will have the shift
of the status of an operand into the next one, with 7 passages from off to on status of the rung, the content
of the defined operand will be in the operand n+7. The operand status is determined by the instruction
OUTT or OUTF inserted before the instruction. You can create a cascade of more shift. See SHRS to reset
the used operands.

ATTENTION! The address of the first operand has to be necessarily the less significant of the bench
(O xxx0, F xxx8).

Examples

The instruction operates on 8 consecutive operand, however you can realize cascades of more instructions
to have shift register with a bigger number of operands. The example reported represents a cascade of 2
SHFT instructions to have the shift of 16 logical outputs, with a time base of 800 mSec. The program is
realized to have the data reported on the first operand at the end of the 16th shift. If you run the program on
a target with at least 16 logical outputs, you can see them flashing in sequence.

Ladder RIL "C" language


ORGR
LODT F PLCPulse500
SHFT O 0008
UTCH O 0008

ORGR
LODT F PLCPulse500
ANDT O 0007
LTCH O 0008

ORGR
LODT F PLCPulse500
SHFT O 0000
UTCH O 0000

ORGR
LODF O 000F
PULS

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Shft.htm (1 of 2) [06/10/2008 17.45.24]


Logic instructions: SHFT

ANDT F PLCPulse500
ORLT F PLCFirstLoop
LTCH O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Shft.htm (2 of 2) [06/10/2008 17.45.24]


Logic instructions: SHRS

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

SHRS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SHRS SHift ReSet Close rung F, O No A

The instruction SHift ReSet allows to reset 8 consecutive operands, the first one of them is that one
defined. This instruction is used in the shift register management. See the SHFT instruction.

ATTENTION! The address of the first operand has to be necessarily the less significant of the bench
(O xxx0, F xxx8).

Examples

In the following example, by activating I 0000, the O 0000, O 0001, O 0002, O 0003, O 0004, O 0005,
O 0006, O 0007 are deactivated. The status of I 0001 is transferred to the output O 0000, every 500 mSec
the status of output O 0000 is transferred to the following outputs.

Ladder RIL "C" language


ORGR
LODT I 0000
SHRS O 0000

ORGR
LODT I 0001
OUTT O 0000

ORGR
LODT F PLCPulse500
SHFT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Shrs.htm [06/10/2008 17.45.24]


Logic instructions: LODB

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

LODB

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

LODB LOaD Bit Open branch Y K No A

The instruction LOaD Bit should be used to begin a new branch testing the status of an operand bit. The
instruction has to be placed after the ORGR instruction or at the beginning of a new branch, that will be
closed with ANDR or ORLR instruction. Obsolete instruction, we suggest to not use it in the new projects, in
alternative use the LODT instruction.

Examples

In the following examples, if the bit 4 of the byte Y 0000 is on, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=PLCOpY(0x0000)&0x10;
LODB Y 0000 K 0004
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Lodb.htm [06/10/2008 17.45.25]


Logic instructions: OUTB

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

OUTB

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

OUTB OUT Bit Close rung Y K No A

The instruction OUT Bit should used to to set a bit into a Byte (Y) operand when the rung is active.
Obsolete instruction, we suggest to not use it in the new projects, in alternative use the OUTT instructionsn.

Examples

In the following example, if you activate the I 0000, the bit 4 of the byte Y 0000 becomes active.

Ladder RIL "C" language


ORGR
LODT I 0000
OUTB Y 0000 K 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Outb.htm [06/10/2008 17.45.25]


Logic instructions: FSGN

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

FSGN

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FSGN Float SiGN Open branch No A

The instruction Float SiGN should be used to identify the sign of the float data in the accumulator AccA.
The instruction has to be placed after the ORGR instruction or at the beginning of a new branch, that will
have to be closed with ANDR or ORLR instruction. if the float data in AccA is positive, the instruction will be
active, if the data is negative the instruction will be inactive.

ATTENTION! The instruction works correctly only if the data in AccA is a float type, otherwise a non
identified status it's returned.

Examples

In the following examples, if you activate the I 0000, if the float data in AccA is positive O 0000 becomes
active, if the float data in AccA is negative, O 0000 becomes inactive.

Ladder RIL "C" language


ORGR
FSGN
ANDT I 0000
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Fsgn.htm [06/10/2008 17.45.26]


Logic instructions: INCO

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

INCO

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y, W,
DW
Y, W,
INCO INCrement Operand Close rung KD, KH, KO, KB No C
DW
FL
FL KF

The instruction INCrement Operand should be used to increment the value of an operand. By defining as
2nd operand a Constant (K) it's possible to specify the increment value. Reached the maximum the value
will rollover to the minimum value.

Examples

In the following example every time the I 0000 is activated, the W 0000 is incremented of 1. Every time the
I 0001 is activated the DW 0004 is incremented of 10.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
INCO W 0000 {
OneShot=PLCOpI(0x0000);
ORGR
LODT I 0001 if (PLCOpI(0x0000))
PULS PLCOpW(0x0000)++;
INCO DW 0004 KD 10 }

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Inco.htm [06/10/2008 17.45.26]


Logic instructions: DECO

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

DECO

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y, W,
DW
Y, W,
DECO DECrement Operand Close rung KD, KH, KO, KB No C
DW
FL
FL KF

The instruction DECrement Operand should be used to decrement the value of an operand. By defining as
2nd operand a Constant (K) it's possible to specify the decrement value. Reached the minimum the value
will rollover to the maximum value.

Examples

In the following example every time the I 0000 is activated, the W 0000 is decremented of 1. Every time the
I 0001 is activated the DW 0004 is decremented of 10.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
DECO W 0000 {
OneShot=PLCOpI(0x0000);
ORGR
LODT I 0001 if (PLCOpI(0x0000))
PULS PLCOpW(0x0000)--;
DECO DW 0004 KD 10 }

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Deco.htm [06/10/2008 17.45.27]


Logic instructions: GRTC

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

GRTC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y KD, KH, KO, KB, Y


W KD, KH, KO, KB, W
GRTC GReaTher Compare Modify branch No A
DW KD, KH, KO, KB, DW
FL KF, FL

The instruction GReaTer Compare should be used to begin a new branch testing if an operand value is
greater than defined value. The instruction has to be placed after the ORGR instruction or at the beginning
of a new branch, that will be closed with ANDR or ORLR instruction.

Examples

in the following instruction, if the operand W 0000 is greater than 10, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(PLCOpW(0x0000) > 10);
GRTC W 0000 KD 10
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Grtc.htm [06/10/2008 17.45.27]


Logic instructions: LESC

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

LESC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y KD, KH, KO, KB, Y


W KD, KH, KO, KB, W
LESC LESs Compare Open branch No A
DW KD, KH, KO, KB, DW
FL KF, FL

The instruction LESs Compare should be used to begin a new branch testing if an operand value is less
than defined value. The instruction has to be placed after the ORGR instruction or at the beginning of a new
branch, that will be closed with ANDR or ORLR instruction.

Examples

In the following examples, if the operand W 0000 is less than 10, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(PLCOpW(0x0000) < 10);
LESC W 0000 KD 10
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Lesc.htm [06/10/2008 17.45.28]


Logic instructions: EQUC

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

EQUC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y KD, KH, KO, KB, Y


W KD, KH, KO, KB, W
EQUC EQUal Compare Modify branch No A
DW KD, KH, KO, KB, DW
FL KF, FL

The instruction EQUal Compare should be used to begin a new branch testing if an operand value is equal
to a defined value. The instruction has to placed after the ORGR instruction or at the beginning of a new
branch, that will be closed with ANDR or ORLR instruction.

Examples

In the following example, if the operand W 0000 is equal to 10, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(PLCOpW(0x0000) == 10);
EQUC W 0000 KD 10
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Equc.htm [06/10/2008 17.45.28]


Logic instructions: NTQC

ELSIST Srl, www.elsist.it MNL041Q100

Logic instructions

NTQC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

Y KD, KH, KO, KB, Y


W KD, KH, KO, KB, W
NTQC NoT eQual Compare Modify branch No A
DW KD, KH, KO, KB, DW
FL KF, FL

The instruction NoT eQual Compare should be used to begin a new branch testing if an operand value is
not equal to a defined value. The instruction has to placed after the ORGR instruction or at the beginning of
a new branch, that will be closed with ANDR or ORLR instruction.

Examples

In the following example, if the operand W 0000 is not equal to 10, O 0000 becomes active.

Ladder RIL "C" language


ORGR PLCOpO(0x0000)=(PLCOpW(0x0000) != 10);
NTQC W 0000 KD 10
OUTT O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Logic/Ntqc.htm [06/10/2008 17.45.29]


Data management instructions: LODA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

LODA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

LODA LOaD Accumulator Close rung K, KD, KH, KF, KO, KB, Y, W, DW, FL No A

The instruction LOaD Accumulator allows to load a value in AccA. The value can be defined by a constant
or it can be contained in an operand. When the instruction is executed the current content of AccA is
transferred to AccB replacing the existing value.

Examples

In the following example, when I 0000 gets activated, the content of the byte Y 0000 is transferred to AccA.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Loda.htm [06/10/2008 17.45.29]


Data management instructions: STRA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

STRA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

STRA SToRe Accumulator Close rung Y, W, DW, FL No A

The instruction SToRe Accumulator allows to transfer the value from AccA to the defined operand, the
content of the two accumulators is not changed.

Examples

In the following example, when I 0000 gets activated, the content AccA is transferred to the byte Y 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Stra.htm [06/10/2008 17.45.30]


Data management instructions: XCHA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

XCHA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

XCHA eXCHange Accumulators Close rung No A

The instruction eXCHange Accumulators allows to exchange each other the content of the two
accumulators AccA and AccB.

Examples

In the following example, when I 0000 gets activated, the content of the 2 accumulators AccA and AccB is
exchanged.

Ladder RIL "C" language


ORGR
LODT I 0000
PULS
XCHA

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Xcha.htm [06/10/2008 17.45.30]


Data management instructions: ANDA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

ANDA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ANDA AND Accumulators Close rung No A

The instruction AND Accumulators allows to place the values of two accumulators in logical AND, the result
replaces the value in AccA. The instruction executes the operation AccA=AccA&AccB.

Examples

In the following example, when I 0000 gets activated, the value of W 0000 is placed in AND with the value
of W 0002 and the result replaces the value in W 0004. W 0004=(W 0000&W 0002).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)&PLCOpW(0x0002);
LODA W 0002
LODA W 0000
ANDA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Anda.htm [06/10/2008 17.45.31]


Data management instructions: ORLA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

ORLA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ORLA OR Accumulators Close rung No A

The instruction OR Accumulators allows to place the values of two accumulators in logical OR, the result
replaces the value in AccA.The instruction executes the operation AccA=AccA|AccB.

Examples

In the following example,when I 0000 gets activated, the value of W 0000 is placed in OR with the value of
W 0002 and the result replaces the value in W 0004. W 0004=(W 0000|W 0002).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)|PLCOpW(0x0002);
LODA W 0002
LODA W 0000
ORLA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Orla.htm [06/10/2008 17.45.31]


Data management instructions: XORA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

XORA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

XORA XOR Accumulators Close rung No A

The instruction XOR Accumulators allows to place the values of two accumulators in logical XOR, the result
replaces the value in AccA. The instruction executes the operation AccA=AccA^AccB.

Examples

in the following example,when I 0000 gets activated, the value of W 0000 is placed in XOR with the value of
W 0002 and the result replaces the value in W 0004. W 0004=(W 0000^W 0002).

Ladder RIL "C" language


ORGR
LODT I 0000
LODA W 0002
LODA W 0000
XORA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Xora.htm [06/10/2008 17.45.32]


Data management instructions: RORA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

RORA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

RORA ROtate Right Accumulator Close rung K, KD, KH, Y No A

The instruction ROtate Right Accumulator allows to rotate to the right the value in AccA. The number of
rotations to be executed is expressed by the operand, it can be a Constant (K) or a Byte (Y). At every
rotation, the least significant bit of AccA is transferred to the most significant. To execute the full rotation of
a digit, you have to execute 4 rotations.

ATTENTION! The accumulator has 32 bits, in the versions 7.x it had only 16 bits, so the instruction has a
different behavior. Loading the value 0x8000 in the accumulator and executing a RORA K 0001, saving the
result in a Word (W), you obtain 0x0000, with the previous versions you obtain 0x1000.

Examples

In the following example, when I 0000 gets activated, the value 0x12345678 is loaded in AccA and then is
rotated to the right for a digit, the result 0x81234567 is transferred in DW 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA KH 12345678
RORA K 0004
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Rora.htm [06/10/2008 17.45.32]


Data management instructions: SHRA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

SHRA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SHRA SHift Right Accumulator Close rung K, KD, KH, Y No A

The instruction SHift Right Accumulator allows to shift to the right the value in AccA. The number of shifts
to be executed is expressed by the operand, it can be a Constant (K) or a Byte (Y). At every shift, the least
significant bit of AccA is lost and a 0 is transferred to the most significant. To execute the full shift of a digit,
you have to execute 4 shifts.

Examples

In the following example, when I 0000 gets activated, the value 0x12345678 is loaded in AccA and then is
shifted to the right for a digit, the result 0x01234567 is stored in DW 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA KH 12345678
SHRA K 0004
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Shra.htm [06/10/2008 17.45.33]


Data management instructions: ROLA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

ROLA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ROLA ROtate Left Accumulator Close rung K, KD, KH, Y No A

The instruction ROtate Left Accumulator allows to rotate to the left the value in AccA. The number of
rotations to be executed is expressed by the operand, it can be a Constant (K) or a Byte (Y). At every
rotation, the most significant bit of AccA is transferred to the least significant. To execute the full rotation of
a digit, you have to execute 4 rotations.

ATTENTION! The accumulator has 32 bits, in the versions 7.x it had only 16 bits, so the instruction has a
different behavior. Loading the value 0x8000 in the accumulator and executing a ROLA K 0001, saving the
result in a Word (W), you obtain 0x0000, with the previous versions you obtain 0x0001.

Examples

In the following example, when I 0000 gets activated, the value 0x12345678 is loaded in AccA and then is
rotated to the left for a digit, the result 0x23456781 is stored in DW 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA KH 12345678
ROLA K 0004
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Rola.htm [06/10/2008 17.45.33]


Data management instructions: SHLA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

SHLA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SHLA SHift Left Accumulator Close rung K, KD, KH, Y No A

The instruction SHift Left Accumulator allows to shift to the left the value in AccA. The number of shifts to
be executed is expressed by the operand, it can be a Constant (K) or a Byte (Y). At every shift, the most
significant bit of AccA is lost and a 0 is transferred to the least significant. To execute the full shift of a digit,
you have to execute 4 shifts.

Examples

In the following example, when I 0000 gets activated, the value 0x12345678 is loaded in AccA and then is
shifted to the left for a digit, the result 0x23456780 is stored in DW 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA KH 12345678
SHLA K 0004
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Shla.htm [06/10/2008 17.45.34]


Data management instructions: ASHX

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

ASHX

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ASHX AScii to HeXadecimal conversion Close rung No A

The instruction AScii to HeXadecimal conversion allows to convert the ASCII character in the LSB of AccA
to the hexadecimal format, the value obtained is placed in the 4 low bits of AccA.

ATTENTION! This instruction accepts ASCII characters from 0 to 9 and from A to F different characters are
not converted and the Flag (F) PLCConvError gets activated.

Examples

In the following example, when I 0000 gets activated, the ASCII character A is loaded in AccA, converted
in hexadecimal and the result 0x0A is transferred in the operand Y 0000.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpY(0x0000)=ASCIIToHEX(0x41);
LODA KH 0041
ASHX
STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Ashx.htm [06/10/2008 17.45.34]


Data management instructions: HXAS

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

HXAS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

HXAS HeXadecimal to AScii conversion Close rung No A

The instruction HeXadecimal to AScii conversion allows to convert the hexadecimal number contained in
the 4 low bits of AccA into ASCII format, the value obtained is placed in AccA.

Examples

In the following example, when I 0000 gets activated, the hexadecimal character 0x0A is loaded in AccA,
converted in ASCII and the result 0x41 is transferred to the operand Y 0000.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpY(0x0000)=HEXToASCII(0x0A);
LODA KH 000A
HXAS
STRA Y 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Hxas.htm [06/10/2008 17.45.35]


Data management instructions: FIXC

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

FIXC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FIXC float to FIXed Conversion Close rung No A

The instruction float to FIXed Conversion allows to convert the float number in AccA to fixed format, the
value obtained replaces the value in AccA.

ATTENTION! The conversion to fixed of a floating data causes the loss of resolution of the variable value,
because the fractional part of the value gets lost.

Examples

In the following example, when I 0000 gets activated, the float data in AccA is converted in fixed and the
result transferred in the variable DW 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpDW(0x0004)=(unsigned long)PLCOpFL(0x0000);
LODA FL 0000
FIXC
STRA DW 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Fixc.htm [06/10/2008 17.45.35]


Data management instructions: FLTC

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

FLTC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FLTC fixed to FLoaTing Conversion Close rung No A

The instruction fixed to FLoaTing Conversion allows to convert the fixed number in AccA to float format, the
value obtained replaces the value in AccA.

Examples

In the following example, when I 0000 gets activated, the fixed data in AccA is converted in float and the
result transferred in the variable FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=(float)PLCOpDW(0x0000);
LODA DW 0000
FLTC
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Fltc.htm [06/10/2008 17.45.36]


Data management instructions: BCDH

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

BCDH

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

BCDH BCD to Hexadecimal conversion Close rung No A

The instruction BCD to Hexadecimal conversion allows to convert the value AccA from BCD format, the
value obtained replaces the value in AccA.

The math accumulator is 32 bit, the grater hexadecimal value is 0xFFFFFFFF equal to a decimal value
greater than the highest number you can express in BCD format 99999999. So the conversion is always
possible.

Examples

In the following example, when I 0000 gets activated, the value 100000 is loaded in AccA, converted in the
hexadecimal vale 0x186A0 and transferred in the operand DW 0000.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpDW(0x0000)=10000;
LODA KD 100000
BCDH
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Bcdh.htm [06/10/2008 17.45.36]


Data management instructions: HBCD

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

HBCD

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

HBCD Hexadecimal to BCD conversion Close rung No A

The instruction Hexadecimal to BCD conversion allows to convert the value AccA from hexadecimal format
to BCD format, the value obtained replaces the value in AccA.

The math accumulator is 32 bit, the grater BCD value is 99999999 equal to a hexadecimal value
0x5F5E0FF. In case of a conversion of a hexadecimal number that is greater than the highest number you
can express, 99999999 will be returned and the flag (F) PLCConvError of the reserved operands gets
activated.

F PLCConvError Attiva se numero da convertire maggiore del massimo numero BCD

Examples

In the following example, when I 0000 gets activated, the hexadecimal value 0x186A0 is loaded in AccA,
converted in a 100000 BCD value and transferred in the operand DW 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
LODA KH 186A0
HBCD
STRA DW 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Hbcd.htm [06/10/2008 17.45.37]


Data management instructions: POPA

ELSIST Srl, www.elsist.it MNL041Q100

Data management instructions

POPA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

POPA POP Accumulator Close rung No A

The instruction POP Accumulator allows to copy the value of AccB to AccA, the previous value of AccA
gets lost. At the end of the instruction execution the two accumulators will have the same values.

Examples

In the following example, when I 0000 gets activated the data of AccB is copied to AccA.

Ladder RIL "C" language


ORGR
LODT I 0000
PULS
POPA

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/DataMng/Popa.htm [06/10/2008 17.45.37]


Mathematical instructions (Fixed): ADDA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

ADDA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

ADDA ADD Accumulators Close rung No A

The instruction ADD Accumulators allows to add the values of the two accumulators, the result replaces the
value in AccA. The instruction executes the operation AccA=AccA+AccB.

Examples

In the following example, when I 0000 is activated, the value of W 0000 is added to the value of W 0002
and the result replaces the value in W 0004. W 0004=(W 0000+W 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)+PLCOpW(0x0002);
LODA W 0002
LODA W 0000
ADDA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Adda.htm [06/10/2008 17.45.37]


Mathematical instructions (Fixed): MULA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

MULA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

MULA MULtiply Accumulators Close rung No A

The instruction MULtiply Accumulators allows to multiply the values of two accumulators, the result replaces
the value in AccA. The instruction executes the operation AccA=AccA*AccB.

Examples

In the following example, when I 0000 is activated the value of W 0000 is multiplied to the value of W 0002
and the result replaces the value in W 0004. W 0004=(W 0000*W 0002)

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)*PLCOpW(0x0002);
LODA W 0002
LODA W 0000
MULA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Mula.htm [06/10/2008 17.45.38]


Mathematical instructions (Fixed): DIVA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

DIVA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

DIVA DIVide Accumulators Close rung No A

The instruction DIVide Accumulators allows to divide the value in AccA (dividend) for the value in AccB
(divisor), the result replaces the value in AccA. The instruction executes the operation AccA=AccA/AccB.

When The value in AccB (divisor) is 0, the instruction returns as a result in AccA the greatest positive
number 0xFFFFFFFF, sets the Flag (F) PLCMathError of the reserved operands and the bit
DivaDivisionZero in the PLCErrors data structure.

F PLCMathError It becomes active if the execution of a mathematical instruction has an error

Examples

In the following example, when I 0000 is activated, the value of W 0000 is divided by the value of W 0002
and the result replaces the value in W 0004. W 0004=(W 0000/W 0002).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpW(0x0004)=PLCOpW(0x0000)/PLCOpW(0x0002);
LODA W 0002
LODA W 0000
DIVA
STRA W 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Diva.htm [06/10/2008 17.45.38]


Mathematical instructions (Fixed): INCA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

INCA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

INCA INCrement Accumulator Close rung KD, KH, KO, KB No A

The instruction INCrement accumulator allows to increase the value in AccA of the value defined by a
Constant (K).

Examples

In the following example, when I 0000 is activated, the value of DW 0000 increases of a unit.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
LODA DW 0000 {
INCA KD 1 OneShot=PLCOpI(0x0000);
STRA DW 0000
if (PLCOpI(0x0000))
PLCOpDW(0x0000)++;
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Inca.htm [06/10/2008 17.45.39]


Mathematical instructions (Fixed): DECA

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Fixed)

DECA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

DECA DECrement Accumulator Close rung KD, KH, KO, KB No A

The instruction DECrement accumulator allows to decrease the value in AccA of the value defined by a
Constant (K).

Examples

In the following example, when I 0000 is activated, the value of DW 0000 is decreased of a unit.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
LODA DW 0000 {
DECA KD 1 OneShot=PLCOpI(0x0000);
STRA DW 0000
if (PLCOpI(0x0000))
PLCOpDW(0x0000)--;
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FixedMath/Deca.htm [06/10/2008 17.45.39]


Mathematical instructions (Float): FADD

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FADD

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FADD Float ADD Accumulators Close rung No A

The instruction ADD Accumulators allows to add the values of the two accumulators, the result replaces the
value in AccA. The instruction executes the operation AccA=AccA+AccB.

Examples

In the following example, when I 0000 is activated, the value of FL 0000 is added to the value of FL 0004
and the result replaces the value in FL 0008. FL 0008=(FL 0000+FL 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0008)=PLCOpFL(0x0000)+PLCOpFL(0x0004);
LODA FL 0004
LODA FL 0000
FADD
STRA FL 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fadd.htm [06/10/2008 17.45.40]


Mathematical instructions (Float): FMUL

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FMUL

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FMUL Float MULtiply Accumulators Close rung No A

The instruction Float MULtiply Accumulators allows to multiply the values of two accumulators, the result
replaces the value in AccA. The instruction executes the operation AccA=AccA*AccB.

Examples

In the following example, when I 0000 is activated the value of FL 0000 is multiplied to the value of FL 0004
and the result replaces the value in FL 0008. FL 0008=(FL 0000*FL 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0008)=PLCOpFL(0x0000)*PLCOpFL(0x0004);
LODA FL 0004
LODA FL 0000
FMUL
STRA FL 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fmul.htm [06/10/2008 17.45.40]


Mathematical instructions (Float): FDIV

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FDIV

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FDIV Float DIVide Accumulators Close rung No A

The instruction Float DIVide Accumulators allows to divide the value in AccA (dividend) for the value in
AccB (divisor), the result replaces the value in AccA. The instruction executes the operation AccA=AccA/
AccB.

When The value in AccB (divisor) is 0, the instruction returns as a result in AccA the greatest positive
number 3.4028233e+38F or negative -3.4028233e+38 according to the value in AccA (dividend), sets the
Flag (F) PLCMathError of the reserved operands and the bit FdivDivisionZero in the PLCErrors data
structure.

Examples

In the following example, when I 0000 is activated, the value of FL 0000 is divided by the value of FL 0004
and the result replaces the value in FL 0008. FL 0008=(FL 0000/FL 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0008)=PLCOpFL(0x0000)/PLCOpFL(0x0004);
LODA FL 0004
LODA FL 0000
FDIV
STRA FL 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fdiv.htm [06/10/2008 17.45.41]


Mathematical instructions (Float): FCHS

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FCHS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FCHS Float CHange Sign accumulator Close rung No A

The instruction Float CHange Sign accumulator changes the sign of the value contained in AccA. If the
value is positive, the instruction changes it in negative and vice versa. You can use the instruction FSGN, to
know the value in AccA.

Examples

In the following example, when I 0000 is activated, the sign of the value FL 0000 is changed and the result
is transferred to FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=PLCOpFL(0x0000)*-1;
LODA FL 0000
FCHS
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fchs.htm [06/10/2008 17.45.41]


Mathematical instructions (Float): FINC

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FINC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FINC Float INCrement accumulator Close rung KF No A

The instruction Float INCrement accumulator allows to increase the value in AccA of the value defined by a
Constant (K).

Examples

In the following example, when I 0000 is activated the value of FL 0000 increases of a unit.

Ladder RIL "C" language


ORGR BOOL OneShot;
LODT I 0000
PULS if (PLCOpI(0x0000) != OneShot)
LODA FL 0000 {
FINC KF 1.000000 OneShot=PLCOpI(0x0000);
STRA FL 0000
if (PLCOpI(0x0000))
PLCOpFL(0x0000)++;
}

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Finc.htm [06/10/2008 17.45.42]


Mathematical instructions (Float): FDEC

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FDEC

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FDEC Float DECrement accumulator Close rung KF No A

The instruction Float DECrement accumulator allows to decrease the value in AccA of the value defined by
a Constant (K).

Examples

In the following example, when I 0000 is activated, the value of FL 0000 is decreased of a unit.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0000)-=1.0;
PULS
LODA FL 0000
FDEC KF 1.000000
STRA FL 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fdec.htm [06/10/2008 17.45.42]


Mathematical instructions (Float): FCLG

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FCLG

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FCLG Float Common LoGaritm Close rung No A

The instruction Float Common LoGaritm calculates the common logarithm of the value present in AccA.
The result replaces the value in AccA.

Examples

In the following example, when I 0000 is activated the logarithm of FL 0000 is calculated and the result
replaces the value in FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=log(PLCOpFL(0x0000));
LODA FL 0000
FCLG
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fclg.htm [06/10/2008 17.45.43]


Mathematical instructions (Float): FPPI

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FPPI

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FPPI Float Push PI Close rung No A

The instruction Float Push PI loads the PiGreco value (3.141592653589) in AccA.

Example

In the following example, when I 0000 is active, the calculation of the circumference of a circle, whose
diameter is in FL 0000, the result replaces the FL 0004. The calculus is: FL 0004=(FL 0000*PiGreco).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=PLCOpFL(0x0000)*3.14;
FPPI
LODA FL 0000
FMUL
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fppi.htm [06/10/2008 17.45.43]


Mathematical instructions (Float): FNLG

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FNLG

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FNLG Float Natural LoGaritm Close rung No A

The instruction Float Natural LoGaritm calculates the natural logarithm of the value present in AccA. The
result replaces the value in AccA.

Examples

In the following example, when I 0000 is activated the natural logarithm of the number in FL 0000 is
calculated and the result replaces the value in FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=nlog(PLCOpFL(0x0000));
LODA FL 0000
FNLG
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fnlg.htm [06/10/2008 17.45.44]


Mathematical instructions (Float): FSIN

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FSIN

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FSIN Float Sine Close rung No A

The instruction Float Sine calculates the sine of the value present in AccA. The result replaces the value in
AccA.

Examples

In the following example, when I 0000 is active the sine of the angle in FL 0000 is calculated and the result
replaces the value in FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=sin(PLCOpFL(0x0000));
LODA FL 0000
FSIN
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fsin.htm [06/10/2008 17.45.44]


Mathematical instructions (Float): FCOS

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FCOS

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FCOS Float COSine Close rung No A

The instruction Float COSine calculates the cosine of the value present in AccA. The result replaces the
value in AccA.

Examples

In the following example, when I 0000 is activated, the cosine of the angle in FL 0000 is calculated and the
result replaces the value in FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=cos(PLCOpFL(0x0000));
LODA FL 0000
FCOS
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fcos.htm [06/10/2008 17.45.44]


Mathematical instructions (Float): FTAN

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FTAN

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FTAN Float TANgent Close rung No A

The instruction Float TANgent calculates the tanget value in AccA. The result replaces the value in AccA.

Examples

In the following example, when you activate I 0000, the tangent of the angle in FL 0000 is calculated and
the result replaces the value in FL 0004.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=tan(PLCOpFL(0x0000));
LODA FL 0000
FTAN
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Ftan.htm [06/10/2008 17.45.45]


Mathematical instructions (Float): FSQR

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FSQR

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FSQR Float SQuare Root Close rung No A

The instruction Float SQuare Root calculates the square root of the value in AccA. The result replaces the
value in AccA.

Examples

In the following example, when I 0000 is active it is calculated the sqaure root of the number in FL 0000 and
the result replaces the value in FL 0008.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0004)=sqrt(PLCOpFL(0x0000));
LODA FL 0000
FSQR
STRA FL 0004

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fsqr.htm [06/10/2008 17.45.45]


Mathematical instructions (Float): FPOW

ELSIST Srl, www.elsist.it MNL041Q100

Mathematical instructions (Float)

FPOW

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

FPOW Float raise to POWer Close rung No A

The instruction Float raise to POWer calculates the power of the value in AccA (AccA AccB). The result
replaces the value in AccA.

Examples

In the following example, when I 0000 is active the value in FL 0000 is powered to the value in FL 0004 and
the result replaces the value in FL 0008. FL 0008=(FL 0000 FL 0004).

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpFL(0x0008)=pow(PLCOpFL(0x0000), PLCOpFL(0x0004));
LODA FL 0004
LODA FL 0000
FPOW
STRA FL 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/FloatMath/Fpow.htm [06/10/2008 17.45.46]


Serial instructions: STXD

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

STXD

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

STXD Serial TX Data Close rung Yes A

The instruction Serial TX Data is to be used every time you want to transmit data to the serial line. When
the instruction is activated, the data in the LSB of AccA is transferred to the serial transmission buffer, to
represent the characters the Ascii code is used. The instruction is referred to the serial line, defined by the
SETV instruction.

Examples

In the following example, if you activate the I 0000, the character A code hex 0x41 is transferred to the
serial line.

Ladder RIL "C" language


ORGR
LODT I 0000
PULS
SETV KE IOSerialPortA
LODA KH 0041
STXD

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Stxd.htm [06/10/2008 17.45.46]


Serial instructions: STXI

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

STXI

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

STXI Serial TX data Immediate Close rung K, KD, KH No A

The instruction Serial TX data Immediate is to be used every time you want to transmit immediate data to
the serial line. When the instruction is activated, the constant operand is transferred to the serial
transmission buffer, to represent the characters the Ascii code is used. The instruction is referred to the
serial line, defined by the SETV instruction.

Examples

In the following example, when I 0000 gets activated, the A character code hex 0x41 is transferred to the
transmission buffer.

Ladder RIL "C" language


ORGR
LODT I 0000
PULS
SETV KE IOSerialPortA
STXI K 0041

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Stxi.htm [06/10/2008 17.45.47]


Serial instructions: SMOD

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

SMOD

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

SMOD Serial MODe Close rung K, KH Yes A

The instruction Serial MODe allows to set the communication parameters of the serial port using a 8 bit
hexadecimal value. Every bit has a specific meaning according to the table below. The instruction is
referred to the serial line, defined by the SETV instruction.

To completely parameterizes the serial line the FbSetSerialPar function block can used.

7 6 5 4 3 2 1 0

Binary Hex Baud

0 0 0 0 0 300
0 0 0 1 1 600
0 0 1 0 2 1200
0 0 1 1 3 2400
0 1 0 0 4 4800
0 1 0 1 5 9600
0 1 1 0 6 19200
0 1 1 1 7 38400
1 0 0 0 8 57600
1 0 0 1 9 76800
1 0 1 0 A 115200
1 0 1 1 B 115200
1 1 0 0 C 115200
1 1 0 1 D 115200
1 1 1 0 E 115200
1 1 1 1 F 115200
0=Parity disabled
1=Parity enabled
0=Odd parity
1=Even parity
0=7 bits data
1=8 bits data
0=Control characters enabled
1=Control characters disabled

For instance, you need to define a binary constant of 10000101, equal to the hexadecimal value of 0x85 to

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Smod.htm (1 of 2) [06/10/2008 17.45.47]


Serial instructions: SMOD

set the serial line at 9600, n, 7, control characters disabled. The serial lines is set as default 19200, e, 8,
control characters disabled.

Examples

In the following example, at the first program loop the serial line A is set at 9600, n, 7, control charcters
disabled. The set made will remain valid until another setting will be executed on the same serial port.

Ladder RIL "C" language


ORGR
LODT F PLCFirstLoop
SETV KE IOSerialPortA
SMOD KH 0085

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Smod.htm (2 of 2) [06/10/2008 17.45.47]


Serial instructions: DTRE

ELSIST Srl, www.elsist.it MNL041Q100

Serial instructions

DTRE

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

DTRE Data Terminal Ready Enable Close rung K, KE No A

The instruction Data Terminal Ready Enable allows to set the type of working of the DTR signal of the serial
port, according to the table below. The DTR signal is available on the serial port connector, it is used to
control the devices connected to the serial line. In target systems that have the RS485 line connected in
multidrop, the DTR signal is used to connect the transmission driver to the line. The instruction is referred to
the serial line, defined by the SETV instruction.

To completely parameterizes the serial line the FbSetSerialPar function block can used.

K KE Funzione

0 Off It sets the DTR signal at the logical level FALSE.


1 On It sets the DTR signal at the logical level TRUE.
2 Auto It sets the DTR signal as automatic working without time interposition. The signal is placed at the
logical level TRUE just before the data transmission, and is placed at the logical level FALSE
immediately after the transmission of the last data.
3 Timed It sets the DTR signal as automatic working with time interposition. Before the data transmission
starts, the signal is placed at the logical level TRUE then the defined delay is waited. After the
transmission of the last data, the defined delay is waited and after the signal is placed at the
logical level FALSE. See the FbSetSerialPar function block to set the times.

Examples

In the following example, at the first program loop the DTR signal is set as automatic working without time
interposition, on the serial port A. The set made will remain valid until another setting will be executed on
the same serial port.

Ladder RIL "C" language


ORGR
LODT F PLCFirstLoop
SETV KE IOSerialPortA
DTRE KE Auto

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Serial/Dtre.htm [06/10/2008 17.45.48]


Program management instructions: LABL

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

LABL

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

LABL LABeL None K, L No A

The instruction LABeL allows to label a section of program with a number or a mnemonic label. You can
reach the label section either with JUMP or with CALL to function instruction if the label defines a function.

Examples

See the instructions JUMP and CALL.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Labl.htm [06/10/2008 17.45.48]


Program management instructions: JUMP

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

JUMP

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

JUMP None JUMP to label Close rung K, L No A

The instruction JUMP to label allows to jump to defined logical blocks of program (rung). The jump depends
on the status of the logical branch before the instruction and it is executed only if it is active. When the
instruction is executed, the logical blocks after the LABL, which the instruction is referred to are immediately
executed, ignoring those between the instruction and the label.

ATTENTION! Jumps to labels on program blocks before the JUMP instruction create close program loops,
that can cause the block of the program.

Examples

In the following example, the status of I 0000 is transferred to O 0000, and if the I 0000 is active the
program execution jumps to the rung where the LABL K 0004 is.

Ladder RIL "C" language


ORGR
LODT I 0000
OUTT O 0000
JUMP K 0004

ORGR
LODT I 0001
OUTT O 0001
JUMP L Label

ORGR
LABL K 0004
SETR
OUTT O 0002

ORGR
LABL L Label
SETR
OUTT O 0003

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Jump.htm [06/10/2008 17.45.49]


Program management instructions: CALL

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

CALL

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CALF None CALL function Close rung K, L No A

The instruction CALL function should be used to calls blocks of program (rung), defined as functions. The
call depends on the status of the logical branch where the instruction is and is executed only if it is active.
When the instruction is active, the block after the LABL, which the instruction is referred to is executed. The
RETN instruction stops the execution of the called function and restore the running of the blocks after the
instruction. You can nesting CALL instructions without any limit.

ATTENTION! All the functions have to be written after a main program termination branch, otherwise they
would be executed as a program part.

The program blocks called by the CALL instruction must be terminated with a RETN instruction, otherwise
the program doesn't run correctly.

The instruction execution doesn't change the status of logic stack.

Examples

In the following example, the status of I 0000 is transferred to O 0000, if the I 0000 is active, the subroutine
K 0004 is executed, it manages the flashing of O 0002. The subroutine terminates with the RETN
instruction.
The status of I 0001 is transferred to O 0001, if the I 0001 is active the subroutine L Label is executed, it
manages the flashing of O 0003. The subroutine terminates with the RETN instruction.

Please note, that if you disable the CALL instructions, the routines are not longer executed, and the logical
outputs them manage, will remain in the status they have.

Ladder RIL "C" language

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Call.htm (1 of 2) [06/10/2008 17.45.50]


Program management instructions: CALL

; Here the "K 0004" routine is called.

ORGR
LODT I 0000
CALL K 0004
OUTT O 0000

; Here the "L Label" routine is called.

ORGR
LODT I 0001
CALL L Label
OUTT O 0001

; Here the main program is ended.

ORGR
SETR
RETN

; Here the "K 0004" routine is defined.

ORGR
LABL K 0004
LODT F PLCTimeBase400
OUTT O 0002

ORGR
SETR
RETN

; Here the "L Label" routine is defined.

ORGR
LABL L Label
LODT F PLCTimeBase800
OUTT O 0003

ORGR
SETR
RETN

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Call.htm (2 of 2) [06/10/2008 17.45.50]


Program management instructions: RETN

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

RETN

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

RETN None RETurN from function Close rung No A

The instruction RETurN from function should be used to define the end of the logical blocks of program
(rung) that form a function. The instruction is also used to define the end of the main program before the
defintion of the subroutines.

Examples

See the instruction CALL.

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Retn.htm [06/10/2008 17.45.50]


Program management instructions: TINE

ELSIST Srl, www.elsist.it MNL041Q100

Program management instructions

TINE

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

K, KH, KD
TINE Temporal INterrupt Enable Close rung No A
K, KH, KD KE

The instruction Temporal INterrupt Enable allows to define the running time of the label function
LABL K 0000, it will be executed on interruption. The range of the time is from 1 to 255 milliseconds. The
Constant (KE) defines the automatic storing of the mathematical operands according to the following table.
The exclusion of the KE operands is equivalent to to the definition KE SaveEnable.

SaveEnable It defines the automatic storing of the mathematical operands. Before execute the function
the mathematical accumulators and the flags F PLCMathError, F PLCConvError, F
PLCLesFlag, F PLCGrtFlag, F PLCEquFlag are saved. It must be used when the executed
function use mathematical instructions.
SaveDisable it disables the saving (for expert users only)

The exclusion of the KE operands is equivalent to to the definition KE SaveEnable.

Expert users: before execute the function the interrupt saves all the microcontroller registers, then
according to the KE operand, the mathematical operands are saved or not. If the function doesn't use any
mathematical instructions, it is possible to exclude it the saving with consequent saving of execution time.

Examples

In the following example, the function LABL K 0000, is automatically executed at every 10 mSec.

Ladder RIL "C" language

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Tine.htm (1 of 2) [06/10/2008 17.45.51]


Program management instructions: TINE

ORGR
SETR
TINE KD 10 KE SaveEnable

; Here the main program is ended.

ORGR
SETR
RETN

; This routine is called every 10 mSec.

ORGR
LABL K 0000
SETR
LODA W 0000
INCA KD 1
STRA W 0000
RETN

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/ProgramMng/Tine.htm (2 of 2) [06/10/2008 17.45.51]


Utility instructions: CMPA

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

CMPA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

CMPA CoMPress Accumulator Close rung F, I, O No A

The instruction CoMPress Accumulator allows the transfer of the operand byte and of the 7 operands with
adjoining address in the 8 LSB bits of AccA. When the instruction is active the bit 0 of the addressed
operand it's transferred to the bit 0 of AccA, the bit 0 of the operand with the next address it's transferred to
the bit 1 and so on until the transfer of all the 8 operands.

This instruction is a useful completion to the IOAQ, indeed it allows to join 8 operands in a single byte to be
transferred to the hardware device.

Examples

In the following example, when I 0000 gets activated, the status of the 8 inputs is transferred to LSB of
AccA, if the inputs are in the status shown after the transfer the AccA will has the value 0xAA.

"C"
Ladder RIL
language
ORGR
LODT I 0000
CMPA I 0008

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Cmpa.htm [06/10/2008 17.45.51]


Utility instructions: EXPA

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

EXPA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

EXPA EXPand Accumulator Close rung F, I, O No A

The instruction EXPand Accumulator allows the transfer of the 8 bits of LSB of AccA, in the operand byte
and in the successive 7 operands with adjoining address. When the instruction is active the bit 0 of AccA is
transferred to the bit 0 of the operand, the bit 1 is transferred to the bit 0 of the operand with the next
address and so on until the transfer of all the 8 bits.

This instruction is a useful completion to the IOAQ, it allows after the reading of a byte value from the
hardware device to transfer it to 8 operands.

Examples

In the following example, when I 0000 gets activated, the data 0x55 contained in AccA is transferred to the
8 byte of output.

"C"
Ladder RIL
language
ORGR
LODT I 0000
LODA KH 0055
EXPA O 0000

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Expa.htm [06/10/2008 17.45.52]


Utility instructions: IOAQ

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

IOAQ

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

IOAQ I/O AcQuisition Close rung K No A

The instruction I/O AcQuisition allows the direct access to the hardware structure allowing the the fast logic I/O
management in the interruption subroutines. Using this instruction it's possible to read the logic inputs and to write
the logic outputs directly independently from process image. The instruction can address all the hardware that can be
addressed by the CPU, allowing the management of any peripherals connected to the BUS.

ATTENTION! The instruction has the access to all the hardware structure, so accesses to areas that are not
documented can cause program crash.

Examples

In the following example, when I 0000 gets activated, the data 0x55 is transferred to the 8 byte of logic outputs.

"C"
Ladder RIL
language
ORGR
LODT I 0000
LODA KH 0055
IOAQ K 0100

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Ioaq.htm [06/10/2008 17.45.52]


Utility instructions: MOVM

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

MOVM

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

I, O, F, C I, O, F, C
Y I, O, F, C, Y
MOVM MOVe Memory Close rung W I, O, F, C, Y, W No A
DW I, O, F, C, Y, W, DW
FL FL

The instruction MOVe Memory allows the transfer of the value of the second operand to the first one.

Examples

In the following example, when I 0000 gets activated, the value of the byte Y 0001 is transferred to the byte
Y 0000.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpY(0x0000)=PLCOpY(0x0001);
MOVM Y 0000 Y 0001

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Movm.htm [06/10/2008 17.45.53]


Utility instructions: MOVA

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

MOVA

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

MOVA MOVe Address Close rung W I, O, F, Y, W, DW, FL, L No A

The instruction MOVe Address allows the transfer of the address of the second operand to the first one. All
the addresses of the operands are considered as numbers in 16 bits (Range 0x0000-0xFFFF), so the
destination operand is always a Word (W).

ATTENTION! The instruction loads the address of the second operand in the first one but not its value, to
transfer the value you need to use the MOVM instruction.

Examples

In the following example, when I 0000 gets activated, the value of the byte address Y 0010 is transferred to
the word W 0000.

Ladder RIL "C" language


ORGR
LODT I 0000
MOVA W 0000 Y 0010

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Mova.htm [06/10/2008 17.45.53]


Utility instructions: MOVI

ELSIST Srl, www.elsist.it MNL041Q100

Utility instructions

MOVI

Operands
RIL Symbol Description Function Puls
1st 2nd 3rd

I, O, F, C, Y, W, DW K, KD, KB, KH, KO


MOVI MOVe Immediate Close rung No A
FL KF

The instruction MOVe Immediate allows the transfer of the value of the second operand to the first one.

Examples

In the following example, when I 0000 gets activated, the value 10 is transferred to the word W 0000.

Ladder RIL "C" language


ORGR if (PLCOpI(0x0000))
LODT I 0000 PLCOpY(0x0000)=10;
MOVI Y 0000 KD 10

http://192.168.0.61/Destination/Html/RILLanguage/Instructions/Utility/Movi.htm [06/10/2008 17.45.53]


HT001

ELSIST Srl, www.elsist.it MNL041Q100

How to

Make network MODBUS Ascii

It is described hot possible it is to make a network MODBUS ASCII between a master system where the function
block FbModbusAsciiMs is made and two or more slave systems where the function block FbModbusAsciiSl is made. The
master system and the slave systems authomatically exchange between themselves memory banks. To test its working you need
to connect the master system with two slave systems on which a program that manages the function block FbModbusAsciiSl must
be executed.

RIL example

; ------------------------------------------------------------------------------
; @Section("Communication buffer")
; ------------------------------------------------------------------------------
; Here define the data buffer to communicate with the slave 0 system.

DEFL Y ToSlave0 KD 4
DEFL Y S0Y0000 Y ToSlave0 KD 0 ;ToSlave0, Y 0000
DEFL Y S0Y0001 Y ToSlave0 KD 1 ;ToSlave0, Y 0001
DEFL W S0W0002 Y ToSlave0 KD 2 ;ToSlave0, W 0002

DEFL Y FromSlave0 KD 2
DEFL Y S0Y0004 Y FromSlave0 KD 0 ;FromSlave0, Y 0004
DEFL Y S0Y0005 Y FromSlave0 KD 1 ;FromSlave0, Y 0005

; Here define the data buffer to communicate with the slave 1 system.

DEFL Y ToSlave1 KD 2
DEFL Y S1Y0000 Y ToSlave1 KD 0 ;ToSlave1, Y 0000
DEFL Y S1Y0001 Y ToSlave1 KD 1 ;ToSlave1, Y 0001

DEFL Y FromSlave1 KD 4
DEFL Y S1Y0002 Y FromSlave1 KD 0 ;FromSlave1, Y 0002
DEFL Y S1Y0003 Y FromSlave1 KD 1 ;FromSlave1, Y 0003
DEFL W S1W0004 Y FromSlave1 KD 2 ;FromSlave1, W 0004

; ------------------------------------------------------------------------------
; @Section("Local variables definition")
; ------------------------------------------------------------------------------
; FbSetSerialPar function block, data structure.

DEFL Y SetS KD 16
DEFL Y SetSMode Y SetS KH 0000 ; SetS.Mode
DEFL Y SetSBaud Y SetS KH 0001 ; SetS.Baud
DEFL Y SetSDTRMng Y SetS KH 0002 ; SetS.DTRMng
DEFL W SetSDTROnTime Y SetS KH 0004 ; SetS.DTROnTime
DEFL W SetSDTROffTime Y SetS KH 0006 ; SetS.DTROffTime

; FbModbusAsciiMs function block, data structure.

DEFL Y Mdb KD 64
DEFL Y MdbCommand Y Mdb KH 0000 ;Mdb.Command
DEFL Y MdbStatus Y Mdb KH 0001 ;Mdb.Status
DEFL Y MdbNodeAdd Y Mdb KH 0002 ;Mdb.NodeAdd
DEFL W MdbWrLcStAd Y Mdb KH 0004 ;Mdb.WrLcStAd
DEFL W MdbWrRmStAd Y Mdb KH 0006 ;Mdb.WrRmStAd
DEFL Y MdbWrBytes Y Mdb KH 0008 ;Mdb.WrBytes
DEFL W MdbRdLcStAd Y Mdb KH 000A ;Mdb.RdLcStAd
DEFL W MdbRdRmStAd Y Mdb KH 000C ;Mdb.RdRmStAd
DEFL Y MdbRdBytes Y Mdb KH 000E ;Mdb.RdBytes
DEFL W MdbCommndWt Y Mdb KH 0010 ;Mdb.CommndWt
DEFL W MdbTimeOutCk Y Mdb KH 0012 ;Mdb.TimeOutCk
DEFL W MdbRxTimeout Y Mdb KH 0014 ;Mdb.RxTimeout
DEFL W MdbTimeouts Y Mdb KH 0016 ;Mdb.Timeouts
DEFL W MdbOverruns Y Mdb KH 0018 ;Mdb.Overruns
DEFL W MdbCommErrs Y Mdb KH 001A ;Mdb.CommErrs

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (1 of 8) [06/10/2008 17.45.58]


HT001

DEFL W MdbTxFrames Y Mdb KH 001C ;Mdb.TxFrames


DEFL W MdbRxFrames Y Mdb KH 001E ;Mdb.RxFrames
DEFL W MdbPLCMemStart Y Mdb KH 0020 ;Mdb.PLCMemStart
DEFL Y MdbFrameLength Y Mdb KH 0023 ;Mdb.FrameLength
DEFL W MdbFrameBuf Y Mdb KH 0024 ;Mdb.FrameBuf

; Rx/Tx frame buffer definition.

DEFL Y FrameBuf KD 40

; Here all the local variables are defined.

DEFL F CommOk ;Communication with node ok


DEFL F CommError ;Communication with node error
DEFL Y NodeSequencer ;Slave nodes sequencer
DEFL Y LastNode ;Last node to communicate
DEFL W Node0CommOk ;Node 0 comm ok counter
DEFL W Node0CommError ;Node 0 comm error counter
DEFL W Node1CommOk ;Node 1 comm ok counter
DEFL W Node1CommError ;Node 1 comm error counter

; ------------------------------------------------------------------------------
; @Section("Program init")
; ------------------------------------------------------------------------------
; Local variables init.

ORGR
LODT F PLCFirstLoop
MOVI Y LastNode K 0001 ;Last node to communicate
MOVM Y NodeSequencer Y LastNode ;Slave nodes sequencer

; Here the serial parameters "19200, e, 8" are set on the serial port "A".
; Please note the set of the "EchoFlush" bit to avoid echo.

UTCH Y SetSMode BH 0000 ;SetS.Mode.DTRComplement


LTCH Y SetSMode BH 0001 ;SetS.Mode.EchoFlush
LTCH Y SetSMode BH 0002 ;SetS.Mode.RxCtrlDisable
LTCH Y SetSMode BH 0003 ;SetS.Mode.ParityEnabled
LTCH Y SetSMode BH 0004 ;SetS.Mode.ParityType
LTCH Y SetSMode BH 0005 ;SetS.Mode.BitNumber
UTCH Y SetSMode BH 0006 ;SetS.Mode.WaitLoop
MOVI Y SetSBaud KD 6 ;SetS.Baud
MOVI Y SetSDTRMng KD 2 ;SetS.DTRMng
MOVI W SetSDTROnTime KD 0 ;SetS.DTROnTime
MOVI W SetSDTROffTime KD 0 ;SetS.DTROffTime
SETV KE IOSerialPortA
TASK L FbSetSerialPar Y SetS ;Set serial parameters

; FbModbusAsciiMs, variables settings.

MOVI W MdbCommndWt KD 1 ;Mdb.CommndWt


MOVI W MdbTimeOutCk KD 500 ;Mdb.TimeOutCk
MOVI W MdbRxTimeout KD 500 ;Mdb.RxTimeout
MOVI Y MdbFrameLength KD 40 ;Mdb.FrameLength
MOVA W MdbFrameBuf Y FrameBuf ;Mdb.FrameBuf
LTCH Y MdbCommand BD 1 ;Mdb.Command.ResetCtrs

; ------------------------------------------------------------------------------
; @Section("Node sequencer management")
; ------------------------------------------------------------------------------
; Slave nodes sequencer increment.

ORGR
LODT F PLCFirstLoop
ORLT F CommOk ;Communication with node ok
ORLT F CommError ;Communication with node error
INCO Y NodeSequencer ;Slave nodes sequencer

; The command enable is disabled for a program loop to reset the status bits, so
; if any error bit in the "MdbStatus" is set it will be reset.

UTCH Y MdbCommand K 0000 ;Command.Enable

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (2 of 8) [06/10/2008 17.45.58]


HT001

MCRS

; Last node control.

ORGR
GRTC Y NodeSequencer Y LastNode ;Slave nodes sequencer
MOVI Y NodeSequencer KD 0 ;Slave nodes sequencer

; ------------------------------------------------------------------------------
; @Section("Slave node 0, communication parameter settings")
; ------------------------------------------------------------------------------
; A memory buffer of 6 bytes that starts at "ToSlave0" address in the master is
; sent to the slave 0 node and data is stored from Y 0000 to Y 0003.
;
; +--------------------+ +-------------+
; ToSlave0 | To slave node 0 | -- | From master | Y 0000 - Y 0003
; FromSlave0 | From slave node 0 | -- | To master | Y 0004 - Y 0005
; +--------------------+ +-------------+

ORGR
EQUC Y NodeSequencer KD 0 ;Slave nodes sequencer
MOVI Y MdbNodeAdd KD 0 ;Mdb.NodeAdd

MOVA W MdbWrLcStAd Y ToSlave0 ;Mdb.WrLcStAd


MOVI W MdbWrRmStAd K 0000 ;Mdb.WrRmStAd
MOVI Y MdbWrBytes K 0004 ;Mdb.WrBytes

MOVA W MdbRdLcStAd Y FromSlave0 ;Mdb.RdLcStAd


MOVI W MdbRdRmStAd K 0004 ;Mdb.RdRmStAd
MOVI Y MdbRdBytes K 0002 ;Mdb.RdBytes

MOVI W MdbPLCMemStart KH E300 ;Mdb.PLCMemStart

; ------------------------------------------------------------------------------
; @Section("Slave node 1, communication parameter settings")
; ------------------------------------------------------------------------------
; A memory buffer of 6 bytes that starts at "ToSlave1" address in the master is
; sent to the slave 1 node and data is stored from Y 0000 to Y 0007.
;
; +--------------------+ +-------------+
; ToSlave1 | To slave node 1 | -- | From master | Y 0000 - Y 0001
; FromSlave1 | From slave node 1 | -- | To master | Y 0002 - Y 0005
; +--------------------+ +-------------+

ORGR
EQUC Y NodeSequencer KD 1 ;Slave nodes sequencer
MOVI Y MdbNodeAdd KD 1 ;Mdb.NodeAdd

MOVA W MdbWrLcStAd Y ToSlave1 ;Mdb.WrLcStAd


MOVI W MdbWrRmStAd K 0000 ;Mdb.WrRmStAd
MOVI Y MdbWrBytes K 0002 ;Mdb.WrBytes

MOVA W MdbRdLcStAd Y FromSlave1 ;Mdb.RdLcStAd


MOVI W MdbRdRmStAd K 0002 ;Mdb.RdRmStAd
MOVI Y MdbRdBytes K 0004 ;Mdb.RdBytes

MOVI W MdbPLCMemStart KH E300 ;Mdb.PLCMemStart

ORGR
MCRE

; ------------------------------------------------------------------------------
; @Section("MODBUS communication, master management")
; ------------------------------------------------------------------------------
; FbModbusAsciiMs, management.

ORGR
SETR
SETV KE IOSerialPortA
TASK L TermIOTick
TASK L FbModbusAsciiMs Y Mdb ;MODBUS master management
LTCH Y MdbCommand K 0000 ;Command.Enable

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (3 of 8) [06/10/2008 17.45.58]


HT001

LTCH Y MdbCommand K 0006 ;Command.Write/read memory bytes

; Communication with node ok set.

ORGR
LODT Y MdbStatus K 0001 ;Status.Command executed
OUTT F CommOk ;Communication with node ok

; Communication with node error set.

ORGR
LODT Y MdbStatus K 0004 ;Status.Timeouts
ORLT Y MdbStatus K 0005 ;Status.Overruns
ORLT Y MdbStatus K 0006 ;Status.CommErrs
ORLT Y MdbStatus K 0007 ;Status.Parameters
OUTT F CommError ;Communication with node error

; ------------------------------------------------------------------------------
; @Section("Slave node 0, communication counters management")
; ------------------------------------------------------------------------------
; The communication ok counter is managed.

ORGR
EQUC Y NodeSequencer KD 0 ;Slave nodes sequencer
ANDT F CommOk ;Communication with node ok
INCO W Node0CommOk ;Node 0 comm ok counter

; The communication error counter is managed.

ORGR
EQUC Y NodeSequencer KD 0 ;Slave nodes sequencer
ANDT F CommError ;Communication with node error
INCO W Node0CommError ;Node 0 comm error counter

; ------------------------------------------------------------------------------
; @Section("Slave node 1, communication counters management")
; ------------------------------------------------------------------------------
; The communication ok counter is managed.

ORGR
EQUC Y NodeSequencer KD 1 ;Slave nodes sequencer
ANDT F CommOk ;Communication with node ok
INCO W Node1CommOk ;Node 1 comm ok counter

; The communication error counter is managed.

ORGR
EQUC Y NodeSequencer KD 1 ;Slave nodes sequencer
ANDT F CommError ;Communication with node error
INCO W Node1CommError ;Node 1 comm error counter

; [End of file]

"C" example

#include <ElSystemLib.h>
#include <ElPLCLib.h>
#include <FbModbusAsciiMs.h>

// -----------------------------------------------------------------------------
// GENERAL DEFINITIONS
// -----------------------------------------------------------------------------

#define NODES 2 //Number of nodes to manage


#define MDBFRAMELENGTH 40 //Modbus frame length

// -----------------------------------------------------------------------------
// DATA BUFFER DEFINITIONS
// -----------------------------------------------------------------------------
// Here define the data buffer to communicate with the slave 0 system.

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (4 of 8) [06/10/2008 17.45.58]


HT001

struct
{
struct
{
unsigned char Byte0; //To slave system, byte 0
unsigned char Byte1; //To slave system, byte 1
unsigned int Word2; //To slave system, word 2
}ToSlave; //Data buffer to slave

struct
{
unsigned char Byte0; //From slave system, byte 0
unsigned char Byte1; //From slave system, byte 1
}FromSlave; //Data buffer from slave
}Slave0;

// Here define the data buffer to communicate with the slave 1 system.

struct
{
struct
{
unsigned char Byte0; //To slave system, byte 0
unsigned char Byte1; //To slave system, byte 1
}ToSlave; //Data buffer to slave

struct
{
unsigned char Byte0; //From slave system, byte 0
unsigned char Byte1; //From slave system, byte 1
unsigned int Word2; //From slave system, word 2
}FromSlave; //Data buffer from slave
}Slave1;

// -----------------------------------------------------------------------------
// GLOBAL VARIABLE DEFINITIONS
// -----------------------------------------------------------------------------
// Here all the global variables are defined.

unsigned int NodesCommOk[NODES]; //Nodes comm ok counter


unsigned int NodesCommError[NODES]; //Nodes CommError counter

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// -------------------------------------------------------------------------
// SLAVE NODE PARAMETERS
// -------------------------------------------------------------------------
// Here the slave node parameters are defined.
// By changing the values loaded in this data structure, the communication
// parameters can be set for any slave node for the desired requirements.

static code struct


{
unsigned char CmdToExecute; //Comand to execute (0:Write, 1:Read, 2:Write/Read)
unsigned char NodeAdd; //Node address

unsigned int WrLcStAd; //Master send data start address


unsigned int WrRmStAd; //Slave receive data start address
unsigned char WrBytes; //Number of bytes to send

unsigned int RdLcStAd; //Master receive data start address


unsigned int RdRmStAd; //Slave send data start address
unsigned char RdBytes; //Number of bytes to receive

unsigned int PLCMemStart; //Start PLC memory


}NodePar[NODES]=
{

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (5 of 8) [06/10/2008 17.45.58]


HT001

// -----------------------------------------------------[Slave node 0]--

{
0x02, //Comand to execute (0:Write, 1:Read, 2:Write/Read)
0x00, //Node address

(unsigned int)&Slave0.ToSlave, //Master send data start address


0x0000, //Slave receive data start address
sizeof(Slave0.ToSlave), //Number of bytes to send

(unsigned int)&Slave0.FromSlave, //Master receive data start address


0x0004, //Slave send data start address
sizeof(Slave0.FromSlave), //Number of bytes to receive

0xE300, //Start PLC memory


},

// -----------------------------------------------------[Slave node 1]--

{
0x02, //Comand to execute (0:Write, 1:Read, 2:Write/Read)
0x01, //Node address

(unsigned int)&Slave1.ToSlave, //Master send data start address


0x0000, //Slave receive data start address
sizeof(Slave1.ToSlave), //Number of bytes to send

(unsigned int)&Slave1.FromSlave, //Master receive data start address


0x0004, //Slave send data start address
sizeof(Slave1.FromSlave), //Number of bytes to receive

0xE300, //Start PLC memory


}
};

// Local variable definitions.

static BOOL CommOk; //Communication with node ok


static BOOL CommError; //Communication with node error
static unsigned char NodeNr; //Node sequencer
SERIALSTRUCT SerialStruct; //Serial communication data structure
static unsigned char FrameBuf[MDBFRAMELENGTH]; //Rx/Tx frame buffer
static FBMODBUSASCIIMSDATA Mdb; //MODBUS master data structure

// -------------------------------------------------------------------------
// PROGRAM INIT
// -------------------------------------------------------------------------
// Here define the serial line must be used.

SetTermIOVectors(IOSerialPortA);
TermIOTick(); //Execute the tick

// Execute the system init at first program execution loop.

if (PLCFirstLoop)
{
// Local variables init.

NodeNr=NODES; //Node sequencer

// Set the serial communication on defined port at 19200, e, 8, 1.


// Please note the set of the "EchoFlush" bit to avoid echo.

GetSerialMode(&SerialStruct); //get communication mode


SerialStruct.Mode.DTRComplement=FALSE; //Complement the DTR signal
SerialStruct.Mode.EchoFlush=TRUE; //Flush the echo
SerialStruct.Mode.DTRManagement=2; //Define the DTR management
SerialStruct.Mode.RxCtrlDisable=TRUE; //Disable Rx control characters
SerialStruct.Mode.BitNumber=TRUE; //FALSE:7 bit, TRUE:8 bit
SerialStruct.Mode.ParityEnabled=TRUE; //Enables the parity management
SerialStruct.Mode.ParityType=TRUE; //FALSE:Odd parity, TRUE:Even parity
SerialStruct.Mode.WaitLoop=FALSE; //FALSE:No wait, TRUE:Wait

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (6 of 8) [06/10/2008 17.45.58]


HT001

SerialStruct.Mode.Baud=6; //Baud rate


SerialStruct.DTROnTime=0; //DTR On wait time
SerialStruct.DTROffTime=0; //DTR Off delay time
SetSerialMode(&SerialStruct); //set communication mode

// Set variables to manage the MODBUS master communication.

Mdb.CommndWt=1; //Wait time before start (mSec)


Mdb.TimeOutCk=500; //Timeout Check (mSec)
Mdb.FrameLength=MDBFRAMELENGTH; //Rx/Tx frame length
Mdb.FrameBuf=&FrameBuf; //Rx/Tx frame buffer
Mdb.Command.ResetCtrs=TRUE; //Resets all the counters
}

// -------------------------------------------------------------------------
// NODES SEQUENCER MANAGEMENT
// -------------------------------------------------------------------------
// Increment the node sequencer and set the "FbModbusAsciiMs" parameters.

if (PLCFirstLoop|CommOk|CommError)
{
Mdb.Command.Enable=FALSE; //Enable

// Node sequencer increment.

if (NodeNr++ >= NODES-1)


NodeNr=0; //Node sequencer

// Here set the command to execute.

switch (NodePar[NodeNr].CmdToExecute)
{
case 0:
Mdb.Command.DoWrite=TRUE; //Write memory bytes
break;

case 1:
Mdb.Command.DoRead=TRUE; //Read memory bytes
break;

case 2:
Mdb.Command.DoWrRd=TRUE; //Write/read memory bytes
break;
}

// Here the communication parameters are set.

Mdb.NodeAdd=NodePar[NodeNr].NodeAdd; //Node address

Mdb.WrLcStAd=NodePar[NodeNr].WrLcStAd; //Master send data start address


Mdb.WrRmStAd=NodePar[NodeNr].WrRmStAd; //Slave receive data start address
Mdb.WrBytes=NodePar[NodeNr].WrBytes; //Number of bytes to send

Mdb.RdLcStAd=NodePar[NodeNr].RdLcStAd; //Master receive data start address


Mdb.RdRmStAd=NodePar[NodeNr].RdRmStAd; //Slave send data start address
Mdb.RdBytes=NodePar[NodeNr].RdBytes; //Number of bytes to receive

Mdb.PLCMemStart=NodePar[NodeNr].PLCMemStart; //Start PLC memory


}

// -------------------------------------------------------------------------
// MODBUS MASTER COMMUNICATION
// -------------------------------------------------------------------------
// FbModbusAsciiMs communication call.

FbModbusAsciiMs(&Mdb); //MODBUS master management


Mdb.Command.Enable=TRUE; //Enable

// Communication with node ok management.

if (CommOk=Mdb.Status.JobDone)
NodesCommOk[NodeNr]++; //Nodes comm ok counter

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (7 of 8) [06/10/2008 17.45.58]


HT001

// Communication with node error management.

if (CommError=(Mdb.Status.Timeouts|Mdb.Status.Overruns|Mdb.Status.CommErrs|Mdb.Status.Parameters))
NodesCommError[NodeNr]++; //Nodes CommError counter
}

// [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT001.htm (8 of 8) [06/10/2008 17.45.58]


HT003

ELSIST Srl, www.elsist.it MNL041Q100

How to

Execute the average of a value

By using a simple mathematic function it is possible to execute the average on a value. This possibility is very
useful in the cases in which for example it is acquired an analogic value that presents some ripple, by using the
function you will be able to obtain the average value. The used function is: Average=((Value-Average)/
Coefficient)+Average. If Coefficient has value 1 you have no average of the value, while by increasing the
value you obtain average effect always more accentuated.

WARNING! The value Coefficient cannot take values lower than 1.

Example RIL

The reported example executes the average of the value FL Value by using as coefficient FL Coefficent and
returns the averaged value in FL Average.

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------

DEFG FL ValueToMediate ; Value to mediate


DEFG FL Average ; Average value
DEFB FL Coefficent ; Average coefficent

; ------------------------------------------------------------------------------
; @Section("Mediate the value")
; ------------------------------------------------------------------------------
; Average=((ValueToMediate-Average)/Coefficent)+Average.

ORGR
SETR
LODA FL Average ; Average value
LODA FL ValueToMediate ; Value to mediate
FSUB
LODA FL Coefficent ; Average coefficent
XCHA
FDIV
LODA FL Average ; Average value
FADD
STRA FL Average ; Average value

; [End of file]

Ecample "C"

The reported example executes the average of the value float ValueToMediate by using as coefficient
float Coefficent and returns the averaged value in float Average.

http://192.168.0.61/Destination/Html/HowTo/HT003.htm (1 of 2) [06/10/2008 17.45.58]


HT003

#include <ElSystemLib.h>

// -----------------------------------------------------------------------------
// Global variables definition.
// -----------------------------------------------------------------------------

float ValueToMediate; //Value to mediate


float Average; //Average value
float Coefficent; //Average coefficent

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------

void Example(void)
{
// Average=((ValueToMediate-Average)/Coefficent)+Average.

Average+=((ValueToMediate-Average)/Coefficent); //Average value


}

// [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT003.htm (2 of 2) [06/10/2008 17.45.58]


HT005

ELSIST Srl, www.elsist.it MNL041Q100

How to

Modify the target device

One of the most important peculiarity of Remoter is the easyness of migration of a project between the
different target systems, making it posssible to adapt easily a project on different targets in function of one's
own needs. To migrate a project from a target system to anothe, you need after having opened the project
define its new settings, choose the Settings voice from the Project menu, or place yourself with the mouse
on the project icon and with the right key select the Settings option , a window that will lead you between
all the needed settings will open.

The first window that will open will show the target device currently selected.

http://192.168.0.61/Destination/Html/HowTo/HT005.htm (1 of 3) [06/10/2008 17.45.59]


HT005

At this point you will need to select with the mouse the new hardware device desired. It is important to
define correctly the target device, so an image of the selected device is presented. However to avoid errors
we remind you to check the code reported on the identification label of the product,the presence of the
asterisks indicates that whatever number or letter appears in that position it is valid anyway.

Selected the new device by pressing the Next key, a message is shown that reminds us that the hardware
device has been modified and that all the other settings will be set at their default values requesting a
further confirmation.

http://192.168.0.61/Destination/Html/HowTo/HT005.htm (2 of 3) [06/10/2008 17.45.59]


HT005

By corfirming you will procede in the settings of all the other project settings so as indicated in the related
chapter.

Normally it will be enough to confirm all the advised settings by pressing the Next key, until you end all the
requested settings. At this point it will be possible to recompile the project and transfer it on the new target
system.

http://192.168.0.61/Destination/Html/HowTo/HT005.htm (3 of 3) [06/10/2008 17.45.59]


HT006

ELSIST Srl, www.elsist.it MNL041Q100

How to

Add a library in Remoter

To compile the Remoter projects use a series of libraries that are provided with the installation. System
libraries, PLC libraries, libraries for the management of the functions blocks , libraries for particular uses
exist.

The addition libraries are provided in a zip file that contains a directory (Named with the library code), in
which inside all the files that make up the library will be.

To install a new version of an existing library and/or to install a new library, you need to copy the provided
library directory, in the installation directory of the Remoter program, in the Lib directory, in the compiler
directory for which the library is made, we remind you that the only compiler currently supported is the
Raisonance compiler.

Ended the copy the new library will be available in the libraries list and will be able to be included in the
project by the definition panel of the libraries.

http://192.168.0.61/Destination/Html/HowTo/HT006.htm [06/10/2008 17.46.00]


HT007

ELSIST Srl, www.elsist.it MNL041Q100

How to

Test a GSM MODEM

To test a GSM MODEM you need to connect the MODEM to the PC


serial line by using a MODEM cable (Example our Cbl058*300),
activate from Remoter the terminal emulation utility, set the number
of serial line and the related communication parameters, typically
"9600,n,8,1".

Here follow the string to digit on the terminal to do the working tests of
the MODEM.

Figure 1

Connection test with MODEM


It permits to check if the connection with the MODEM works correctly. If the MODEM receives the
command strings from the serial line and if it transfers the strings of answer.
1 Send some commands "AT" followed by return.
At every command received the MODEM answers "OK".

PIN code unlock


If the SIM card has the PIN code enabled, before to operate it's necessary to unlock the SIM by
sending the correct PIN code.
1 Send the command "+CPIN=<pin>" followed by return.
If the PIN is correct the MODEM answers "OK".
MODEM init
It permits to initialize the MODEM by setting the correct working settings.
1 Send the command "AT&F" followed by return, to set the default profile.
The MODEM answers "OK".
2 Send the command "AT+CMGF=1" followed by return, to set the SMS messages in text mode.
The MODEM answers "OK".
3 Send the command "AT+CNMI=3,1,0,0,1" followed by return, to set the new received SMS
message indication.
The MODEM answers "OK".

Check camp
It permits to check the level of GSM signal available, the answer string from the MODEM reports two
values.
aa: It indicates the value of the camp intensity, values lower than 9 indicates a scarce reliability of the
connection.
b: It indicates an error status, the value must not exceed the 3.

http://192.168.0.61/Destination/Html/HowTo/HT007.htm (1 of 5) [06/10/2008 17.46.02]


HT007

1 Send the command "AT+CSQ" followed by return.


The MODEM answers "+CSQ: aa,b".
2 By sending the command "AT+CSQ=?" followed by return.
The MODEM answers "+CSQ: (0-31),(0-7)". The numbers in the brackets represent the ranges
defined for the intensity of camp aa and for the error b.

Send SMS message


It permits to check the transmission of an SMS message.
1 Send the command "AT+CMGS=+39nnn" followed by return (nnn is the number to which send
the SMS).
The MODEM answers ">".
2 Digit the text of the message to be sent.
3 End the message with the command "CTRL Z". The message is sent.
The MODEM answers "+CMGS: nnn" (nnn is a progressive number that increases at every
message sent).

Receive a SMS message


It permits to check the reception of an SMS message.
1 Wait for the reception of a message, the MODEM returns a string like "+CMTI: "SM", 1", the
number represents the message location in the memory.
To simplify management it's suggested to always leave the memory location "1" free, in this way the
received message will come always stored in this location.
2 Send the command "AT+CMGR=1" followed by return (1 is the memory location from which the
message will be read).
3 The MODEM answers "+CMGR: "REC UNREAD", "+39nnnnnn", "04/09/14, 15:39:39+08"\rThis
is the message\r\rOK" (nnn it is the telephone number from which the message has been sent and
it's followed by the date and time of sending, in the "yy/mm/dd, hh:mm:ss" format).
4 Send the command "AT+CMGD=1" followed by return (1 is the memory location to be deleted).

Data call
It permits to execute a data connection with another MODEM both GSM or PSTN.
Warning! if the number called belongs to a digital line (GSM or ISDN) the possibility of the called
device to answer a dates call is checked automatically and in the case it is not possible the MODEM
aborts the call by returning the string NO CARRIER.
The data call is possible only if your SIM is enabled to a data traffic, otherwise it will be
originated a voice call.
1 Send the command "ATD nnn" followed by return (nnn is the number to call comprehensive of
prefix).
When the number called answers the negotiation of the connection speed starts at which end the
MODEM answers "CONNECT".

Voice call
It permits to execute a voice connection with a telephone both GSM and analog one connected to the
telephone network commuted. The difference from a dates call is indicated by the character";" located
after the number to call.
1 Send the command "ATD nnn;" followed by return (nnn is the number to call comprehensive of
prefix).
The MODEM answers "OK".

http://192.168.0.61/Destination/Html/HowTo/HT007.htm (2 of 5) [06/10/2008 17.46.02]


HT007

Answer to a data call


It permits to answer to a dates call coming in.
The answer to a data call is possible only if your SIM is enabled to a data traffic, otherwise a
voice answer is executed.
1 Wait for the call, the MODEM returns the string "RING".
2 Send the command "ATA" followed by return.
The negotiation of the connection speed starts at which end the MODEM answers
"CONNECT".

End dates connection


It permits to interrupt a dates connection both in calling and answering a call.
1 Sent the string "CONNECT" of happened connection, the MODEM stands in dates mode. All the
dates received from the serial line are sent to the remote MODEM, to return in command mode
send the command "+++".
The MODEM answers "OK".
2 Send the command "ATH0" followed by return.
The MODEM interrupts the communication to the remote system and answers "OK".

GSM modem notes


We add some notes that can be useful in the use of a GSM modem, we remind you that some features
reported is not available on all of the models present in commerce.
a) It's possible to decrease the speed negotiation time on the connection, in both the modems the
command "AT+CBST=71, 0, 1" followed by return must be sent.
b) Could be necessary, for example by using Remoter to have to dial the number with the terminal
emulation utility, and then to switch to the program debug after the connection. To avoid the
modem loses the connection in the switch due the DTR signal deactivation, it's possible to set the
modem to ignore this signal, send the command "AT&D0" followed by return.

GPRS modem notes


Even the GPRS modems are very like to the GSM modems, they presents some additional commands
that can vary in function of the model.
a) In some models it's enabled by default the auto answer independently from the setting of the the S0
register. To disable this function the command "AT#CID=[DATA]ENABLED=5" followed by return
must be sent.

MODEM profile
Is called profile of a MODEM all its settings. The MODEM is supplied with a default profile that can be
changed with specifics AT commands. To display the actual profile the "AT&V" string followed by
return must be send to the MODEM, the MODEM answers with its setting profile. The "AT&F"
command restores the default profile. In the following table we report the the default settings of the
TC35i MODEM:

http://192.168.0.61/Destination/Html/HowTo/HT007.htm (3 of 5) [06/10/2008 17.46.02]


HT007

AT Command Restored parameters Description


AT\Q <n>=0 No flow control
ATE <value>=1 Echo mode on
ATQ <n>=0 DCE transmits result code
ATS0 <n>=000 Disables automatic answer mode
ATS3 <n>=013 Command line termination character as <CR>
ATS4 <n>=010 Response formatting character
ATS5 <n>=008 Command line editing character
ATS6 <n>=000 Number of seconds to wait before blind dialing
Number of seconds to wait for connection
ATS7 <n>=060
completion
Number of tenths of seconds that remains
ATS10 <n>=002
connected in absence of a data carrier
ATS18 <n>=0 Disable the presentation of extended error reports
ATV <value>=1 Verbal result codes
CONNECT result code returned, dial tone and busy
ATX <value>=4
detection are both enabled
AT&C <value>=1 DCD line is ON in the presence of data carrier only
ON->OFF on DTR: Disconnect data call, change to
AT&D <value>=2 command mode. During state DTR=OFF is auto-
answer off
AT&S <value>=0 DSR always on
AT+ILRR <value>=0 Set baud rate to autobaud
AT+FCLASS <n>=0 Fax: data (e.g. EIA/TIA-602 or ITU V.25ter)
Selects the bearer service asynchronous modem,
AT+CBST <speed>=7, <name>=0, <ce>=1 data rate 9600 bps (V.32) and connection element
non-transparent
AT+CFUN <fun>=1 Set phone functionality to full functionality
AT+CLIP <n>=0 Calling line identification presentation
Report mobile equipment error, disable result code
AT+CMEE <n>=0
(only 'ERROR' will be displayed)
AT+CMER <mode>=0, <keyp>=0, <disp>=0, <ind>=0, <bfr>=0 Mobile equipment event reporting
AT+COPS <format>=0 Operator selection
AT+CPBS <storage>=?SM? Select phone book memory storage
AT+CR <mode>=0 Service reporting control disabled
Set Cellular Result Codes for incoming call
AT+CRC <mode>=0
indication
AT+CREG <n>=0 Network registration
Select radio link protocol param. for orig. non-
AT+CRLP <iws>=61, <mws>=61, <T1>=78, <N2>=6
transparent data call
Set character set to GSM default alphabet (GSM
AT+CSCS <chset>=?GSM?
03.38 subclause 6.2.1)
AT+CSSN <n>=0, <m>=0 Supplementary service notifications
AT+CUSD <n>=0, <n>=1 Unstructured supplementary service data
AT+VTD <duration>=1 Tone duration in 1/10 second
AT+CMGF <mode>=0 Select SMS message format to PDU mode
AT+CNMI <mode>=0, <mt>=0, <bm>=0, <ds>=0, <bfr>=1 New SMS message indications
Show SMS text mode parameters set to not show
AT+CSDH <show>=0
header values
AT+CSMS <service>=0, <mt>=1, <mo>=1, <bm>=1 Select Message Service
AT+CSMP <dcs>=0, <fo>=17, <pid>=0, <vp>=167 Set SMS text mode parameters
Set or query SMS overflow presentation mode or
AT^SMGO <n>=0
query SMS overflow disabled

http://192.168.0.61/Destination/Html/HowTo/HT007.htm (4 of 5) [06/10/2008 17.46.02]


HT007

AT^SSCONF <ra>=0, <ff>=0 SMS Configuration


Set Display Availability, the mobile station is not
AT^SSDA <da>=0
capable of displaying short messages
AT^SACM <n>=0 Advice of charge and query of ACM and ACMmax
Set SIM connection presentation mode and query
AT^SCKS <n>=0
SIM connection status
Set critical operating temperature presentation
AT^SCTM <n>=0
mode or query temperature
AT^SM20 <CallMode>=1, <CmgwMode>=1 Set M20 Compatibility
Set Short Message Storage Sequence to "ME" then
AT^SSMSS <seq>=0
"SM"
AT^SPBS Internal counter = 0 Step through the selected phone book alphabetically
Set CONNECT result code format, result code
AT\V <value>=1
returned with RLP trailer
AT%D <state>=0, <type>=?? Automatic dial on DTR line activation

http://192.168.0.61/Destination/Html/HowTo/HT007.htm (5 of 5) [06/10/2008 17.46.02]


HT008

ELSIST Srl, www.elsist.it MNL041Q100

How to

Test the working of a PSTN MODEM

To test a PSTN MODEM you need to connect the


MODEM to the PC serial line by using a MODEM
cable (Example our Cbl030**00), activate from
Remoter the terminal emulation utility, set the
number of serial line and the related
communication parameters, typically "9600,n,8,1".

Here follow the string to digit on the terminal to do


the working tests of the MODEM.

Figure 1

Connection test with MODEM


It permits to check if the connection with the MODEM works correctly. If the MODEM receives the
command strings from the serial line and if it transfers the strings of answer.
1 Send some commands "AT" followed by return.
At every command received the MODEM answers
"OK".

Starting
It permits to start the MODEM by setting the correct working settings.
1 Send the command "AT&F" followed by return.
The MODEM answers "OK". This permits to shape the MODEM with the default parameters, the
default shape changes between the different dodels of MODEM, so we advice you to send anyway a
starting string .
2 Send the command "ATH0X0E1V1L1" followed by return.
The MODEM answers "OK". This command disconnects the line, sets the base answer codes, the
textual dialog, the echo of the commands and activates the loudspeaker on a medium volume.
3 Send the command "AT&K0" followed by return.
The MODEM answers "OK". This command unqualifies the stram control on the serial line.
4 Send the command "AT%C3" followed by return.
The MODEM answers "OK". This command qualifies the compression of the dates V42 bis and
MNP5.
It is possible that some modem do not manage this command, in that case the answer string will be
"Error". Refere to the MODEM handbook to sent the alternative command to be sent.

http://192.168.0.61/Destination/Html/HowTo/HT008.htm (1 of 3) [06/10/2008 17.46.03]


HT008

5 Send the command "AT&B1" followed by return.


The MODEM answers "OK". This command orders the MODEM to communicate on serial line
always with the communication parameters set no matter the connection speed.
It is possible that some modem do not manage this command, in that case the answer string will be
"Error". Refere to the MODEM handbook to sent the alternative command to be sent.
6 Send the command "AT&N0" followed by return.
The MODEM answers "OK". This command orders the MODEM to communicate with the remote
MODEM at the maximum possible speed indipendently from the communication parameters on
serial line.
It is possible that some modem do not manage this command, in that case the answer string will be
"Error". Refere to the MODEM handbook to sent the alternative command to be sent.

Data call
It permits to execute a data connection with another MODEM both analogic connected to telephone
network commuted and GSM.
1 Send the command "ATDT nnn" followed by return (nnn is the number to call comprehensive of
prefix).
When the called number answers the negotiation of the connection speed starts at which end the
MODEM answers "CONNECT".

Answer to a data call


It permits to answer to a dates call coming in.
1 Wait for the call, the MODEM returns the string "RING".
2 Send the command "ATA" followed by return.
The negotiation of the connection speed starts at which end the MODEM answers
"CONNECT".

End data connection


It permits to interrupt a data connection both in calling and answering a call.
1 Sent the string "CONNECT" of happened connection, the MODEM stands in dates mode. All the
dates received from the serial line are sent to the remote MODEM, to return in command mode send
the command "+++".
The MODEM answers "OK".
2 Send the command "ATH0" followed by return.
The MODEM interrupts the communication to the remote system and answers "OK".

MODEM pofile
Is called MODEM profile all its settings. The MODEM is supplied with a default profile that can be
changed with specifics AT commands. The "AT&F" command restores the default profile. To display
the actual profile the "AT&V" string followed by return must be send to the MODEM, the MODEM
answers with its setting profile. In the following table we report the the default settings of standard
MODEM.

http://192.168.0.61/Destination/Html/HowTo/HT008.htm (2 of 3) [06/10/2008 17.46.03]


HT008

E1 Q0 V1 X0 &C1 &D2 &S0 \Q0


S0:000 S3:013 S4:010 S5:008 S6:000 S7:060 S8:000 S10:002
S18:000
+CBST: 7,0,1
+CRLP: 61,61,78,6
+CR: 0
+FCLASS: 0
+CRC: 0
+CMGF: 1
+CSDH: 0
+CNMI: 0,0,0,0,1
+ILRR: 0
+IPR: 0
+CMEE: 0
^SMGO: 0,0
+CSMS: 0,1,1,1
^SACM: 0,"000000","FFFFFF"
^SCKS: 0,1
+CREG: 0,1
+CLIP: 0,2
+CAOC: 0
+COPS: 0,0,"I TIM"

http://192.168.0.61/Destination/Html/HowTo/HT008.htm (3 of 3) [06/10/2008 17.46.03]


HT009

ELSIST Srl, www.elsist.it MNL041Q100

How to

Use the smart cards Sle4442

The Siemens Sle4442, the Gemplus GPM2K and the Philips PCB2024 are some smart cards with
protected memory, to use them on the Netreader systems a proper function block is provided. The three
types of card are compatible and their main features are:

256 byte of memory protected by PSC (secret code) of which:


14 written by the construster and not modifiable
18 bytes that can be permanently protected from writing
224 bytes for the user data
Secret code (also said PIN or PSC) of 3 bytes not readable by card
Compatible synchrone protocol ISO 7816 1/2/3/4/5.

The PSC is needed to be able to modify the dates available on the smart card, the reading, instead, is
always possible. The memory map of the smart card Sle4442 (and compatibles) is the following.

Addr Description Sle4442 GPM2K PCB2024 Write

0 0xA2 0xA2 0xA2 NO


1 0x13 0x13 0x13 NO
2 0x10 0x10 0x10 NO
Historical bytes ISO7816 4/5
3 0x91 0x91 0x91 NO
4 0xFF 0xFF 0xFF NO
5 0xFF 0xFF 0xFF NO
6 0x81 0x81 0x81 NO
IC manufacturer
7 0x15 0x15 0x15 NO
8-12 IC manufacturer location 0xFF 0xFF 0xFF SI(*)
13-16 Serial number (option) - - - SI(*)
17-20 Discretionary data ISO 7816 4/5 - - - SI(*)
21 0xD2 0xD2 0xD2 NO
22 0x76 0x76 0x76 NO
IC Card Manufacturer
23 0x00 0x00 0x00 NO
24 0x00 0x00 0x00 NO
25 0x04 0x35 NO
26 Issuer Reference 0x00 0xFF NO
27 0xFF 0xAA NO
28-31 Discretionary data ISO 7816 4/5 - - - SI(*)
32-255 User data - - - SI
SI(*) significa che la scrittura è possibile se l'area non è stata protetta permanentemente da scrittura

PSC code

http://192.168.0.61/Destination/Html/HowTo/HT009.htm (1 of 2) [06/10/2008 17.46.04]


HT009

The Sle4442 smart cards always have a three bytes PSC. When you buy a Sle4442 it is therefore
necessary that the seller tells you this PSC (PIN or secret code). However, generally, the Sle4442 have, at
the moment of the distribution, a PSC equal to 0xFF, 0xFF, 0xFF. The GPM2K instead have PSC 0xAA,
0xAA, 0xAA. Obviously, the PSC can be modified when the card is started by the application that uses it.

The card inserted in the reader is always readable, but it is not possible to modify the dates contained in it if
you haven't locked it before by defining the the correct PSC value in SecurityMem[1-2-3] and executing
the function PSCVerification. WARNING! After three wrong attempts the card locks itself unreversibly.

Dates protection

As already said, to change the dates in a Sle4442 or compatibles, it is necessary to present the PSC with
the proper sequence. Moreover, it is also possible to protect permanently and unreversibly the dates in the
first 32 bytes of the smart card. This is possible by writing in a particular area of the card (out of the 256
bytes) called Protection Memory.

This area is formed by 4 bytes, in which every bit corresponds to a byte of the card, and if the
correspondent bit is 1, the byte is not changeble. To protect a byte in the zone 0-31, you need to execute
the function ProtectionMemoryWrite by defining the addresse of the byte to be protected (From 0x00 to
0x31) and its current value.

Modify PSC

To modify the PSC you need to unlock the chip card by defining the correct PSC value in SecurityMem[1-2-
3] and executing the function PSCVerification. Define then the new PSC value in SecurityMem[1-2-3] and
execute the function UpdateSecurityMemory.

Note

The information on this page are reported to help or understand better the nature of these cards, and have
a general view on its functions. We do not assume on ourselves the responsibility on the use of these
information, and on their exactness, even though we have done all the possible to create a correct profile.

http://192.168.0.61/Destination/Html/HowTo/HT009.htm (2 of 2) [06/10/2008 17.46.04]


HT013

ELSIST Srl, www.elsist.it MNL041Q100

How to

Manage logic sequences on interrupt

Remoter allows to execute functions written in RIL language on interrupt events. The execution of the normal program
is interrupted and is executed the defined function. This allows to know exactly the scanning time of a function, this can
be useful when is necessary to manage fast vents. To be able to perform a function written in RIL language on
interrupt it's necessary to remember that:

The RIL program operates on a process image of the logic inputs, this means that the inputs are acquired before
execute the program loop and are transferred in the Input (I) operands. So to have their state in real time, in the
interrupt function will be necessary to acquire the logic inputs on which to operate.

The RIL program operates on a process image of the logic outputs, this means that the Output (O) operands are
managed during the program loop but they are transferred to the hardware only at the end of the loop execution.
So to manage their state in real time, in the interrupt function will be necessary to acquire the state of the Output
operands on which to operate, and after to have operated on them, will be necessary to transfer the the new state
in the operands used by main program and then to manage hardware

RIL example

Here an example of a RIL program divided in two files, one


executed in main StartUp that will be included in the project and
defined Autocalled, the other executed on temporal Interrupt
Interrupt that will be included in the project, but the temporal
interrupt to 1 mSec enabled by the TINE instruction provides
automatically to call the LABL K 0000, the file should be defined
not Autocalled in order to avoid to execute it also in main.

In the following table the StartUp file.

; ------------------------------------------------------------------------------
; @Section("Main program")
; ------------------------------------------------------------------------------
; Enable the timing interrupt, it's executed every 1 mSec.

ORGR
SETR
TINE KD 1

; Execute the desired logic.

ORGR
LODT I 0000
OUTT O 0000

; [End of file]

In the following table the Interrupt file, it will be executed on interrupt at every 1 mSec.

http://192.168.0.61/Destination/Html/HowTo/HT013.htm (1 of 2) [06/10/2008 17.46.05]


HT013

; ------------------------------------------------------------------------------
; @Section("Local variable definitions")
; ------------------------------------------------------------------------------
; Local variable definitions.

DEFL Y LogInput ;Logic inputs acquisition


DEFL Y LogOutput ;Logic output copy

; ------------------------------------------------------------------------------
; @Section("Program executed on interrupt")
; ------------------------------------------------------------------------------
; Here the logic inputs are acquired directly from the hardware and the buffer
; of the logic outputs where they are managed by the main program is copied.

ORGR
LABL K 0000
SETR
IOAQ K 0000
STRA Y LogInput ;Logic inputs acquisition
CMPA O 0000
STRA Y LogOutput ;Logic output copy

; Execute the desired logic.

ORGR
LODT Y LogInput BD 1
OUTT Y LogOutput BD 1

; Here the logic output copy is directly transferred to hardware outputs and are
; copied in the buffer managed by the main program.

ORGR
SETR
LODA Y LogOutput ;Logic output copy
EXPA O 0000
IOAQ K 0100
RETN

; [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT013.htm (2 of 2) [06/10/2008 17.46.05]


HT014

ELSIST Srl, www.elsist.it MNL041Q100

How to

Execute program backup and restore on mass memory

Using the PCB111 mass of memory module it's


possible to execute the backup and the
successive restore of the user program on
Picosyst and Netsyst systems. So it's suggested
for the updating of the program on systems
already installed. Due to the automatic module
recognition from the operating system, the
restore operation does not require any
instrumentation.

Program backup

The program backup could be executed either manual or automatic, please refer to the table:

Manual By using a PC connected to the target system with the mass memory manager procedure.
Automatic With the system in power off insert a formatted mass memory module. To format the
module use the mass memory manager procedure.
At the system power on, 5 consecutive blinks alternated from a pause of the RUN led
indicates that the backup module has been recognized by the system.
After about 30 seconds the program backup will start automatically, 8 consecutive blinks
alternated from a pause of the RUN led indicates that the procedure is in execution.
The backup procedure takes about 2 minutes. 10 consecutive blinks alternated from a
pause of the RUN led indicates that backup is ended, now it's possible to switch off the
system and extract the mass of memory module. It now contains a copy of the user
program present in your system.
9 consecutive blinks alternated from a pause of the RUN led indicates that the procedure is
an error. Verify if the module is well inserted in the connector and that the switch on the
module doesn't be in Write protect position. It's necessary to repeat the procedure.

The automatic backup, store only the data that were defined in the Data to manage during the mass
of memory module format. Please refer to the mass memory manager procedure.

Program restore

The program restore could be executed either manual or automatic, please refer to the table:

Manual By using a PC connected to the target system with the mass memory manager procedure.

http://192.168.0.61/Destination/Html/HowTo/HT014.htm (1 of 2) [06/10/2008 17.46.06]


HT014

Automatic With the system in power off, insert a mass of memory module on which it's stored a
program with the backup procedure.
At the system power on, 6 consecutive blinks alternated from a pause of the RUN led
indicates that the restore module has been recognized by the system.
After about 30 seconds the program restore will start automatically, 8 consecutive blinks
alternated from a pause of the RUN led indicates that the procedure is in execution.
The backup procedure takes about 2 minutes. 10 consecutive blinks alternated from a
pause of the RUN led indicates that restore is ended, now it's possible to switch off the
system and extract the mass of memory module. The user program present on it it's been
loaded in your system.
9 consecutive blinks alternated from a pause of the RUN led indicates that the procedure is
an error. Verify if the module is well inserted in the connector. It's necessary to repeat the
procedure.

http://192.168.0.61/Destination/Html/HowTo/HT014.htm (2 of 2) [06/10/2008 17.46.06]


HT015

ELSIST Srl, www.elsist.it MNL041Q100

How to

Define from user program the Netsyst extension module address

The I2C addresses of the Netsyst family extension modules are defined in the range from 0x21 to 0x27, that
correspond to the module addresses from 0x01 to 0x07 in the bus access functions, NSYSTExtModuleAbort,
NSYSTExtModuleInp, NSYSTExtModuleOut, NSYSTExtReadVar and NSYSTExtWriteVar. The address are
automatically defined by the master system that assigns them following the connection order of the module to the
extension bus. The nearest module to the master system will take address 0x21, the successive one 0x22 and so on,
the allocation finish when no more module are been recognized by the master.

However it's possible to define the module I2C address by the user program, refer to the AddressForce bit of the
Command byte of the FbI2CSlaveManager function block. To define the address it's necessary to follow the
allocation order the system master adopts. Example to the 2nd module joined to the bus must be defined the address
0x22, otherwise the modules automatic addressing will be compromised.

It's possible to define I2C addresses different from those defined but the modules must be the last joined to the bus. In
that case case the modules will be accessible only by the I2CMasterRead and I2CMasterWrite functions.

10 I/O extension module

The 10 I/O extension module, instead of the other extension modules presents only one extension bus connector, so
it can be joined only one of this type of module to the bus and it must be the last one.

If more than one module must be used it's possible to store in one of them the SWM135 standard program, while on
the other will be necessary to realize a dedicated program for every module on wich the module address is defined.

http://192.168.0.61/Destination/Html/HowTo/HT015.htm (1 of 4) [06/10/2008 17.46.08]


HT015

RIL example

In the following example it's reported the program of a 10 I/O extension module SWM135 modified for the definition of
the module address. In the example the module has the address forced to 0x22.

; ------------------------------------------------------------------------------
; @Section("External variable definitions")
; ------------------------------------------------------------------------------

EXTR Y SystemConfig
EXTR W IOSerialPortA
DEFG Y SCTargetDevice Y SystemConfig KH 0002 ;SystemConfig.TargetDevice

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------
; Program variables.

DEFG T MessageDly ;Welcome message delay


DEFG W MessageNr ;Message number

; "FbI2CSlaveManager" data structure definition.

DEFG Y Slm KD 128


DEFG Y SlmCommand Y Slm KH 0000 ;Slm.Command
DEFG Y SlmStatus Y Slm KH 0001 ;Slm.Status
DEFG Y SlmI2CSAddress Y Slm KH 0002 ;Slm.I2CSAddress
DEFG Y SlmI2CSRxFrames Y Slm KH 0003 ;Slm.I2CSRxFrames
DEFG Y SlmI2CSRxError Y Slm KH 0004 ;Slm.I2CSRxError
DEFG W SlmSerial Y Slm KH 0006 ;Slm.Serial
DEFG W SlmI2CStdIO Y Slm KH 0008 ;Slm.I2CStdIO
DEFG Y SlmI2CSHLogInp Y Slm KH 0010 ;Slm.I2CSHLogInp
DEFG Y SlmI2CSLLogInp Y Slm KH 0011 ;Slm.I2CSLLogInp
DEFG Y SlmI2CSLLogOut Y Slm KH 0013 ;Slm.I2CSLLogOut
DEFG Y SlmI2CSADMode0 Y Slm KH 0014 ;Slm.I2CSADMode[0]
DEFG Y SlmI2CSADMode1 Y Slm KH 0015 ;Slm.I2CSADMode[1]
DEFG Y SlmI2CSADMode2 Y Slm KH 0016 ;Slm.I2CSADMode[2]
DEFG Y SlmI2CSADMode3 Y Slm KH 0017 ;Slm.I2CSADMode[3]
DEFG Y SlmI2CSADFilter0 Y Slm KH 0018 ;Slm.I2CSADFilter[0]
DEFG Y SlmI2CSADFilter1 Y Slm KH 0019 ;Slm.I2CSADFilter[1]

http://192.168.0.61/Destination/Html/HowTo/HT015.htm (2 of 4) [06/10/2008 17.46.08]


HT015

DEFG Y SlmI2CSADFilter2 Y Slm KH 001A ;Slm.I2CSADFilter[2]


DEFG Y SlmI2CSADFilter3 Y Slm KH 001B ;Slm.I2CSADFilter[3]
DEFG FL SlmI2CSADValue0 Y Slm KH 001C ;Slm.I2CSADValue[0]
DEFG FL SlmI2CSADValue1 Y Slm KH 0020 ;Slm.I2CSADValue[1]
DEFG FL SlmI2CSADValue2 Y Slm KH 0024 ;Slm.I2CSADValue[2]
DEFG FL SlmI2CSADValue3 Y Slm KH 0028 ;Slm.I2CSADValue[3]
DEFG Y SlmI2CSDAMode0 Y Slm KH 002E ;Slm.I2CSDAMode[0]
DEFG Y SlmI2CSDAMode1 Y Slm KH 002F ;Slm.I2CSDAMode[1]
DEFG FL SlmI2CSDAValue0 Y Slm KH 0030 ;Slm.I2CSDAValue[0]
DEFG FL SlmI2CSDAValue1 Y Slm KH 0034 ;Slm.I2CSDAValue[1]
DEFG Y SlmKeyLow Y Slm KH 003C ;Slm.Key.Low
DEFG Y SlmKeyHigh Y Slm KH 003D ;Slm.Key.High
DEFG Y SlmKeyFun Y Slm KH 003E ;Slm.Key.Fun
DEFG Y SlmDisplayUp Y Slm KH 0040 ;Slm.Display.Up
DEFG Y SlmDisplayDw Y Slm KH 0050 ;Slm.Display.Dw

; ------------------------------------------------------------------------------
; @Section("Welcome message management")
; ------------------------------------------------------------------------------
; For 5 Sec at power up a welcome message is displayed.

ORGR
SETR
OUTM T MessageDly KD 5000 KE Base1mS ;Welcome message delay

ORGR
LODF T MessageDly ;Welcome message delay
PULS
MOVI W MessageNr KD 0 ;Message number

ORGR
LODT T MessageDly ;Welcome message delay
PULS
MOVI W MessageNr KD 1 ;Message number

; ------------------------------------------------------------------------------
; @Section("I2C slave manager execution")
; ------------------------------------------------------------------------------
; Here the I2C slave manager function block parameters are set.
; The module address 0x22 (Module 2) is set.

ORGR
LODT F PLCFirstLoop
LTCH Y SlmCommand BD 0 ;Slm.Command.Enable
LTCH Y SlmCommand BD 1 ;Slm.Command.AddressForce
MOVI Y SlmI2CSAddress KH 0022 ;Slm.I2CSAddress
MOVM W SlmSerial W IOSerialPortA ;Slm.Serial

; Here the function block is executed.

ORGR
SETR
TASK L FbI2CSlaveManager Y Slm

; Manage the logic inputs.

IOAQ K 0000
STRA Y SlmI2CSLLogInp ;Slm.I2CSLLogInp

http://192.168.0.61/Destination/Html/HowTo/HT015.htm (3 of 4) [06/10/2008 17.46.08]


HT015

; Manage the logic output.

LODA Y SlmI2CSLLogOut ;Slm.I2CSLLogOut


IOAQ K 0100

; Main program end.

ORGR
SETR
RETN

; ------------------------------------------------------------------------------
; @Section("User startup function")
; ------------------------------------------------------------------------------
; This function is automatically called once before to execute the user program.
; Configure the system as "NETREADER_P89C664_SLAVE_EXT".

ORGR
LABL L PLCUserStartUp
SETR
MOVI Y SCTargetDevice KH 0022 ;SystemConfig.TargetDevice
RETN

; [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT015.htm (4 of 4) [06/10/2008 17.46.08]


HT016

ELSIST Srl, www.elsist.it MNL041Q100

How to

Effettuare la taratura di sonde temperatura Pt100

Le termoresistenze più usate in ambito industriale sono le Pt100, cioè termoresistori al platino da 100 Ohm a 0 °C
(Pt100). L’elemento sensibile è costruito mediante deposizione sotto vuoto di platino su un substrato di ceramica e
definito al laser. Le sonde possono avere una precisione di acquisizione compresa tra 0.1 ed 1 grado. Pertanto se si
desiderano acquisizioni di temperatura estremamente precise occorre provvedere ad una taratura della sonda.

Per soluzionare il problema viene fornito un programma dimostrativo che permette utilizzando il corretto valore di
temperatura rilevato con una sonda di precisione di tarare l'acquisizione delle sonde Pt100. Il programma permette:

Visualizzare il valore di temperatatura acquisito dalle sonde Pt100.


Impostare il valore di temperatura acquisito dalla sonda di riferimento.
Visualizzare i valore dei coefficenti di conversione da utilizzarsi per correggere l'errore di acquisizione delle sonde
Pt100.

Utilizzo del programma

Il programma è stato realizzato per un sistema NetlogII, per il suo utilizzo occorre connettere due sonde di temperatura
Pt100 agli ingressi analogici. Occorre poi disporre di uno strumento indicatore di temperatura di riferimento. Per
mantenere un perfetto scambio termico tra le sonde Pt100 di rilevamento ed lo strumento di riferimento si consiglia di
immergere sia le sonde che lo strumento in un bicchiere di acqua.

RIL example

In the following example it's reported the program of a 10 I/O extension module SWM135 modified for the definition of
the module address. In the example the module has the address forced to 0x22.

; ------------------------------------------------------------------------------
; @Section("External variable definitions")
; ------------------------------------------------------------------------------

EXTR Y SystemConfig
EXTR W IOSerialPortA
DEFG Y SCTargetDevice Y SystemConfig KH 0002 ;SystemConfig.TargetDevice

; ------------------------------------------------------------------------------
; @Section("Global variables definition")
; ------------------------------------------------------------------------------
; Program variables.

DEFG T MessageDly ;Welcome message delay


DEFG W MessageNr ;Message number

; "FbI2CSlaveManager" data structure definition.

DEFG Y Slm KD 128


DEFG Y SlmCommand Y Slm KH 0000 ;Slm.Command
DEFG Y SlmStatus Y Slm KH 0001 ;Slm.Status
DEFG Y SlmI2CSAddress Y Slm KH 0002 ;Slm.I2CSAddress
DEFG Y SlmI2CSRxFrames Y Slm KH 0003 ;Slm.I2CSRxFrames
DEFG Y SlmI2CSRxError Y Slm KH 0004 ;Slm.I2CSRxError

http://192.168.0.61/Destination/Html/HowTo/HT016.htm (1 of 3) [06/10/2008 17.46.09]


HT016

DEFG W SlmSerial Y Slm KH 0006 ;Slm.Serial


DEFG W SlmI2CStdIO Y Slm KH 0008 ;Slm.I2CStdIO
DEFG Y SlmI2CSHLogInp Y Slm KH 0010 ;Slm.I2CSHLogInp
DEFG Y SlmI2CSLLogInp Y Slm KH 0011 ;Slm.I2CSLLogInp
DEFG Y SlmI2CSLLogOut Y Slm KH 0013 ;Slm.I2CSLLogOut
DEFG Y SlmI2CSADMode0 Y Slm KH 0014 ;Slm.I2CSADMode[0]
DEFG Y SlmI2CSADMode1 Y Slm KH 0015 ;Slm.I2CSADMode[1]
DEFG Y SlmI2CSADMode2 Y Slm KH 0016 ;Slm.I2CSADMode[2]
DEFG Y SlmI2CSADMode3 Y Slm KH 0017 ;Slm.I2CSADMode[3]
DEFG Y SlmI2CSADFilter0 Y Slm KH 0018 ;Slm.I2CSADFilter[0]
DEFG Y SlmI2CSADFilter1 Y Slm KH 0019 ;Slm.I2CSADFilter[1]
DEFG Y SlmI2CSADFilter2 Y Slm KH 001A ;Slm.I2CSADFilter[2]
DEFG Y SlmI2CSADFilter3 Y Slm KH 001B ;Slm.I2CSADFilter[3]
DEFG FL SlmI2CSADValue0 Y Slm KH 001C ;Slm.I2CSADValue[0]
DEFG FL SlmI2CSADValue1 Y Slm KH 0020 ;Slm.I2CSADValue[1]
DEFG FL SlmI2CSADValue2 Y Slm KH 0024 ;Slm.I2CSADValue[2]
DEFG FL SlmI2CSADValue3 Y Slm KH 0028 ;Slm.I2CSADValue[3]
DEFG Y SlmI2CSDAMode0 Y Slm KH 002E ;Slm.I2CSDAMode[0]
DEFG Y SlmI2CSDAMode1 Y Slm KH 002F ;Slm.I2CSDAMode[1]
DEFG FL SlmI2CSDAValue0 Y Slm KH 0030 ;Slm.I2CSDAValue[0]
DEFG FL SlmI2CSDAValue1 Y Slm KH 0034 ;Slm.I2CSDAValue[1]
DEFG Y SlmKeyLow Y Slm KH 003C ;Slm.Key.Low
DEFG Y SlmKeyHigh Y Slm KH 003D ;Slm.Key.High
DEFG Y SlmKeyFun Y Slm KH 003E ;Slm.Key.Fun
DEFG Y SlmDisplayUp Y Slm KH 0040 ;Slm.Display.Up
DEFG Y SlmDisplayDw Y Slm KH 0050 ;Slm.Display.Dw

; ------------------------------------------------------------------------------
; @Section("Welcome message management")
; ------------------------------------------------------------------------------
; For 5 Sec at power up a welcome message is displayed.

ORGR
SETR
OUTM T MessageDly KD 5000 KE Base1mS ;Welcome message delay

ORGR
LODF T MessageDly ;Welcome message delay
PULS
MOVI W MessageNr KD 0 ;Message number

ORGR
LODT T MessageDly ;Welcome message delay
PULS
MOVI W MessageNr KD 1 ;Message number

; ------------------------------------------------------------------------------
; @Section("I2C slave manager execution")
; ------------------------------------------------------------------------------
; Here the I2C slave manager function block parameters are set.
; The module address 0x22 (Module 2) is set.

ORGR
LODT F PLCFirstLoop
LTCH Y SlmCommand BD 0 ;Slm.Command.Enable
LTCH Y SlmCommand BD 1 ;Slm.Command.AddressForce
MOVI Y SlmI2CSAddress KH 0022 ;Slm.I2CSAddress
MOVM W SlmSerial W IOSerialPortA ;Slm.Serial

http://192.168.0.61/Destination/Html/HowTo/HT016.htm (2 of 3) [06/10/2008 17.46.09]


HT016

; Here the function block is executed.

ORGR
SETR
TASK L FbI2CSlaveManager Y Slm

; Manage the logic inputs.

IOAQ K 0000
STRA Y SlmI2CSLLogInp ;Slm.I2CSLLogInp

; Manage the logic output.

LODA Y SlmI2CSLLogOut ;Slm.I2CSLLogOut


IOAQ K 0100

; Main program end.

ORGR
SETR
RETN

; ------------------------------------------------------------------------------
; @Section("User startup function")
; ------------------------------------------------------------------------------
; This function is automatically called once before to execute the user program.
; Configure the system as "NETREADER_P89C664_SLAVE_EXT".

ORGR
LABL L PLCUserStartUp
SETR
MOVI Y SCTargetDevice KH 0022 ;SystemConfig.TargetDevice
RETN

; [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT016.htm (3 of 3) [06/10/2008 17.46.09]


HT017

ELSIST Srl, www.elsist.it MNL041Q100

How to

Gestire il Modem su targets con kernel

I sistemi NetlogII e Psyst MEIII sono dotati di un programma kernel che gestisce le comunicazioni con il Modem.
Il Kernel gestisce autonomamente l'accesso da remoto via Modem al sistema, permettendo di effettuare tutte le
operazioni di debug e programmazione. Esistono casi in cui però è necessario da programma utente gestire il
Modem per la ricezione o l'invio di SMS, per il controllo del CLIP del chiamante, e per la gestione di chiamate in
uscita.

Per utilizare il Modem da programma utente occorre configurare il kernel in modo oppurtuno. Selezionando la
configurazione target nelle impostazioni di progetto, definire:

Modem... Impostare tutti i parametri desiderati per il Modem ed il terminale di I/O a cui il Modem è
connesso.
Porta seriale... Impostare i corretti parametri di comunicazione supportati dal Modem utilizzato.
Modbus... Selezionare Modem come terminale di I/O a cui il modbus verrà connesso. Disabilitare il tick
abilitazione debug utente. In questo modo da Modem sarà possibile eseguire le operazioni di
caricamento programma, mentre con il programma utente in esecuzione il Modem sarà
completamente gestito da programma utente.

Programma utente

Viene riportato un esempio di programma utente per la gestione di un modem con ricezione ed invio messaggi
SMS.

// -----------------------------------------------------------------------------
// FILE INCLUSIONS
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <string.h>
#include <ElSystemLib.h>
#include <ElPLCLib.h>

// -----------------------------------------------------------------------------
// GLOBAL VARIABLES
// -----------------------------------------------------------------------------
// Global variables definition.

unsigned int VarInt; //Unsigned int variable


float VarFloat; //Float variable

// -----------------------------------------------------------------------------
// EXAMPLE PROGRAM
// -----------------------------------------------------------------------------
// Example program executed on main.

void Example(void)
{
// Local variable definitions.

http://192.168.0.61/Destination/Html/HowTo/HT017.htm (1 of 3) [06/10/2008 17.46.10]


HT017

static BOOL SMSFlag; //Flag managed by SMS


static char SMSNumber[16]; //Number to send the message
static char DialNumber[16]; //Number to be dialed
static char CLIPRxNumber[16]; //CLIP received number
static char SMSRxBuf[160]; //SMS received message buffer
static char SMSTxBuf[160]; //SMS message to send
static unsigned char LogInput; //Logic inputs
static unsigned char PulseBuf; //Pulse buffer
static MODEMSTRUCT Mdm; //Modem data structure

// -------------------------------------------------------------------------
// LOGIC I/O MANAGEMENT
// -------------------------------------------------------------------------
// Here acquire the 8 logic input from I 0000 to I 0007.

PeripheralInp(0, 0, &LogInput);

// -------------------------------------------------------------------------
// MODEM MANAGEMENT
// -------------------------------------------------------------------------
// Set the modem data structure address.

if (PLCFirstLoop)
{
Mdm.CLIPRxNumber=&CLIPRxNumber; //CLIP received number
Mdm.CLIPRxLgt=sizeof(CLIPRxNumber); //CLIP received number length
Mdm.DialNumber=&DialNumber; //Number to be dialed

Mdm.SMSRxBuf=&SMSRxBuf; //SMS received message buffer


Mdm.SMSRxLgt=sizeof(SMSRxBuf); //SMS message received lenght

Mdm.SMSNumber=&SMSNumber; //Number to send the message


Mdm.SMSTxBuf=&SMSTxBuf; //SMS message to send

SetTermIOVectors(IOModemA); //Set the modem "A" as I/O console


SetTermIOData(&Mdm); //Modem data structure
}

// Check if an SMS is received.

if (Mdm.Status.SMSReceived)
{
if (!strcmp(SMSRxBuf, "Set flag")) SMSFlag=TRUE;
if (!strcmp(SMSRxBuf, "Reset flag")) SMSFlag=FALSE;
}

// Check if logic inputs are changed.

if (LogInput != PulseBuf) {PulseBuf=LogInput; return;}

// If the logic input "0" is active an SMS is sent.

if (LogInput&0x01)
{
strcpy(&SMSNumber, "+39335217595");
strcpy(&SMSTxBuf, "Input 0 is set");

http://192.168.0.61/Destination/Html/HowTo/HT017.htm (2 of 3) [06/10/2008 17.46.10]


HT017

Mdm.Command.SMSSend=TRUE; //Active force the SMS send


}

// If the logic input "1" is active an SMS is sent.

if (LogInput&0x02)
{
strcpy(&SMSNumber, "+39335217595");
strcpy(&SMSTxBuf, "Input 1 is set");
Mdm.Command.SMSSend=TRUE; //Active force the SMS send
}
}

// [End of file]

http://192.168.0.61/Destination/Html/HowTo/HT017.htm (3 of 3) [06/10/2008 17.46.10]


Scanner errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Scanner errors

The scanner considers all the project RIL files examining the instructions and the operands contained. The
possible errors are returned with a message, following the possible errors.

Code Description

RME100 The instruction list does not exist


RME101 It's not possible to create the output @ dir
The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME102 The @ SourceCode file is not present
The @ file reported in the project tree is not present on the disk, it could have been cancelled or
moved.
RME103 The @ destination file is not cancelable
The @ file could be writing protected or you have not the rights to access it.
RME104 It's not possible to create the @ destination file
The disk can be full, write protected or you have not the rights to access it.
RME105 List of files for scanning absent
RME106 IN THE @ LINE: The instruction "Instruction" not valid
In the reported line, the reported instruction is not valid.
RME107 IN THE @ LINE: The operand "Operand" is not valid
In the reported line the reported operand is not valid.
RME108 IN THE @ LINE: The value format "Format" is not valid for the operand "Operand". The correct
format is "Format"
In the reported line the value format reported is not valid for the operand, it's necessary to modify
the value format as indicated.
RME109 IN THE @ LINE: The value "Value" is out of the permitted range for the operand "Operand. The
permitted range is "Min" - "Max"
In the reported line the reported value is not in the permitted range for the operand, it's necessary
to modify the value in the indicated range.
RME110 IN THE @ LINE: Too many operands for the instruction "Instruction"
In the reported line the reported instruction has more operands than permitted.
RME111 IN THE @ LINE: Few operands for the instruction "Instruction"
In the reported line the reported instruction has less operands than required.
RME112 IN THE @ LINE: Too many operands for the scanner
RME113 IN THE @ LINE: The value "Value" is not valid for the operand "Operand
In the reported line the reported value is not valid for the operand.

http://192.168.0.61/Destination/Html/Appendix/Errors/Scanner.htm [06/10/2008 17.46.11]


Parser errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Parser errors

The parser considers all the project RIL files examining the instructions and the operands contained. The
possible errors are returned with a message, following the possible errors.

Code Description

RME200 It's not possible to create the output @ dir


The @ directory that contains the output files does not exist and it is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME202 The @ user file is not present
The @ user file is not present on the disk, it could have been cancelled or moved.
RME201 The @ library file is not present
The @ library file is not present on the disk, it must be installed.
RME204 The @ user file is not readable
The @ user file is not present on the disk or you have not the rights to access it.
RME205 List of files for parsing is absent
There isn't any file to be parsed.
RME206 It's not possible to create the output @ file
The @ file could be write protected or you have not the rights to access it.
RME207 The @ instruction is unknown to the parser
The @ instruction present in the project is not an instruction that the parser knows.
RME208 The instruction type for the @ instruction is unknown
The instruction type for the @ instruction is unknown.
RME209 Operands number wrong for the @ instruction
The @ instruction has an operands number not corresponding to the defined.
RME210 The @ operand is unknown for the instruction #
The @ operand is not a recognized type for the instruction #.
RME211 The local @ operand has already been stated global in the # file
The local mnemonic @ operand in the # file has already been defined global in the # file. It'
necessary to rename one of the two operands.
RME212 The local @ operand has already been stated extern in the # file
The local mnemonic @ operand in the # file has already been defined extern in the # file. It'
necessary to rename one of the two operands.
RME213 The global @ operand has already been stated local in the # file
The global mnemonic @ operand in the # file has already been defined local in the # file. It'
necessary to rename one of the two operands
RME214 The global @ operand has already been stated extern in the # file
The mnemonic @ operand stated global in the # file has already been stated extern in the # file.
It' necessary to rename one of the two operands
RME215 The extern @ operand has already been stated global in the # file
The extern @ operand in the # file has already been defined global in the # file. It' necessary to
rename one of the two operands.

http://192.168.0.61/Destination/Html/Appendix/Errors/Parser.htm (1 of 2) [06/10/2008 17.46.12]


Parser errors

RME216 RME216
The extern @ operand has already been stated local in the # file
The extern @ operand in the # file has already been defined local in the # file. It' necessary to
rename one of the two operands.
RME217 The global @ operand is duplicated in the # file
The global @ operand has been duplicated in the # file. It's necessary to rename one of the two
operands
RME218 The local @ operand is duplicated
The local @ operand is defined more than one time in the file.
RME219 The @ operand must be stated
The @ operand has been used but it isn't been defined, it's necessary to define it.
RME220 CALL to @ without LABL
A CALL instruction has been done to the @ label but the label isn't been defined.
RME221 It's not permitted to define @. The definition is automatic
The @ operand has been defined but this operand is already defined automatically. It's
necessary to remove the definition.
RME222 IN THE @ LINE: the previous rung must be closed
The previous logic branch to the @ line has not been closed correctly.
RME223 IN THE @ LINE: the rung must be opened
The previous logic branch to the @ line has not been opened correctly.
RME224 N THE @ LINE: not all the previous branches have been closed
The logic branch previous to the @line contains one or more branch not correctly closed.
RME225 IN THE @ LINE: too many branches opened
The previous logic branch to the @line contains too many opened branches.
RME226 IN THE @ LINE: the branch must be opened
The closing branch instruction to the @ line does not correspond to an opened branch.
RME227 IN THE @ LINE: it's necessary to have at least two branches opened
The closing branch instruction to the @ line does not correspond to at least two opened branch.
RME228 IN THE @ LINE: it's necessary to have no branch opened
At the moment of the instruction to the @ line must be there no branch opened.
RME229 IN THE @ LINE: to the end of the file there is a rung left opened
In the @ line of the file end there is still a rung opened.
RME230 IN THE @ LINE: to the end of the file there is at least a branch left opened
In the @ line of end file there is still one or more rung opened.
RME231 IN THE @ LINE: The # operand can not be written because is in CODE
In the @ line the # operand that has been located in memory code can not be written.
RME232 IN THE @ LINE: All the MCRS must be closed with MCRE
In the @ line of end file there is still some MCRS instructions that haven't been closed with the
respective MCRE instructions.
RME233 The @ operand is related to the # operand that has a visibility different than the stated one.
This error advises that the @ operand has been defined different than the related # array.
It reminds that in the array definition all the operands have to be defined in the same way. For
example they all have to be DEFG, DEFL o DEFB.
RME234 The @ operand can not be contained in the # operand. Verify dimension and offset.
This error advises that there is not enough space in the # array to locate the @ operand

http://192.168.0.61/Destination/Html/Appendix/Errors/Parser.htm (2 of 2) [06/10/2008 17.46.12]


RFB converter errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

RFB converter errors

The RFB converter converts the project FB graphics considering the instructions and the operands
contained. The possible errors are returned with a message, following the possible errors.

Code Description

RME300 It's not possible to create the output @ dir


The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME301 The @ user file is not present
The @ user file is not present on the disk, it could have been cancelled or moved.
RME302 The @ destination file is not cancelable
The @ file could be writing protected or you have not the rights to access it.
RME303 It's impossible to open the @ file
The @ file is not readable or you have not the rights to access it.
RME304 It's impossible to create the @ file
The @ file could be write protected or you have not the rights to access it.
RME305 List of files to be converted is absent
There isn't any file to be converted.
RME306 # function block specified for the @ file incompatible with the selected target.
The # function block selected in the @ file is not compatible with the selected target.
RME307 Data not valid in the @ file. Conversion impossible
The @ file is not a valid RFB file.
RME308 The # library necessary to the @ Fb has not been found. Add in the Project Settings. Conversion
impossible
The # library is not present in the project libraries, it must be added in the project settings.

http://192.168.0.61/Destination/Html/Appendix/Errors/RFBConverter.htm [06/10/2008 17.46.12]


RLD converter errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

RLD converter errors

The RLD converter converts all the files written in Ladder diagram considering the instructions and the
operands contained. The possible errors are returned with a message, following the possible errors.

Code Description

RME350 It's not possible to create the output @ dir


The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME351 The @ user file is not present
The @ user file is not present on the disk, it could have been cancelled or moved.
RME352 The @ destination file is not cancelable
The @ file could be writing protected or you have not the rights to access it.
RME353 It's impossible to open the @ file
The @ file is not readable or you have not the rights to access it.
RME354 It's impossible to create the @ file
The @ file could be write protected or you have not the rights to access it.
RME355 List of files to be converted is absent
There isn't any file to be converted.

http://192.168.0.61/Destination/Html/Appendix/Errors/RldConverter.htm [06/10/2008 17.46.13]


AOF converter errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

AOF converter errors

The AOF converter converts the file created by the linker in the Intel-hex format to be transferred on the
target system. The possible errors are returned with a message, following the possible errors.

Code Description

RME400 The aof-hex @ converter does not exist


The AOF @ file converter is not present, it is necessary to install it.
RME401 It's not possible to create the output @ dir
The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME402 The @ SourceCode file is not present
The @ file to be converted is not present on the disk, it could have been cancelled or moved.
RME403 The @ destination file is not cancellable
The @ destination file could be write protected or you have not the rights to access it.
RME404 It's not possible to create the @ file
The @ file could be write protected or you have not the rights to access it.
RME405 List of files to be converted is absent
There isn't any file to be converted.

http://192.168.0.61/Destination/Html/Appendix/Errors/AOFConverter.htm [06/10/2008 17.46.13]


Linker errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Linker errors

The linker merges the different project files in one program file to be passed to the AOF converter. The
possible errors are returned with a message, following the possible errors.

Code Description

RMW500 Linker internal warning


It informs that the linker has found an anomalous condition, it is necessary to make reference to
the warning number reported by the linker.
RME500 Linker internal error
It informs that the linker has found an error condition, it is necessary to make reference to the
error number reported by the linker. We report a list of the common error could be found:
ERROR 107 Address space overflow More CODE segment are been allocated at the same memory address
The maximum memory dimension has been reach
RME501 The @ linker does not exist
The @ linker is not present, it is necessary to install it.
RME502 It's not possible to create the output @ dir
The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME503 It's not possible to create the output @ dir
he @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME504 The @ user file is not present
The @ user file is not present on the disk, it could have been cancelled or moved.
RME505 The @ library file is not present
The @ library file is not present on the disk, it could have been cancelled or moved.
RME506 No file to be linked.
There isn't any file to be linked.
RME507 The @ destination file is not cancelable
The @ file could be write protected or you have not the rights to access it.
RME508 List of files to be linked is absent
There isn't any file to be linked.
RME509 It's impossible to create the command file
The command file could be write protected or you have not the rights to access it.

http://192.168.0.61/Destination/Html/Appendix/Errors/Linker.htm [06/10/2008 17.46.14]


Assembler errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Assembler errors

The assembler converts the files written in assembler language in the format to be interpreted by the linker.
The possible errors are returned with a message, following the possible errors.

Code Description

RMW550 Assembler internal warning


It informs that the assembler has found an anomalous condition, it is necessary to reference to
the warning number reported by the assembler.
RME550 Assembler internal error
It informs that the assembler has found an error condition, it is necessary to reference to the
error number reported by the assembler.
RME551 The @ assembler does not exist
The @ assembler is not present, it is necessary to install it.
RME552 It's not possible to create the output @ dir
The @ directory that contains the output files does not exist and it is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME553 It's not possible to create the @ dir list
The @ directory that contains the listing output files does not exist and it is impossible to create
it. The disk can be full, write protected or you have not the rights to access it.
RME554 The @ SourceCode file is not present
The @ file to be assembled is not present on the disk, it could have been cancelled or moved.
RME555 The @ destination file is not cancellable
The @ file could be write protected or you have not the rights to access it.
RME556 List of files to be assembled is absent
There isn't any file to be assembled.

http://192.168.0.61/Destination/Html/Appendix/Errors/Assembler.htm [06/10/2008 17.46.15]


Compiler errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Compiler errors

The compiler converts the files written in C language in the format to be interpreted by the linker. The
possible errors are returned with a message, following the possible errors.

Code Description

RMW600 Compiler internal warning


It informs that the compiler has found an anomalous condition, it is necessary to reference to the
warning number reported by the compiler.
RME600 Compiler internal error
It informs that the compiler has found an error condition, it is necessary to reference to the error
number reported by the compiler.
RME601 The @ Compiler does not exist
The @ compiler is not present, it is necessary to install it.
RME602 It's not possible to create the output @ dir
The @ directory that contains the output files does not exist and it is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME603 It's not possible to create the @ dir list
The @ directory that contains the listing output files does not exist and it is impossible to create
it. The disk can be full, write protected or you have not the rights to access it.
RME604 The @ SourceCode file is not present
The @ file to be compiled is not present on the disk, it could have been cancelled or moved.
RME605 The @ destination file is not cancellable
The @ file could be write protected or you have not the rights to access it.
RME606 List of files to be assembled is absent
There isn't any file to be compiled.

http://192.168.0.61/Destination/Html/Appendix/Errors/Compiler.htm [06/10/2008 17.46.15]


Project errors

ELSIST Srl, www.elsist.it MNL041Q100

Error list

Project errors

Before to compile the project, all its settings are checked. The possible errors are returned with a message,
following the possible errors.

Code Description

RMW650 The file @ isn't compilable by this project type


It informs that the @ file present in the project is non compatible with the project.
RMW651 The @ system library version is upper than the library released by Remoter. This can produce
some undesirable effects. It is suggest to use the # version
Indicates that the system library @ defined in the project settings has a level upper than which
distributed with Remoter, to be used it needs an upper version of Remoter. We suggest to
change the library with the # version.
RMW652 The @ PLC library version is upper than the library released by Remoter. This can produce
some undesirable effects. It is suggest to use the # version
Indicates that the PLC library @ defined in the project settings has a level upper than which
distributed with Remoter, to be used it needs an upper version of Remoter. We suggest to
change the library with the # version.
RMW653 The @ FB library version is upper than the library released by Remoter. This can produce some
undesirable effects. It is suggest to use the # version
Indicates that the function block library @ defined in the project settings has a level upper than
which distributed with Remoter, to be used it needs an upper version of Remoter. We suggest
to change the library with the # version.
RME650 There are different version or more than one library of the @ library. Please modify your project
Settings
It informs that in the project settings are been declared more than one version of the same
library, verify the settings done.
RME651 The @ and # libraries can't coexist. Please modify your project Settings
It informs that in the project settings are been declared two libraries that cannot be used
together, verify the settings done.
RME652 The actual Remoter version, don't allow to have more than one "C" file in your project
The Remoter version you have is not enabled to accept more than one C program file in the
project. The proper license must be bought.
RME653 The actual Remoter version, don't allow to have more than 4 "C" file in your project
The Remoter version you have is not enabled to accept more than four C program files in the
project. The proper license must be bought.
RME654 Impossible to build 2 file with the same base name: @ e #
In the project exist two files @ and # that have the same name, one of them must be renamed.
RME655 Impossible to build the @ file because already created by Remoter. Please rename it
The @ file present in the project has a name used used by Remoter, it must be renamed.
RME656 The @ Fb is incompatible with the # system library. Please change the target chosen.
The function block @ is not compatible with the system library #. Verify the compatibility.
RME657 The system library not exist
The system library defined in the project settings doesn't appear in the Remoter library directory.

http://192.168.0.61/Destination/Html/Appendix/Errors/Project.htm (1 of 2) [06/10/2008 17.46.16]


Project errors

RME658 The PLC library not exist


The PLC library defined in the project settings doesn't appear in the Remoter library directory.
RME659 The @ library was not found in #. Build impossible
The @ library defined in the project settings doesn't appear in the # Remoter library directory.
RME660 Impossible to create the temporary dir @
The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME661 The temporary dir @ not exist
The @ directory that contains the output files does not exist and is impossible to create it. The
disk can be full, write protected or you have not the rights to access it.
RME662 The include files copy to the temporary directory @ is impossible
It's not possible to copy the temporary files in the @ directory. The disk can be full, write
protected or you have not the rights to access it.
RME663 Nothing choices for uploading. Impossible to upload
No files are been chosen, it's not possible to execute the upload. Verify the upload settings.
RME664 For the project Build, you must install RIDE Raisonance
Remoter uses an external compiler and assembler, they are supplied by the Raisonance, to
compile the project they must be installed.
RME665 For the project Build, you must initialize the Raisonance tools. From the menu' Tools-Options-
Tools, press the button RaisonanceTools
After installed the Raisonance compiler and assembler, it's necessary to configure Remoter to
use them. To do that it's necessary to execute the proper procedure.

http://192.168.0.61/Destination/Html/Appendix/Errors/Project.htm (2 of 2) [06/10/2008 17.46.16]


Netlog system library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

Netlog system library, history report

SFR025B000

First library version available for Remoter 8.x

SFR025C000

Renamed library with ElSystemLib alias and create version for Remoter 8.1.

SFR025D000

A
The SetPeripheralReady function resets the logic outputs on all the modules at the ready signal
disable. In the previous versions the reset was executed also on the ready signal enable.
Defined two new global variables FLASHWriteCtr and EEPROMWriteCtr for the accesses count to
the FLASH and EEPROM memories.
The TermIOOpen and TermIOClose functions if referred to the serial line I/O device now allows the
enable and disable of the management interrupt.
Added ArrayBitCount, ArrayBitSet, ArrayBitStatus functions.
Defined in the SERIALSTRUCT data structure the Mode.WaitLoop member.
Modified SystemMemoryRead e SystemMemoryWrite functions, the bytes number operand is
passed on a unsigned int variable instead of unsigned char.
Added ASCIIToHEX and HEXToASCII macros, they allow the ASCII to HEX e HEX to ASCII
conversion.
Added Random function.
The system functions IODeviceFctReturn and IODeviceFctMissing are defined as global.
Eliminated the BUS_TERMINALSTRUCT definition and created the TERMINALSTRUCT data
structure.
Added the AsciiStringConvert function.
Added the GetCharEchoEnable variable.
Added the NSYSTExtModuleInp and NSYSTExtModuleOut functions, to maintain compatibility with the
Picosyst system.
Added a 30 mSec debouncing on the terminal keyboard acquisition.

SFR025E000

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr025.htm (1 of 2) [06/10/2008 17.46.17]


Netlog system library, history report

Added the ElSystemLibVersion global variable definition.


Enabled the power down interrupt to guarantee more protection in RAM memory data backup.
Added BlinkBit function.
Added the tick interrupt enable SetTimer0Enable(TRUE) and the watchdog enable SetWDogTime
(1400) functions call, in SystemInit function.
Added NSYSTReadyMng function.
Added RunLEDMng function.
Added I2CMasterNodeCheck function.
Eliminated the FLASHWriteCtr global variable.
Eliminated from the SetTimer0Enable function the unsigned int Time parameter.
Eliminated the blinking bits Toggle100, Toggle200, Toggle400, Toggle800, Toggle1600,
Toggle3200, Toggle6400, Toggle12800 management.
Added in the SystemMemoryRead and SystemMemoryWrite functions, the management of the
PCB111 mass memory module.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr025.htm (2 of 2) [06/10/2008 17.46.17]


Picosyst system library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

Picosyst system library, history report

SFR026C000

First library version available for Remoter 8.x

SFR026D000

Renamed library with ElSystemLib alias and create version for Remoter 8.1.
Modified the SystemMemoryRead and SystemMemoryWrite functions, added the access to PCB088
mass memory module (From 0x00000000 to 0x07FFFFFF)
Added NSYSTExtReadVar e NSYSTExtWriteVar functions.
The interrupt timer 1 and 2 is executed with the microcontroller in interrupt condition, before was
executed with the microcontroller in user program condition.

SFR026E000

A
The SetPeripheralReady function resets the logic outputs on all the modules at the ready signal
disable. In the previous versions the reset was executed also on the ready signal enable.
Defined two new global variables FLASHWriteCtr and EEPROMWriteCtr for the accesses count to
the FLASH and EEPROM memories.
The TermIOOpen and TermIOClose functions if referred to the serial line I/O device now allows the
enable and disable of the management interrupt.
Added ArrayBitCount, ArrayBitSet, ArrayBitStatus functions.
Defined in the SERIALSTRUCT data structure the Mode.WaitLoop member.
Modified SystemMemoryRead e SystemMemoryWrite functions, the bytes number operand is
passed on a unsigned int variable instead of unsigned char.
Added ASCIIToHEX and HEXToASCII macros, they allow the ASCII to HEX e HEX to ASCII
conversion.
Added Random function.
The system functions IODeviceFctReturn and IODeviceFctMissing are defined as global.
Eliminated the BUS_TERMINALSTRUCT definition and created the TERMINALSTRUCT data
structure.
Added the AsciiStringConvert function.
Added the GetCharEchoEnable variable.
Added a 30 mSec debouncing on the terminal keyboard acquisition.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr026.htm (1 of 3) [06/10/2008 17.46.18]


Picosyst system library, history report

SFR026F000

Added the ElSystemLibVersion global variable definition.


Enabled the power down interrupt to guarantee more protection in RAM memory data backup.
Added BlinkBit function.
Added the tick interrupt enable SetTimer0Enable(TRUE) and the watchdog enable SetWDogTime
(1400) functions call, in SystemInit function.
Added NSYSTReadyMng function.
Added RunLEDMng function.
Added I2CMasterNodeCheck function.
Eliminated the FLASHWriteCtr global variable.
Eliminated from the SetTimer0Enable function the unsigned int Time parameter.
Eliminated the blinking bits Toggle100, Toggle200, Toggle400, Toggle800, Toggle1600,
Toggle3200, Toggle6400, Toggle12800 management.
Added in the SystemMemoryRead and SystemMemoryWrite functions, the management of the
PCB111 mass memory module.

SFR026G000

A
Modified SystemMemoryRead and SystemMemoryWrite functions, added the management of type 5
to access to the DATA memory inside to the microprocessor and disabled interrupt on memory access.
Eliminated the XON and XOFF character management in serial line.
Addded ModbusCRC function.
Eliminated bug on data input, if the [ENT] key was pressed without any data given the system locks.

SFR026H000

E
Version realized to have the same behavior of the libraries that interface with the Kernel. Changed the
TERMIOFUNCTIONS, SERIALFUNCTIONS and TERMINALFUNCTIONS data structures.
Eliminated the SetDataAddress and GetDataAddress functions, the SetTermIOData e
GetTermIOData functions must be used.
Modified the BlinkBit function and the relate BLINKBITDATA data structure.
The user program is executed allowing the return to the library where the run led blink is managed.

SFR026H100

E
Solved the bug in ArrayBitCount, ArrayBitSet and ArrayBitStatus functions. They don't work properly if
the given array was long 32 bytes.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr026.htm (2 of 3) [06/10/2008 17.46.18]


Picosyst system library, history report

SFR026H200

E
Solved the bug in SystemMemoryWrite function on PCB111 mass memory module management.
Changed the hexadecimal data entry, it's not longer used the [FUN] key but now it' managed the
double function for the keys from [0] to [5]. The [FUN] key is used to input the "-" character in the
binary enhanced data entry.
Managed two new data entry types: 5: Binary, are accepted only 0 and 1. 6: Binary enhanced, range
from 0 to F and '-'.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr026.htm (3 of 3) [06/10/2008 17.46.18]


Netreader system library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

Netreader system library, history report

SFR037A000

First library version available for Remoter 8.x

SFR037B000

Renamed library with ElSystemLib alias and create version for Remoter 8.1.

SFR037C000

A
The SetPeripheralReady function resets the logic outputs on all the modules at the ready signal
disable. In the previous versions the reset was executed also on the ready signal enable.
Defined two new global variables FLASHWriteCtr and EEPROMWriteCtr for the accesses count to
the FLASH and EEPROM memories.
The TermIOOpen and TermIOClose functions if referred to the serial line I/O device now allows the
enable and disable of the management interrupt.
Added ArrayBitCount, ArrayBitSet, ArrayBitStatus functions.
Defined in the SERIALSTRUCT data structure the Mode.WaitLoop member.
Modified SystemMemoryRead e SystemMemoryWrite functions, the bytes number operand is
passed on a unsigned int variable instead of unsigned char.
Added ASCIIToHEX and HEXToASCII macros, they allow the ASCII to HEX e HEX to ASCII
conversion.
Added Random function.
The system functions IODeviceFctReturn and IODeviceFctMissing are defined as global.
Eliminated the BUS_TERMINALSTRUCT definition and created the TERMINALSTRUCT data
structure.
Added the AsciiStringConvert function.
Added the GetCharEchoEnable variable.
Added the NSYSTExtModuleInp and NSYSTExtModuleOut functions, to maintain compatibility with the
Picosyst system.

SFR037D000

Added the ElSystemLibVersion global variable definition.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr037.htm (1 of 2) [06/10/2008 17.46.19]


Netreader system library, history report

Added BlinkBit function.


Added the tick interrupt enable SetTimer0Enable(TRUE) and the watchdog enable SetWDogTime
(1400) functions call, in SystemInit function.
Added NSYSTReadyMng function.
Added RunLEDMng function.
Added I2CMasterNodeCheck function.
Eliminated the FLASHWriteCtr global variable.
Eliminated from the SetTimer0Enable function the unsigned int Time parameter.
Eliminated the blinking bits Toggle100, Toggle200, Toggle400, Toggle800, Toggle1600,
Toggle3200, Toggle6400, Toggle12800 management.
Added in the SystemMemoryRead and SystemMemoryWrite functions, the management of the
PCB111 mass memory module.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr037.htm (2 of 2) [06/10/2008 17.46.19]


Netlog lite system library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

Netlog lite system library, history report

SFR038A000

Created the ElSystemLib and realized version for the Remoter 8.1.

SFR038B000

Added the ElSystemLibVersion global variable definition.


Added BlinkBit function.
Added the tick interrupt enable SetTimer0Enable(TRUE) and the watchdog enable SetWDogTime
(1400) functions call, in SystemInit function.
Added NSYSTReadyMng function.
Added NSYSTReadyIn function.
Added RunLEDMng function.
Added I2CMasterNodeCheck function.
Eliminated the FLASHWriteCtr global variable.
Eliminated from the SetTimer0Enable function the unsigned int Time parameter.
Eliminated the blinking bits Toggle100, Toggle200, Toggle400, Toggle800, Toggle1600,
Toggle3200, Toggle6400, Toggle12800 management.
Added in the SystemMemoryRead and SystemMemoryWrite functions, the management of the
PCB111 mass memory module.

SFR038C000

Eliminated some bugs on I2C management.

SFR038D000

A
Modified SystemMemoryRead and SystemMemoryWrite functions, added the management of type 5
to access to the DATA memory inside to the microprocessor and disabled interrupt on memory access.
SystemMemoryWrite function, managed the FLASH memory write access.
Eliminated the XON and XOFF character management in serial line.
Addded ModbusCRC function.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr038.htm (1 of 2) [06/10/2008 17.46.20]


Netlog lite system library, history report

SFR038E000

A
Version realized to have the same behavior of the libraries that interface with the Kernel. Changed the
TERMIOFUNCTIONS, SERIALFUNCTIONS and TERMINALFUNCTIONS data structures.
Eliminated the SetDataAddress and GetDataAddress functions, the SetTermIOData e
GetTermIOData functions must be used.
Modified the BlinkBit function and the relate BLINKBITDATA data structure.
The user program is executed allowing the return to the library where the run led blink is managed.
Increased the serial reception buffer dimension, now is 256 bytes, this allows the upload of the
programs on NetlogII sistems on "B" port at maximum baud rate of 115200.

SFR038E200

A
Solved the bug in ArrayBitCount, ArrayBitSet and ArrayBitStatus functions. They don't work properly if
the given array was long 32 bytes.
Solved the bug in SystemMemoryWrite function on PCB111 mass memory module management.
Changed the hexadecimal data entry, it's not longer used the [FUN] key but now it' managed the
double function for the keys from [0] to [5]. The [FUN] key is used to input the "-" character in the
binary enhanced data entry.
Managed two new data entry types: 5: Binary, are accepted only 0 and 1. 6: Binary enhanced, range
from 0 to F and '-'.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr038.htm (2 of 2) [06/10/2008 17.46.20]


Netreader system library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

Netreader system library, history report

SFR039A000

Created the ElSystemLib and realized version for the Remoter 8.1.

SFR039B000

A
The SetPeripheralReady function resets the logic outputs on all the modules at the ready signal
disable. In the previous versions the reset was executed also on the ready signal enable.
Defined two new global variables FLASHWriteCtr and EEPROMWriteCtr for the accesses count to
the FLASH and EEPROM memories.
The TermIOOpen and TermIOClose functions if referred to the serial line I/O device now allows the
enable and disable of the management interrupt.
Added ArrayBitCount, ArrayBitSet, ArrayBitStatus functions.
Defined in the SERIALSTRUCT data structure the Mode.WaitLoop member.
Modified SystemMemoryRead e SystemMemoryWrite functions, the bytes number operand is
passed on a unsigned int variable instead of unsigned char.
Added ASCIIToHEX and HEXToASCII macros, they allow the ASCII to HEX e HEX to ASCII
conversion.
Added Random function.
The system functions IODeviceFctReturn and IODeviceFctMissing are defined as global.
Eliminated the BUS_TERMINALSTRUCT definition and created the TERMINALSTRUCT data
structure.
Added the AsciiStringConvert function.
Added the GetCharEchoEnable variable.

SFR039C000

Added the ElSystemLibVersion global variable definition.


Added BlinkBit function.
Added the tick interrupt enable SetTimer0Enable(TRUE) and the watchdog enable SetWDogTime
(1400) functions call, in SystemInit function.
Added NSYSTReadyMng function.
Added the NSYSTReadyIn function.
Added RunLEDMng function.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr039.htm (1 of 2) [06/10/2008 17.46.20]


Netreader system library, history report

Added I2CMasterNodeCheck function.


Eliminated the FLASHWriteCtr global variable.
Eliminated from the SetTimer0Enable function the unsigned int Time parameter.
Eliminated the blinking bits Toggle100, Toggle200, Toggle400, Toggle800, Toggle1600,
Toggle3200, Toggle6400, Toggle12800 management.
Added in the SystemMemoryRead and SystemMemoryWrite functions, the management of the
PCB111 mass memory module.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr039.htm (2 of 2) [06/10/2008 17.46.20]


System library, history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

System library, history report

SFR039A000

First version of system library


Renamed the SetExtInt1Vector function with SetEIntVector, and EX1InterruptLatency bit in
ExecutionErrors with ExtInterruptLatency.
Renamed the PwDownIntVector function with SetPwDownIntVector. In the function prototype has
been added the possibility to manage the interrupt enable and disable.
Eliminated the FlashSectorErase, I2CSendReceive, BitSetCount, SetBitStatus, TestBitStatus
functions.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr043.htm [06/10/2008 17.46.21]


ElPLCLib history report

ELSIST Srl, www.elsist.it MNL041Q100

Libraries

ElPLCLib history report

SFR036A000

B C A A A

First library version available for Remoter 8.x

SFR036B000

B C A A A

Renamed library with alias ElPLCLib and realized version for Remoter 8.1.
Modified DTRE instruction to adapt it to the modified ElSystemLib system libraries.
Insert the PLCTxBufEmpty flag management in the STXC instruction.

SFR036C000

D E C A B
Modified the backup and restore management, now they use the SystemMemoryRead and
SystemMemoryWrite system functions to access to the backup memory. In this way it is possible to
use also EEPROM memory and mass memory to backup data.
Added PLCBackupEnd flag management, it is activated for a program loop at every backup cycle.
Modified macro for access to the numerical operands from C programs, statements like: PLCOpW
(0x0000)++; did not work correctly.
Added functions to manage the TASK instruction at relative address
Added PLCRemoterProjectInfo variable definition for the project information.
Inserted PLCRTCDATA prototype definition for the management of the real time clock. In this way it is
possible from Remoter to allocate to known address the Rtc values to be able to be accessed from
MODBUS
Modified the logic input acquisition function, now it acquires the input by executing a debouncing on
them. The debouncing time can be set in the project settings.
The loop time calculation is always executed, it isn't possible to disable it in the project settings.
All the blinking flag now are managed synchronously with the program execution.
In the FDIV floating division when a division for 0 occurs it returns the maximum value with the proper
sign.
Defined the PLCErrors data structure, it reports al the PLC program execution errors.
Modified the RunLED management, it blinks regularly if non errors are present, and irregularly if any
error is present in the SystemErrors, ExecutionErrors and PLCErrors data structures.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr036.htm (1 of 2) [06/10/2008 17.46.22]


ElPLCLib history report

SFR036D000

D E C A B

Added the ElPLCLibVersion global variable definition.


Added PLCDebouncing function.
Executed the two new variables to disable and one shot command the data backup,
PLCBackupDisable and PLCBackupOneShot.
Defined in the PLCRemoterProjectInfo data structure, new members to report the project information
LIStartAddress, LINrOfBytess, LOStartAddress, LONrOfBytes, FStartAddress, FNrOfBytes.
These members are automatically updates by Remoter.
Added management of Y PLCRandom reserved operand.
Added management of W PLCSystemTime reserved operand.
Added Linearize function.

http://192.168.0.61/Destination/Html/Appendix/Libraries/HistoryReport/Sfr036.htm (2 of 2) [06/10/2008 17.46.22]


Memory map: Picosyst

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

Picosyst systems

The Picosyst sytems have a memory


configuration as reported in the figure. the access
to the memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 32 Kbytes of external RAM
memory, addresses from 0x8000 to 0xFFFF,
used as data memory. The memory has a backup
battery, the addresses from 0x8000 to 0xDFFF
can be write protected, see the
SetUserDataLock function.

Type 1, user code memory


The system has 128 Kbytes of FLASH memory,
addresses from 0x00000 to 0x1FFFF. The user
program usually uses 64 Kbytes of memory in the
range from 0x0000 to 0xFFFF (Sectors from 0 to
3). The other 64 Kbytes of memory can be used
for the data storage.

Type 3, mass memory (PCB088)


To the Pycosyst extension bus can be connect
up to 7 PCB088 Mass memory modules, address
from 0x00000000 to 0xFFFFFFFF, that can be
used as data memory. The memory modules
available are based on RAM memory with
backup battery and have a capacity of 128
Kbytes of memory with address from 0x00000 to
0x1FFFF.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/Picosyst.htm (1 of 2) [06/10/2008 17.46.23]


Memory map: Picosyst

internally to the microprocessor and the access to


it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/Picosyst.htm (2 of 2) [06/10/2008 17.46.23]


Memory map: Picosyst

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

Picosyst ME II systems

The Picosyst sytems have a memory


configuration as reported in the figure. the access
to the memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 24 Kbytes of external RAM
memory, addresses from 0x0000 to 0x5FFF,
used as data memory. The memory has a backup
battery, the memory can be write protected, see
the SetUserDataLock function.

Type 1, user code memory


The system has 128 Kbytes of FLASH memory,
addresses from 0x00000 to 0x1FFFF. The user
program usually uses 64 Kbytes of memory in the
range from 0x0000 to 0xFFFF (Sectors from 0 to
3). The other 64 Kbytes of memory can be used
for the data storage.

Type 3, mass memory (PCB088)


To the Pycosyst extension bus can be connect
up to 7 PCB088 Mass memory modules, address
from 0x00000000 to 0xFFFFFFFF, that can be
used as data memory. The memory modules
available are based on RAM memory with
backup battery and have a capacity of 128
Kbytes of memory with address from 0x00000 to
0x1FFFF.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/PicosystMEII.htm (1 of 2) [06/10/2008 17.46.24]


Memory map: Picosyst

it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/PicosystMEII.htm (2 of 2) [06/10/2008 17.46.24]


Memory map: Netlog

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

Netlog systems

The Netlog system have a memory configuration


as reported in the figure. the access to the
memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 32 Kbytes of external RAM
memory, addresses from 0x8000 to 0xFFFF,
used as data memory. The memory has a backup
battery, the addresses from 0x8000 to 0xDFFF
can be write protected, see the
SetUserDataLock function.

Type 1, user code memory


The system has 128 Kbytes of FLASH memory,
addresses from 0x00000 to 0x1FFFF. The user
program usually uses 64 Kbytes of memory in the
range from 0x0000 to 0xFFFF (Sectors from 0 to
3). The other 64 Kbytes of memory can be used
for the data storage.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to
it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/Netlog.htm [06/10/2008 17.46.24]


Memory map: Netreader T89C51ED2

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

Netreader systems T89C51ED2 Temic

The Netreader systems based on a


microcontroller Temic T89C51ED2, have a
memory configuration as reported in the figure.
The access to the memory is possible by using
the SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 1792 bytes of external RAM
memory, addresses from 0x8000 to 0x06FF,
used as data memory.

Type 1, user code memory


The system has 64 Kbytes of FLASH memory,
address from 0x0000 to 0xFFFF. The last 1
Kbyte of the memory has the Bootloader and it
is not available for the user program.

Type 2, user storage memory


The system has 2 Kbytes of EEPROM memory,
address from 0x0000 to 0x07FF. It can be used
by the user program as storage memory. If to the
system is connected the chip card reader
(PCB105**00), additional 256 bytes of EEPROM
memory are available, address from 0x10000 to
0x100FF.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to
it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/NetreaderT89C51ED2.htm [06/10/2008 17.46.25]


Memory map: Netreader P89C664

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

Netreader systems P89C664 Philips

The Netreader systems based on a


microcontroller Philips P89C664, have a memory
configuration as reported in the figure. The
access to the memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 1792 bytes of external RAM
memory, addresses from 0x8000 to 0x06FF,
used as data memory.

Type 1, user code memory


The system has 64 Kbytes of FLASH memory,
address from 0x0000 to 0xFFFF. The last 1
Kbyte of the memory has the Bootloader and it
is not available for the user program.

Type 2, user storage memory


If to the system is connected the chip card reader
(PCB105**00), a 256 bytes of EEPROM memory
are available, address from 0x10000 to 0x100FF.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to
it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/NetreaderP89C664.htm [06/10/2008 17.46.26]


Memory map: NetlogII lite systems

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

NetlogII lite systems

The NetlogII lite systems have a memory


configuration as reported in the figure. The
access to the memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 2 Kbytes of external RAM
memory, addresses from 0x8000 to 0x07FF,
used as data memory.

Type 1, user code memory


The system has 64 Kbytes of FLASH memory,
address from 0x0000 to 0xFFFF. The last 2
Kbyte of the memory are reserved. It's defined a
zone of 6 Kbyte that in some system can be used
to store the Bootloader.

Type 2, user storage memory


The system has 3 Kbytes of EEPROM memory,
address from 0x0000 to 0x0BFF. It can be used
by the user program as storage memory.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to
it is more fast than the external.

Type 22, system configuration memory


The system has 1 Kbytes of EEPROM memory,
address from 0x0000 to 0x03FF.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/NetlogIILite.htm [06/10/2008 17.46.26]


Memory map: NetlogII systems

ELSIST Srl, www.elsist.it MNL041Q100

Memory map

NetlogII systems

The NetlogII lite systems have a memory


configuration as reported in the figure. The
access to the memory is possible by using the
SystemMemoryRead, SystemMemoryWrite
functions.

Type 0, user data memory


The system has 24 Kbytes of external RAM
memory, addresses from 0x0000 to 0x5FFF,
used as data memory. The memory has a backup
battery, the memory can be write protected, see
the SetUserDataLock function.

Type 1, user code memory


The system has 128 Kbytes of FLASH memory,
addresses from 0x00000 to 0x1FFFF. The user
program usually uses 64 Kbytes of memory in the
range from 0x0000 to 0xFFFF (Sectors from 0 to
3). The other 64 Kbytes of memory can be used
for the data storage.

Type 2, user storage memory


The system has 60 Kbytes of EEPROM memory,
addresses from 0x0000 to 0xEFFF. It can be
used for the data storage.

Type 4, mass memory (PCB111)


To the I2C extension bus can be connect a
PCB111 mass memory module, address from
0x00000 to 0x1FFFF, that can be used as data
memory. The memory modules available are
based on EEPROM memory and have a capacity
of 128 Kbytes of memory.

Type 5, user I data memory


The system has 256 bytes of internal RAM
memory, addresses from 0x0000 to 0x00FF,
used as data memory. This memory is located
internally to the microprocessor and the access to
it is more fast than the external.

http://192.168.0.61/Destination/Html/Appendix/MemoryMap/NetlogII.htm [06/10/2008 17.46.27]


NetlogII loader, history report

ELSIST Srl, www.elsist.it MNL041Q100

Loaders

NetlogII loader, history report

SFW142A000

First version

http://192.168.0.61/Destination/Html/Appendix/Loaders/HistoryReport/Sfw142.htm [06/10/2008 17.46.27]


Picosyst ME II loader, history report

ELSIST Srl, www.elsist.it MNL041Q100

Loaders

Picosyst ME II loader, history report

SFW147A000

First version

http://192.168.0.61/Destination/Html/Appendix/Loaders/HistoryReport/Sfw147.htm [06/10/2008 17.46.28]


Picosyst ME III loader, history report

ELSIST Srl, www.elsist.it MNL041Q100

Loaders

Picosyst ME III loader, history report

SFW152A000

First version

http://192.168.0.61/Destination/Html/Appendix/Loaders/HistoryReport/Sfw152.htm [06/10/2008 17.46.28]


Picosyst ME III loader, history report

ELSIST Srl, www.elsist.it MNL041Q100

Loaders

Picosyst ME III loader, history report

SFW154A000

First version

http://192.168.0.61/Destination/Html/Appendix/Loaders/HistoryReport/Sfw154.htm [06/10/2008 17.46.29]


NetlogII kernel, history report

ELSIST Srl, www.elsist.it MNL041Q100

Kernels

NetlogII kernel, history report

SFW146A000

First version
SFW146B300

Solved the bug in SystemMemoryWrite function on PCB111 mass memory module management.
Changed the hexadecimal data entry, it's not longer used the [FUN] key but now it' managed the
double function for the keys from [0] to [5]. The [FUN] key is used to input the "-" character in the
binary enhanced data entry.
Managed two new data entry types: 5: Binary, are accepted only 0 and 1. 6: Binary enhanced, range
from 0 to F and '-'.

http://192.168.0.61/Destination/Html/Appendix/Kernels/HistoryReport/Sfw146.htm [06/10/2008 17.46.29]


Picosyst ME II kernel, history report

ELSIST Srl, www.elsist.it MNL041Q100

Kernels

Picosyst ME II kernel, history report

SFW149A000

First version
SFW149B500

Solved the bug in ArrayBitCount, ArrayBitSet and ArrayBitStatus functions. They don't work properly if
the given array was long 32 bytes.
SFW149B510

Solved the bug in SystemMemoryWrite function on PCB111 mass memory module management.
Changed the hexadecimal data entry, it's not longer used the [FUN] key but now it' managed the
double function for the keys from [0] to [5]. The [FUN] key is used to input the "-" character in the
binary enhanced data entry.
Managed two new data entry types: 5: Binary, are accepted only 0 and 1. 6: Binary enhanced, range
from 0 to F and '-'.

http://192.168.0.61/Destination/Html/Appendix/Kernels/HistoryReport/Sfw149.htm [06/10/2008 17.46.30]


Picosyst ME III kernel, history report

ELSIST Srl, www.elsist.it MNL041Q100

Kernels

Picosyst ME III kernel, history report

SFW153A000

First version

http://192.168.0.61/Destination/Html/Appendix/Kernels/HistoryReport/Sfw153.htm [06/10/2008 17.46.30]


1 Porte seriali 2 Bus di campo (opzionale) 3 Ingressi logici e analogici
Serial ports Field bus (optional) Logic and analog inputs
LK1 Half/Full Duplex Pos 0-1: Full
DTE CONFIGURATIONS Pos 0-2: Half
Pin A B Pos 0-1: Receive Always
2
1 LK2 Receiver Mode Pos 0-2: Receive if DTR ON
1 NC NC 3
2 NC NC
4
5 A Pos 0-1: not allowed
6
7 LK3 Line Termination Pos 0-2: RS485
8 + + V0 + V2
3 DTR (1) DTR (2) None: Not terminated
4 GND GND 10-30VDC
1 1 2 3 4 5 P9 Cavo schermato
2 - + V1 + V3
3
5 RXD RXD Pin RS485 Shielded cable
4
5 B P9
6 TXD TXD 6
8
7 RS485 1 TX+
7 NC CTS 2 TX-
P6 1 9 P7 1 9
8 RTS (1) RTS (2) 1 LK1 2 1 LK2 2 1 LK3 2 3 RX+
LED segnalazione stato
4 RX- INC IND INE INF COM-A
(1), (2) Collegati insieme internamente ETHERNET FIELD BUS Status LED COM-L
5 GND
(1), (2) Internally connected togheter L 0 1 2 3 4 5 6 7 8 9 A B C D E F A
COM LOGIC INPUT ANALOG INPUT COM
12 Logic Input 4 Analog input
10-30VDC 0 - 10V, 12bit
9 Bus di estensione
Extension bus
IN EXT. MODULE OUT

P4
4 Identificazione prodotto
Product identification
2 10

1 9 LBL052B000

Code: MPS022***0
P4 - 12C BUS EXT.
Serial nr.: 000437
Pin Signal
1
2
+5VCC
+5VCC
MPS022 * * * 0
3 SUPPLY-R
4 SUPPLY-R Livello scheda 0 = Without keyboard/display
5 RDYOU-N
6 GND Board release 1 = With keyboard/display
7 SCLK
6 = Relais
8 GND
9 SDATA 9 = Static
10 GND

8 Circuito di alimentazione 7 Uscite analogiche 6 Uscite logiche 5 LED di stato CPU


Power supply circuit Analog outputs Logic outputs CPU Status LEDs
10-30VDC PE COM ANALOG OUTPUT OUTPUT COM RUN LED (Yellow)
- + 0 1 RDY LED (Green)
0 1 2 3 4 5 6 7
OUT0 OUT1 OUT2 OUT0 OUT1 OUT2 10-30VDC PE
POWER 0N LED (Green) OUT0 OUT1 OUT2 OUT3 OUT0 OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 COM - +
P11 P11
P12 3 1 3 1
9 1 P5
OUT4 OUT5 OUT6 OUT4 OUT5 OUT6
OUT4 OUT5 OUT6 OUT7
POWER EARTH FUSE 1A T P12

=
Cavo schermato
+ ~ Shielded cable LED segnalazione stato
~/=
~
STATO CPU RUN RDY
_ ~ VOUT 1 Status LED CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
MNL104B100

ON
0 - 2.5V RUN
Vmax= 30VDC OFF
COM ON
RUN/TEST
OFF
0 - 2.5V ELECTRONIC SYSTEMS
Massima tensione modulo relè: 150VDC/270VAC ON
Massima tensione modulo statico: 60VDC/60VAC STOP/TEST
VOUT 0 OFF
Relay module maximum voltage: 150VDC/270VAC Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
AVARIA INDETERMINATO INDETERMINATO Phone +39-0142-451987 Fax +39-0142-451988
Static module maximum voltage: 60VDC/60VAC FAILURE INDETERMINATE INDETERMINATE Internet: http://www.elsist.net; email: elsist@elsist.net
Alimentazione (Fig. 8) Uscite analogiche (Fig. 7) Compatibilità elettromagnetica Technical specifications Procedura di avviamento
NetLog è conforme alla direttiva compatibilità Start
NETLOG può essere alimentato con una tensione continua Le uscite analogiche disponibili sono 2 riferite verso un solo Power supply requirements MPS022**00 (10-30Vdc, 4.5W) Starting procedure
compresa nell’intervallo 10-30V; la presenza della tensione sui comune presente sul pin 2 del connettore P11. elettromagnetica in riferimento alle norme CEI EN 50081-1 (EMC: Power supplied to the Ext. Bus 5Vdc 1A
morsetti 1 (+) e 2 (-) del connettore P12, è segnalata dal LED La tensione in uscita è compresa tra 0 e +2,5V, la norma generica sull’emissione riguardante ambienti residenziali,
CPU
verde contrassegnato dalla scritta “POWER ON LED”. risoluzione di ogni singola uscita è di 12bit. commerciali e dell’industria leggera) e CEI EN 50082-2 (EMC: Microprocessor Analog Device ADuC812 (MCS51
norma generica sull’immunità riguardante gli ambienti industriali). Family)
ATTENZIONE! Il collegamento delle uscite deve essere
Collegamento di terra effettuato utilizzando cavi schermati.
2
IC TM
è un marchio registrato di Philips Semiconductors. Flash memory 128 KBytes Collegare alimentazione
(+, -, PE fig.8)
Ram memory 32 KBytes non volatile
Il dispositivo deve essere collegato direttamente a terra Connect power supply
Data Retension Min. 10 years @ 25°C
mediante l'apposito morsetto del connettore di alimentazione P12 Bus di estensione (Fig. 9) Real Time Clock Calendar Yes (+, -, PE fig.8)
(Vedi Fig. 8). Il collegamento deve essere eseguito mediante una Il bus di comunicazione con i moduli di estensione sfrutta Optional
KEYBOARD/DISPLAY
cordina con sezione di almeno 1,5 mmq, ad una barra l’interfaccia I2CTM ed è disponibile su connettore IDC 10 poli (P4). I Display LCD STN Alphanumeric 2x16 characters
equipotenziale di rame di adeguata sezione. moduli di estensione devono essere collegati in cascata tramite gli with fixed backlight
Al fine di garantire una buona rejezione ai disturbi, è appositi cavetti CBL045**00 (da ordinare separatamente). Keyboard 6 keys with tactile feedback
necessario che questo collegamento sia mantenuto il più corto L'indirizzamento dei moduli di estensione avviene in modo
Led POWER ON acceso?
INTERFACE No (fig.8)
possibile e non venga fatto passare con altri cavi. automatico: il software riconosce se un modulo di estensione è RS232 (Port “A & B”) Is POWER ON led light?
collegato alla unità base e gli assegna l’indirizzo di quello • Baud rate 300 - 115200 Baud (fig.8)
Ingressi logici (Fig. 3) precedente +1. Il modulo base ha indirizzo 00Hex. • Galvanic insulation None
Gli ingressi logici disponibili sono 12, tutti optoisolati e • Maximum cable length 15mt Yes
attivabili mediante una tensione continua di 10-30Vdc. E' previsto ATTENZIONE! Prima di collegare al modulo base i moduli di Field Bus (optional) RS485
• Maximum speed 115.2 Kbps
un comune per tutti gli ingressi (pin 1 connettore P6); lo stato di estensione, accertarsi che questo non sia alimentato. In caso
• Maximum cable length 1200m - 4000ft
contrario i dispositivi potrebbero essere irrimediabilmente Verificare tensione Led RUN lampeggiante?
ogni ingresso è visualizzato tramite LED (Vedi Fig. 3). La tensione • Galvanic insulation Yes No
di alimentazione. (fig.5)
di attivazione degli ingressi deve essere continua e filtrata. danneggiati. Verify power supply Is flashing RUN Led ?
I/Os voltage. (fig.5)
Ingressi analogici (Fig. 3) Porte seriali (Fig. 1) Logic inputs 12 with one common
Gli ingressi analogici disponibili sono 4, la tensione NETLOG dispone di due porte seriali di tipo “DTE” (Data • Voltage range 10 - 30Vdc Yes
Terminal Equipment). Il collegamento con altri dispositivi dello • Input current 5mA @ 24Vdc
applicabile è compresa nell’intervallo tra 0 e +10V riferita verso il
Analog inputs 4 with one common
comune presente sul pin 9 del connettore P7. La risoluzione del stesso tipo, quali personal computer o terminali operatore in • Input voltage range 0 - 10 Volt Programma già in Led RDY acceso?
convertitore è di 12bit. L’impedenza di ingresso è di 47Kohm. genere, deve essere eseguito con un cavo di tipo Null-Modem • Input impedance 43Kohm esecuzione. Yes (fig.5)
ATTENZIONE! Il collegamento degli ingressi deve essere della lunghezza massima di 15 mt, come prescritto dalle specifiche • Resolution 12 bit Program already in Is RDY led light?
execution.
EIA RS232C. Per la programmazione di NETLOG deve essere Logic outputs 8 with one common, static or relais (fig.5)
effettuato utilizzando cavi schermati. • Maximum voltage (static) 60Vac/dc
usata la porta “B”.
• Maximum current (static) 350mA No
Uscite logiche (Fig. 6) Entrambe le porte: A e B, non sono galvanicamente isolate, • Maximum voltage (relay) 250Vac, 110Vdc
Sono disponibili 8 uscite logiche, a relè oppure statiche. Le quindi è opportuno verificare, prima di collegare tra di loro • Maximum current (relay) 5A
uscite statiche possono comandare carichi sia in c.a. che in c.c.. dispositivi diversi, che il potenziale di massa di questi ultimi sia lo • Max. switching power (relay) 750 VA 90W Collegare linea seriale
stesso. • UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc e trasferire il programma.
Le uscite sono galvanicamente isolate dal sistema. È previsto un • Electrical life @ 20cpm
4
5x10 Operat. @ 5A 250Vac, 3A 30Vdc Connect serial line and
comune per tutte le uscite (pin 1 connettore P5); lo stato di ogni ATTENZIONE!: Differenze di potenziale eccessive tra punti di (relay) 2x107 Operations minimum transfer the program.
uscita è visualizzato tramite LED (Vedi Fig. 6). massa diversi, possono causare danneggiamenti irreversibili • Mechanical life (relay)

Le uscite vengono forzate a “0” all'accensione del sistema, Analog outputs 2 with one common
ai dispositivi.
• Output voltage range 0-2.5 Volt
e comunque ogni qualvolta lo stato del LED "RDY" è “0”. • Resolution 12 bit
ATTENZIONE! Usare sempre i soppressori in parallelo ai Bus di campo - opzionale (Fig. 2) Absolute wire size 0,13 - 1,5 mm 2
Il ponticello LK3 in posizione 0-2 consente di inserire la Mandare in esecuzione
• UL 22 - 14 AWG
carichi induttivi, la mancata osservanza di questa il programma.
resistenza di terminazione di 120 ohm prevista per le reti RS485; • DIN 46 228/1 0,5 - 1,5 mm
2
prescrizione può produrre alterazioni funzionali e ridurre la Run program.
l’assenza del ponticello esclude la terminazione. La posizione 0-1 Case Standard DIN 43880 9M
vita dei relè interni dell’apparecchio. • Dimensions 90x160x58 mm
non è consentita.
Weight 0,4 Kg
Operating temperure 0 to +60 °C
Relative humidity Max. 90%

anomalies and reduce the internal relays expected life. the termination is excluded. Never use 0-1 position, this position
Power supply (Fig. 8) may be used only if present the CAN Bus interface.
NETLOG can be powered with DC voltage at range 10-30V. Analog output (Fig. 7)
The presence of the power supply is signalized by the green LED The module is equipped with 2 analog outputs; output Electromagnetic Compatibility
marked “POWER ON LED”. voltage range is 0-2.5V. The analog outputs common is available NetLog is conforming to the EMC directive in reference to
on P11-2 connector. the norms CEI EN 50081-1 (EMC: Generic norm on the issue Modalità di collegamento Full-Duplex
Ground connection regarding residential environments, commercial and of the light IMPORTANTE! NETMASTER Full-Duplex configuration NETMASTER
The device must be connected directly to GND by means of WARNING! The analog output connection must be executed industry) and CEI EN 50082-2 (EMC: Generic norm on immunity Le reti RS485 devono essere SCH
the specific terminal of power connector P12 (See Fig. 1). The using shielded cables. regarding the industrial environments). realizzate utilizzando cavi Bianco Bianco
1 Tx+ 1 3 Rx+ 1
connection must be performed through a wire with section at least 2
IC
TM
is a trade mark of Philips Semiconductors. schermati e twistati. In caso LK1
0
Nero Nero
0
LK1
2 2
of 1.5 sq. mm to a copper equipotential bar of adeguate section. contrario la comunicazione Tx- 2 4 Rx-
To guarantee a good noise rejection, keep this connection
Extension bus (Fig. 9) 1
Rosso Rosso
1
The communication bus with the extension modules potrebbe essere compromessa. LK2
0
2 Rx+ 3 1 Tx+ 0
2 LK2
as short as possible an take care to place it fa away to the other
overworks the I2C™ interface and it’s available on IDC 10 1
Rx- 4
Giallo Giallo
2 Tx- 1
cables. IMPORTANT! 0 0
connector (P4). The extension modules must be connected LK3 2 2 LK3
through the the special cables CLB045**00 (to be ordered The RS485 nets must be created 5 5
Logic inputs (Fig. 3)
separately). using shelded and twisted cable. Lunghezza massima cavo: 1200mt
The module is equipped with 12 logic optoisolated inputs.
The addressing of extension modules is automatic: the The communication is not Cable maximum length: 4000 feet
These inputs can be activated by means of a DC source in the
range 10-30V. A unique common is provided for all 12 inputs (pin software recognise if an extension module is connected or not and guaranteed in other cases.
1 of connector P6). The state of each input is shown by a LED assign it an address equal to the previous module address +1. The
(See Fig. 3). The voltage applied at inputs must be filtered. base module has address 00Hex.
WARNING! Before to connect the extension modules to the NETMASTER Modalità di collegamento Half-Duplex multipunto NETMASTER
Analog inputs (Fig. 3) NETLOG Half-Duplex multidrop configuration NETLOG
base module, be sure that it’s unpowered. Missing this rule
The module is equipped with 4 analog inputs, the voltage may produce failures in the modules. SCH
applicable included in range 0-10V, common mode referred to the Bianco Bianco
1 Tx+ 1 1 Tx+ 1
common on pin 9 of connector P7. The converter resolution is 0 0
LK1 Nero Nero LK1
12bit, the input impedance is 47Kohm. Serial Ports (Fig. 1) 2
Tx- 2 2 Tx- 2

1 1
WARNING! The analog input connection must be executed NETLOG is provided of two serial ports DTE (Data Terminal 0 0
Equipment). The connection between DTEs, such as Personal LK2 2 Rx+ 3 3 Rx+ 2 LK2
using shielded cables.
Computers, Operator Terminals etc., must be done through a 1
0 Rx- 4 4 Rx- 1
0
Null-modem cable of maximum cable lenght of 15mt, according to LK3 2 2 LK3
Logic outputs (Fig. 6) EIA RS232C specifications. NetMaster must be programmed using 5 5
The module is equipped with 8 relays or static outputs. The serial port “A”. These ports aren’t galvanically insulated from the NETMASTER
static outpus can drive a.c. or d.c. loads indifferently. The outputs system, is recommended to verify, before to connect toghether Nero Bianco NETLOG
are galvanically isolated from the system. There is unique common different devices, the difference of potential on the ground.
connection for every 8 outputs (pin 1 of P5); The state of every
output is shown by a LED (See Fig. 6). WARNING!: An excess of difference of potential on ground 1 Tx+ 1
The calbe maximum length between the
All outputs are reseted at each system power on, and
0
LK1 first one and the last of the devices does
loop may cause damages to the devices. 2 Tx- 2
however every time the state of the "RDY" LED is 0. La lunghezza massima del cavo tra il primo e l’ultimo not exceed 4000 feet.
1
dei dispositivi non deve superare i 1200 mt. 3 Rx+ 0
LK2
The termination resistor must be enabled
2
Field bus (Fig. 2) La resistenza di terminazione deve essere abilitata solo on to the first one and the last device only:
WARNING! Interference suppressors must be connected in The Jumper LK3 allow to connect the termination resistor sul primo e l’ultimo dei dispositivi: LK3 pos. 0-2 4 Rx- 1
0 LK3 pos. 0-2.
parallel to inductive loads, according to manufacturer 2 LK3
needed for these networks. The positions 0-2 of the jumper allows La resistenza di terminazione di tutti i dispositivi inter- Termination resistor of all middle devices
suggestions. Missing this rule may produce functional 5
to insert the termination resistor on RS485; If jumper is removed medi deve essere disabilitata: LK3 non presente. must be disabled: LK3 Off.
1 Porta seriale e bus estensione I2C 2 Interfaccia Smart-Card 3 Circuito di alimentazione 4 Inseritore Smart Card (opzionale)
2
Serial port and I C extension bus Smart-Card interface P4 - SMART CARD EXT. Power supply circuit Smart Card reader (optional)
Pin Signal
ATTENZIONE! Max. 30Vdc/20Vac
1 Switch (+5REG) Codice scheda: PCB105**00
WARNING! Max. 30Vdc/20Vac
RS232 LINE OUT EXT. MODULE 2 Switch (P0.4) Board code: PCB105**00
9 1 FUSE 1A T
=/~
Contatti Smart Card:
3 C8 - NC +/~ ~ lato inferiore
P4 Smart Card pad:
LK2 10 2 4 C4 - LED (+) POWER ON LED
bottom side

2 10 /~ ~
5 C7 - SDA (RD-N)
P2 P3
1 9 OUT EXT. MODULE 6 C3 - CLK (WR-N)
7 C6 - NC P1 1 3
POWER RUN RDY
8 C2 - RST (P2.5) POWER EARTH
1 3 5 7
2 4 6 8 9 C5 - GND ~ ~
10-20VAC PE
10 C1 - VCC OUT0 OUT1 OUT2 OUT3

LK2 ON=Catch ENABLED P3 - I2C BUS EXT. Pin 1

LK2 OFF=Catch DISABLED P1 PCB105**00


Pin Signal P1

Ingressi logici Pin Signal


DTE CONFIGURATIONS 1 +5VCC 5
Logic inputs Connecting cable 1 Switch
Pin Signal 2 +5VCC CBL045**00
2 Switch
1 NC 3 SUPPLY-R
Dimensioni (bxhxp): 3 C8 - NC
2 NC 4 SUPPLY-R - b (base) = 75mm
- h (altezza) = 92mm 4 C4 - LED (+)
3 DTR (INT1) 5 RDYOU-N (T0) - p (prof. con connettore inserito) = 20mm
5 C7 - SDA
4 GND 6 GND
6 C3 - CLK
5 RXD (RxD) 7 SCLK (P1.6) Dimension (bxhxt):
- b (base) = 75mm
+ 7 C6 - NC
6 TXD (TxD) 8 GND - h (height) = 92mm

10-30VDC
- t (thickness with connector inserted) = 20mm 8 C2 - RST
7 CTS (PSEN) 9 SDATA (P1.7)
- 9 C5 - GND
8 RTS (INT1) 10 GND
10 C1 - VCC

P6 1 8
Si raccomanda l'uso di cavi ELSIST.
The use of ELSIST cables is recommended. Led di segnalazione stato
State signalling led COM-L
CBL054*000 DB9F/RJ45 Null-Modem Adapter
CBL055**00 DB9M/RJ45 Modem Adapter L 0 1 2 3 4 5
CBL057*300 RJ45 8/8 Unshielded Cable (2m) COM LOGIC INPUT
6 Logic Inputs
CBL045*200 NETSYST I2C Extens. Cable (20cm) 10-30VDC
CBL045*300 NETSYST I2C Extens. Cable (50cm)

8 Segnalazione anomalie 7 Uscite logiche 6 Identificazione prodotto


Signalling anomalies Logic outputs Product identification
RDY LED (Green) OUTPUT COM
RUN LED (Yellow) 0 1 2 3
Fuse 1 A EF
OUTPUT COM POWER RUN RDY
F1 F2
0 1 2 3 P5 LBL052D000

5 1 COM Code: MPS024A000


POWER RUN RDY OUT0 OUT1 Serial nr.: 00024
OUT0 OUT1 OUT2 OUT3
STATO CPU RUN RDY
CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
Led di segnalazione stato
MPS024 * * * 0
OUT0 OUT1 OUT2 OUT3 ON
RUN State signalling led
~/= Livello modulo MNL099B100
OFF
Module release
ON
RUN/TEST
OFF Relay Out = 0 0 = Equipped with 89C51RD2
ON Massima tensione modulo relè: 150VDC/270VAC Static Out = 3 1 = Equipped with AT89C51RD2
STOP/TEST ELECTRONIC SYSTEMS
OFF Massima tensione modulo statico: 60VDC/60VAC
AVARIA INDETERMINATO INDETERMINATO
Relay module maximum voltage: 150VDC/270VAC Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
FAILURE INDETERMINATE INDETERMINATE Static module maximum voltage: 60VDC/60VAC Phone +39-0142-451987 Fax +39-0142-451988
Internet: http://www.elsist.net email: elsist@elsist.it
Alimentazione (Fig. 3)
Il modulo base può essere alimentato con tensione continua od alternata rispettivamente nei
range 10-30Vdc o 8-20Vac e frequenze di 50 o 60 Hz indifferentemente. La presenza
Technical specifications
Porta seriale (Fig. 1)
dell’alimentazione è segnalata dal LED POWER (Fig. 3). Power supply requirements MPS024***0 (10-30Vdc or 9-20Vac, 2W)
Il modulo base è dotato di una porta seriale di tipo “DTE” (Data Terminal Equipment) disponibile
ATTENZIONE! Il superamento del valore massimo di tensione indicato può provocare sul connettore P2 di tipo RJ45. Il collegamento con altri dispositivi DTE, quali personal computer o
terminali operatore in genere, deve essere eseguito con un cavo di tipo Null-Modem della lunghezza
Power supplied to the Extension Bus 5Vdc 300mA
il danneggiamento irreversibile dell’apparato.
massima di 15 mt, vedi ns Cod. CBL054*000 + CBL057**00. CPU
Se il dispositivo collegato è di tipo DCE (Data Communication Equipment), come ad esempio un
modem, si dovrà utilizzare un cavo Modem, o l’adattatore CBL055*000 in luogo del CBL054*000. Microprocessor Philips P89C51RD2 or ATMEL AT89C51RD2 (MCS51 Family)
Collegamento di terra Il segnale CTS presente sul pin 7 di P2 non è utilizzabile come segnale di controllo flusso, esso System memory FLASH EPROM 64 KBytes
Il modulo base deve essere collegato direttamente a terra mediante l'apposito morsetto del serve unicamente nelle fasi di caricamento del programma, rimuovendo LK2 tale operazione non è più
connettore di alimentazione (Fig. 3). Il collegamento deve essere eseguito mediante una cordina con possibile. User memory SRAM 1 KBytes
sezione di almeno di 1.5 mmq, ad una barra equipotenziale di rame di adeguata sezione. La porta seriale non è galvanicamente isolata, quindi è opportuno verificare, prima di collegare Data Retention Min. 10 years @ 25°C
Al fine di garantire una buona rejezione ai disturbi, è necessario che questo collegamento sia tra di loro dispositivi diversi, che il potenziale di massa di questi ultimi sia lo stesso.
Real Time Clock Calendar Optional with PCB105*000
mantenuto il più corto possibile e non venga fatto passare con altri cavi.
ATTENZIONE!: Differenze di potenziale eccessive tra punti di massa diversi, possono INTERFACE
Ingressi logici (Fig. 5) causare danni irreversibili ai dispositivi.
Il modulo base è dotato di 6 ingressi logici optoisolati attivabili con segnali compresi nel range RS232
10-30Vdc, la tensione deve essere filtrata. E’ previsto un comune per tutti gli ingressi. Gli ingressi 04-05 • Baud rate 12800 - 115200 Baud
sono di tipo veloce e possono acquisire segnali con frequenza max. di 50KHz. • Galvanic insulation None
Lo stato di ogni ingresso è visualizzato tramite LED. • Maximum cable length 15mt
Interfaccia Smart-Card (Fig. 2)
Uscite logiche (Fig. 7) Al connettore P4 può essere connesso, opzionalmente, un lettore di smart card ns cod. I/Os
Il modulo base è dotato di 4 uscite logiche a relè o statiche, dotate di un comune. Per la portata PCB105**00 o, in alternativa i cod. AMPHENOL:
C702 10M008 7012, C702 10M008 7002, C702 10M008 5142, Logic inputs 6 with one common
commutabile riferirsi alla tabella caratteristiche tecniche. Lo stato di ogni uscita è visualizzato tramite
Fornibili con l'apposita cornice C702 N1114 1E2; • Voltage range 10 - 30Vdc
LED. Le uscite vengono forzate a 0 all'accensione del sistema, e comunque ogni qualvolta lo stato del
LED "RDY" è 0 (Fig. 8). Nel caso di utilizzo del Cod. PCB105*000, il collegamento deve essere effettuato tramite • Input current 5mA @ 24Vdc
Il modulo con uscite statiche dispone di fusibili extrarapidi di protezione ogni 2 Out. F1 è l’apposito cavetto, utilizzabile anche per i moduli di estensione, CBL045*000. Logic outputs 4 with one common, static or relay
destinato alla protezione di OUT00-01, F2 alla protezione di OUT02-03. Le uscite statiche sono in • Maximum voltage (static) 60Vac/dc
grado di commutare carichi sia AC che DC. Compatibilità elettromagnetica
Il dispositivo è conforme alla direttiva compatibilità elettromagnetica in riferimento alle norme CEI • Maximum current (static) 350mA
ATTENZIONE! Usare sempre i soppressori in parallelo ai carichi induttivi, la mancata EN 50081-1 (norma generica sull’emissione riguardante ambienti residenziali, commerciali e • Maximum voltage (relay) 250Vac, 110Vdc
osservanza di questa prescrizione può produrre alterazioni funzionali e ridurre la vita dell’industria leggera) e CEI EN 50082-2 (norma generica sull’immunità riguardante gli ambienti • Maximum current (relay) 5A
dei relè del dispositivo. industriali). • Max. switching power (relay) 750 VA 90W
• UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc
I2CTM è un marchio registrato di Philips Semiconductors 4
Bus di estensione (Fig. 1) • Electrical life @ 20cpm (relay) 5x10 Operat. @ 5A 250Vac, 3A 30Vdc
Il modulo base può essere ampliato con moduli di estensione della famiglia Netsyst attraverso il 7
• Mechanical life (relay) 2x10 Operations minimum
bus I CTM disponibile su connettore IDC 10 poli (P3). I moduli di estensione devono essere collegati in
2

cascata tramite gli appositi cavetti CBL045**00 (da ordinare separatamente).


2
ATTENZIONE! Prima di collegare al modulo base i moduli di estensione, accertarsi che
Absolute wire size 0,13 - 1,5 mm
questo non sia alimentato. In caso contrario i dispositivi potrebbero essere • UL 22 - 14 AWG
2
irrimediabilmente danneggiati. • DIN 46 228/1 0,5 - 1,5 mm
Case Standard DIN 43880 6M
• Dimensions 90x106x58 mm
Weight 0,25 Kg
Operating temperature 0 to +60 °C
Relative humidity Max. 90%
Power supply (Fig. 3) WARNING! Before to connect the extension modules to the base module, be sure that
The base module may be powered with dc or ac power source in the range 10-30Vdc or 8-20Vac it’s unpowered. Missing this rule may produce failures in the modules.
respectively at frequencies of 50 or 60Hz. The power On is displayed by LED POWER (Fig.3).
Serial Port (Fig. 1) Schema a blocchi
The base module is provided of one serial port DTE (Data Terminal Equipment) Type, available
BEWARE! Values greater than the maximum may destroy the device.
on the RJ45 connector P2. The connection with others DTE devices as PCs or Operator Terminals,
Block diagram P6 P5
must be executed using proper Null-modem cables of maximum lenght of 15mt, according to EIA
RS232 specifications, see our codes CBL054*000 + CBL057**00.
Ground connection If the connected device is a DCE (Data Communication Equipment), i.e. a modem, a modem
INPUT OUTPUT
The base module must be connected directly to Ground using the terminal block on the power cable must be used or the adapter CBL055*000 instead of CBL054*000.
supply connector (Fig. 3). The connection must be performed through a wire with section at least of 1.5 The CTS signal on P2-7 cannot be used as a flow control, it’s useful only during device
mm2, to a copper equipotential bar of adeguate section. programming, removing the jumper LK2 this operation become not allowed.
To guarantee a good noise rejection, keep this connection as short as possible and take care to This port isn’t galvanically insulated from the system, is recommended to verify, before to
place it far away to the other cables. connect toghether different devices, the difference of potential on the ground.

Logic inputs (Fig. 5) WARNING!: An excess of difference of potential on ground loop may cause damages
to the devices. Port P1 0-5 Port P2 0-3
The module is equipped with 6 logic optoisolated inputs. These inputs can be activated by
means of a DC source in the range 10-30V. The voltage applied at inputs must be filtered. A unique Tx
common is provided for all 6 inputs (pin 1 of connector P6). Inputs INP04-05 are Fast type, able to TxD X1-X2 OSCILLATOR
acquire signals at frequencies up to 50KHz. The state of each input is shown by a LED (See Fig. 5). Smart-Card interface Rx
To P4 connector may be connected, optionally, a smart-card reader our code PCB105**00 or,
RS232 RxD
Logic outputs (Fig. 7) P2 SERIAL LINE DTR uP
one of the following AMPHENOL codes: INT1
The module is equipped with 4 relays or static outputs with one common (See the table on side C702 10M008 7012, C702 10M008 7002, C702 10M008 5142,
for characteristics). Outputs are galvanically isolated from the system and the state of each one is
CTS RESET RESET
In case of use of PCB105*000, the connection must be done using the special cable, suitable for PSEN
displayed through a LED. All outputs are reset at each system power on, and however every time the extension modules also, CBL045*000.
state of the "RDY" LED is 0. INT0 PWDown
The static output module is provided of two extrarapid fuses to protect the device against shorts. LK2
Electromagnetic Compatibility
F1 protects OUT00-01, F2 protects OUT02-03. Static outputs may be used on DC or AC loads. WR RD P1.6 P1.7
The device meets the EMC directive in reference to the standards CEI EN 50081-1 (generic
standard on the issue regarding residential environments, commercial and of the light industry) and CEI
EN 50082-2 (generic standard on immunity regarding the industrial environments).
WARNING! Interference suppressors must be connected in parallel to inductive loads, SCL1 SDA1 SCL SDA
according to manufacturer suggestions. Missing this rule may produce functional
anomalies and reduce the relays expected life. 2 TM
IC is a trade mark of Philips Semiconductors

Extension bus (Fig. 1) SMART CARD INT. EXTENSION BUS


2
The module can be expanded with the extension modules of Netsyst family through the I C™
bus available on a 10 poles IDC connector (P3). The extension modules must be connected using the
special cables CBL045**00 available in different lenghts (to be ordered separately).
P4 P3
1 Porte seriali 2 Bus di campo (Opzione) 3 Ingressi logici 4 Ingressi analogici
Serial ports Field bus (Option) Digital inputs Analog inputs
DTE CONFIGURATIONS RS485 Termination +/-10-30VDC
LK3 Status PT100-PT1000
A B
Pin Not available 1
2
3 124 Ohm termitated
1 NC 4
6
5 A 1 2
V2
7 + V0 +
2 NC 8 Not terminated
1 2 Cavo schermato
3 DTR0 Shielded cable
1
4 GND 2
3 1 2
NOT ALLOWED + V1 + V3

5 RXD0
4
6
5 B RS485 Settings P9 P6 P7
8
7
Jumper Status 1 2 3 4 5 1 6 1 6
6 TXD0 Pin RS485
7 CTS0 P9 1 9 1
LK1 Full duplex 1 TX+ P14 P14
8 RTS0 2 TX- LK55 LK59 LK55 LK59
1 2 Half duplex
Si raccomanda l'uso di cavi Null-Modem ELSIST, codice: CBL054*000+CBL057**00 1 LK1 2 1 LK2 2 1 LK3 2 3 RX+ COM-L
The use of ELSIST Null-modem cables is recommended, code: CBL054*000+CBL057**00
LK2 Receiver always ready 4 RX-
ATTENZIONE! La porta B è condivisa con il bus RS485 ove presente
1
Receiver ready if DTR Off FIELD BUS 5 GND
WARNING! Port B is shared with RS485 bus if exist 1 2
4 Analog input
12 Digital Input 0 - 10V, 16bit 2 RTD
10-30VDC
I1 +
5 Bus di estensione I0 +
Extension bus Cavo schermato
Shielded cable
Analog inputs configuration
IN EXT. MODULE OUT 62R 62R Jumper ON OFF
6 Identificazione prodotto 1 6
Product identification LK55 Ch0 0-10Vdc Ch0 0-1.25Vdc
P14 LK56 Ch1 0-10Vdc Ch1 0-1.25Vdc
LK55 LK59
P4 - I2C BUS EXT. 2 10 LK57 Ch2 0-10Vdc Ch2 0-1.25Vdc
Pin Signal LK24 LBL052B000
LK58 Ch3 0-10Vdc Ch3 0-1.25Vdc
1 9
LK59 P14-6=GND P14-6=SHUNT
1 +5VCC P4 Code: MPS029A000
Serial nr.: 00004 2*0-20mA
2 +5VCC 2*4-20mA

3 SUPPLY-R LK24 CPU Programming


4 SUPPLY-R
5 RDYOU-N
ON ENABLED MPS029 * * * *
Versione 0 = RS232
6 GND OFF DISABLED
7 SCLK Release 1 = RS485
8 GND Relè = 0 0 = Without keyboard/display
9 SDATA
Static = 3 1 = With keyboard/display
10 GND

7 Circuito di alimentazione 8 Uscite analogiche 9 Uscite logiche 10 Segnalazione anomalie


Power supply circuit Analog outputs Logic outputs Signalling anomalies
RUN LED (Yellow)
OUTPUT COM RDY LED (Green)
COM ANALOG OUTPUT 0 1 2 3 4 5 6 7
0 1 PE
10-30VDC
10-30VDC PE OUT0 OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 COM - +
- +
9 1 P5
POWER 0N LED (Green) 4 1 P11
P11 OUT0 OUT7 P12
OUT0 OUT7
P12 3 1
OUT0 Cavo schermato Led di segnalazione stato STATO FIELD CPU RUN RDY
FUSE 1A T Shielded cable
State signalling led
~/= FIELD CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
MNL123B100
POWER EARTH ON
+
= ~ VOUT 1
0 - 10V (PWM)
RUN
OFF
ON
_
~ ~ COM
RUN/WARN
OFF
ON
Vmax= 30VDC COM Massima tensione modulo relè: 150VDC/270VAC STOP ELECTRONIC SYSTEMS
0 - 10V (DAC) Massima tensione modulo statico: 60VDC/60VAC OFF

Relay module maximum voltage: 150VDC/270VAC


AVARIA INDETERMINATO INDETERMINATO Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
FAILURE INDETERMINATE INDETERMINATE
VOUT 0 Phone +39-0142-451987 Fax +39-0142-451988
Static module maximum voltage: 60VDC/60VAC Internet: http://www.elsist.net; email: elsist@elsist.it
quindi è opportuno verificare, prima di collegare tra di loro dispositivi Technical specifications
Connessioni Uscite logiche (Fig. 9) RS232 diversi, che il loro potenziale di massa sia lo stesso. Procedura di avviamento
Power supply requirements 10-30Vdc 2W (Base module only) Start
NETLOG è dotato di morsetti estraibili per la connessione Il modulo base è dotato di 8 uscite logiche a relè oppure statiche, ATTENZIONE!: Differenze di potenziale eccessive tra punti Starting procedure
Power supplied to the Ext. Bus 5Vdc 300mA
dell’alimentazione, degli I/O e del bus di campo; di connettori IDC per il è previsto un comune per tutte le uscite. Per la portata commutabile di massa diversi, possono causare danneggiamenti
collegamento dei moduli di estensione e di connettori RJ45 per il riferirsi alla tabella caratteristiche tecniche. Lo stato di ogni uscita è CPU
irreversibili ai dispositivi. Microprocessor ANALOG DEV. ADuC845
collegamento delle porte RS232 e Ethernet. visualizzato tramite LED.
System memory FLASH 62kBytes RAM 2KBytes
Le uscite vengono forzate a 0 all'accensione del sistema, e
Data Retention Tipical 10 years @ 25°C
Alimentazione (Fig. 7) comunque ogni qualvolta lo stato del LED "RDY" è 0 (Fig. 10). Bus di campo (Fig. 2) (Opzione) Real Time Clock Calendar No Collegare alimentazione
NETLOG può essere alimentato con una tensione continua La versione statica monta 4 fusibili di protezione extrarapidi (1 Il connettore P9 rende disponibile una interfaccia field bus di tipo Optional
ogni due uscite). RS485. La figura 2 mostra la nomenclatura dei segnali presenti su P9. KEYBOARD/DISPLAY (+, -, PE fig.7)
compresa nell’intervallo 10-30V. La connessione della alimentazione Display LCD STN Alphanumeric 2x16 characters Connect power supply
deve essere effettuata su P12. Le uscite sono galvanicamente isolate dal sistema. Il ponticello LK3 consente di inserire o meno la resistenza di with fixed backlight (+, -, PE fig.7)
La presenza della tensione di alimentazione è segnalata dal LED terminazione prevista per le reti RS485. Keyboard 6 keys with tactile feedback
verde contrassegnato “POWER ON ”. ATTENZIONE! Usare sempre i soppressori in parallelo ai
carichi induttivi, la mancata osservanza di questa Compatibilità elettromagnetica INTERFACE
prescrizione può produrre alterazioni funzionali e ridurre la RS232 (Port “B”)
ATTENZIONE! Il superamento del valore massimo di Il dispositivo è conforme alla direttiva compatibilità • Baud rate 12800 - 115200 Baud
tensione indicato può provocare il danneggiamento vita dei relè interni dell’apparecchio. elettromagnetica in accordo con la norma CEI EN 50081-2 (Norma • Galvanic insulation None Led POWER ON acceso?
irreversibile dell’apparato. generica sull’emissione riguardante ambienti residenziali) e con la • Field Bus (option) RS485 No (fig.7)
norma CEI EN 50082.2 (Norma generica sull’immunità riguardante gli • Maximum speed 115.2 Kbps Is POWER ON led light?
Collegamento di terra (Fig. 7) Uscite analogiche (Fig. 8) ambienti industriali). • Maximum cable length 1200mt, 4000ft (fig.7)
ll dispositivo deve essere collegato direttamente a terra Le uscite analogiche disponibili sono 2. L’uscita analogica 0 è • Galvanic insulation Yes
mediante l'apposito morsetto del connettore di alimentazione (Fig. 7). Il realizzata tramite DAC a 12bit, l’uscita analogica 1 è invece realizzata 2 TM Yes
con tecnica PWM ed ha risoluzione 16bit IC è un marchio registrato di Philips Semiconductors I/Os
collegamento deve essere eseguito mediante una cordina con sezione Logic inputs 12 PNP/NPN with one common
di almeno di 1.5 mmq, ad una barra equipotenziale di rame di adeguata La tensione in uscita è compresa tra 0 e +10Vdc.
• Voltage range 10 - 30Vdc
sezione. Verificare la tensione Led RUN lampeggiante?
ATTENZIONE! Il collegamento delle uscite analogiche deve • Input current 5mA @ 24Vdc No
di alimentazione. (fig.10)
Al fine di garantire una buona rejezione ai disturbi, è necessario essere effettuato utilizzando cavi schermati. Analog inputs 4 common mode or 2 differential
• Input range 0-10 V, 0-1.25V, -200-+300°C (PT1000) Verify power supply Is flashing RUN Led ?
che questo collegamento sia mantenuto il più corto possibile e non
-200-+850°C (PT100) voltage. (fig.10)
venga fatto passare con altri cavi. Bus di estensione (Fig. 5) • Input impedance 37.7Kohm (0-10Vscale)
Il bus di comunicazione con i moduli di estensione sfrutta • Resolution 16 bit (0-10V, 0-1.25V) Yes
Ingressi logici (Fig. 3) 2 TM
l’interfaccia I C ed è disponibile su connettore IDC 10 poli (P4). I • +/-0.01°C (PT100/1000)
Il dispositivo è dotato di 12 ingressi logici optoisolati attivabili con moduli di estensione devono essere collegati in cascata tramite gli • RTD’s Linearization Kallendar-Van Dusen
segnali compresi nel range 10-30Vdc. E’ previsto un comune per tutti Programma già in Led RDY acceso?
appositi cavetti CBL045**00 (da ordinare separatamente). Logic outputs 8 with one common, static or relais
esecuzione. Yes
gli ingressi come illustrato in Fig. 3. Gli ingressi logici possono essere • Maximum voltage (static) 60Vac/dc (fig.10)
L'indirizzamento dei moduli di estensione avviene in modo Program already in
sia di tipo PNP che NPN. Lo stato di ogni ingresso è visualizzato • Maximum current (static) 350mA Is RDY led light?
automatico: il software riconosce se un modulo di estensione è execution.
tramite LED. La tensione di alimentazione degli ingressi deve essere • Maximum voltage (relay) 250Vac, 110Vdc (fig.10)
collegato alla unità base e gli assegna l’indirizzo di quello precedente
continua e filtrata, non è necessario che sia stabilizzata, ma non deve • Maximum current (relay) 5A
+1. Il modulo base ha indirizzo 0x20. No
superare il valore massimo di 30Vdc. • Max. switching power (relay) 750 VA 90W
• UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc
ATTENZIONE! Prima di collegare al modulo base i moduli di
• Electrical life @ 20cpm 5x104 Operat. @ 5A 250Vac, 3A 30Vdc
Ingressi analogici (Fig. 4) estensione, accertarsi che questo non sia alimentato. In (relay) Collegare linea seriale
Gli ingressi analogici disponibili sono 4 con connessione a modo caso contrario i dispositivi potrebbero essere • Mechanical life (relay)
7
2x10 Operations minimum e trasferire il programma.
comune o 2 in modo differenziale, la tensione applicabile è compresa irrimediabilmente danneggiati. Analog outputs 2 with one common Connect serial line and
nell’intervallo 0 +10V. La risoluzione del convertitore è di 16bit. • Output voltage range 0-10 Vdc transfer the program.
L’impedenza di ingresso è di 37.7Kohm in modalità 0-10Vdc. • Resolution 12 bit/16bit
Il sistema è altresì in grado di effettuare acquisizioni dirette di Porte seriali RS232 (Fig. 1) Absolute wire size 0,13 - 1,5 mm2
RTD di tipo PT100 o PT1000 con risoluzione di 0.01°C e NETLOG dispone di una porta seriale di tipo “DTE” (Data • UL 22 - 14 AWG
linearizzazione con il metodo Kallendar-Van Dusen, e può acquisire Terminal Equipment). Il collegamento con altri dispositivi DTE, quali • DIN 46 228/1 0,5 - 1,5 mm2
Case Standard DIN 43880 9M
riferimenti in corrente nel range 0-20mA (con shunt esterno 62 Ohm). personal computer o terminali operatore in genere, deve essere Mandare in esecuzione
• Dimensions 90x160x58 mm
eseguito con un cavo di tipo Null-Modem della lunghezza massima di il programma.
ATTENZIONE! Il collegamento degli ingressi analogici deve Weight 0,3 Kg Run program.
15 mt, come prescritto dalle specifiche EIA. Per la programmazione del Operating temperature -20 to +70 °C
essere effettuato utilizzando cavi schermati. dispositivo deve essere usata la porta “B”, la porta “A” non è connessa. Relative humidity Max. 90%
Le porte RS232, non sono galvanicamente isolate dal sistema,

These ports aren’t galvanically insulated from the system, it is


Connections Digital outputs (Fig. 6) recommended to verify, before to connect toghether different devices,
NETLOG is equipped with extractable TB for power supply, I/O’s The module is equipped with 8 relays or static outputs a unique the difference of potential on the ground.
and field bus connections; with IDC connectors for extension modules common for all outputs is provided. Please refer to the Technical specs Modalità di collegamento Full-Duplex
connection, and RJ45 connectors for RS232 and Ethernet connection. table for the maximum switching loads. The state of each output is WARNING!: An excess of difference of potential on ground
IMPORTANTE! NETLOG Full-Duplex configuration NETLOG
displayed by LED. loop may cause damages to the devices.
Le reti RS485 devono essere SCH
Power supply (Fig. 7) All outputs are reseted at each system power on, and however Bianco Bianco
NETLOG may be powered with a DC source in the range each time the state of the "RDY" LED is 0. realizzate utilizzando cavi 1 Tx+ 1 3 Rx+ 1

10-30Vdc. The DC source must be connected on P12.


Field bus (Fig. 2) (Option) schermati e twistati. In caso LK1
0
2 Nero Nero
0
2 LK1
WARNING! Interference suppressors must be connected in On connector P9 is available a field bus RS485 type. In Fig. 2 is Tx- 2 4 Rx-
The presence of the power is signalled by the green LED marked contrario la comunicazione 1 1
parallel to inductive loads, according to manufacturer shown the list of signals on P9 . Rosso Rosso
“POWER ON ”. potrebbe essere compromessa. LK2
0
Rx+ 3 1 Tx+ 0
LK2
suggestions. Missing this rule may produce functional The Jumper LK3 allows to connect or not the termination resistor 2 2

needed for this network. 1 Giallo Giallo 1


WARNING! Values greater than the maximum specified may anomalies and reduce the internal relays expected life. 0 Rx- 4 2 Tx- 0
IMPORTANT! LK3 2 2 LK3
destroy the device.
Electromagnetic Compatibility The RS485 net must be created 5 5
Analog output (Fig. 8) The device meets the EMC directive in reference to the using shielded and twisted cable, Lunghezza massima cavo: 1200mt
Ground connection The module is equipped with 2 analog outputs. Analog out 0 is standards CEI EN 50081-1 (generic standard on the issue regarding otherwise the communication is Cable maximum length: 4000 feet
The device must be connected directly to Ground using the made through a 12bit DAC, the analog out 1 is made through a 16bit residential environments, commercial and of the light industry) and CEI not guaranteed.
terminal block on the power supply connector (Fig. 7). The connection PWM. EN 50082-2 (generic standard on immunity regarding the industrial
must be performed through a wire with section at least of 1.5 mm2, to a The output voltage range is 0-10Vdc. T environments).
copper equipotential bar of adeguate section.
To guarantee a good noise rejection, keep this connection as WARNING! The analog output connection must be executed I2CTM is a trade mark of Philips Semiconductors Modalità di collegamento Half-Duplex multipunto
short as possible and take care to place it far away to the other cables. using shielded cables. NETLOG Half-Duplex multidrop configuration NETLOG

Digital inputs (Fig. 3) Bianco


SCH
Bianco
The device is equidded with 12 optoisolated digital inputs to be Extension bus (Fig. 5) 1 Tx+ 1 1 Tx+ 1
0 0
activated with signals in the range 10-30Vdc. A common for all the The communication bus with the extension modules uses the LK1 2 Nero Nero 2 LK1
I2C™ interface and it’s available on IDC 10 connector (P4). The Tx- 2 2 Tx-
inputs is provided as described in Fig. 3. The inputs may be PNP or 1 1
NPN. The state of each one is displayed with LED. The voltage to extension modules must be connected through the the special cables LK2
0
Rx+ 3 3 Rx+ 0
LK2
2 2
activate the inputs must be DC and filtered and be below the maximum CLB045**00 (to be ordered separately).
allowed. The addressing of extension modules is automatic: the software 1
0 Rx- 4 4 Rx- 1
0
recognise if an extension module is connected or not and assign it an LK3 2 2 LK3
address equal to the previous module address +1. The base module 5 5
Analog Inputs (Fig. 4) has address 0x20.
The available analog inputs are 4, with a common mode
connection or 2 in differential connection. The voltage applicable is Nero Bianco NETLOG
WARNING! Before to connect the extension modules to the
included in the range 0-10V. The converter resolution is 16bit. The input base module, be sure that it’s unpowered. Missing this rule
impedance is 37.7 Kohm in 0-10Vdc mode. may produce failures in the modules. 1 Tx+ The maximum cable length between the
The system is able to acquire PT100 or PT1000 RTSs directly 1
with a 0.01°C of resolution and Kallendar-Van Dusen linearization, and
0
2 LK1 first and the last device does not exceed
La lunghezza massima del cavo tra il primo e l’ultimo 2 Tx- 4000 feet.
may acquire current sensors in the range 0-20 mA (external 62 Ohm Serial Port (Fig. 1) 1
shunt is required). dei dispositivi non deve superare i 1200 mt. 3 Rx+ 0
LK2
The termination resistor must be inserted
NETLOG is provided of one serial port DTE (Data Terminal 2
La resistenza di terminazione deve essere abilitata solo on to the first and on the last device only
WARNING! The analog input connection must be executed Equipment). The connection between DTEs, such as Personal 1
Computers, Operator Terminals etc., must be done through a Null- sul primo e l’ultimo dei dispositivi (LK3-2). 4 Rx- 0 (LK3-2).
using shielded cables. 2 LK3
modem cable of maximum cable lenght of 15mt, according to EIA La resistenza di terminazione di tutti i dispositivi inter- Termination resistor of all middle devices
medi deve essere disabilitata: (LK3 non presente). 5 must be disabled (Jumper LK3 off).
specifications. For the programming the port B must be used, the port
“A” is not connected.
1 Porte seriali Bus di campo 3 Ingressi logici 4 Ingressi analogici
Serial ports RS485 Termination RS485 Settings Digital inputs Analog inputs
LK3 Status Jumper Status
DTE CONFIGURATIONS +/-10-30VDC
PT100-PT1000
A B 124 Ohm termitated Full duplex
Pin 1 1 2 LK1
Network I/F Field I/F 2
3 1 2 Half duplex
Not terminated
1 NC NC 4
6
5 A P8
1 2 + V0 + V2
7 Receiver always ready Cavo schermato
2 DCD NC LK2
8 Pin Signal 1 2
NOT ALLOWED Shielded cable
3 NC DTR0 8 6 4 2 1 2 Receiver ready if DTR Off + V1 + V3
1 ETH1 7 5 3 1
1
2
4 GND GND 3 2 ETH2
1 2 3 4 5
P9
P6 P7
5 RXD1 RXD0
4
6
5 B 3 ETH3 Pin RS485
1 6 1 6
7 P9
6 TXD1 TXD0 8 4 NC 1 TX+ 1 9 1 P14 P14
P8
7 NC CTS0 5 NC 2 TX- LK55 LK59 LK55 LK59
6 ETH6 1 LK1 2 1 LK2 2 1 LK3 2 3 RX+ COM-L
8 NC RTS0
7 NC 4 RX-
Si raccomanda l'uso di cavi Null-Modem ELSIST, codice: CBL054*000+CBL057**00 ETHERNET FIELD BUS 1
The use of ELSIST Null-modem cables is recommended, code: CBL054*000+CBL057**00
8 NC 5 GND
4 Analog input
0 - 10V, 16bit 2 RTD
12 Digital Input
10-30VDC
I1 +

5 Bus di estensione I0 +
Extension bus Cavo schermato
Shielded cable
Analog inputs configuration
IN EXT. MODULE OUT 62R 62R Jumper ON OFF
6 Identificazione prodotto 1 6
LK17 LK41 LK42 Product identification LK55 Ch0 0-10Vdc Ch0 0-1.25Vdc
2 10 P14 LK56 Ch1 0-10Vdc Ch1 0-1.25Vdc
1 2
LK36 LK10 P13 LK24 LK55 LK59
1 9
LK57 Ch2 0-10Vdc Ch2 0-1.25Vdc
P4 LK58 Ch3 0-10Vdc Ch3 0-1.25Vdc
LBL052B000
LK36 LK10 LK17 1-Wire STATUS P13 - 1-Wire Interface LK59 P14-6=GND P14-6=SHUNT
Pin Signal Code: MPS033A002 2*0-20mA
ON ON ON 1-Wire DISABLED Serial nr.: 00024 2*4-20mA
1 DATA (OWIO)
OFF OFF OFF 1-Wire ENABLED 2 GND (OWRTN)
MPS031 * * * * (SNAP Version)
P4 - I2C BUS EXT. MPS033 * * * * (TStik Version)
Pin Signal
LK41 LK42 I/Os Management Livello scheda 1 = RS485
1 +5VCC
Network I/O only,
ON ON
No Field I/O programming 2 +5VCC Board release 2 = CAN
OFF OFF Field I/O programming 3 SUPPLY-R Relè = 0 0 = Without keyboard/display
PLC like through Remoter
4 SUPPLY-R
Static = 3 1 = With keyboard/display
5 RDYOU-N
LK24 Field I/F programming 6 GND
7 SCLK
ON ENABLED
8 GND
OFF DISABLED 9 SDATA
8 Uscite analogiche 9 Uscite logiche 10 Segnalazione anomalie
10 GND Analog outputs Logic outputs Signalling anomalies
RUN LED (Yellow)
OUTPUT COM RDY LED (Green)
COM ANALOG OUTPUT 0 1 2 3 4 5 6 7
0 1 PE
7 Circuito di alimentazione OUT0 OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 COM
10-30VDC
- +
Power supply circuit
9 1 P5
4 1 P11
10-30VDC PE
P11 OUT0 OUT7 P12
- + OUT0 OUT7

POWER 0N LED (Green) Cavo schermato Led di segnalazione stato STATO FIELD CPU RUN RDY
Shielded cable
State signalling led
~/= FIELD CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
MNL094E100
ON
P12 3 1 RUN
VOUT 1 OFF
OUT0
FUSE 1A T 0 - 10V (PWM) ON
POWER EARTH RUN/WARN
COM
+
= ~
COM Massima tensione modulo relè: 150VDC/270VAC
OFF

STOP
ON
ELECTRONIC SYSTEMS
_
~ ~ 0 - 10V (DAC) Massima tensione modulo statico: 60VDC/60VAC
Relay module maximum voltage: 150VDC/270VAC
OFF
AVARIA
FAILURE
INDETERMINATO
INDETERMINATE
INDETERMINATO
INDETERMINATE
Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
VOUT 0 Phone +39-0142-451987 Fax +39-0142-451988
Vmax= 30VDC Static module maximum voltage: 60VDC/60VAC Internet: http://www.elsist.net; email: elsist@elsist.it
ATTENZIONE!: L’abilitazione del canale 1-Wire, esclude Technical specifications
Connessioni Uscite logiche (Fig. 9) l’utilizzo della porta CAN/RS485 sui codici Netmaster TStik Procedura di avviamento
Power supply requirements 10-30Vdc 5W (Base module only) Start
NETMASTER è dotato di morsetti estraibili per la connessione Il modulo base è dotato di 8 uscite logiche a relè oppure statiche, (MPS033****). Starting procedure
Power supplied to the Ext. Bus 5Vdc 300mA
dell’alimentazione, degli I/O e del bus di campo; di connettori IDC per il è previsto un comune per tutte le uscite. Per la portata commutabile
collegamento dei moduli di estensione e di connettori RJ45 per il riferirsi alla tabella caratteristiche tecniche. Lo stato di ogni uscita è CPU
collegamento delle porte RS232 e Ethernet. visualizzato tramite LED. Porte seriali RS232 (Fig. 1) Microprocessor Dallas DS80C400 (TStik version)
Imsys Cjip (SNAP version)
Le uscite vengono forzate a 0 all'accensione del sistema, e NETMASTER dispone di due porte seriali di tipo “DTE” (Data
System memory FLASH 1.5MBytes (TStik version)
Alimentazione (Fig. 7) comunque ogni qualvolta lo stato del LED "RDY" è 0 (Fig. 10). Terminal Equipment). Il collegamento con altri dispositivi DTE, quali FLASH 2MBytes (SNAP version) Collegare alimentazione
NETMASTER può essere alimentato con una tensione continua La versione statica monta 4 fusibili di protezione extrarapidi (1 personal computer o terminali operatore in genere, deve essere User memory SRAM 1MBytes non vol. (TStik version) (+, -, PE fig.7)
compresa nell’intervallo 10-30V. La connessione della alimentazione ogni due uscite). eseguito con un cavo di tipo Null-Modem della lunghezza massima di DRAM 8MBytes (SNAP version) Connect power supply
deve essere effettuata su P12. Le uscite sono galvanicamente isolate dal sistema. 15 mt, come prescritto dalle specifiche EIA. Per la programmazione Data Retention Tipical 10 years @ 25°C (+, -, PE fig.7)
La presenza della tensione di alimentazione è segnalata dal LED della sezione “Network Interface”, deve essere usata la porta “A”, Real Time Clock Calendar Yes
verde contrassegnato “POWER ON ”. ATTENZIONE! Usare sempre i soppressori in parallelo ai mentre la porta “B” deve essere usata per la programmazione della KEYBOARD/DISPLAY Optional
carichi induttivi, la mancata osservanza di questa Parte “Field Interface” (vedi MNL100*100). Display LCD STN Alphanumeric 2x16 characters
ATTENZIONE! Il superamento del valore massimo di prescrizione può produrre alterazioni funzionali e ridurre la Le porte RS232, non sono galvanicamente isolate dal sistema, with fixed backlight
tensione indicato può provocare il danneggiamento vita dei relè interni dell’apparecchio. quindi è opportuno verificare, prima di collegare tra di loro dispositivi Keyboard 6 keys with tactile feedback
Led POWER ON acceso?
irreversibile dell’apparato. RS232 diversi, che il loro potenziale di massa sia lo stesso. INTERFACE No (fig.7)
ATTENZIONE!: Differenze di potenziale eccessive tra punti RS232 (Port “A”) Is POWER ON led light?
Collegamento di terra (Fig. 7) Uscite analogiche (Fig. 8) di massa diversi, possono causare danneggiamenti • Baud rate 12800 - 115200 Baud (fig.7)
ll dispositivo deve essere collegato direttamente a terra Le uscite analogiche disponibili sono 2. L’uscita analogica 0 è • Galvanic insulation None
irreversibili ai dispositivi.
mediante l'apposito morsetto del connettore di alimentazione (Fig. 7). Il realizzata tramite DAC a 12bit, l’uscita analogica 1 è invece realizzata 1-Wire® Interface Shared with CAN bus (TStik version) Yes
con tecnica PWM ed ha risoluzione 16bit Always available (SNAP version)
collegamento deve essere eseguito mediante una cordina con sezione
di almeno di 1.5 mmq, ad una barra equipotenziale di rame di adeguata La tensione in uscita è compresa tra 0 e +10Vdc. Ethernet e Bus di campo (Fig. 2) • Field Bus RS485
• Maximum speed 115.2 Kbps Led RUN lampeggiante?
sezione. ATTENZIONE! Il collegamento delle uscite analogiche deve NETMASTER è dotato di una porta ethernet 10/100-BaseT a Verificare la tensione
• Maximum cable length 1200mt, 4000ft No (fig.10)
Al fine di garantire una buona rejezione ai disturbi, è necessario 100 Mbps disponibile sul connettore P8 di tipo RJ45; le connessioni, di alimentazione.
essere effettuato utilizzando cavi schermati. • Galvanic insulation Yes Verify power supply Is flashing RUN Led ?
che questo collegamento sia mantenuto il più corto possibile e non evidenziate in figura 2, sono compatibili con lo standard ethernet IEEE
802.3 100-BaseT. Per l’inserimento di NETMASTER in una rete Ethernet 100Base-T voltage. (fig.10)
venga fatto passare con altri cavi. Bus di estensione (Fig. 5) • Protocol TCP/IP
ethernet devono essere utilizzati cavi UDP Cat. 5 RJ45 ed un
Il bus di comunicazione con i moduli di estensione sfrutta concentratore (HUB), mentre, per un collegamento punto-punto, è • Maximum speed 100 Mbps Yes
Ingressi logici (Fig. 3) 2 TM
l’interfaccia I C ed è disponibile su connettore IDC 10 poli (P4). I • Maximum cable length According to Ethernet spec.
Il dispositivo è dotato di 12 ingressi logici optoisolati attivabili con sufficiente utilizzare un cavo incrociato RJ45 senza utilizzo di HUB. • Galvanic insulation Yes
moduli di estensione devono essere collegati in cascata tramite gli Il connettore P9 rende disponibile una interfaccia field bus che,
segnali compresi nel range 10-30Vdc. E’ previsto un comune per tutti Programma già in Led RDY acceso?
appositi cavetti CBL045**00 (da ordinare separatamente). in funzione del codice ordinato, può essere di tipo CAN oppure RS485.
I/Os esecuzione. Yes
gli ingressi come illustrato in Fig. 3. Gli ingressi logici possono essere Logic inputs 12 PNP/NPN with one common (fig.10)
L'indirizzamento dei moduli di estensione avviene in modo La figura 2 mostra la nomenclatura dei segnali presenti su P9 in Program already in
sia di tipo PNP che NPN. Lo stato di ogni ingresso è visualizzato • Voltage range 10 - 30Vdc Is RDY led light?
automatico: il software riconosce se un modulo di estensione è funzione del tipo di interfaccia disponibile. execution.
tramite LED. La tensione di alimentazione degli ingressi deve essere • Input current 5mA @ 24Vdc (fig.10)
collegato alla unità base e gli assegna l’indirizzo di quello precedente Il ponticello LK3 consente di inserire o meno la resistenza di
continua e filtrata, non è necessario che sia stabilizzata, ma non deve +1. Il modulo base ha indirizzo 0x20. Analog inputs 4 common mode or 2 differential
superare il valore massimo di 30Vdc. terminazione prevista per le reti CAN/RS485. • Input range 0-10 V, 0-1.25V, -200-+300°C (PT1000) No

ATTENZIONE! Prima di collegare al modulo base i moduli di -200-+850°C (PT100)


Ingressi analogici (Fig. 4) estensione, accertarsi che questo non sia alimentato. In Compatibilità elettromagnetica • Input impedance 37.7Kohm (0-10Vscale)
Collegare linea seriale
• Resolution 16 bit (0-10V, 0-1.25V)
Gli ingressi analogici disponibili sono 4 con connessione a modo caso contrario i dispositivi potrebbero essere Il dispositivo è conforme alla direttiva compatibilità e trasferire il programma.
• +/-0.01°C (PT100/1000)
comune o 2 in modo differenziale, la tensione applicabile è compresa irrimediabilmente danneggiati. elettromagnetica in accordo con la norma CEI EN 50081-2 (Norma Connect serial line and
• RTD’s Linearization Kallendar-Van Dusen
nell’intervallo 0 +10V. La risoluzione del convertitore è di 16bit. generica sull’emissione riguardante ambienti residenziali) e con la Logic outputs 8 with one common, static or relais transfer the program.
L’impedenza di ingresso è di 37.7Kohm in modalità 0-10Vdc. norma CEI EN 50082.2 (Norma generica sull’immunità riguardante gli • Maximum voltage (static) 60Vac/dc
Il sistema è altresì in grado di effettuare acquisizioni dirette di Interfaccia 1-Wire® (Fig. 5) ambienti industriali). • Maximum current (static) 350mA
RTD di tipo PT100 o PT1000 con risoluzione di 0.01°C e NETMASTER dispone di un’interfaccia di tipo “1-Wire” che • Maximum voltage (relay) 250Vac, 110Vdc
• Maximum current (relay) 5A
linearizzazione con il metodo Kallendar-Van Dusen, e può acquisire consente di collegare tutti i dispositivi compatibili con questo bus. Tali
• Max. switching power (relay) 750 VA 90W
riferimenti in corrente nel range 0-20mA (con shunt esterno 62 Ohm). dispositivi, atti a diversi utilizzi, possono essere trovati ai siti web I2CTM è un marchio registrato di Philips Semiconductors Mandare in esecuzione
• UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc
Maxim-Dallas e IButton unitamente alle classi Java™ per la loro 1-Wire® è un marchio registrato di Maxim/Dallas Semiconductors 4 il programma.
• Electrical life @ 20cpm 5x10 Operat. @ 5A 250Vac, 3A 30Vdc
ATTENZIONE! Il collegamento degli ingressi analogici deve gestione. La parte sinistra della figura 5 mostra il pin-out di P13 e come Java™ è un marchio registrato di Sun Microsystems Run program.
(relay)
essere effettuato utilizzando cavi schermati. settare LK10 ed LK36 per abilitare l’interfaccia • Mechanical life (relay) 2x107 Operations minimum
Analog outputs 2 with one common
• Output voltage range 0-10 Vdc
• Resolution 12 bit/16bit
Absolute wire size 0,13 - 1,5 mm2
• UL 22 - 14 AWG
• DIN 46 228/1 0,5 - 1,5 mm2
Case Standard DIN 43880 9M
• Dimensions 90x160x58 mm
Connections Digital outputs (Fig. 6) WARNING!: The enabling of 1-Wire, excludes the use of
Weight 0,4 Kg
NETMASTER is equipped with extractable TB for power supply, The module is equipped with 8 relays or static outputs a unique CAN/RS485 Port on Netmaster codes equipped with TStik Operating temperature -20 to +70 °C
I/O’s and field bus connections; with IDC connectors for extension common for all outputs is provided. Please refer to the Technical specs (MPS033****). Relative humidity Max. 90%
modules connection, and RJ45 connectors for RS232 and Ethernet table for the maximum switching loads. The state of each output is
connection. displayed by LED.
All outputs are reseted at each system power on, and however Serial Ports (Fig. 1) IMPORTANTE!
NETMASTER is provided of two serial ports DTE (Data Le reti RS485 devono essere Modalità di collegamento Full-Duplex
Power supply (Fig. 7) each time the state of the "RDY" LED is 0.
NETMASTER Full-Duplex configuration NETMASTER
NETMASTER may be powered with a DC source in the range Terminal Equipment). The connection between DTEs, such as realizzate utilizzando cavi
10-30Vdc. The DC source must be connected on P12. WARNING! Interference suppressors must be connected in Personal Computers, Operator Terminals etc., must be done through a schermati e twistati. In caso SCH

parallel to inductive loads, according to manufacturer Null-modem cable of maximum cable lenght of 15mt, according to EIA Bianco Bianco
The presence of the power is signalled by the green LED marked contrario la comunicazione 1 Tx+ 1 3 Rx+ 1
“POWER ON ”. suggestions. Missing this rule may produce functional specifications. For the programming of the section “Network interface” 0 0
the port A must be used, to program the “Field interface” section must potrebbe essere compromessa. LK1 2 Nero Nero 2 LK1
anomalies and reduce the internal relays expected life. Tx- 2 4 Rx-
WARNING! Values greater than the maximum specified be used the port “B”. These ports aren’t galvanically insulated from the 1
0 Rosso Rosso
1
0
system, it is recommended to verify, before to connect toghether IMPORTANT! LK2 2 Rx+ 3 1 Tx+ 2 LK2
may destroy the device.
Analog output (Fig. 8) different devices, the difference of potential on the ground. The RS485 net must be created 1
0 Rx- 4
Giallo Giallo
2 Tx- 1
0
The module is equipped with 2 analog outputs. Analog out 0 is using shielded and twisted cable, LK3 2 2 LK3
Ground connection made through a 12bit DAC, the analog out 1 is made through a 16bit WARNING!: An excess of difference of potential on ground 5 5
otherwise the communication is
The device must be connected directly to Ground using the PWM. loop may cause damages to the devices.
not guaranteed. Lunghezza massima cavo: 1200mt
terminal block on the power supply connector (Fig. 7). The connection The output voltage range is 0-10Vdc. T Cable maximum length: 4000 feet
must be performed through a wire with section at least of 1.5 mm2, to a
copper equipotential bar of adeguate section. WARNING! The analog output connection must be executed Ethernet and Field bus (Fig. 2)
To guarantee a good noise rejection, keep this connection as using shielded cables. NETMASTER is provided of a 10/100-BaseT ethernet port
NETMASTER Modalità di collegamento Half-Duplex multipunto NETMASTER
short as possible and take care to place it far away to the other cables. available on connector (P8). The connections, as described in Fig. 2, Half-Duplex multidrop configuration
are compatible with the standard ethernet IEEE 802.3 100-BaseT. To NETLOG NETLOG

Digital inputs (Fig. 3) Extension bus (Fig. 5) connect one or more NETMASTER into an ethernet Local Area
SCH
The communication bus with the extension modules uses the Network must be used cables UDP Cat. 5 and an HUB, while to made Bianco Bianco
The device is equidded with 12 optoisolated digital inputs to be 1 Tx+ 1 1 Tx+ 1
I2C™ interface and it’s available on IDC 10 connector (P4). The a point to point connection its enough to use a cross cable RJ45 without 0 0
activated with signals in the range 10-30Vdc. A common for all the HUBs. LK1 2 Nero Nero 2 LK1
inputs is provided as described in Fig. 3. The inputs may be PNP or extension modules must be connected through the the special cables Tx- 2 2 Tx-
CLB045**00 (to be ordered separately). On connector P9 is available a field bus interface that, 1 1
NPN. The state of each one is displayed with LED. The voltage to depending of the ordered code, may be CAN or RS485 type. In Fig. 2 is LK2
0
Rx+ 3 3 Rx+ 0
LK2
activate the inputs must be DC and filtered and be below the maximum The addressing of extension modules is automatic: the software 2 2
recognise if an extension module is connected or not and assign it an shown the list of signals on P9 for the both types of interface. 1 1
allowed. The Jumper LK3 allows to connect or not the termination resistor 0 Rx- 4 4 Rx- 0
address equal to the previous module address +1. The base module LK3 2 2 LK3
has address 0x20. needed for these networks.
Analog Inputs (Fig. 4) 5 5
The available analog inputs are 4, with a common mode WARNING! Before to connect the extension modules to the Electromagnetic Compatibility NETMASTER
connection or 2 in differential connection. The voltage applicable is base module, be sure that it’s unpowered. Missing this rule The device meets the EMC directive in reference to the Nero Bianco NETLOG
included in the range 0-10V. The converter resolution is 16bit. The input may produce failures in the modules. standards CEI EN 50081-1 (generic standard on the issue regarding
impedance is 37.7 Kohm in 0-10Vdc mode.
residential environments, commercial and of the light industry) and CEI The maximum cable length between the
The system is able to acquire PT100 or PT1000 RTSs directly 1 Tx+ 1
with a 0.01°C of resolution and Kallendar-Van Dusen linearization, and EN 50082-2 (generic standard on immunity regarding the industrial 0 first and the last device doesn’t exceed
1-Wire® Interface (Fig. 5) environments). 2 Tx- 2 LK1
may acquire current sensors in the range 0-20 mA (external 62 Ohm NETMASTER is provided of a 1-Wire® interface that allows to La lunghezza massima del cavo tra il primo e l’ultimo 4000 feet.
1
shunt is required). connect all the devices compatible with this interface. These devices 2 TM
I C is a trade mark of Philips Semiconductors
dei dispositivi non deve superare i 1200 mt. 3 Rx+ 0
LK2
The termination resistor must be inserted
2
made for different purposes, can be reached on the Maxim/Dallas and 1-Wire® is a trade mark of Maxim/Dallas Semiconductors La resistenza di terminazione deve essere abilitata solo on to the first and on the last device only
WARNING! The analog input connection must be executed 1
Ibutton internet sites, togheter with the Java classes needed. Look at Java™ is a trade mark of Sun Microsystems sul primo e l’ultimo dei dispositivi (LK3-2). 4 Rx- 0 (LK3-2).
using shielded cables. 2 LK3
Fig. 5 to connect P13 and to enable this interface. La resistenza di terminazione di tutti i dispositivi inter- Termination resistor of all middle devices
5 must be disabled (Jumper LK3 off).
medi deve essere disabilitata: (LK3 non presente).
1 Porte seriali 2 Bus di campo CAN Bus Termination
3 Ingressi logici 4 Ingressi analogici
Serial ports Field bus Digital inputs Analog inputs
LK3 Status
DTE CONFIGURATIONS +/-10-30VDC
PT100-PT1000
124 Ohm termitated
1 2
A B
Pin Network I/F Field I/F 1
2
3 P8 Not terminated
1 NC NC 4
6
5 A Pin Signal
1 2
+ V0 + V2
7 Cavo schermato
2 DCD NC 8
1 ETH1 8 6 4 2
7 5 3 1 1 2
NOT ALLOWED Shielded cable
3 NC DTR0 + V1 + V3
1 2 ETH2 P9
4 GND GND 2 1 2 3 4 5
3 P9
3 ETH3 Pin CAN P6 P7
5 RXD1 RXD0
4
6
5 B 1 6 1 6
7 4 NC 1 GND
6 TXD1 TXD0 8 P8 1 9 1 P14 P14
5 NC 2 CANL
7 NC CTS0 CAN Bus LK55 LK59 LK55 LK59
6 ETH6 1 LK3 2 3 NC
8 NC RTS0 COM-L
7 NC 4 CANH
Si raccomanda l'uso di cavi Null-Modem ELSIST, codice: CBL054*000+CBL057**00 ETHERNET FIELD BUS 1
The use of ELSIST Null-modem cables is recommended, code: CBL054*000+CBL057**00
8 NC 5 NC
4 Analog input
0 - 10V, 16bit 2 RTD
12 Digital Input
10-30VDC
I1 +

5 Bus di estensione I0 +
Extension bus Cavo schermato
Shielded cable
Analog inputs configuration
IN EXT. MODULE OUT 62R 62R Jumper ON OFF
6 Identificazione prodotto 1 6
LK17 LK41 LK42 Product identification LK55 Ch0 0-10Vdc Ch0 0-1.25Vdc
2 10 P14 LK56 Ch1 0-10Vdc Ch1 0-1.25Vdc
1 2
LK36 LK10 P13 LK24 LK55 LK59
1 9
LK57 Ch2 0-10Vdc Ch2 0-1.25Vdc
P4 LK58 Ch3 0-10Vdc Ch3 0-1.25Vdc
LBL052B000
LK36 LK10 LK17 1-Wire STATUS P13 - 1-Wire Interface LK59 P14-6=GND P14-6=SHUNT
Pin Signal Code: MPS033A002 2*0-20mA
ON ON ON 1-Wire DISABLED Serial nr.: 00024 2*4-20mA
1 DATA (OWIO)
OFF OFF OFF 1-Wire ENABLED 2 GND (OWRTN)
MPS031 * * * * (SNAP Version)
P4 - I2C BUS EXT. MPS033 * * * * (TStik Version)
Pin Signal
LK41 LK42 I/Os Management Livello scheda 1 = RS485
1 +5VCC
Network I/O only,
ON ON
No Field I/O programming 2 +5VCC Board release 2 = CAN
OFF OFF Field I/O programming 3 SUPPLY-R Relè = 0 0 = Without keyboard/display
PLC like through Remoter
4 SUPPLY-R
Static = 3 1 = With keyboard/display
5 RDYOU-N
LK24 Field I/F programming 6 GND
7 SCLK
ON ENABLED
8 GND
OFF DISABLED 9 SDATA
8 Uscite analogiche 9 Uscite logiche 10 Segnalazione anomalie
10 GND Analog outputs Logic outputs Signalling anomalies
RUN LED (Yellow)
OUTPUT COM RDY LED (Green)
COM ANALOG OUTPUT 0 1 2 3 4 5 6 7
0 1 PE
7 Circuito di alimentazione OUT0 OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 COM
10-30VDC
- +
Power supply circuit
9 1 P5
4 1 P11
10-30VDC PE
P11 OUT0 OUT7 P12
- + OUT0 OUT7

POWER 0N LED (Green) Cavo schermato Led di segnalazione stato STATO FIELD CPU RUN RDY
Shielded cable
State signalling led
~/= FIELD CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
MNL092D100
ON
P12 3 1 RUN
VOUT 1 OFF
OUT0
FUSE 1A T 0 - 10V (PWM) ON
POWER EARTH RUN/WARN
COM
+
= ~
COM Massima tensione modulo relè: 150VDC/270VAC
OFF

STOP
ON
ELECTRONIC SYSTEMS
_
~ ~ 0 - 10V (DAC) Massima tensione modulo statico: 60VDC/60VAC
Relay module maximum voltage: 150VDC/270VAC
OFF
AVARIA
FAILURE
INDETERMINATO
INDETERMINATE
INDETERMINATO
INDETERMINATE
Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
VOUT 0 Phone +39-0142-451987 Fax +39-0142-451988
Vmax= 30VDC Static module maximum voltage: 60VDC/60VAC Internet: http://www.elsist.net; email: elsist@elsist.it
ATTENZIONE!: L’abilitazione del canale 1-Wire, esclude Technical specifications
Connessioni Uscite logiche (Fig. 9) l’utilizzo della porta CAN/RS485 sui codici Netmaster TStik Procedura di avviamento
Power supply requirements 10-30Vdc 5W (Base module only) Start
NETMASTER è dotato di morsetti estraibili per la connessione Il modulo base è dotato di 8 uscite logiche a relè oppure statiche, (MPS033****). Starting procedure
Power supplied to the Ext. Bus 5Vdc 300mA
dell’alimentazione, degli I/O e del bus di campo; di connettori IDC per il è previsto un comune per tutte le uscite. Per la portata commutabile
collegamento dei moduli di estensione e di connettori RJ45 per il riferirsi alla tabella caratteristiche tecniche. Lo stato di ogni uscita è CPU
collegamento delle porte RS232 e Ethernet. visualizzato tramite LED. Porte seriali RS232 (Fig. 1) Microprocessor Dallas DS80C400 (TStik version)
Imsys Cjip (SNAP version)
Le uscite vengono forzate a 0 all'accensione del sistema, e NETMASTER dispone di due porte seriali di tipo “DTE” (Data
System memory FLASH 1.5MBytes (TStik version)
Alimentazione (Fig. 7) comunque ogni qualvolta lo stato del LED "RDY" è 0 (Fig. 10). Terminal Equipment). Il collegamento con altri dispositivi DTE, quali FLASH 2MBytes (SNAP version) Collegare alimentazione
NETMASTER può essere alimentato con una tensione continua La versione statica monta 4 fusibili di protezione extrarapidi (1 personal computer o terminali operatore in genere, deve essere User memory SRAM 1MBytes non vol. (TStik version) (+, -, PE fig.7)
compresa nell’intervallo 10-30V. La connessione della alimentazione ogni due uscite). eseguito con un cavo di tipo Null-Modem della lunghezza massima di DRAM 8MBytes (SNAP version) Connect power supply
deve essere effettuata su P12. Le uscite sono galvanicamente isolate dal sistema. 15 mt, come prescritto dalle specifiche EIA. Per la programmazione Data Retention Tipical 10 years @ 25°C (+, -, PE fig.7)
La presenza della tensione di alimentazione è segnalata dal LED della sezione “Network Interface”, deve essere usata la porta “A”, Real Time Clock Calendar Yes
verde contrassegnato “POWER ON ”. ATTENZIONE! Usare sempre i soppressori in parallelo ai mentre la porta “B” deve essere usata per la programmazione della KEYBOARD/DISPLAY Optional
carichi induttivi, la mancata osservanza di questa Parte “Field Interface” (vedi MNL100*100). Display LCD STN Alphanumeric 2x16 characters
ATTENZIONE! Il superamento del valore massimo di prescrizione può produrre alterazioni funzionali e ridurre la Le porte RS232, non sono galvanicamente isolate dal sistema, with fixed backlight
tensione indicato può provocare il danneggiamento vita dei relè interni dell’apparecchio. quindi è opportuno verificare, prima di collegare tra di loro dispositivi Keyboard 6 keys with tactile feedback
Led POWER ON acceso?
irreversibile dell’apparato. RS232 diversi, che il loro potenziale di massa sia lo stesso. INTERFACE No (fig.7)
ATTENZIONE!: Differenze di potenziale eccessive tra punti RS232 (Port “A”) Is POWER ON led light?
Collegamento di terra (Fig. 7) Uscite analogiche (Fig. 8) di massa diversi, possono causare danneggiamenti • Baud rate 12800 - 115200 Baud (fig.7)
ll dispositivo deve essere collegato direttamente a terra Le uscite analogiche disponibili sono 2. L’uscita analogica 0 è • Galvanic insulation None
irreversibili ai dispositivi.
mediante l'apposito morsetto del connettore di alimentazione (Fig. 7). Il realizzata tramite DAC a 12bit, l’uscita analogica 1 è invece realizzata 1-Wire® Interface Shared with CAN bus (TStik version) Yes
con tecnica PWM ed ha risoluzione 16bit Always available (SNAP version)
collegamento deve essere eseguito mediante una cordina con sezione
di almeno di 1.5 mmq, ad una barra equipotenziale di rame di adeguata La tensione in uscita è compresa tra 0 e +10Vdc. Ethernet e Bus di campo (Fig. 2) • Field Bus CAN Bus
• Maximum speed 125 Kbps Led RUN lampeggiante?
sezione. ATTENZIONE! Il collegamento delle uscite analogiche deve NETMASTER è dotato di una porta ethernet 10/100-BaseT a Verificare la tensione
• Maximum cable length See note below No (fig.10)
Al fine di garantire una buona rejezione ai disturbi, è necessario 100 Mbps disponibile sul connettore P8 di tipo RJ45; le connessioni, di alimentazione.
essere effettuato utilizzando cavi schermati. • Galvanic insulation Yes Verify power supply Is flashing RUN Led ?
che questo collegamento sia mantenuto il più corto possibile e non evidenziate in figura 2, sono compatibili con lo standard ethernet IEEE
802.3 100-BaseT. Per l’inserimento di NETMASTER in una rete Ethernet 100Base-T voltage. (fig.10)
venga fatto passare con altri cavi. Bus di estensione (Fig. 5) • Protocol TCP/IP
ethernet devono essere utilizzati cavi UDP Cat. 5 RJ45 ed un
Il bus di comunicazione con i moduli di estensione sfrutta concentratore (HUB), mentre, per un collegamento punto-punto, è • Maximum speed 100 Mbps Yes
Ingressi logici (Fig. 3) 2 TM
l’interfaccia I C ed è disponibile su connettore IDC 10 poli (P4). I • Maximum cable length According to Ethernet spec.
Il dispositivo è dotato di 12 ingressi logici optoisolati attivabili con sufficiente utilizzare un cavo incrociato RJ45 senza utilizzo di HUB. • Galvanic insulation Yes
moduli di estensione devono essere collegati in cascata tramite gli Il connettore P9 rende disponibile una interfaccia field bus che,
segnali compresi nel range 10-30Vdc. E’ previsto un comune per tutti Programma già in Led RDY acceso?
appositi cavetti CBL045**00 (da ordinare separatamente). in funzione del codice ordinato, può essere di tipo CAN oppure RS485.
I/Os esecuzione. Yes
gli ingressi come illustrato in Fig. 3. Gli ingressi logici possono essere Logic inputs 12 PNP/NPN with one common (fig.10)
L'indirizzamento dei moduli di estensione avviene in modo La figura 2 mostra la nomenclatura dei segnali presenti su P9 in Program already in
sia di tipo PNP che NPN. Lo stato di ogni ingresso è visualizzato • Voltage range 10 - 30Vdc Is RDY led light?
automatico: il software riconosce se un modulo di estensione è funzione del tipo di interfaccia disponibile. execution.
tramite LED. La tensione di alimentazione degli ingressi deve essere • Input current 5mA @ 24Vdc (fig.10)
collegato alla unità base e gli assegna l’indirizzo di quello precedente Il ponticello LK3 consente di inserire o meno la resistenza di
continua e filtrata, non è necessario che sia stabilizzata, ma non deve +1. Il modulo base ha indirizzo 0x20. Analog inputs 4 common mode or 2 differential
superare il valore massimo di 30Vdc. terminazione prevista per le reti CAN/RS485. • Input range 0-10 V, 0-1.25V, -200-+300°C (PT1000) No

ATTENZIONE! Prima di collegare al modulo base i moduli di -200-+850°C (PT100)


Ingressi analogici (Fig. 4) estensione, accertarsi che questo non sia alimentato. In Compatibilità elettromagnetica • Input impedance 37.7Kohm (0-10Vscale)
Collegare linea seriale
• Resolution 16 bit (0-10V, 0-1.25V)
Gli ingressi analogici disponibili sono 4 con connessione a modo caso contrario i dispositivi potrebbero essere Il dispositivo è conforme alla direttiva compatibilità e trasferire il programma.
• +/-0.01°C (PT100/1000)
comune o 2 in modo differenziale, la tensione applicabile è compresa irrimediabilmente danneggiati. elettromagnetica in accordo con la norma CEI EN 50081-2 (Norma Connect serial line and
• RTD’s Linearization Kallendar-Van Dusen
nell’intervallo 0 +10V. La risoluzione del convertitore è di 16bit. generica sull’emissione riguardante ambienti residenziali) e con la Logic outputs 8 with one common, static or relais transfer the program.
L’impedenza di ingresso è di 37.7Kohm in modalità 0-10Vdc. norma CEI EN 50082.2 (Norma generica sull’immunità riguardante gli • Maximum voltage (static) 60Vac/dc
Il sistema è altresì in grado di effettuare acquisizioni dirette di Interfaccia 1-Wire® (Fig. 5) ambienti industriali). • Maximum current (static) 350mA
RTD di tipo PT100 o PT1000 con risoluzione di 0.01°C e NETMASTER dispone di un’interfaccia di tipo “1-Wire” che I2CTM è un marchio registrato di Philips Semiconductors • Maximum voltage (relay) 250Vac, 110Vdc
• Maximum current (relay) 5A
linearizzazione con il metodo Kallendar-Van Dusen, e può acquisire consente di collegare tutti i dispositivi compatibili con questo bus. Tali 1-Wire® è un marchio registrato di Maxim/Dallas Semiconductors
Java™ è un marchio registrato di Sun Microsystems • Max. switching power (relay) 750 VA 90W
riferimenti in corrente nel range 0-20mA (con shunt esterno 62 Ohm). dispositivi, atti a diversi utilizzi, possono essere trovati ai siti web Mandare in esecuzione
• UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc
Maxim-Dallas e IButton unitamente alle classi Java™ per la loro 4 il programma.
• Electrical life @ 20cpm 5x10 Operat. @ 5A 250Vac, 3A 30Vdc
ATTENZIONE! Il collegamento degli ingressi analogici deve gestione. La parte sinistra della figura 5 mostra il pin-out di P13 e come Run program.
(relay)
essere effettuato utilizzando cavi schermati. settare LK10 ed LK36 per abilitare l’interfaccia • Mechanical life (relay) 2x107 Operations minimum
Analog outputs 2 with one common
• Output voltage range 0-10 Vdc
• Resolution 12 bit/16bit
Absolute wire size 0,13 - 1,5 mm2
• UL 22 - 14 AWG
• DIN 46 228/1 0,5 - 1,5 mm2
Case Standard DIN 43880 9M
• Dimensions 90x160x58 mm
Connections Digital outputs (Fig. 6) WARNING!: The enabling of 1-Wire, excludes the use of
Weight 0,4 Kg
NETMASTER is equipped with extractable TB for power supply, The module is equipped with 8 relays or static outputs a unique CAN/RS485 Port on Netmaster codes equipped with TStik Operating temperature -20 to +70 °C
I/O’s and field bus connections; with IDC connectors for extension common for all outputs is provided. Please refer to the Technical specs (MPS033****). Relative humidity Max. 90%
modules connection, and RJ45 connectors for RS232 and Ethernet table for the maximum switching loads. The state of each output is
connection. displayed by LED.
All outputs are reseted at each system power on, and however Serial Ports (Fig. 1) Caratteristiche reti CAN - CAN networks characteristics
Power supply (Fig. 7) each time the state of the "RDY" LED is 0. NETMASTER is provided of two serial ports DTE (Data
La resistenza di terminazione interna deve essere inserita solo sul primo e sull’utlimo dei dispositivi della catena (LK3 in posizione 1-0); tutti
NETMASTER may be powered with a DC source in the range Terminal Equipment). The connection between DTEs, such as
i dispositivi intermedi non devono essere terminati (ponticello LK3 non presente). La massima velocità raggiungibile dal dispositivo è di 125 Kbit/s.
10-30Vdc. The DC source must be connected on P12. WARNING! Interference suppressors must be connected in Personal Computers, Operator Terminals etc., must be done through a
The presence of the power is signalled by the green LED marked parallel to inductive loads, according to manufacturer Null-modem cable of maximum cable lenght of 15mt, according to EIA
specifications. For the programming of the section “Network interface” The inside terminator, must be enabled on first one and last devices only (LK3 1-0 position); all middle devices must not be terminated
“POWER ON ”. suggestions. Missing this rule may produce functional
the port A must be used, to program the “Field interface” section must (jumper LK3 off). The maximum device speed is 125 Kbit/s.
anomalies and reduce the internal relays expected life.
WARNING! Values greater than the maximum specified be used the port “B”. These ports aren’t galvanically insulated from the
may destroy the device. system, it is recommended to verify, before to connect toghether Il cavo deve essere twistato
Analog output (Fig. 8) different devices, the difference of potential on the ground. GND 1 Cable must be twisted 1 GND
The module is equipped with 2 analog outputs. Analog out 0 is White White
Ground connection made through a 12bit DAC, the analog out 1 is made through a 16bit WARNING!: An excess of difference of potential on ground CANL 2 2 CANL
The device must be connected directly to Ground using the PWM. loop may cause damages to the devices.
3 3
terminal block on the power supply connector (Fig. 7). The connection The output voltage range is 0-10Vdc. T
Black Black
must be performed through a wire with section at least of 1.5 mm2, to a CANH 4 4 CANH
copper equipotential bar of adeguate section. WARNING! The analog output connection must be executed Ethernet and Field bus (Fig. 2) 1 1
To guarantee a good noise rejection, keep this connection as using shielded cables. NETMASTER is provided of a 10/100-BaseT ethernet port 0
2 5 5 0
2
available on connector (P8). The connections, as described in Fig. 2, GND 1 GND 1
short as possible and take care to place it far away to the other cables. LK3 LK3
are compatible with the standard ethernet IEEE 802.3 100-BaseT. To White White
NETMASTER CANL 2 CANL 2 NETMASTER
Digital inputs (Fig. 3) Extension bus (Fig. 5) connect one or more NETMASTER into an ethernet Local Area
The communication bus with the extension modules uses the Network must be used cables UDP Cat. 5 and an HUB, while to made 3 3
The device is equidded with 12 optoisolated digital inputs to be a point to point connection its enough to use a cross cable RJ45 without
activated with signals in the range 10-30Vdc. A common for all the I2C™ interface and it’s available on IDC 10 connector (P4). The Black Black
extension modules must be connected through the the special cables HUBs. CANH 4 CANH 4
inputs is provided as described in Fig. 3. The inputs may be PNP or On connector P9 is available a field bus interface that, 1 1
NPN. The state of each one is displayed with LED. The voltage to CLB045**00 (to be ordered separately). 0 0
The addressing of extension modules is automatic: the software depending of the ordered code, may be CAN or RS485 type. In Fig. 2 is 2 5 2 5
activate the inputs must be DC and filtered and be below the maximum shown the list of signals on P9 for the both types of interface.
recognise if an extension module is connected or not and assign it an NETMASTER LK3 NETMASTER LK3
allowed. The Jumper LK3 allows to connect or not the termination resistor
address equal to the previous module address +1. The base module
has address 0x20. needed for these networks.
Analog Inputs (Fig. 4) Le caratteristiche dei cavi e delle resistenze di terminazione usate in una rete CAN, sono definite dalla norma ISO 11898. La tabella di
The available analog inputs are 4, with a common mode WARNING! Before to connect the extension modules to the Electromagnetic Compatibility seguito mostra alcune linee guida su come selezionare il tipo di cavo in una rete CAN con meno di 64 nodi.
connection or 2 in differential connection. The voltage applicable is base module, be sure that it’s unpowered. Missing this rule The device meets the EMC directive in reference to the Parametri AC del cavo raccomandati: impedenza 120 ohm, linea di ritardo 5-ns/m.
included in the range 0-10V. The converter resolution is 16bit. The input may produce failures in the modules. standards CEI EN 50081-1 (generic standard on the issue regarding
impedance is 37.7 Kohm in 0-10Vdc mode. Lunghezza bus (m) Length-related Cross-section Termination Baudrate
residential environments, commercial and of the light industry) and CEI Bus length (m) resistance (mmq) resistance (Kbit/s)
The system is able to acquire PT100 or PT1000 RTSs directly
with a 0.01°C of resolution and Kallendar-Van Dusen linearization, and EN 50082-2 (generic standard on immunity regarding the industrial (mohm/m) (ohm)
1-Wire® Interface (Fig. 5) environments). 0÷40 70 0.25÷0.34 124 1000 at 40 m
may acquire current sensors in the range 0-20 mA (external 62 Ohm NETMASTER is provided of a 1-Wire® interface that allows to
shunt is required). 40÷300 <60 0.34÷0.6 150÷300 >500 at 100 m
connect all the devices compatible with this interface. These devices 2 TM
I C is a trade mark of Philips Semiconductors 300÷600 <40 0.5÷0.6 150÷300 >100 at 500 m
WARNING! The analog input connection must be executed made for different purposes, can be reached on the Maxim/Dallas and 1-Wire® is a trade mark of Maxim/Dallas Semiconductors 600÷1000 <26 0.75÷0.8 150÷300 >50 at 1Km
Ibutton internet sites, togheter with the Java classes needed. Look at Java™ is a trade mark of Sun Microsystems
using shielded cables. The cables, and termination resistors used in CAN networks shall meet the requirements defined in ISO 11898. In addition, here are given
Fig. 5 to connect P13 and to enable this interface.
some guidelines for selecting cables. The table above shows some standard values for DC parameters for CAN networks with less than 64 nodes.
Recommended cable AC parameters: 120-ohm impedance and 5-ns/m specific line delay.
1 Porta seriale e bus estensione I2C 2 Interfaccia Smart-Card 4 Inseritore Smart Card (opzionale)
2
Serial port and I C extension bus Smart-Card interface P4 - SMART CARD EXT. Smart Card reader (optional)
Pin Signal
1 Switch (+5REG) Codice scheda: PCB105**00

RS232 LINE OUT EXT. MODULE 2 Switch (P0.4) Board code: PCB105**00
9 1 Contatti Smart Card:
3 C8 - NC lato inferiore
P4 Smart Card pad:
LK2 10 2 4 C4 - LED (+) bottom side

2 10 5 C7 - SDA (RD-N)
P2 P3
1 9 OUT EXT. MODULE 6 C3 - CLK (WR-N)
7 C6 - NC
8 C2 - RST (P2.5)
1 3 5 7
2 4 6 8 9 C5 - GND
10 C1 - VCC

LK2 ON=Catch ENABLED P3 - I2C BUS EXT. Pin 1

LK2 OFF=Catch DISABLED P1 PCB105**00


Pin Signal P1

Ingressi logici Pin Signal


DTE CONFIGURATIONS 1 +5VCC 5
Logic inputs Connecting cable 1 Switch
Pin Signal 2 +5VCC CBL045**00
2 Switch
1 NC 3 SUPPLY-R
Dimensioni (bxhxp): 3 C8 - NC
2 NC 4 SUPPLY-R - b (base) = 75mm
- h (altezza) = 92mm 4 C4 - LED (+)
3 DTR (INT1) 5 RDYOU-N (T0) - p (prof. con connettore inserito) = 20mm
5 C7 - SDA
4 GND 6 GND
6 C3 - CLK
5 RXD (RxD) 7 SCLK (P1.6) Dimension (bxhxt):
- b (base) = 75mm
+ 7 C6 - NC
6 TXD (TxD) 8 GND - h (height) = 92mm

10-30VDC
- t (thickness with connector inserted) = 20mm 8 C2 - RST
7 CTS (PSEN) 9 SDATA (P1.7)
- 9 C5 - GND
8 RTS (INT1) 10 GND
10 C1 - VCC

P6 1 8
Si raccomanda l'uso di cavi ELSIST.
The use of ELSIST cables is recommended. Led di segnalazione stato
State signalling led COM-L
CBL054*000 DB9F/RJ45 Null-Modem Adapter
CBL055**00 DB9M/RJ45 Modem Adapter L 0 1 2 3 4 5
CBL057*300 RJ45 8/8 Unshielded Cable (2m) COM LOGIC INPUT
6 Logic Inputs
CBL045*200 NETSYST I2C Extens. Cable (20cm) 10-30VDC
CBL045*300 NETSYST I2C Extens. Cable (50cm)

8 Segnalazione anomalie 7 Uscite logiche 6 Identificazione prodotto


Signalling anomalies Logic outputs Product identification
RDY LED (Green) OUTPUT COM
RUN LED (Yellow) 0 1 2 3
LBL052D000

Fuse 1 A EF
OUTPUT COM RUN RDY
F1 F2
0 1 2 3 P5
Code: PCB104A020
5 1 COM Serial nr.: 00024
RUN RDY OUT0 OUT1
OUT0 OUT1 OUT2 OUT3
STATO CPU RUN RDY

OUT0 OUT1 OUT2 OUT3


CPU STATE
ON
(GIALLO - YELLOW) (VERDE - GREEN)
Led di segnalazione stato
PCB104**20
~/=
RUN
OFF
State signalling led Livello modulo MNL121A100

ON
RUN/TEST Module release
OFF
ON
STOP/TEST
Massima tensione modulo relè: 150VDC/270VAC Relay Out = 0 ELECTRONIC SYSTEMS
OFF Massima tensione modulo statico: 60VDC/60VAC
AVARIA Relay module maximum voltage: 150VDC/270VAC Static Out = 3 Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
INDETERMINATO INDETERMINATO
FAILURE INDETERMINATE INDETERMINATE Static module maximum voltage: 60VDC/60VAC Phone +39-0142-451987 Fax +39-0142-451988
Internet: http://www.elsist.net email: elsist@elsist.it
tra di loro dispositivi diversi, che il potenziale di massa di questi ultimi sia lo stesso.
Alimentazione
Il modulo estensione non richiede alimentazione esterna poichè alimentato dal bus di sistema.
ATTENZIONE!: Differenze di potenziale eccessive tra punti di massa diversi, possono
causare danni irreversibili ai dispositivi.
Technical specifications
Ingressi logici (Fig. 5) Power supply requirements 5Vdc 150mA Max from I2C bus (All Out ON, All Inp ON)
Il modulo base è dotato di 6 ingressi logici optoisolati attivabili con segnali compresi nel range Interfaccia Smart-Card (Fig. 2) CPU
10-30Vdc, la tensione deve essere filtrata. E’ previsto un comune per tutti gli ingressi. Gli ingressi 04-05 Al connettore P4 può essere connesso, opzionalmente, un lettore di smart card ns cod.
sono di tipo veloce e possono acquisire segnali con frequenza max. di 50KHz. PCB105**00 o, in alternativa i cod. AMPHENOL: Microprocessor Philips P89C664 (MCS51 Family)
Lo stato di ogni ingresso è visualizzato tramite LED. C702 10M008 7012, C702 10M008 7002, C702 10M008 5142, Fornibili con l'apposita cornice
C702 N1114 1E2. System memory FLASH EPROM 64 KBytes
Uscite logiche (Fig. 7) Nel caso di utilizzo del Cod. PCB105*000, il collegamento deve essere effettuato tramite User memory SRAM 2 KBytes
Il modulo base è dotato di 4 uscite logiche a relè o statiche, dotate di un comune. Per la portata l’apposito cavetto, utilizzabile anche per i moduli di estensione, CBL045*000. INTERFACE
commutabile riferirsi alla tabella caratteristiche tecniche. Lo stato di ogni uscita è visualizzato tramite
LED. Le uscite vengono forzate a 0 all'accensione del sistema, e comunque ogni qualvolta lo stato del Compatibilità elettromagnetica RS232
LED "RDY" è 0 (Fig. 8). Il dispositivo è conforme alla direttiva compatibilità elettromagnetica in riferimento alle norme CEI • Baud rate 12800 - 115200 Baud
Il modulo con uscite statiche dispone di fusibili extrarapidi di protezione ogni 2 Out. F1 è EN 50081-1 (norma generica sull’emissione riguardante ambienti residenziali, commerciali e
• Galvanic insulation None
destinato alla protezione di OUT00-01, F2 alla protezione di OUT02-03. Le uscite statiche sono in dell’industria leggera) e CEI EN 50082-2 (norma generica sull’immunità riguardante gli ambienti
industriali). • Maximum cable length 15mt
grado di commutare carichi sia AC che DC.
I/Os
ATTENZIONE! Usare sempre i soppressori in parallelo ai carichi induttivi, la mancata 2
IC
TM
è un marchio registrato di Philips Semiconductors
osservanza di questa prescrizione può produrre alterazioni funzionali e ridurre la vita Logic inputs 6 with one common
dei relè del dispositivo. • Voltage range 10 - 30Vdc
• Input current 5mA @ 24Vdc
Bus di estensione (Fig. 1) Logic outputs 4 with one common, static or relay
Il modulo di estensione può essere collegato a qualunque modulo base della famiglia Netsyst e/o • Maximum voltage (static) 60Vac/dc
della famiglia Picosyst ME. Non essendo previsto bus passante, può essere inserito un solo modulo di • Maximum current (static) 350mA
questo tipo per ogni base, a meno che la connessione con il modulo base non venga effettuata con un
• Maximum voltage (relay) 250Vac, 110Vdc
cavo passante. Per il collegamento del modulo di estensione devono essere utilizzati gli appositi cavetti
• Maximum current (relay) 5A
CBL045**00 (da ordinare separatamente).
• Max. switching power (relay) 750 VA 90W
ATTENZIONE! Prima di collegare al modulo base i moduli di estensione, accertarsi che • UL/CSA rating (relay) 3A @ 250Vac; 3A @30Vdc
questo non sia alimentato. In caso contrario i dispositivi potrebbero essere 4
• Electrical life @ 20cpm (relay) 5x10 Operat. @ 5A 250Vac, 3A 30Vdc
irrimediabilmente danneggiati. 7
• Mechanical life (relay) 2x10 Operations minimum
Porta seriale (Fig. 1)
2
Il modulo estensione è dotato di una porta seriale di tipo “DTE” (Data Terminal Equipment) Absolute wire size 0,13 - 1,5 mm
disponibile sul connettore P2 di tipo RJ45. Il collegamento con altri dispositivi DTE, quali personal • UL 22 - 14 AWG
computer o terminali operatore in genere, deve essere eseguito con un cavo di tipo Null-Modem della 2
• DIN 46 228/1 0,5 - 1,5 mm
lunghezza massima di 15 mt, vedi ns Cod. CBL054*000 + CBL057**00.
Se il dispositivo collegato è di tipo DCE (Data Communication Equipment), come ad esempio un Case Standard DIN 43880 6M
modem, si dovrà utilizzare un cavo Modem, o l’adattatore CBL055*000 in luogo del CBL054*000.
• Dimensions 90x106x58 mm
Il segnale CTS presente sul pin 7 di P2 non è utilizzabile come segnale di controllo flusso, esso
serve unicamente nelle fasi di caricamento del programma, rimuovendo LK2 tale operazione non è più Weight 0,20 Kg
possibile. Operating temperature 0 to +60 °C
La porta seriale non è galvanicamente isolata, quindi è opportuno verificare, prima di collegare
Relative humidity Max. 90%

connect toghether different devices, the difference of potential on the ground.


Power supply
The extension module don't require external power supply because it's fed from the system bus. WARNING!: An excess of difference of potential on ground loop may cause damages
to the devices.
Logic inputs (Fig. 5) Schema a blocchi
Smart-Card interface
The module is equipped with 6 logic optoisolated inputs. These inputs can be activated by
means of a DC source in the range 10-30V. The voltage applied at inputs must be filtered. A unique To P4 connector may be connected, optionally, a smart-card reader our code PCB105**00 or,
Block diagram P6 P5
common is provided for all 6 inputs (pin 1 of connector P6). Inputs INP04-05 are Fast type, able to one of the following AMPHENOL codes:
acquire signals at frequencies up to 50KHz. The state of each input is shown by a LED (See Fig. 5). C702 10M008 7012, C702 10M008 7002, C702 10M008 5142,
In case of use of PCB105*000, the connection must be done using the special cable, suitable for
INPUT OUTPUT
Logic outputs (Fig. 7) extension modules also, CBL045*000.
The module is equipped with 4 relays or static outputs with one common (See the table on side
for characteristics). Outputs are galvanically isolated from the system and the state of each one is Electromagnetic Compatibility
displayed through a LED. All outputs are reset at each system power on, and however every time the The device meets the EMC directive in reference to the standards CEI EN 50081-1 (generic
state of the "RDY" LED is 0. standard on the issue regarding residential environments, commercial and of the light industry) and CEI
The static output module is provided of two extrarapid fuses to protect the device against shorts. EN 50082-2 (generic standard on immunity regarding the industrial environments).
F1 protects OUT00-01, F2 protects OUT02-03. Static outputs may be used on DC or AC loads.
Port P1 0-5 Port P2 0-3
WARNING! Interference suppressors must be connected in parallel to inductive loads, I2CTM is a trade mark of Philips Semiconductors
according to manufacturer suggestions. Missing this rule may produce functional Tx
anomalies and reduce the relays expected life. TxD X1-X2 OSCILLATOR
Rx
RS232 RxD
Extension bus (Fig. 1) P2 SERIAL LINE DTR uP
The module can be connected to whatever base module of the Netsyst and/or Picosyst ME INT1
families. Not having provided any pass-through bus, can be connected one extension module each CTS RESET RESET
base only, except the connection has been made with a special pass-through cable. To connect this PSEN
module must be used the proper cables (our codes CBL045**00) available in different lenghts (to be INT0 PWDown
ordered separately). LK2
WR RD P1.6 P1.7
WARNING! Before to connect the extension modules to the base module, be sure that
it’s unpowered. Missing this rule may produce failures in the modules.
SCL1 SDA1 SCL SDA
Serial Port (Fig. 1)
The module is provided of one serial port DTE (Data Terminal Equipment) Type, available on the
RJ45 connector P2. The connection with others DTE devices as PCs or Operator Terminals, must be
executed using proper Null-modem cables of maximum lenght of 15mt, according to EIA RS232 SMART CARD INT. EXTENSION BUS
specifications, see our codes CBL054*000 + CBL057**00.
If the connected device is a DCE (Data Communication Equipment), i.e. a modem, a modem
cable must be used or the adapter CBL055*000 instead of CBL054*000.
The CTS signal on P2-7 cannot be used as a flow control, it’s useful only during device
programming, removing the jumper LK2 this operation become not allowed. P4 P3
This port isn’t galvanically insulated from the system, is recommended to verify, before to
http://192.168.0.61/Destination/Ftp/Mnl116a0.pdf

Embedded Secure Document


The file
http://192.168.0.61/
Destination/Ftp/
Mnl116a0.pdf is a secure document that has been
embedded in this document. Double click the pushpin to view.

http://192.168.0.61/Destination/Ftp/Mnl116a0.pdf [06/10/2008 17.46.49]


2
1 Circuito di alimentazione 2 LED di stato - Bus
2
IC 3 Ingressi logici P5
LD9 PLC P5 FIELD
Tutti gli ingressi possono essere di tipo PNP o
NPN con un comune ogni quattro:
Power supply circuit Status LEDs - I C Bus Logic inputs +
+/-
1
LD9 1 INP00 INP 00÷03 > COM 00÷03
-
ATTENZIONE! Max. 30Vdc/20Vac 2 INP 04÷07 > COM 04÷07
WARNING! Max. 30Vdc/20Vac BUS I2C LD10 2 INP01 LD11
+
3
INP 08÷0B > COM 08÷0B
+/-
Alimentazione ausiliaria ingressi LD11 3 INP02 INP 0C÷0F > COM 0C÷0F
-/~ Massima corrente erogabile: 500 mA -
RDY 4 Gli ingressi “INP 0C÷0F” sono di tipo “veloce”
2 4 6 8 10 BUS I2C LD12 4 INP03 LD13
DC or AC input Inputs auxiliary power supply RUN BUS I2C
Pin Signal
+
5 e possono acquisire segnali con frequenza
+/~
3 5 7 9
Maximum output current: 500 mA 1
+/-
Fuse 2A + DTR LD13 5 INP04 massima di 50 KHz.
1 +5 VDC -
- 6
LD14 6 INP05 LD15
AC1 AC2 PE EGND EUNRG 2 +5 VDC + I ponticelli LK4 e LK5 uniscono rispettiva-
7
+/- mente i comuni COM 00÷03 con COM 04÷07
1 2 3 4 5 3 SUPPLY-R LD15 7 INP06
-
P1 STATO CPU RUN RDY 8 e COM 08÷0B con COM 0C÷0F. Per garantire
(GIALLO - YELLOW) (VERDE - GREEN) 4 SUPPLY-R LD16 8 INP07
CPU STATE

9
la compatibilità con i vecchi dispositivi, in con-
ON
5 RDYOU-N 9 COM00÷03 dizioni di default, essi sono presenti.
RUN
OFF 6 GND LK4 LK4 10
- +
10 COM04÷07
ON 7 SCLK
RUN/TEST LD17 1 INP08 LD17 PLC P6 FIELD
All inputs can either PNP or NPN type with a
8 GND +
OFF
LD18 2 INP09 +/-
1 common for every four:
ON 9 SDATA - INP 00-03 > COM 00-03
STOP/TEST 2
10 GND LD19 3 INP0A LD19
INP 04-07 > COM 04-07
OFF
+
3 INP 08-0B> COM 08-0B
LD20 4 INP0B +/-
Power On Led AVARIA INDETERMINATO INDETERMINATO
FAILURE INDETERMINATE INDETERMINATE -
4 INP 0C-0F > COM 0C-0F
LD21 5 INP0C
102
LD21
+
The inputs “INP 0C÷0F” are fast; they read
5
LD22 6 INP0D +/- A signals with maximum frequency of 50KHz.
-
6 B
LD23 7 INP0E LD23 The jumpers LK4 and LK5 connect respecti-
+
LD24 8 INP0F +/-
7 A + vely the common COM 00-03 with COM 04-07
9 Uscite logiche P4 9 COM08÷0B
-
8 B
- and the common COM 08-0B with COM
Logic outputs LK5
9
0C-0F, to guarantee the compatibility with the
OUT00 1 10 COM0C÷0F + - previous Picolog devices. These jumpers, are
P6 LK5 10 factory set plugged in.
OUT01 2

OUT02 3

OUT03 4
4 Porta JTAG
COM00÷03 5 JTAG port 1 2

PORTA DI PROGRAMMAZIONE SCHEDA I/O 3 4


OUT04 6
UTILIZZO RISERVATO 5 6

OUT05 7 I/O CARD PROGRAMMING PORT 7 8

RESERVED USE 9 10

OUT06 8

OUT07 9

COM04÷07 10

5 Identificazione prodotto MPS026*0*0


FIELD P4 PLC Product identification
1 OUT00 Livello modulo
LBL052B000 Module release
2 OUT01
Relay Out = 0
3 OUT02 LED OFF = CONTACT OPEN
Code: MPS026A000 Static Out = 3
Serial nr.: 000222
Base 1*RS232 = 0
4 OUT03
= Fast 2*RS232 = 1
5
Fast 1*RS232 + 1*RS232/RS485 = 2
~
6 OUT04 LED ON = CONTACT CLOSED

7 OUT05
=
8 OUT06 8 Indirizzo modulo 7 Bus di estensione 6 Porte seriali
Module address Extension bus Serial ports
9 OUT07
ADD 0 ADD 1 ON= Half Duplex mode
10 LK8:
~
LK1 LK1
Solo modulo base
LK2 LK2
1 2 OFF=Full Duplex mode
5REG 5REG LK8 P2
Base module only LK3 LK3 3 4
UNRG UNRG 1
1 0 2 1 0 2 ON= TX Line terminated (120Ohm)
LK1 5 6
2 LK6:
EINT-N EIOR-N
ADD 2 ADD 3 LK6 OFF= TX Line unterminated
LK2
LK1 LK1
EIOW-N
7 8
EAB0 A RS485 3
LK3 9 10
4
LK2 LK2 EAB1 EAB2 LK5 ON= RX Line terminated (120Ohm)
1 0 2 12
LK5: MNL110A100
LK3 LK3
11
5
EAB3 EAB4 OFF= RX Line unterminated
1 0 2 1 0 2 13 14
ERDY RESERVED 8
LD1 LD2 LD3 LD4 7
ADD 4 ADD 5 15 16 6

OUT 00 OUT 01 OUT 02 OUT 03


LK1
LK1 LK1
EDB0
18
EDB1
A RS232 4
5
3
RS232 RS485
LK2 17
2
EDB2 EDB3 1 Pin Signal Pin Signal
LK3 LK2 LK2
LD5 LD6 LD7 LD8 EDB4
19 20
EDB5 1 N.C. 1 Tx+
1 0 2 LK3 LK3
8
OUT 04 OUT 05 OUT 06 OUT 07
1 0 2 1 0 2 EDB6
21 22
EDB7 6
7 2 DCD 2 Tx- ELECTRONIC SYSTEMS
3 DTR (1) 3 Rx+
ADD 6 ADD 7 GND
23 24
GND B RS232 4
5
3 4 GND 4 Rx-
2
Mod. di estensione LK1 LK1 GND
25 26
GND
1
5 RX 5 EGND Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
LK2 LK2 6 TX Phone +39-0142-451987 Fax +39-0142-451988
Extension modules LK3 LK3 (1) LED on DTR port A
Internet: http://www.elsist.net email: elsist@elsist.it
7 N.C.
1 0 2 1 0 2
8 RTS
ingresso è visualizzato tramite LED. La tensione di alimentazione Fast e RS485 sono invece dotati di due porte seriali connesse Technical specifications Procedura di avviamento
Connessioni degli ingressi deve essere continua e filtrata, non è necessario rispettivamente, la principale al port A e la secondaria al port B. Start
che sia stabilizzata, ma non deve superare il valore massimo di Picolog RS485 condivide il port A RS232 con l’interfaccia RS485,
Power supply requirements MPS026*0*0 (10-30Vdc 8-20Vac, 1.2W Starting procedure
PICOLOG relè è dotato di connettori estraibili a vite per il Min, 4W Max) (base module alone)
collegamento dell’alimentazione e degli I/O, e di connettori IDC 30Vdc. e, se questa non è connessa, il port A RS232 può essere utilizzato
per il collegamento delle estensioni. Il dispositivo può fornire l’alimentazione agli ingressi logici, come sulle versioni Base e Fast, a patto che il ponticello LK5 sia Power supplied to the bus 5Vdc 1500mA
Sul modulo base sono presenti 5 blocchi di connettori: come mostra la Fig. 1. disinserito. Le porte RS232 sono configurate come DTE e dotate 10-30Vdc 1A (unregulated)
di connettori RJ45/8. Per realizzare la totale compatibilità di Program memory 64K FlashEPROM
Alimentazione Data memory 32K (backed-up) Collegare alimentazione
Ingressi logici Uscite logiche (Fig. 9) connessione con i Picolog precedenti sono disponibili gli (AC1-AC2-PE fig.1)
adattatori cod. CBL055*000+CBL057*000 (da acquistare a parte). Battery life Tip. 10 years
Uscite logiche Il modulo base è dotato di 8 uscite logiche a relè, è previsto Connect power supply
Attraverso la/le porte seriali ed i ns tools di sviluppo, il Scansion rate (AC1-AC2-PE fig.1)
Bus per connessione estensioni un comune ogni 4 uscite. Per la portata commutabile riferirsi alla
Porte seriali RS232C e/o RS422/485 tabella caratteristiche tecniche. Lo stato di ogni uscita è dispositivo può essere programmato e testato. Per il collegamento Internal flags (1) no limits (Flags, Bytes or Words)

visualizzato tramite LED. al PC è necessario un cavo null-modem, si consiglia l'utilizzo dei Timers (1) no limits
Le uscite vengono forzate a 0 all'accensione del sistema, e cavi precablati da noi forniti (codici CBL054**00+CBL057*300). La Counters (1) no limits
Alimentazione (Fig. 1) lunghezza massima del cavo prescritta dalle EIA RS232C è di Floating point operations (1) Yes
Il modulo base può essere alimentato con tensione comunque ogni qualvolta lo stato del LED "RDY" è 0 (Fig. 2).
15mt. Interface Base module: 1x RS232 Led POWER ON acceso?
continua od alternata rispettivamente nei range 10-30Vdc o 8- PICOLOG RS485 è dotato di un port seriale RS422/485 Fast module: 2 x RS232 No (fig.1)
20Vac e frequenze di 50 o 60 Hz indifferentemente. La presenza Collegamento estensioni (Fig. 7) galvanicamente isolato dal sistema. Il modulo può essere RS485 mod.:1xRS485/232 + 1xRS232 Is POWER ON led light?
dell’alimentazione è segnalata dal LED LD1 (Fig. 1). Il modulo base è dotato di un connettore IDC a 26 poli per la • Baud rate 300 ÷ 115200 Baud (fig.1)
configurato per le modalità Full-Duplex o Half-Duplex variando la • Galvanic insulation RS232C: No
connessione di un max. di 7 moduli di estensione della famiglia posizione del jumper LK8. Il dispositivo è dotato di resistenze di
ATTENZIONE! Il superamento del valore massimo di RS422/485: Yes (1600Vrms 1Min) Yes
PICOSYST. Per il collegamento dei moduli di estensione si terminazione 120 Ohm inseribili separatamente sulle linee Tx • Dataformat 7/8 bit, E/O/N parity
tensione indicato può provocare il danneggiamento consiglia l'utilizzo dei cavetti precablati da noi forniti (codici • Maximum cable length RS232C 15mt
irreversibile dell’apparato. (LK6) ed RX (LK5).
CBL024*000). RS422/485 1200 mt Verificare tensione Led RUN lampeggiante?
Logic inputs 16 (insulated in group of 4) di alimentazione. No (fig.7)
ATTENZIONE! Prima di inserire i cavi di estensione Programmazione • Polarity PNP or NPN (selectable for each
Verify power Is RUN Led flashing?
• Voltage range group)
togliere alimentazione al dispositivo. In caso La programmazione del dispositivo può avvenire supply. (fig.7)
• Input current 10 ÷ 30Vdc
Collegamento di terra contrario i dispositivi potrebbero essere unicamente tramite PC, attraverso i pacchetti di sviluppo da noi 5mA @ 12 Vdc
Il modulo base deve essere collegato direttamente a terra irrimediabilmente danneggiati. forniti. Per ulteriori informazioni al riguardo si prega di visitare il ns Logic outputs 8 (insulated in group of 4) Yes
mediante l'apposito morsetto del connettore di alimentazione (Fig. sito internet www.elsist.net. • Nominal switching capacity 3A @ 250Vac, 3A @ 30Vdc
Il raggiungimento delle caratteristiche segnate con (1) • Maximum switching power 831VA (AC), 90W (DC)
1). Il collegamento deve essere eseguito mediante una cordina Programma già in Led RDY acceso?
• Maximum switching voltage 250Vac, 30Vdc
con sezione di almeno di 1.5 mmq, ad una barra equipotenziale di Settaggi indirizzo (Fig. 8) elencate in tabella sono subordinate all’utilizzo di Remoter 8.0 o • Maximum switching current 3A
esecuzione. Yes (fig.7)
rame di adeguata sezione. Il modulo base viene fornito già settato con l'indirizzo per il superiore. • Electrical life @ 20cpm
5
2x10 Operations @ 3A 125Vac, 3A
Program already Is RDY led light?
running. (fig.7)
Al fine di garantire una buona rejezione ai disturbi, è normale funzionamento (ADD 0). In Fig. 8 è riportata la vista dei 30Vdc
• Mechanical life 1x105 Operations @ 180cpm
necessario che questo collegamento sia mantenuto il più corto ponticelli presenti sull’apparecchiatura, con evidenza del loro LED di stato (Fig. 2) No
possibile e non venga fatto passare con altri cavi. legame con l'indirizzo del modulo (ADD 0-7). In Fig. 2 è riportata la dislocazione dei led di stato presenti 2
I moduli di estensione vengono forniti settati ad indirizzo 1 Absolute wire size 0,13 ÷ 1,5 mm
sul modulo base, con un diagramma che evidenzia le condizioni di • UL 22 ÷ 14 AWG
Ingressi logici (Fig. 3) (ADD 1). Nel caso vengano usati più moduli di estensione sarà funzionamento della CPU. • DIN 46 228/1 0,5 ÷ 1,5 mm 2 Collegare linea seriale
Il modulo base è dotato di 16 ingressi logici optoisolati necessario settarne l’indirizzo in conformità con il programma e trasferire il programma.
sviluppato. Connections Connect serial line and
attivabili con segnali compresi nel range 10-30Vdc. I comuni degli Compatibilità elettromagnetica • Power supply 3 +2 pin 5,08 mm extractable TB transfer the program.
ingressi sono raggruppati a gruppi di 4 come illustrato in Fig. 3. Gli ATTENZIONE! Non utilizzare lo stesso indirizzo su PICOLOG è conforme alla direttiva compatibilità • Inputs Two 10 pin 5,08 mm extractable TB
ingressi logici possono essere configurati PNP o NPN. Al fine di elettromagnetica in riferimento alle norme CEI EN 50081-1 • Outputs 10 pin 5,08 mm extractable TB
più di un modulo. • Serial Interface RS232: RJ45/8
mantenere la compatibilità con i prodotti precedenti sono stati (norma generica sull’emissione riguardante ambienti residenziali, RS422/485: 5 pin 3,81 mm extractable
predisposti 2 ponticelli che raggruppano i comuni a gruppi di 8; commerciali e dell’industria leggera) e CEI EN 50082-2 (norma
per sfruttare il raggruppamento a 4 è necessario perciò rimuovere generica sull’immunità riguardante gli ambienti industriali). Dimensions 110 x 170 x 80 mm Mandare in esecuzione
il ponticello del banco relativo. Gli ingressi 0C-0F sono di tipo il programma.
Porte seriali (Fig 6) Weight 0,4 Kg Run program.
veloce e possono acquisire segnali con frequenza max. di 50KHz.
PICOLOG è dotato di una (versione Base) o due (versioni
Questa caratteristica rende il dispositivo idoneo, attraverso Op. temper. range -20 - +70 °C
Fast e RS485) porte seriali (Fig. 6). Picolog versione base è
l’installazione di apposite opzioni, alla acquisizione di segnali
dotato di una sola porta seriale RS232 connessa al port A, Picolog Relative humidity Max. 90%
provenienti da encoders e/o righe ottiche. Lo stato di ogni
Electromagnetic Compatibility CEI EN50081-1
CEI EN50082-2

Collegamento di terra PICOLOG RS232


ATTENZIONE! Il port seriale RS232 non è isolato galvanicamente dal sistema, è opportuno adottare gli accorgimenti a riguardo del
frequencies up to 50Khz. The state of each input is shown by LED and/or RS485 Versions) serial ports (Fig. 6). Picolog Base version collegamento di terra, ed evitare passaggi del cavo seriale paralleli a cavi di potenza.
Connections (Fig. 3). Input feeding tension must be continuous and filtered and is equipped with only one serial port (A), The Fast and RS485
PICOLOG relay base module is equipped with screw must not exceed 30Vdc. version are equipped with two serial ports connected respectively, RS232 PICOLOG ground connection
connectors for supply and I/Os wiring and IDC connectors for The device can supply the power for logic inputs, as shown the main to port A, and the secondary to port B. Picolog RS485
BEWARE! All care on using the RS232 serial port must be taken refered to as examples: respect of GND connection, respect of galvanic
extensions bus. in Fig. 1 shares the port A (RS232) with RS485 and, if this is unconnected,
insulation and respect of wire passages to prevent noise troubles.
The base module provide 5 connector blocks: the port A may be used as RS232, in that case LK5 must be Off.
Power supply Logic outputs (Fig. 9) RS232 ports are configured as DTE and equipped with a RJ45/8
Logic inputs The base module is equipped with 8 relays outputs (see connector. To guarantee the totally compatibility with the previous
Logic outputs beside technical features for specific details). A common each 4 devices, we suggest the use of our cables/adapters code Collegamento Full-Duplex
Extensions bus output is provided. CBL055*000+CBL057*000 (to be ordered separately). La modalità Full-duplex su Picolog RS485, è
RS232C or RS422/485 Serial port The state of each output is shown by LED (Fig. 9). To connect the device with a PC, a null modem cable is Modalità di collegamento Full-Duplex CONVERFACE abilitata togliendo il ponticello LK8 (Fig. 6).
required, we suggest to use our codes LK8
All outputs are reset at each system power on, and Full-Duplex connection LK8 E’ anche possibile la programmazione
however every time the state of the "RDY" LED is off (Fig. 2). CBL054*000+CBL057*300. attraverso RS485, in questo caso il PC deve
Power Supply (Fig. 1) The maximum cable length, recommended by EIA RS232C LK6 Tx+ 1
SCH
3 Rx+
The base module may be powered with dc or ac power LK6 essere dotato di CONVERFACE o di un
is 15mt. Tx- 2 4 Rx- qualsiasi convertitore RS232/RS485.
source in the range 10-30Vdc or 8-20Vac respectively at Plug in extension modules (Fig. 7) PICOLOG RS422/485 is equipped with RS422/485
frequencies of 50 or 60Hz. The power On is displayed by LED The base module is equipped with a 26 poles IDC LK5 Rx+ 3 1 Tx+
galvanically isolated serial port (Fig. 6). The module may be LK5 Full-Duplex connection
LD1 (Fig.1). connector to be used to connect a maximum of 7 Picosyst configured to operate in Full-Duplex or Half-Duplex mode. through Rx- 4 2 Tx- Full-duplex mode on Picolog RS485 is
extension modules. LK8 setting. The device is equipped with internal termination
BEWARE! Values greater than the maximum may EGND 5 Lunghezza massima cavo: 1200mt 5 EGND enabled unplugging the jumper LK8 (Fig. 6).
To connect extension modules we recommend to use the resistor of 120 Ohms to be included with LK6 (Tx) and LK5 (Rx).
destroy the device. PICOLOG Maximum cable length: 4000 feet PICOLOG Also programming through RS485 is
extension cables code CBL024*000.
possible, in this case the PC must be
BEWARE! Before insert the bus module extension Programming equipped with CONVERFACE or any
cable, the base module power supply must be The device may be programmed through its serial ports and RS232/RS485 converter.
Ground connection disconnected to prevent serious devices damage. a PC, using our development tools. For more informations please
The base module must be connected directly to Ground refer to our internet site: www.elsist.net.
The reach of programming characteristics shown in the Collegamento Half-Duplex Modalità di collegamento Half-Duplex multipunto
using the terminal block on the power supply connector (Fig. 1). PICOLOG PICOLOG
• La distanza massima tra il primo e l’ul- Half-Duplex multidrop connection
The connection must be performed through a wire with section at Address setting (Fig. 8) table are subject to te use of Remoter 8.0 or superior.
timo dei dispositivi non deve superare i LK8 LK8
least of 1.5 mm2, to a copper equipotential bar of adeguate The base module is factory set to address 0 (ADD 0). Fig. 8
1200 mt.
section. show the relation between the jumper position and the address Status LEDs (Fig. 2) SCH SCH
• La resistenza di terminazione deve es- Tx+ 1 1 Tx+
To guarantee a good noise rejection, keep this connection set. The Fig. 2 shows status LEDs position and diagram that LK6 LK6
sere collegata solo sul primo e sull’ ultimo
as short as possible and take care to place it far away to the other The extension modules are factory set to address 1 (ADD display all CPU statements. Tx- 2 2 Tx-
dei dispositivi.
cables. 1). Care on setting the right address must be taken in case of use
LK5 Rx+ 3 3 Rx+ LK5
of more than one extension according with the developed
program.
EMC Half-Duplex connection Rx- 4 4 Rx-
Logic inputs (Fig. 3) PICOLOG meets the EMC directive in reference to the • The maximum distance between the first 5 4 3 2 1
The base module is equipped with 16 logic optoisolated EGND 5 5 EGND
BEWARE! Never use same address for more than standards CEI EN 50081-1 (generic standard on the issue one and the last of the devices does not E Rx- Rx+ Tx- Tx+
inputs that support signals in the range of 10-30Vdc. Inputs regarding residential environments, commercial and of the light exceed 4000 feet.
one extension module.
commons are grouped in groups of 4, as shown in Fig. 3. These industry) and CEI EN 50082-2 (generic standard on immunity • The termination resistor must be connec-
groups may be used in PNP or NPN configuration. To guarantee LK5 LK6 LK8
regarding the industrial environments). ted on the first and on the last device
the compatibility with previous devices, two jumpers that connect only.
togheter the two commons of every bank are provided, to use the PICOLOG
Serial Ports (Fig. 6)
module 4 grouping it’s necessary to remove these jumpers. The
PICOLOG is equipped with one (Base version) or two (Fast
inputs 0C-0F are “fast” type and may acquire logic signals with
2
1 Circuito di alimentazione 2 LED di stato - Bus
2
IC 3 Ingressi logici LD17 PLC P5 FIELD
Tutti gli ingressi possono essere di tipo PNP o
NPN con un comune ogni quattro:
Power supply circuit Status LEDs - I C Bus Logic inputs +
+/- 1
INP 00÷03 > COM 00÷03
-
ATTENZIONE! Max. 30Vdc/20Vac
LD17
2 INP 04÷07 > COM 04÷07
WARNING! Max. 30Vdc/20Vac BUS I2C LD19
INP 00
+ INP 08÷0B > COM 08÷0B
3
Alimentazione ausiliaria ingressi LD18 +/- INP 0C÷0F > COM 0C÷0F
INP 01
-/~ Massima corrente erogabile: 500 mA RDY 2 4 6 8 10 BUS I2C
-
4 Gli ingressi “INP 0C÷0F” sono di tipo “veloce”
DC or AC input LD19 LD21
Inputs auxiliary power supply RUN BUS I2C
Pin Signal
INP 02
+ e possono acquisire segnali con frequenza
+/~
3 5 7 9
Maximum output current: 500 mA 1
5
Fuse 2A + DTR LD20 +/- massima di 50 KHz.
- 1 +5 VDC INP 03
- 6
AC1 AC2 PE EGND EUNRG 2 +5 VDC
LD21
INP 04
LD23
I ponticelli LK4 e LK5 uniscono rispettiva-
+ 7
1 2 3 4 5 3 SUPPLY-R LD22 +/- mente i comuni COM 00÷03 con COM 04÷07
P1 STATO CPU RUN RDY
INP 05
- 8 e COM 08÷0B con COM 0C÷0F. Per garantire
(GIALLO - YELLOW) (VERDE - GREEN) 4 SUPPLY-R LD23
CPU STATE
INP 06 COM0C÷0F
LD25
la compatibilità con i vecchi dispositivi, in con-
+
ON
5 RDYOU-N LD24
20 19
COM04÷07
COM08÷0B
+/- 9 dizioni di default, essi sono presenti.
RUN COM00÷03
OFF 6 GND INP 07 18 17
INP0F -
10
LK4 16 15
INP0E
INP0D LD27
ON 7 SCLK INP0C
+
All inputs can either PNP or NPN type with a
14 13
RUN/TEST INP0B
+/- 11
8 GND LK5 12 11
INP09
INP0A
OFF
INP08 -
12
common for every four:
9 SDATA
10 9
INP07
STOP/TEST
ON
LD25 8 7
INP05
INP06 LD29 INP 00-03 > COM 00-03
+
OFF
10 GND INP 08
6 5
INP03
INP04
+/- 13 Z INP 04-07 > COM 04-07
LD26 INP02
INP 09
4 3
INP01 -
14
INP 08-0B> COM 08-0B
Power On Led AVARIA INDETERMINATO INDETERMINATO INP00
FAILURE INDETERMINATE INDETERMINATE LD27
2 1
LD31 INP 0C-0F > COM 0C-0F
+
102
INP 0A
P5 +/- 15 A + The inputs “INP 0C÷0F” are fast; they read
LD28
INP 0B -
16
- signals with maximum frequency of 50KHz.
B
LD29
INP 0C 17 The jumpers LK4 and LK5 connect respecti-
- +
LD30 vely the common COM 00-03 with COM 04-07
LK4
9 Uscite logiche
INP 0D 18
LD31
and the common COM 08-0B with COM
Logic outputs OUT04 OUT00 INP 0E 19 + -
0C-0F, to guarantee the compatibility with the
OUT05 OUT01
LD32
previous Picolog devices. These jumpers, are
OUT06
OUT07
OUT02
OUT03
INP 0F LK5 20
factory set plugged in.
Massima tensione mod. statico:
OUT00
60VDC/60VAC OUT01
OUT02
OUT03
Static module max. voltage: F1
60VDC/60VAC
F2
4 Porta JTAG
FIELD P4 PLC OUT04
OUT05 JTAG port 1 2

1 OUT00 OUT06
OUT07 PORTA DI PROGRAMMAZIONE SCHEDA I/O 3 4
P4
2 OUT01 UTILIZZO RISERVATO
F1 5 6

3 OUT02
OUT00
1 2
I/O CARD PROGRAMMING PORT 7 8
1A F OUT01
4 OUT03
OUT02
3 4
RESERVED USE 10
OUT03 5 6
9

OUT04
OUT05
5 OUT04
OUT06
7 8

OUT07 9 10
OUT08
6 OUT05
OUT09
F2 OUT0A
11 12

OUT0B
7 OUT06
OUT0C
13 14
1A F
OUT0D 15 16
8 OUT0E

5 Identificazione prodotto
OUT07

MPS026*3*0
OUT0F 17 18
COUT1 +/-
9 OUT08 COUT2 -/+ 19 20

10 OUT09
COUT1 +/-
COUT2 -/+ Product identification
F3 Livello modulo
OUT08
11 OUT0A
OUT09
Module release
1A F
OUT0A
12 OUT0B OUT0B LBL052B000 Relay Out = 0
F3
13 OUT0C
Static Out = 3
F4 Code: MPS026A300 Base 1*RS232 = 0
OUT0C
14 OUT0D
Serial nr.: 00142
F4 OUT0D
OUT0E Fast 2*RS232 = 1
15 OUT0E OUT0F
1A F Fast 1*RS232 + 1*RS232/RS485 = 2
16 OUT0F
COUT1 +/-

17 P6
COUT2 -/+
18

~/=
19
OUT0C
OUT0D
OUT08
OUT09
8 Indirizzo modulo 7 Bus di estensione 6 Porte seriali
20
OUT0E
OUT0F
OUT0A
OUT0B
Module address Extension bus Serial ports
ADD 0 ADD 1 ON= Half Duplex mode
FIELD P6 PLC LK1 LK1 LK8:
Solo modulo base
LK2 LK2
1 2 OFF=Full Duplex mode
5REG 5REG LK8 P2
COUT1 +/- Base module only LK3 LK3 3 4
UNRG UNRG 1
ON= TX Line terminated (120Ohm)
COUT2 -/+ 1 0 2 1 0 2
5 6 LK6:
EINT-N EIOR-N 2
ADD 2 ADD 3 LK6 OFF= TX Line unterminated
LED OFF = CONTACT OPEN
LK1 LK1
EIOW-N
7 8
EAB0 A RS485 3
9 10
LK5 4 ON= RX Line terminated (120Ohm)
LK2 LK2 EAB1 EAB2
= LK5: MNL112B100
12
LK3 LK3
11
5
20 EAB3 EAB4 OFF= RX Line unterminated
LED ON = CONTACT CLOSED 1 0 2 1 0 2
PCB082*000
13 14
ERDY RESERVED 8
7
11 ADD 4 ADD 5 15 16 6
= 10 LK1
LK1 LK1
EDB0
18
EDB1
A RS232 4
5
3
RS232 RS485
LK2 17
2
EDB2 EDB3 1 Pin Signal Pin Signal
LK3 LK2 LK2
20
1 19
1 N.C. 1 Tx+
1 0 2 LK3 LK3 EDB4 EDB5
8
1 0 2 1 0 2 EDB6
21 22
EDB7 6
7 2 DCD 2 Tx- ELECTRONIC SYSTEMS
3 DTR (1) 3 Rx+
Adattatore IDC 20 pin ADD 6 ADD 7 GND
23 24
GND B RS232 4
5
3 4 GND 4 Rx-
Opzionale, non incluso 2
Mod. di estensione LK1 LK1 GND
25 26
GND
1
5 RX 5 EGND Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
20 pin IDC adapter LK2 LK2 6 TX Phone +39-0142-451987 Fax +39-0142-451988
Optional, not included Extension modules LK3 LK3 (1) LED on DTR port A
Internet: http://www.elsist.net email: elsist@elsist.it
7 N.C.
1 0 2 1 0 2 8 RTS
che sia stabilizzata, ma non deve superare il valore massimo di Technical specifications Procedura di avviamento
Connessioni 30Vdc. Porte seriali (Fig 6) Start
Il dispositivo può fornire l’alimentazione agli ingressi logici,
Power supply requirements MPS026*0*0 (10-30Vdc 8-20Vac, 1.2W Starting procedure
PICOLOG statico è dotato di connettori IDC per il PICOLOG è dotato di una (versione Base) o due (versioni Min, 4W Max) (base module alone)
collegamento degli I/O e del bus di estensione, e di morsetti come mostra la Fig. 1. Fast e RS485) porte seriali (Fig. 6). Picolog versione base è
estraibili per il collegamento dell’alimentazione. dotato di una sola porta seriale RS232 connessa al port A, Picolog Power supplied to the bus 5Vdc 1500mA
10-30Vdc 1A (unregulated)
Sul modulo base sono presenti 5 blocchi di connettori: Uscite logiche (Fig. 9) Fast e RS485 sono invece dotati di due porte seriali connesse Program memory 64K FlashEPROM
Alimentazione Il modulo base è dotato di 16 uscite logiche statiche. Per la rispettivamente, la principale al port A e la secondaria al port B. Data memory 32K (backed-up) Collegare alimentazione
Ingressi logici portata commutabile riferirsi alla tabella caratteristiche tecniche. I Picolog RS485 condivide il port A RS232 con l’interfaccia RS485, Battery life Tip. 10 years
(AC1-AC2-PE fig.1)
Uscite logiche driver di uscita sono protetti dal cortocircuito attraverso fusibili e, se questa non è connessa, il port A RS232 può essere utilizzato Connect power supply
Scansion rate (AC1-AC2-PE fig.1)
Bus di estensione extrarapidi (1 ogni 4 uscite). Lo stato di ogni uscita è visualizzato come sulle versioni Base e Fast, a patto che il ponticello LK5 sia
Internal flags (1) no limits (Flags, Bytes or Words)
Porte seriali RS232C e/o RS422/485 tramite LED. disinserito. Le porte RS232 sono configurate come DTE e dotate
Le uscite possono commutare carichi sia DC che AC e Timers (1) no limits
di connettori RJ45/8. Per realizzare la totale compatibilità di
sono galvanicamente isolate dal sistema. connessione con i Picolog precedenti sono disponibili gli Counters (1) no limits
Alimentazione (Fig. 1) Floating point operations (1) Yes
Il modulo base può essere alimentato con tensione Le uscite vengono forzate a 0 all'accensione del sistema, e adattatori cod. CBL055*000+CBL057*000 (da acquistare a parte).
comunque ogni qualvolta lo stato del LED "RDY" è 0 (Fig. 2). Interface Base module: 1x RS232 Led POWER ON acceso?
continua od alternata rispettivamente nei range 10-30Vdc o 8- Attraverso la/le porte seriali ed i ns tools di sviluppo, il Fast module: 2 x RS232 No (fig.1)
20Vac e frequenze di 50 o 60 Hz indifferentemente. La presenza dispositivo può essere programmato e testato. Per il collegamento RS485 mod.:1xRS485/232 + 1xRS232 Is POWER ON led light?
ATTENZIONE! In caso di utilizzo su carichi induttivi al PC è necessario un cavo null-modem, si consiglia l'utilizzo dei • Baud rate 300 ÷ 115200 Baud
dell’alimentazione è segnalata dal LED LD1 (Fig. 1). (fig.1)
è opportuno montare adeguati soppressori sul cavi precablati da noi forniti (codici CBL054**00+CBL057*300). La • Galvanic insulation RS232C: No
ATTENZIONE! Il superamento del valore massimo di carico stesso. lunghezza massima del cavo prescritta dalle EIA RS232C è di RS422/485: Yes (1600Vrms 1Min) Yes
• Dataformat 7/8 bit, E/O/N parity
tensione indicato può provocare il danneggiamento 15mt. • Maximum cable length RS232C 15mt
irreversibile dell’apparato. PICOLOG RS485 è dotato di una porta seriale RS422/485 RS422/485 1200 mt
Collegamento estensioni (Fig. 7) galvanicamente isolata dal sistema. Il modulo può essere Logic inputs 16 (insulated in group of 4)
Verificare tensione
No
Led RUN lampeggiante?
di alimentazione. (fig.7)
Il modulo base è dotato di un connettore IDC a 26 poli per la configurato per le modalità Full-Duplex o Half-Duplex variando la • Polarity PNP or NPN (selectable for each
Verify power Is RUN Led flashing?
Collegamento di terra connessione di un max. di 7 moduli di estensione della famiglia posizione del jumper LK8. Il dispositivo è dotato di resistenze di • Voltage range group)
supply. (fig.7)
• Input current 10 ÷ 30Vdc
Il modulo base deve essere collegato direttamente a terra PICOSYST. Per il collegamento dei moduli di estensione si terminazione 120 Ohm inseribili separatamente sulle linee Tx 5mA @ 12 Vdc
mediante l'apposito morsetto del connettore di alimentazione (Fig. consiglia l'utilizzo dei cavetti precablati da noi forniti (codici (LK6) ed RX (LK5). Logic outputs 16 (protected in group of 4) Yes
1). Il collegamento deve essere eseguito mediante una cordina CBL024**00). • Nominal switching capacity 0.4A @ 60V, (0.25A 4Out ON)
• Maximum switching voltage 60Vac/dc
con sezione di almeno di 1.5 mmq, ad una barra equipotenziale di ATTENZIONE! Prima di inserire i cavi di estensione Programmazione Programma già in Led RDY acceso?
• Maximum switching current 0.4A
rame di adeguata sezione. togliere alimentazione al dispositivo. In caso La programmazione del dispositivo può avvenire esecuzione. Yes (fig.7)
Al fine di garantire una buona rejezione ai disturbi, è Program already Is RDY led light?
contrario i dispositivi potrebbero essere unicamente tramite PC, attraverso i pacchetti di sviluppo da noi Absolute wire size 0,13 ÷ 1,5 mm
2
running.
necessario che questo collegamento sia mantenuto il più corto (fig.7)
irrimediabilmente danneggiati. forniti. Per ulteriori informazioni al riguardo si prega di visitare il ns • UL 22 ÷ 14 AWG
possibile e non venga fatto passare con altri cavi. sito internet www.elsist.net. • DIN 46 228/1 0,5 ÷ 1,5 mm 2
No
Il raggiungimento delle caratteristiche segnate con (1) Connections
Ingressi logici (Fig. 3) Settaggi indirizzo (Fig. 8) elencate in tabella sono subordinate all’utilizzo di Remoter 8.0 o • Power supply 3 +2 pin 5,08 mm extractable TB
Il modulo base è dotato di 16 ingressi logici optoisolati Il modulo base viene fornito settato con l'indirizzo per il superiore. • Inputs 1 IDC 20Poles Collegare linea seriale
• Outputs 1 IDC 20Poles e trasferire il programma.
attivabili con segnali compresi nel range 10-30Vdc. I comuni degli normale funzionamento (ADD 0). In Fig. 8 è riportata la vista dei • Serial Interface RS232: RJ45/8 Connect serial line and
ingressi sono raggruppati a gruppi di 4 come illustrato in Fig. 3. Gli ponticelli presenti sull’apparecchiatura, con evidenza del loro LED di stato (Fig. 2) RS422/485: 5 pin 3,81 mm extractable transfer the program.
ingressi logici possono essere configurati PNP o NPN. Al fine di legame con l'indirizzo del modulo (ADD 0-7). In Fig. 2 è riportata la dislocazione dei LED di stato presenti
mantenere la compatibilità con i prodotti precedenti sono stati Dimensions 110 x 170 x 80 mm
I moduli di estensione vengono forniti settati ad indirizzo 1 sul modulo base, con un diagramma che evidenzia le condizioni di
predisposti 2 ponticelli che raggruppano i comuni a gruppi di 8; (ADD 1). Nel caso vengano usati più moduli di estensione sarà funzionamento della CPU. Weight 0,4 Kg
per sfruttare il raggruppamento a 4 è necessario perciò rimuovere necessario settarne l’indirizzo in conformità con il programma
il ponticello del banco relativo. Gli ingressi 0C-0F sono di tipo Op. temper. range -20 - +70 °C
sviluppato. Compatibilità elettromagnetica Mandare in esecuzione
veloce e possono acquisire segnali con frequenza max. di 50KHz. Relative humidity Max. 90% il programma.
PICOLOG è conforme alla direttiva compatibilità Run program.
Questa caratteristica rende il dispositivo idoneo, attraverso ATTENZIONE! Non utilizzare lo stesso indirizzo su
elettromagnetica in riferimento alle norme CEI EN 50081-1 Electromagnetic Compatibility CEI EN50081-1
l’installazione di apposite opzioni, alla acquisizione di segnali più di un modulo.
(norma generica sull’emissione riguardante ambienti residenziali, CEI EN50082-2
provenienti da encoders e/o righe ottiche. Lo stato di ogni
ingresso è visualizzato tramite LED. La tensione di alimentazione commerciali e dell’industria leggera) e CEI EN 50082-2 (norma
degli ingressi deve essere continua e filtrata, non è necessario generica sull’immunità riguardante gli ambienti industriali).

Collegamento di terra PICOLOG RS232


frequencies up to 50Khz. The state of each input is shown by LED ATTENZIONE! Il port seriale RS232 non è isolato galvanicamente dal sistema, è opportuno adottare gli accorgimenti a riguardo del
Connections (Fig. 3). Input feeding tension must be continuous and filtered and Serial Ports (Fig. 6) collegamento di terra, ed evitare passaggi del cavo seriale paralleli a cavi di potenza.
PICOLOG relay base module is equipped with IDC must not exceed 30Vdc. PICOLOG is equipped with one (Base version) or two (Fast
connectors for I/Os and extension bus connection, and The device can supply the power for logic inputs, as shown and/or RS485 Versions) serial ports (Fig. 6). Picolog Base version RS232 PICOLOG ground connection
extractable TB for power supply. in Fig. 1 is equipped with only one serial port (A), The Fast and RS485 BEWARE! All care on using the RS232 serial port must be taken refered to as examples: respect of GND connection, respect of galvanic
The base module provide 5 connector blocks: version are equipped with two serial ports connected respectively, insulation and respect of wire passages to prevent noise troubles.
Power supply Logic outputs (Fig. 9) the main to port A, and the secondary to port B. Picolog RS485
Logic inputs The base module is equipped with 16 static outputs (see shares the port A (RS232) with RS485 and, if this is unconnected,
Logic outputs beside technical features for specific details). Output drivers are the port A may be used as RS232, in that case LK5 must be Off.
Extensions bus protected against shorts by extrarapid fuses (one each 4out). The RS232 ports are configured as DTE and equipped with a RJ45/8 Collegamento Full-Duplex
RS232C or RS422/485 Serial port state of each output is shown by LED (Fig. 9). The outputs can connector. To guarantee the totally compatibility with the previous La modalità Full-duplex su Picolog RS485, è
Modalità di collegamento Full-Duplex CONVERFACE abilitata togliendo il ponticello LK8 (Fig. 6).
drive AC or DC loads and are galvanically isolated from the devices, we suggest the use of our cables/adapters code LK8
LK8
Full-Duplex connection E’ anche possibile la programmazione
Power Supply (Fig. 1) system. CBL055*000+CBL057*000 (to be ordered separately).
All outputs are reset at each system power on, and To connect the device with a PC, a null modem cable is
SCH
attraverso RS485, in questo caso il PC deve
The base module may be powered with dc or ac power LK6 Tx+ 1 3 Rx+
however every time the state of the "RDY" LED is off (Fig. 2). required, we suggest to use our codes
LK6 essere dotato di CONVERFACE o di un
source in the range 10-30Vdc or 8-20Vac respectively at Tx- 2 4 Rx- qualsiasi convertitore RS232/RS485.
frequencies of 50 or 60Hz. The power On is displayed by LED CBL054*000+CBL057*300.
BEWARE! In case of use on inductive loads, The maximum cable length, recommended by EIA RS232C LK5 Rx+ 3 1 Tx+
LD1 (Fig.1). LK5 Full-Duplex connection
interference suppressors are needed. is 15mt. Rx- 4 2 Tx- Full-duplex mode on Picolog RS485 is
PICOLOG RS422/485 is equipped with RS422/485 enabled unplugging the jumper LK8 (Fig. 6).
EGND 5 Lunghezza massima cavo: 1200mt 5 EGND
BEWARE! Values greater than the maximum may galvanically isolated serial port (Fig. 6). The module may be Also programming through RS485 is
destroy the device. Plug in extension modules (Fig. 7) configured to operate in Full-Duplex or Half-Duplex mode. through
PICOLOG Maximum cable length: 4000 feet PICOLOG
The base module is equipped with a 26 poles IDC possible, in this case the PC must be
LK8 setting. The device is equipped with internal termination equipped with CONVERFACE or any
connector to be used to connect a maximum of 7 Picosyst resistor of 120 Ohms to be included with LK6 (Tx) and LK5 (Rx).
extension modules. RS232/RS485 converter.
Ground connection
The base module must be connected directly to Ground To connect extension modules we recommend to use the
extension cables code CBL024**00.
Programming
using the terminal block on the power supply connector (Fig. 1). The device may be programmed through its serial ports and Collegamento Half-Duplex Modalità di collegamento Half-Duplex multipunto
PICOLOG PICOLOG
The connection must be performed through a wire with section at BEWARE! Before insert the bus module extension a PC, using our development tools. For more informations please • La distanza massima tra il primo e l’ul- Half-Duplex multidrop connection
least of 1.5 mm2, to a copper equipotential bar of adeguate cable, the base module power supply must be refer to our internet site: www.elsist.net. timo dei dispositivi non deve superare i LK8 LK8
section. The reach of programming characteristics shown in the 1200 mt.
disconnected to prevent serious devices damage. SCH SCH
To guarantee a good noise rejection, keep this connection table are subject to te use of Remoter 8.0 or superior. • La resistenza di terminazione deve es- Tx+ 1 1 Tx+
LK6 LK6
as short as possible and take care to place it far away to the other sere collegata solo sul primo e sull’ ultimo
Tx- 2 2 Tx-
cables. dei dispositivi.
Address setting (Fig. 8) Status LEDs (Fig. 2)
The base module is factory set to address 0 (ADD 0). Fig. 8 LK5 Rx+ 3 3 Rx+ LK5
The Fig. 2 shows status LEDs position and diagram that
Logic inputs (Fig. 3) show the relation between the jumper position and the address Half-Duplex connection Rx- 4 4 Rx-
display all CPU statements.
The base module is equipped with 16 logic optoisolated set. • The maximum distance between the first 5 4 3 2 1
EGND 5 5 EGND
inputs that support signals in the range of 10-30Vdc. Inputs The extension modules are factory set to address 1 (ADD one and the last of the devices does not E Rx- Rx+ Tx- Tx+
commons are grouped in groups of 4, as shown in Fig. 3. These
EMC exceed 4000 feet.
1). Care on setting the right address must be taken in case of use PICOLOG meets the EMC directive in reference to the
groups may be used in PNP or NPN configuration. To guarantee of more than one extension according with the developed • The termination resistor must be connec-
standards CEI EN 50081-1 (generic standard on the issue LK5 LK6 LK8
the compatibility with previous devices, two jumpers that connect program. ted on the first and on the last device
togheter the two commons of every bank are provided, to use the regarding residential environments, commercial and of the light only.
industry) and CEI EN 50082-2 (generic standard on immunity PICOLOG
module 4 grouping it’s necessary to remove these jumpers. The BEWARE! Never use same address for more than
inputs 0C-0F are “fast” type and may acquire logic signals with one extension module. regarding the industrial environments).
1 RS232 Serial Line 2 STATO CPU RUN RDY
3 Circuito di alimentazione
Pin Signal CPU STATE (GIALLO - YELLOW) (VERDE - GREEN)
5
1 N.C.
Power sypply circuitry
ON
1 2 RD RUN
9 3 TD OFF
FACELOG
4 DTR ON
Fuse 1A
6
5
6
7
SG
N.C.
RTS RUN
RUN/TEST
OFF
Vin
~ ~ +
12Vdc or 24Vdc
AC1
ON
RDY -
8 N.C.
DTR*
STOP/TEST ~ AC2
9 N.C. OFF
* : Solo versione RS485
5
RS485 Serial Line * : RS485 version only AVARIA INDETERMINATO INDETERMINATO PE
FAILURE INDETERMINATE INDETERMINATE AC1
Pin Signal
1 AC2
1 Tx+ PE
2 Tx-
3 Rx+
4 Rx-
LK2
5 EGND
MPS018*300 4
LK2 Pos. 1: TxON, RxON
LK2 Pos. 2: TxRTS, RxON
MPS019*300 1
(Full-Duplex)
(Half-Duplex) INP *0
INP *1 2
Pos. 1
Pos. 2
INP *2 3

INP *3 4

INP *4 5
N.B.: Le posizioni di LK2 sono invertite nel caso in cui esso sia di
colore Rosso e Grigio. INP *5 6
Beware: The positions of LK2 are reversed in the case in which it is of
INP *6 7
Red and Grey color. 13
INP *7 8
P4
COM 0 INP *8 9
INP *B
Settaggi indirizzo INP *A 10
8 Addresses setting INP *9
INP *8
INP *9
11
ADD 0 ADD 1 ADD 2 ADD 3 INP *7 INP *A
INP *6
LK3 LK3 LK3 LK3 12 fmax=50KHz
LK3 INP *5 INP *B
LK2 LK2 LK2 LK2 INP *4
LK2
LK1 LK1 LK1 LK1
1 INP *3 COM 0 13
INP *2 - +
LK1 INP *1
INP *0
ADD 4 ADD 5 ADD 6
LK3 LK3 LK3
LK2 LK2 LK2
LK1 LK1 LK1

5 Dimensioni dima di foratura


Template dimension
137
7 Internal 13 Bit Up Counter 127
63.5 63.5
Bus estensioni
GATE EN DATA LATCH FUNCTION Extension bus
Internal input Internal output

Modo normale 35.5 39


0 0
Normal mode

Modo Gate esterno 71 78 88


1 X
External Gate mode
35.5 39
Fronte di gate intercettato, dato pronto per lettura
1 1 Regolazione contrasto display
Gate Front intercepted, data ready
Display contrast adjustment 3.5
IOAQ K0002 > Reset "DATA LATCH" (vedi nota) 59.5 59.5
1
IOAQ K0002 > Reset "DATA LATCH" (see note) 119

NOTA: La lettura del contatore deve


avvenire nella sequenza indicata sopra.
“Normal mode” example
L’istruzione IOAQ K 0003 deve essere 0000 :ORGR
eseguita per prima mentre IOAQ K 0001 :SETR
0002 per seconda. Il ciclo è completato 0002
0003
:IOAQ K 0003
:STRA Y 0000
Acq. MSB count.
MSB counter
6 Fuse 1AFF 250V
solo se le due fasi sono state eseguite
0004 :IOAQ K 0002 Acq. LSB count.
ORD. CODE: FUSH1100U0
nell’ordine indicato. Soppressore
0005 :STRA Y 0001 LSB counter
0006 :LODA W 0000 Counter Word Arc suppressor
NOTE: The reading of the counter must Imax=125mA
0007 :**** * Address
happen in the suitable sequence above.
IOAQ K 0003 must be executed first, 1 OUT *0 0 Add 0
IOAQ K 0002 second.The cicle is com- F1
2 OUT *1 2 Add 1
pleted only if theese two steps are
executed, and in the right order. 3 OUT *2 4 Add 2
6 Add 3 MNL074B100
4 OUT *3 1
Clock 13 Bit Bit 12 Bit 8 8 Add 4 P5
INP 0B 12 IOAQ K 0003 Step 1
5 OUT *4
Up Counter 0 0 0
A Add 5 OUT *0
6 OUT *5
X= module address (0-7) C Add 6 OUT *1
7 OUT *6 OUT *2
Edge Gate Bit 7 Bit 0 F1 E Add 7 OUT *3
INP 0A 11 Gate Logic IOAQ K 0002 Step 2 8 OUT *7 OUT *4
ELECTRONIC SYSTEMS
OUT *5 9
Gate Enable 9 COUT+
OUT 08 OUT *6
- + Via G. Brodolini, 15 (Z.I.) 15033 CASALE M.TO (AL) ITALY
OUT *7
Data Latched Phone +39-0142-451987 Fax +39-0142-451988 BBS +39-0142-453165
INP 0C 12-24 Vcc COUT + Internet: http://www.elsist.it; email: elsist@elsist.it
aggiuntivi possono essere al massimo 6 e con indirizzo diverso
Alimentazione (Fig. 3) da “0” e da “7”. Technical features Procedura di avviamento
FACELOG può essere alimentato con una tensione ATTENZIONE! Prima di inserire il cavo di Power supply requirements MPS018*300 (10÷28Vdc) (3W) Starting procedure
continua di 12 o 24V, oppure con una tensione alternata di 9 o interfaccia, togliere l’alimentazione a FACELOG. In Programmazione MPS019*300 (10÷28Vdc) (3W)
18V; sono accettate tensioni con tolleranze di +/-10% e caso contrario i dispositivi potrebbero essere La programmazione del dispositivo può avvenire tramite Power supplyed to the bus 5Vdc 300mA
frequenze di 50 o 60 Hz. irrimediabilmente danneggiati. PC mediante i pacchetti REMOTER (Cod.: SFW040*000) e UNRG 250mA Start
PROFACE (Cod.: SFW047*000). Per l'utilizzo di quest’ultimo si Program memory 24K SRAM
Collegamento di terra rimanda ai relativi manuali (Cod.: MNL041*000 e MNL045*000). Data memory 4K (256 bytes non volatile)
FACELOG deve essere collegato direttamente a terra
Linea seriale (Fig. 1) FACELOG RS485, in fase di programmazione, deve essere Data retention Tip. 10 years
mediante l'apposito morsetto del connettore di alimentazione FACELOG RS232 è dotato di un port seriale RS232C settato in modalità Full-Duplex mediante l’apposito switch LK2
non isolato galvanicamente (Fig. 1), su connettore vaschetta a 9 Scansion speed 0.7÷2 mS/K instructions
(Fig. 3). Il collegamento deve essere eseguito mediante una (Fig. 1). Il PC deve essere dotato di CONVERFACE o di un
poli. Esso consente la connessione al PC per il trasferimento dei qualsiasi convertitore RS232/RS485. Internal flags 1536 (Flags o Bytes) or 768 (words) Collegare alimentazione
cordina con sezione di almeno di 1.5 mmq, ad una barra (AC1-AC2-PE fig.3)
equipotenziale di rame di adeguata sezione. programmi, o a qualunque altro dispositivo periferico. Per il Timers 64 (with 0.1Sec. time base)
Connect feeding
collegamento al Pc si consiglia l'utilizzo dei cavetti precablati da Counters 128 (Range 0÷255)
noi forniti (codici CBL025**00), o, in alternativa, qualunqhe cavo Segnalazioni e anomalie (AC1-AC2-PE fig.3)
ATTENZIONE! Assicurarsi che FACELOG RS232 sia In Fig. 2 è riportata la posizione dei led di segnalazione Mathematical instructions +, -, *, ÷ (8 or 16 bits operands)
null-modem. La lunghezza massima del cavo prescritta dalle EIA
collegato alla stessa terra del dispositivo remoto; presenti sulla CPU; il diagramma evidenzia il loro stato in Interface Serial RS232C o RS422/485 Yes
• Baud rate
RS232C è di 15mt, il cavo utilizzato deve essere schermato.
eventuali differenze di potenziale tra punti di terra funzione delle condizioni di funzionamento. 300 ¸ 57600 Baud
diversi, possono causare danneggiamenti ATTENZIONE! Il port seriale RS232 non è isolato Il led di DTR presente solo nella versione RS485 indica, • Galvanic insulation RS232C: No
Verificare tensione Led RUN lampeggiante?
hardware irreversibili. galvanicamente dal sistema, quindi è opportuno quando è acceso, che la trasmissione è attiva. RS422/485: Yes (2500V)
• Data format di alimentazione. No (fig.2)
adottare tutti gli accorgimenti necessari riguardo al 7/8 bit, E/O/N parity Verify feeding Is flashing RUN Led ?
collegamento di terra ed evitare passaggi del cavo Compatibilità elettromagnetica Maximum cable lenght RS232C: 15 mt tension. (fig.2)
Ingressi logici (Fig. 4) seriale paralleli a cavi di potenza. FACELOG è conforme alla direttiva compatibilità RS422/485: 1200 mt
Il dispositivo è dotato di 12 ingressi logici optoisolati elettromagnetica in riferimento alle norme CEI EN 50081-2 Yes
Display LCD Supertwist alfanumeric
previsti per alimentazione da 12VDC a 24VDC. La tensione di FACELOG RS422/485 è dotato di un port seriale
(norma generica sull’emissione riguardante gli ambienti • Number of chars 2 * 16
alimentazione degli ingressi deve essere continua e filtrata, non RS422/485 galvanicamente isolato sia sulla parte di
industriali) e CEI EN 50082-2 (norma generica sull’immunità • Character size 2,96 * 5,56 mm, 5*7 matrix Programma già in
• Display dimension
è necessario che sia stabilizzata. alimentazione che sui segnali (Fig. 1). E’ possibile configurare le Led RDY acceso?
riguardante gli ambienti industriali). 61 * 15 mm esecuzione. Yes (fig.2)

Uscite logiche (Fig. 6)


modalità Full-Duplex o Half-Duplex variando la posizione dello
switch LK2. Anche il segnale EGND è galvanicamente isolato • Backlight LED Matrix (program enabled) Program already in
execution.
Is RDY led light?
Codifica prodotto (fig.2)
dalla massa di FACELOG. Keyboard
Il dispositivo è dotato di 8 uscite logiche statiche, esse
• La distanza massima tra il primo e l’ultimo dei dispositivi non • Number of keys 16 touch-sensitive
sono tutte protette da un solo fusibile extra rapido da 1A 250V. La
corrente massima che ogni uscita può erogare è di 125mA. deve superare i 1200 mt. • Customizable keys 7 with red LED light
No

Le uscite vengono forzate a 0 all'accensione del sistema, • La resistenza di terminazione deve essere collegata solo sul Logic inputs 12
• Voltage range
LBL052B000

e comunque ogni qualvolta lo stato del LED "RDY" è 0. primo e l’ultimo dei dispositivi. 10 ¸ 30Vdc Collegare linea seriale

Code: MPS018A300
• Input current 5mA @ 24 Vdc e trasferire il programma.
Connect serial line and
Bus per estensioni (Fig. 8) Serial nr.: 000104 Logic Outputs 8
Indirizzo (Fig. 9)
• Maximum voltage
transfer the program.
FACELOG è dotato di un connettore transition a 26 poli per 30Vdc
la connessione di un max. di 6 moduli di estensione della famiglia
FACELOG viene fornito già settato con l'indirizzo per il MPS018 A 300 • Output current 125mA/OUT @70°C 8 OUT ON
PICOSYST. Per il collegamento dei moduli di estensione si
normale funzionamento (Add 0).
Nel caso in cui il dispositivo venga abbinato ad una
• Switching power 3.75W @ 30 Vdc
2
consiglia l'utilizzo dei cavetti precablati da noi forniti (codici configurazione dove siano presenti più moduli di estensione, è Uso interno Absolute wire size 0,13 ¸ 1 mm
CBL024**00). opportuno considerare che l’indirizzo “7” è impegnato • UL 22 ¸ 16 AWG Mandare in esecuzione
internamente, quindi eventuali estensioni con tale indirizzo
Livello
• DIN 46 228/1 0,5 ¸1 mm
2 il programma.
Run program.
devono essere eliminate. Ne consegue che i moduli di I/O Codice MPS Connections
• Power supply 3 pin 5,08mm extractable
• Inputs 13 pin 3.81mm extractable
• Outputs 9 pin 3.81mm extractable
• Serial Interface RS232C: Delta 9 pin male
RS422/485: 5 pin 5,08 mm extractable
Dimensions MPS018*300 137x88x76 mm Dispositivo Seriale
Power supply (Fig. 3) Serial Line (Fig. 1) Signalings and anomalies (Fig. 2) MPS019*300 137x88x84 mm PICOLOG
FACELOG could be powered with 12 or 24V continuous The Fig. 2 shows leds position and diagram witch display FACELOG
FACELOG RS232 is endowed with a "D" 9 poles socket Weight 0,5Kg
Serial Device Linea seriale RS232
RS232 Serial line
tension, or with 9 or 18V alternate tension; tolerances tensions is RS232C serial port (Fig. 1). all CPU statements. max. 15 mt
AC1

+/-10% and frequency range is 50-60 Hz. By this port it is possible the connection to the PC (to The DTR led present in the RS485 version, show if the Enviromental protection IP 65 (front) AC2
PE

transfer programs and/or debug) or to any RS232C devices. transmission is active. Operating temperature 0 ¸ 60°C
Ground connection To connect base module to the Pc a standard Null Modem Relative umidity range Max. 90%
PICOFACE must be connected directly to GND by means cable is required (our codes CBL025** 00). EMC
RS232 Line RS232 Line

of the specific clamp of feeding connector (Fig. 3). The The maximum length of the shelded cable prescribed by FACELOG is conforming to the EMC directive in reference
connection must be performed by means of a wire with section at EIA RS232C is of 15mt. to the norms CEI EN 50081-2 (emission generic norm regarding
least of 1.5 sq. mm, to a copper equipotential bar of adequate
section.
BEWARE! All care on using the RS232 serial port industrial environments) and CEI EN 50082-2 (immunity generic Collegamenti seriali
norm regarding the industrial environments).
must be taken refered to as examples: respect of Serial connections
BEWARE! It is necessary which FACELOG RS232 is GND connection, respect of galvanic insulation and
respect of wire passages to prevent noise troubles. Encoding product
connected to the same ground of the remote
device; possible differences of potential between Modalità di collegamento Full-Duplex CONVERFACE
FACELOG RS422/485 is endowed with RS422/485 LBL052B000 FACELOG PICOLOG
different ground points , can cause irreversible optoisolated serial port (Fig. 1). The LK2 switch allow to Full-Duplex configuration
hardware damages. configurate the communication mode: Full-Duplex or Half- R=100 ohm SCH
Code: MPS018A300 Rx+ 3 1 Tx+
Duplex. The EGND signal is insulated to the FACELOG ground.
Serial nr.: 000104
• The maximum distance between the first one and the last of Rx- 4 2 Tx-
Logical inputs (Fig. 4) the devices does not exceed 4000 feet. MPS018 A 300 Tx+ 1 3 Rx+
FACELOG is endowed with 12 logical optoisolated inputs • The termination resistor must be connected on to the first one
(DC range 12V to 24V). Input feeding tension not necessary must and the last device only. Tx- 2 4 Rx-
be stabilized, but continuous and filtered is required. Internal use R=100 ohm
EGND 5 Lunghezza massima cavo: 1200mt 5 EGND
Level Cable maximum length: 4000 feet
Logical output (Fig. 6) Addresses (Fig. 9)
The FACELOG address is predisposed for the normal MPS Code
FACELOG is endowed with 8 static logical outputs . The
maximum supplied current is 125mA. All outputs are reseted at operation (Add 0). Modalità di collegamento Half-Duplex multipunto
each system power on, or however every time the state of the Possible extension modules inserted in hardware Half-Duplex multidrop configuration
"RDY" LED is equal to 0. configuration, must not be setted with address “0” or “7” FACELOG R=120 ohm R=120 ohm PICOLOG
because internally used .
SCH SCH
Plug in bus module extensions (Fig. 8) Tx+ 1 1 Tx+
FACELOG is fitted a 26 poles transition connector to be Programming Tx- 2 2 Tx-
used to link the going-through bus of each extension module. The programming of the device can happen entirely via PC
Max number of extension supported is up to 6 unit. Rx+ 3 PICOLOG 3 Rx+
with the REMOTER (Cod.: SFW040*100) and PROFACE (Cod.:
Expecially designed cables for the bus module extension SFW047*100) sotware. For the use it is postponed to the users Rx- 4 4 Rx-
ready to be plug in thus socket (Fig. 5) are available (code handbook (Cod.: MNL041*100 and MNL045*100). 1 Tx+
EGND 5 5 EGND
CBL024** 00). FACELOG RS485, in programming phase, must be setted in 2 Tx-
Full-Duplex mode using the LK2 switch (Fig. 1). The PC must be
BEWARE! Before insert the bus module extension 3 Rx+
endowed with CONVERFACE or any RS232/RS485 converter.
cable, the base module power supply must be
4 Rx-
switched-off to prevent serious devices demage.
5 EGND
http://192.168.0.61/Destination/Ftp/Mnl115a1.pdf

Embedded Secure Document


The file
http://192.168.0.61/
Destination/Ftp/
Mnl115a1.pdf is a secure document that has been
embedded in this document. Double click the pushpin to view.

http://192.168.0.61/Destination/Ftp/Mnl115a1.pdf [06/10/2008 17.46.59]


Application programs

ELSIST Srl, www.elsist.it MNL041Q100

Worspaces list

Application programs

SFW111E000: Alias "ChipCardMng"


Loaded on Netreader systems based on both the processor P89C664 and T89C51 allows the
complete management of Sle4432 and Sle4442 chip cards. The program accepts a series of
commands from serial line, it unlocks the card (with PSC code), it reads and writes the protection
memory and the main memory, it executes the cards duplication.

SFW125C100: Alias "NesystExtension"


Loaded on NetlogII lite systems allows to use them as Netsyst extension or as a Netmaster base
module. The program could be modified in order to execute on the extension module a specific user
program.

SFW131F600: Picolog emulator for compatibility with 7.x of Remoter


Loaded on Picosyst millennium systems makes them compatible with the previous versions of
Picolog systems. Using this emulator, clients that had old versions of our Picolog systems could
change them with the millennium family maintaining the complete programming compatibility.

SFW135D000: Alias "NesystExtension"


Loaded on Netreader systems based on PhilipsP89C664 microcontoller, allows to use them as
Netsyst extension. The program could be modified in order to execute on the extension module a
specific user program.

SWM106E100: Alias "SerialPicoface"


Loaded on Picoface serial terminal allows to use it as serial terminal connected to a target system.
On the target, the FbPicofaceSerial manages the terminal as it is directly connected to the system, it
is also possible to use the FB system terminal.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Applications.htm [06/10/2008 17.47.00]


Programmi di esempio "Ptp087"

ELSIST Srl, www.elsist.it MNL041Q100

Example programs

"CLIPAndSMSManager"

This example program allows to verify the operation of the FbModemMng modem management FB using
all of its functions. In the Workspace are present different projects, everyone arranged for a specific system
target. It will be necessary to define as active project the project for the target on whose will be upload. The
program allows to:

To identify the number of the calling CLIP. It's possible at the ring, before to answer, to verify the
number of the calling and to be able to decide how to operate in function of it.
To execute command on reception of SMS messages. It's possible to send to the system messages
like Set output or Reset output and the system set or reset a logic output.

To send SMS messages on events. On logic change of an input signal it's possible to send a messages
like Input is active.
To activate the data communication on call, it's possible from a central system to call the device
activating the data communication, allowing to connect SCADA systems and/or to execute the program
debug.

The Modem management is realized in C language, all the logic I/O are managed in RIL language. This
solution allows to be easily modify the program also for the users not expert in C language programming.
Below the files included in the program.

Start.ril Defines all the external and global variables, executes the call of all the functions written in
C language. The file contains also the logic I/O management.
SetSerialMode Executes the serial communication parameters.
Definitions.h Contains definitions for the C file.
ModemFcts Executes the Modem management.
Debug Manages the program debug from serial line. This can be executed only on target systems
whose have two serial lines.
ModemDebug Manages the program debug from Modem. After a phone data call it's possible to debug
the program by Modem.
Terminal Manages the operator terminal, only for target systems whose have operator terminal.

The program manages some logic I/O, below a list of the I/O managed.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Examples/Ptp087.htm (1 of 3) [06/10/2008 17.47.01]


Programmi di esempio "Ptp087"

Input Function Output Function

I 0000 Send SMS message 0, it forces the system to O 0000 Modem OK, it blinks during the Modem
send a SMS message with the text init.
Input 0 active. O 0001 Ring, incoming call, it's on for a second
I 0001 Send SMS message 1, it forces the system to at every ring.
send a SMS message with the text O 0002 Ring from CLIP, incoming call from the
Last call number: nnn defined CLIP, it's on for a second at
I 0002 Debug input 2 every ring.
I 0003 Debug input 3 O 0003 Command from SMS, it became on on
a reception of SMS message
Set command, it became off on a
reception of SMS message
Reset command.

Test the program

After to have uploaded the program on target system, join to the serial port A the Modem and switch on the
system. The other Modem must be joined to a PC in which is in execution Remoter with terminal emulation
active. Follow we report the indications on how to execute the test of the program, please follow the steps
exactly in the chronological order defined.

1 Steps from 2 to 10:


To use the CLIP control functions and SMS send e receive, can be used any SIM card.

Step 11:
To use the data communication function, a SIM card enabled to data transmission must be used.
Please ask to your phone service provider.
2 Check the status of the LED present on the two Modems.
1 second off and 1 second on: The Modem is out of bridge, there's not the SIM card inserted or
the SIM card has a enable PIN.
5 seconds off and 1 second on: The Modem is correctly initialized.
Always on : The Modem is connected.
3 Verify the state of the output O 0000 on the target system. The output flashes during the Modem init,
after the init if all the operations is correctly executed the output is switched on. If it is not switched on,
please verify:
Check the connection between the Modem and the serial line.
Try to switch off an on the Modem.
Verify that the Modem settings are correct. If necessary join the Modem to a PC and by using the
terminal emulation:
Send to the Modem the AT&F command followed by carriage return. This command sets the
default profile.
The Modem answers OK.
4 Call the Modem connected to the target system by using a cellular phone or by using the Modem joined
to the PC sending the command ATD nnn followed by a carriage return (nnn is the number to call
inclusive of area code). Verify the set of the output O 0001 on the target system, it's switched on for 1
second at every ring. Attention! at the fifth ring the system will answer to the call.
5 Send a SMS message with the text Set command and verify the set of the output O 0003.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Examples/Ptp087.htm (2 of 3) [06/10/2008 17.47.01]


Programmi di esempio "Ptp087"

6 Send a SMS message with the text Reset command and verify the set of the output O 0003.
7 Send a SMS message with the text Accept nn, where nnn is the number to that the system send the
SMS messages. You could define the number of a cellular phone. Attention! To every reception of this
message will be changed the number to that the system send the SMS messages. The number must be
exactly the same with the CLIP, that it is wanted to verify (put before the number also the international
prefix, example +39).
8 Call the Modem connected to the target system by using a cellular phone or by using the Modem joined
to the PC, if the number of the SIM that makes the call is the number set to the point 7 beyond to
activate the output O 0001 will be activated also the output O 0002. Attention! at the fifth ring the
system will answer to the call.
9 Activate the input I 0000, the system sends to the phone number set to the point 7 a SMS message with
the text Input 0 active. Deactivating the input and activating it again the message will be resent.
10 Activate the input I 0001, the system sends to the phone number set to the point 7 a SMS message with
the text Last call number: nnn, where nnn is the last received CLIP.
11 Execute a call from the Modem joined to the PC, sending the command ATD nnn followed by a
carriage return (nnn is the number to call inclusive of area code). After five rings (indicated from five
flash of the output O 0001), starts the data connection. If connection succeeded on the terminal window
appears CONNECT. At this point it's possible to terminate the terminal emulation and start the debug
sequence it will be executed on the target system. Attention! until the sequence of debug remains active
remains active also the connection. Deactivating the debug after about 30 seconds will be deactivated
also the connection.

http://192.168.0.61/Destination/Html/Appendix/Workspaces/Examples/Ptp087.htm (3 of 3) [06/10/2008 17.47.01]


"FbModbusAsciiSl" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbModbusAsciiSl" history report

PFB042H000

B C A A A A A

First function block version available for Remoter 8.x.

PFB042I000

B C A A A A A

Disabled the Ready signal before forcing the system reset on reset diagnostic command.
Modified the management of the MODBUS command 43 Extended read memory bytes and 44
Extended write memory bytes allowing the access in writing and in reading to the FLASH memory,
to the EEPROM memory and to the mass memory modules. Now the addressing range on this
commands is:
RAM memory: From 0x000000 to 0x0FFFFF
FLASH memory : From 0x100000 to 0x1FFFFF
EEPROM memory : From 0x200000 to 0x2FFFFF
Mass memory (PCB088) module 4: From 0x400000 to 0x4FFFFF
Mass memory (PCB088) module 5: From 0x500000 to 0x5FFFFF
Mass memory (PCB088) module 6: From 0x600000 to 0x6FFFFF
Mass memory (PCB088) module 7: From 0x700000 to 0x7FFFFF
Insert the management of the MODBUS diagnose command, it allows to read the project information.
Error reset bits management modified in StatusBit they are cleared at the FB disable instead of at the
enable.
Answer to the diagnose command 02 modified, the StatusBit value is returned.
Insert the bit CmdBit.ResetCtrs for the reset of all the counters which now are not cleared on the bit of
CmdBit.Enable.
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb042
becomes FbModbusAsciiSl, PFB042_DATASTRUCT becomes FBMODBUSASCIISLDATA.

PFB042J000

D E C C A B A
Eliminated the Pfb042 function, lost the compatibility with the previous versions whose use a numerical
addressing.
Insert the management of the MODBUS command 06 Preset Single Register.
External buffer management for frame reception and transmission, this allow to manage longer data
frames. FrameLength and FrameBuf members added in data structure.
Managed the MODBUS reception timeout bit. StatusBit.CmActive and CmActiveDelay members
added in data structure.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb042.htm (1 of 2) [06/10/2008 17.47.02]


"FbModbusAsciiSl" history report

PFB042K000

D E C C A B A

Increased the data structure length, now is 64 bytes.


Inserted global variable FbModbusAsciiSlVersion.
Insert the management of the MODBUS command 04 Read Input Registers.
Added the Compatibility parameter in data structure to manage the compatibility with the MODBUS
specification.
Eliminated the PLCMemStart and PrjReference in data structure, their values are automatically read
from the PLCRemoterProjectInfo variable.
Modified the management of the MODBUS command 43 Extended read memory bytes and 44
Extended write memory bytes allowing the access of the (PCB111) mass memory modules. Now the
addressing range on this commands is:
RAM memory: From 0x000000 to 0x0FFFFF
FLASH memory : From 0x100000 to 0x1FFFFF
EEPROM memory : From 0x200000 to 0x2FFFFF
Mass memory (PCB088) module 4: From 0x400000 to 0x4FFFFF
Mass memory (PCB088) module 5: From 0x500000 to 0x5FFFFF
Mass memory (PCB111) module: From 0x600000 to 0x6FFFFF
Changed the management of StatusBit.CmActive, the bit is immediately activated at FB enable and
at the reception of a MODBUS command. It is reset if there is not communication for the definite time.

PFB042L000

D E D C A B A
Insert the management of the MODBUS commands 47 Flat read memory variables and 48 Flat write
memory variables, to manage the access to all the memory the system can address.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb042.htm (2 of 2) [06/10/2008 17.47.02]


"FbModbusRtuSl" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbModbusRtuSl" history report

PFB060A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB060B000

B C A A A A A

Increased the data structure length, now is 45 bytes.


Added the Compatibility parameter in data structure to manage the compatibility with the MODBUS
specification.

PFB060C000

D E C C A B A

Increased the data structure length, now is 64 bytes.


Inserted global variable FbModbusRtuSlVersion.
Insert the management of the MODBUS command 04 Read Input Registers.
Eliminated the PLCMemStart and PrjReference in data structure, their values are automatically read
from the PLCRemoterProjectInfo variable.

PFB060D000

D E C C A B A
Insert the management of the MODBUS commands 47 Flat read memory variables and 48 Flat write
memory variables, to manage the access to all the memory the system can address.
Used the system function ModbusCRC to calculate the CRC.

PFB060E000

D E C C A B A
Insert the management of the MODBUS command 01 Read coil status, 02 Read input status and 05
Force single coil.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb060.htm [06/10/2008 17.47.03]


"FbSysTerminal" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbSysTerminal" history report

PFB054A000

B C A A A A A

First version function block available for Remoter 8.x

PFB054B000

B C A A A A A
Bug solved on displaying message not belonging to a page, after a certain time the message 0xFFFF
was shown.
Bug solved on showing number message not found, if 0xFFFF was shown -0001.
Pages scroll with the keys and , eliminatedin the Picosyst systems.

PFB054C000

B C A A A A A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb054
becomes FbSysTerminal, PFB054_DATASTRUCT becomes FBSYSTERMINALDATA.

PFB054D000

D E A C A B A

Managed the display and the input value of binary variables.


Used the ArrayBitCount funcrtion, it is available on the new system libraries.
Added in the data structure the TerminalType member used to define the terminal type.
If data input active, the automatic page message scroll is disabled.
Added the command bit Command.DisablePageScroll.
Added the posibility for every variable to execute a function before to display the value and after the
editing of a new value.
Added the possibility for every message to jump to another message or to execute a function on a
particular events.

PFB054E000

D E A C A B A

Inserted global variable FbSysTerminalVersion.


Changed the Toggle800 variable with PLCTimeBase800 variable to compatibility with the last system
libraries.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb054.htm (1 of 2) [06/10/2008 17.47.03]


"FbSysTerminal" history report

Added the DisableAutoscroll parameter in data structure so the user program can disable the the
automaric page message scroll.
Modified the alarms and warnings management, now they are not memorized by the function, the user
program must memorize them by using a LTCH instruction to active the bit. When the display page is
left al the alarms or warnings are cleared.
In the string variables display, if the variable length is greater than the definite number of characters,
only the defined number of characters are displayed.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb054.htm (2 of 2) [06/10/2008 17.47.03]


"FbCounterOverIO" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbCounterOverIO" history report

PFB035B000

B C A A A A A

First version function block available for Remoter 8.x

PFB035B100

B C A A A A A

Solved bug on pulses count.


Eliminated the Pfb035 function, lost the compatibility with the previous versions whose use a numerical
addressing.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb035.htm [06/10/2008 17.47.04]


"FbDMXProtocol" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbDMXProtocol" history report

PFB076A000

- - - - - - A

First version function block available for Remoter 8.3.0.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb076.htm [06/10/2008 17.47.04]


"FbElevatorCall" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbElevatorCall" history report

PFB062A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB062B000

B C A A A A A

Increased the data structure length, now is 41 bytes.


The status bits CabinStart, CabinUp, CabinDw, now are conditioned by the CabinReady command
bit.
Added bit Command.CabinPriority to force cabin priority.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb062.htm [06/10/2008 17.47.05]


"FbEncoderOverIO" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbEncoderOverIO" history report

PFB018B000

B C A A A A A

First version function block available for Remoter 8.x.

PFB018C000

B C A A A A A
Modified names of function and data structure for compatibility with new version of Remoter 8.1.
Pfb018 becomes FbEncoderOverIO, PFB018_DATASTRUCT becomes
FBENCODEROVERIODATA.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb018.htm [06/10/2008 17.47.05]


"FbI2CSerial" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbI2CSerial" history report

PFB057A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB057B000

B C A A A A A

Modified I/O functions table to adapt it to the last system libraries version.

PFB057C000

B C A A A A A

Increased the data structure length, now is 224 bytes.


IInserted global variable FbI2CSerialVersion.
The FB now is compatible with the FbI2CSlaveManager.
PFB057D000

Modified the I2C bus management the NSYSTBusIO function is used.


Eliminated from the data structure the struct I2CError; unsigned char I2CErrorCtr members.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb057.htm [06/10/2008 17.47.06]


"FbI2CSlaveManager" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbI2CSlaveManager" history report

PFB064A000

- - A - B C A

First version function block available for Remoter 8.x.

PFB064B000

- - A - B C A
Changed the management of I2C commands 0C: Analog input acquisition and 0D: Analog output
management.

PFB064C000

- - A - B C A

Increased the data structure length, now is 128 bytes.


Changed the terminal management, now it isn't managed directly from the FB now the I2C commands
0A: Display write and 0B: Keyboard read work on buffers allocated in data structure. The user
program must manage the terminal copying the data in the relate buffers.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb064.htm [06/10/2008 17.47.06]


"FbIOComm" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbIOComm" history report

PFB043C000

B C A A A A A

First version function block available for Remoter 8.x.

PFB043D000

B C A A A A A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb043
becomes FbIOComm, PFB043_DATASTRUCT becomes FBIOCOMMDATA.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb043.htm [06/10/2008 17.47.07]


"FbModbusAsciiMs" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbModbusAsciiMs" history report

PFB044H000

B C A A A A A

First version function block available for Remoter 8.x.

PFB044I000

D E C C A B A

All the Status bits are cleared at the FB disable.


The one shot set of Status.JobDone bit is not done if no active commands.
Eliminated the 500 mSec minimum timeout value on reception control, now the timeout time is exactly
the one set in RxTimeout.
Insert the bit Command.ResetCtrs for the reset of all the counters which now are not cleared on the
bit of Command.Enable.
PLCMemStart member inserted in the data structure for the definition of the origin address of the PLC
memory of the slave system.
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb044
becomes FbModbusAsciiMs, PFB044_DATASTRUCT becomes FBMODBUSASCIIMSDATA.

PFB044J000

D E C C A B A
Eliminated the Pfb044 function, lost the compatibility with the previous versions whose use a numerical
addressing.
Reduced the data structure length, now is 64 bytes.
Inserted global variable FbModbusAsciiMsVersion.
External buffer management for frame reception and transmission, this allow to manage longer data
frames. FrameLength and FrameBuf members added in data structure.
Modified timeout management, timeout error is activated if no reply has been received from the slave
system after the command is sent.
Eliminated the RxTimeout member from the data structure.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb044.htm [06/10/2008 17.47.07]


"FbModbusRtuMs" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbModbusRtuMs" history report

PFB069A000

E F A D C A A

First version function block available for Remoter 8.x.

PFB069A100

E G A D D A A
The library function ModbusCRC is used.

PFB069B000

E G A D D A A
Defined a new bit Command.FctSelect to select the modbus function to be used to read data from the
slave device. The function Code 03: Read holding registers or Code 04: Read input registers can
be select.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb069.htm [06/10/2008 17.47.08]


"FbModemMng" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbModemMng" history report

PFB053B000

B C A A A A A

First version function block available for Remoter 8.x

PFB053C000

B C A A A A A

Increased the data structure length, now is 64 bytes.


Inserted global variable FbModemMngVersion.
Modified the pointer type to the modem configuration data structure ModemCfg, it was generic, now is
code.

PFB053D000

B C A A A A A
Changed the management of initialization strings, now it considered as separator the '\r' character
instead of the ',' character.
Added in the data structure the Status.RingFlag bit. This bit was added to allow the debug, it remains
active for 1 second to every ring received
Added the CLIP reception.
Added new membrs in MODEM configuration data structure FBMODEMMNGCONFIG.
Modified the SMS messages reception, now it returns the sender number and the message body
without the header and tail.

PFB053D100

B C A A A A A

Added a 5 Sec delay after the SMS message send to avoid to send another message immediately.

PFB053D200

B C A A A A A

Added the Command.AnswerDisable bit, to disable to answer to incoming calls.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb053.htm [06/10/2008 17.47.08]


"FbNetlogAD" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbNetlogAD" history report

PFB050C000

B C A A A A A

First version function block available for Remoter 8.x.

PFB050D000

B C A A A A A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb050
becomes FbNetlogAD, PFB050_DATASTRUCT becomes FBNETLOGADDATA.

PFB050E000

B C A A A A A

Bug solved in the management of the extension modules.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb050.htm [06/10/2008 17.47.09]


"FbNetlogDA" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbNetlogDA" history report

PFB051C000

B C A A A A A

First version function block available for Remoter 8.x.

PFB051D000

B C A A A A A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb051
becomes FbNetlogDA, PFB051_DATASTRUCT becomes FBNETLOGDADATA.

PFB051E000

B C A A A A A
Redefined FBNETLOGDAPROTOTYPES was erroneusly defined as the A/D acquisition FB
FBNETLOGADPROTOTYPES.
Bug solved in the extension modules.management.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb051.htm [06/10/2008 17.47.09]


"FbNetlogIIAD" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbNetlogIIAD" history report

PFB065A000

- F A D C A A

First version function block available for Remoter 8.x.

PFB065A100

- F A D C A A
Added a control on the target system. The base module can be accessed only if the target system is
based on ADuC845 microcontroller, otherwise the module is not managed and FBParameters bit of
PLCErrors is set.

PFB065A200

- F A D C A A

Bug solved on acquisition from NetlogII base module.


Managed the NSYSTBusRetries variable increment, on Netsyst bus access retry.

PFB065A300

- F A D C A A

Removed the Status.BusRetry data structure member.


Added the Command.UnipolarAcq data structure member to manage the unipolar acquisition.

PFB065A600

- F A D F A A
Managed the external current generator on RTD acquisition. It can be used on hardware versions
"PCB099H***", "MPS031B***", "MPS033B***" and "MPS034B***".

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb065.htm [06/10/2008 17.47.10]


"FbNetlogIIDA" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbNetlogIIDA" history report

PFB066A000

- F A D C A A

First version function block available for Remoter 8.x.

PFB066A100

- F A D C A A
Added a control on the target system. The base module can be accessed only if the target system is
based on ADuC845 microcontroller, otherwise the module is not managed and FBParameters bit of
PLCErrors is set.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb066.htm [06/10/2008 17.47.10]


"FbPicofaceSerial" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbPicofaceSerial" history report

PFB055B000

D E A C A B A

First version function block available for Remoter 8.x.

PFB055C000

D E D C A B A

Increased the data structure length, now is 128 bytes.


Inserted global variable FbPicofaceSerialVersion.

PFB055C100

D E D C A B A

Eliminated bug on data input, if the [ENT] key was pressed with any data given the system locks.

PFB055D000

D E D C A B A
Changed the hexadecimal data entry, it's not longer used the [FUN] key but now it' managed the
double function for the keys from [0] to [5]. The [FUN] key is used to input the "-" character in the
binary enhanced data entry.
Managed two new data entry types: 5: Binary, are accepted only 0 and 1. 6: Binary enhanced, range
from 0 to F and '-'.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb055.htm [06/10/2008 17.47.11]


"FbPIDMng" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbPIDMng" history report

PFB056A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB056B000

B C A A A A A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb056
becomes FbPIDMng, PFB056_DATASTRUCT becomes FBPIDMNGDATA.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb056.htm [06/10/2008 17.47.11]


"FbPsystADSubm" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbPsystADSubm" history report

PFB047G000

- C A - - - A

First version function block available for Remoter 8.x.

PFB047H000

- C A - - - A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb047
becomes FbPsystADSubm, PFB047_DATASTRUCT becomes FBPSYSTADSUBMDATA.

PFB047I000

- C A - - - A
Eliminated the Pfb047 function, lost the compatibility with the previous versions whose use a numerical
addressing.
Used the FbPsystAnaCpDMARead and FbPsystAnaCpDMAWrite functions, they are defined global
in the coprocessor module management FB.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb047.htm [06/10/2008 17.47.12]


"FbPsystAnaCp" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbPsystAnaCp" history report

PFB033F000

- C A - - - A

First version function block available for Remoter 8.x

PFB033G000

- C A - - - A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb033
becomes FbPsystAnaCp, PFB033_DATASTRUCT becomes FBPSYSTANACPDATA.

PFB033H000

- C A - - - A
Eliminated the Pfb033 function, lost the compatibility with the previous versions whose use a numerical
addressing.
Changed the names of the DMARead and DMAWrite functions that become
FbPsystAnaCpDMARead and FbPsystAnaCpDMAWrite. The functions become global to be used
from the function blocks that manage the A/D and the D/A submodules.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb033.htm [06/10/2008 17.47.12]


"FbPsystDASubm" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbPsystDASubm" history report

PFB048E000

- C A - - - A

First version function block available for Remoter 8.x.

PFB048F000

- C A - - - A
Function and data structure names modified for compatibility with new version of Remoter 8.1. Pfb048
becomes FbPsystDASubm, PFB048_DATASTRUCT becomes FBPSYSTDASUBMDATA.

PFB048G000

- C A - - - A
Eliminated the Pfb048 function, lost the compatibility with the previous versions whose use a numerical
addressing.
Used the FbPsystAnaCpDMARead and FbPsystAnaCpDMAWrite functions, they are defined global
in the coprocessor module management FB.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb048.htm [06/10/2008 17.47.13]


"FbPWMRegulation" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function blocks

"FbPWMRegulation" history report

PFB072A000

E F A D C A A

First version function block available for Remoter 8.x.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb072.htm [06/10/2008 17.47.13]


"FbQuoteMng" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbQuoteMng" history report

PFB059A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB059B000

B C A A A A A

Managed inversion on displacement calculation using the Command.Reverse command bit.


Added the Displacement member in data structure it returns the quote displacement in pulses.
Eliminated the management of the Status.QuoteSign bit.
Added the Status.Enabled bit, it returns the FB enabled status.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb059.htm [06/10/2008 17.47.14]


"FbRtuManager" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbRtuManager" history report

PFB061D000

D E C C A B A

First version function block available for Remoter 8.x.

PFB061D100

D E C C A B A

Added the Command.Acknowledge comand bit.


Modified the Status.TrendTimeError bit management, the bit is managed at every FB enable or when
the Command.TrendLock bit is reset.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb061.htm [06/10/2008 17.47.14]


"FbSetSerialPar" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbSetSerialPar" history report

PFB058A000

B C A A A A A

First version function block available for Remoter 8.x.

PFB058B000

B C A A A A A

Increased the data structure length, now is 16 bytes.


Inserted global variable FbSetSerialParVersion.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb058.htm [06/10/2008 17.47.14]


"FbSle44x2Card" history report

ELSIST Srl, www.elsist.it MNL041Q100

Function block

"FbSle44x2Card" history report

PFB063A000

- - A A - A A

First version function block available for Remoter 8.x.

PFB063B000

- - A A - A A

Reduced the data structure dimension to 40 bytes.


Introduced new data structure members for the definition of allocation address, the length of the data
buffer and the PSC control address on chip card ChipCardStart, CardDataLength and
PSCCheckAddress.
If chip card without PSC (Sle4432) does not execute the unlock sequence in writing.
Eliminated the call to ChipCardMng function, the hardware management of chip card reader is
included into the function block.
Added a chip card reader LED management bit Command.ChipCardLED. This bit replaces the
ChipCardLED bit of the system library.
Possibility to use two access modes to the chip card, normal or advanced, defined new Command.
AdvancedMode bit.
Modified the CRC calculation is initialized with the 0xFFFF value.
Modified the status length, now is an 16 bits integer.
Modified the prototype of the chip card main memory read function unsigned char MainMemoryRead
(unsigned char Address, unsigned char* Data).

PFB063B100

- - A A - A A

Modified the Command.WriteData management, now it's reset at the chip card write operation end.
Modified Status.CardDataOk bit noum in Status.CardReadEnd and Status.WriteDataOk in Status.
CardWriteEnd.
Added Status.ReadDataOk, Status.ReadDataError, Status.WriteDataOk e Status.WriteDataError
bits management.

PFB063B200

- - A A - A A

Solved bug on PSC check when the Sle4432 chip card is used.

http://192.168.0.61/Destination/Html/Appendix/FBHistoryReport/Pfb063.htm [06/10/2008 17.47.15]


"C" functions: TermIOIsOpen

ELSIST Srl, www.elsist.it MNL041Q100

"C" functions

TermIOIsOpen

This functions returns the selected I/O console status.

Prototype
ElSystemLib.h
Declaration
BOOL TermIOIsOpen(void);
Parameters
None
Return value
BOOL FALSE: I/O console not open
TRUE: I/O console open

http://192.168.0.61/Destination/Html/CLanguage/Functions/TermIO/TermIOIsOpen.htm [06/10/2008 17.47.16]

You might also like