Advant OCS Advant Controller 100 Series: System Software Extensions
Advant OCS Advant Controller 100 Series: System Software Extensions
Advant OCS Advant Controller 100 Series: System Software Extensions
Designers Guide
3BDS 003 340R401
Use of DANGER, WARNING, CAUTION, and NOTE
This publication includes, DANGER, WARNING, CAUTION, and NOTE information where appropriate to point out safety
related or other important information.
DANGER Hazards which could result in severe personal injury or death
WARNING Hazards which could result in personal injury
CAUTION Hazards which could result in equipment or property damage
NOTE Alerts user to pertinent facts and conditions
Although DANGER and WARNING hazards are related to personal injury, and CAUTION hazards are associated with
equipment or property damage, it should be understood that operation of damaged equipment could, under certain operational
conditions, result in degraded process performance leading to personal injury or death. Therefore, comply fully with all
DANGER, WARNING, and CAUTION notices.
TRADEMARKS
Advant, AdvaCommand, AdvaInform, and AdvaBuild are registered trademarks of ABB Asea Brown Boveri Ltd, Switzerland.
NOTICE
The information in this document is subject to change without notice and should not be construed as a commitment by ABB
Automation Products GmbH. ABB Automation Products GmbH assumes no responsibility for any errors that may appear in this
document.
In no event shall ABB Automation Products GmbH be liable for direct, indirect, special, incidental or consequential damages of
any nature or kind arising from the use of this document, nor shall ABB Automation Products GmbH be liable for incidental or
consequential damages arising from use of any software or hardware described in this document.
This document and parts thereof must not be reproduced or copied without ABB Automation Products GmbHs written
permission, and the contents thereof must not be imparted to a third party nor be used for any unauthorized purpose.
The software described in this document is furnished under a license and may be used, copied, or disclosed only in accordance
with the terms of such license.
CE MARKING
This product meets the requirements specified in EMC Directive 89/336/EEC and in Low Voltage Directive 73/23/EEC.
Template: 3BSE001286/F
TABLE OF CONTENTS
Chapter 1 - Introduction
1.1 BASE System Software and Standard Options ...........................................................1
1.2 Extensions, Add-On Options .......................................................................................1
1.3 Scope of This Manual ..................................................................................................2
1.4 User Characteristics .....................................................................................................2
1.5 How to Use This Book.................................................................................................3
1.6 Conventions .................................................................................................................3
1.7 Related Documentation................................................................................................4
1.8 Release History ............................................................................................................5
1.9 Terminology.................................................................................................................5
Chapter 1 Introduction
Chapter
System Appendix
Software Sample
Extensions Development How to Build Programmers Option
Introduction Environment an Option Reference
Disk POWER
1.6 Conventions
The following conventions are used throughout this manual for the presentation of material:
The words in proper names of screen elements (for example, the title in the title bar of a
window, the label for a field of a dialog box) are initially capitalized.
The names of keyboard keys are boldfaced.
Initial capital letters are used for the name of a keyboard key if it is labeled on the
keyboard. For example, the Return key or <Return>.
Lowercase letters are used for the name of a keyboard key that is not labeled on the
keyboard. For example, the space bar, comma key, and so on.
In descriptions, the word key is used in conjunction with its name. For example,
pressing the Return key initiates the process.
In tables and procedures, angle brackets replace the word key. For example, press
<Return>.
A dash is used to indicate that you must simultaneously press several keys. For
example, <Ctrl-C> indicates that you must hold down the Control key while
pressing the C key.
The phrase press and release is used to indicate that you sequentially press several
keys. For example, to close a window, press and release <Alt>, and then <F4>. This
indicates that you press and release the Alt key, and then you press and release the F4
function key.
The names of push and toggle buttons are boldfaced.
Initial capital letters are used for the name of a push or toggle button labeled on the
display. For example, the OK button.
In descriptions, tables and procedures, the word button is used in conjunction with
its name. For example, pressing the OK button initiates the process.
The names of menus and menu items are boldfaced.
Initial capital letters are used for the name of menus listed in the menu bar. For
example, the File menu.
Initial capital letters are used for the name of menu items. For example, to open a
new window, choose New from the File menu.
System prompts/messages are shown in the Courier font, and user responses/input are in
the boldfaced Courier font. For example, if you enter a value out of range, the following
message is displayed:
Entered value is not valid. The value must be 0-30.
In a tutorial, you may be told to enter the string TIC132 in a field. The string is shown as
follows in the procedure:
TIC132
Title Description
VRTX Velocity VRTX/OS 68K, RTL Users Guide This guide helps you using the run-time library
50QDM0005 of VRTX OS.
AMPL Control Configuration Setup Add-ons Describes how to design a target description
Designers Guide (TED) file and how to add a new option to
3BDS 000 610R401 AMPL Control Configuration (included on
System Software Extension Disk).
Title Description
AMPL Control Configuration PC Element Describes how to design a PC element
Description for Advant Controller 100 Series, description for AMPL Control Configuration
Designers Guide (included on System Software Extension Disk).
3BDS 000 617R101
AMPL Configuration Advant Controller 100 Describes how to program Advant Controller
Series, Reference Manual 100 Series in general.
3BSE 009 626R401
Function Chart Builder Users Guide This guide describes how to work with FCB.
3BSE 007 149R801
AS 100 Series Engineering Station Users Guide This guide describes how to work with AS 100
3BSE 007 117R501 ES.
Version Description
Separate documents for Advant Controller 110 and Advant Controller
70, 16-bit development environment:
3BDS 005 029/B and 3BDS 003 340/B
1.0 New version common for Advant Controller 100 Series, based on
Windows NT 4.0 development environment.
1.9 Terminology
The following is a list of terms associated with creating system software extensions that you
should be familiar with.
Term Description
AC 160, AC 110, AC 70, Abbreviation for controllers in Advant Controller 100 Series.
etc.
ACC Abbreviation for AMPL Control Configuration.
APB Application Builder, part of AMPL Control Configuration.
AMPL ABB Master Programming Language.
Term Description
CONTRM Control Module
This is an executable unit within the PC program
application.
CPU Central Processing Unit
CRC Cyclic Redundancy Code Check
DB Data Base
FB Function Block (PC element or move block)
FCB Function Chart Builder, part of AMPL Control Configuration.
FPROM Electrically Programmable Read Only Memory (Flash
PROM)
LED Light Emitting Diode
MC Microcontroller (e.g. Motorola MC68360)
OS Operating System
PC Programmable Control
PLC Programmable Logic Controller
PM Processor Module (board with CPU)
PROM Programmable Read Only Memory
RAM Random Access Memory
RTC Real Time Clock
SSW System Software
SW Software
VRTX Operating system kernel from Ready Systems
File Description
AC70IL.LIB Interface library for Advant Controller 70, providing a version-
independent link to the base system software and to the C runtime
functions.
AC110IL.LIB Interface library for Advant Controller 110, providing a version-
independent link to the base system software and to the C runtime
functions.
AC160IL.LIB Interface library for Advant Controller 160, providing a version-
independent link to the base system software and to the C runtime
functions.
AC70IL.H C language include file, defines the prototypes for the library
functions in AC 70.
AC110IL.H C language include file, defines the prototypes for the library
functions in AC 110.
AC160IL.H C language include file, defines the prototypes for the library
functions in AC 160.
PC_SKELE.C A skeleton for a C language PC element.
PC_SKELE.ASM A skeleton for a assembler language PC element.
MATH.H Include file for mathematical functions.
STRING.H Include file for string functions.
PCFRAME.ASM Assembly language PC element frame
File Description
JNFB.INC Assembler include file for PC elements containing the instructions
that jump to the successor element.
IBUILD32.EXE Image builder, used to create a loadable option file (32-bit
version).
LOADER32.EXE Image loader for loading the add-on option to Advant Controller
(32-bit version).
File Description
MAKEFILE MKS make file for add-on option POWER.
POWER.BAT Batch file for loading option POWER.
POWER.BLD Image Builder input file.
POWER.C POWER PC element source file.
POWER.CMD Linker command file.
POWER.ODF Image Builder option definition file.
POWER.PED POWER PC element definition file.
POWER.TED POWER option target element description
File Description
D003340.PDF This document in Adobe Acrobat Reader format.
D000610.PDF AMPL Control Configuration Setup Add-ons Designers Guide in
Adobe Acrobat Reader format.
D000617.PDF AMPL Control Configuration PC Element Descriptions for Advant
Controller 100 Series Designers Guide in Adobe Acrobat Reader
format.
2.2 Tools
Syntax:
IBUILD32 <Image Builder Command File>
The Image Builder command file (extension BLD) must contain general library definitions an a
link to at least one option. For each bound option, two files must be present: an ASCII text file
describing the option (Add-on Option Definition File, extension ODF) and a Motorola S-record
formatted file containing the options linked code (extension ABS). The latter one must contain
the public symbols for initialization and main routines as defined for PC elements.
To make handling of the command file easier, it is assumed that the option definition file has the
same name as the code file, with the extension ODF and ABS, respectively. Hence, it is not
necessary to specify both files in the Image Builder command file; it is sufficient to use the
filename without extension, the Image Builder will add them itself.
More about add-on library build files can be found in Chapter 4.2.2 "Image Builder Command
File" on page 4-19 and about option definitions files in Chapter 4.3.2 "Option Definition File
Syntax" on page 4-21.
Syntax:
LOADER32.EXE <port> <options> <imagefile>
<port> Meaning
-p1 Use COM port 1
-p2 Use COM port 2
<options> Meaning
-d Display debug messages (logging communication)
-l Delete Library (availability depends on target version)
<imagefile> Meaning
name Load image file given by name
It is also possible to call this executable with out parameters. If an image file is present in
current working directory, this will be taken automatically.
In addition, the program searches for the first free communication port and takes this one as
default.
The Image Loader takes the loadable image created by the Image Builder and transmits its
contents to the CPU, where it is stored in the system Flash PROM.
Figure 2-1 shows how the memory map looks like after loading.
Free Memory
Code of Option 2
Code of Option 1
System Software
MainTable.FirstFree
0x200006 (_MainTable)
2.3 Templates
To reduce possible mistakes in advance, template files have been added to the extension disk.
PC element skeletons can be taken to create a new C or Assembler module.
The example files also may serve as templates.
3.1 Hardware
When talking about required hardware, we must have in mind that it must fulfill the
requirements of several software products:
System software cross development environment,
AMPL Control Configuration, runs on Advant Station 100 Series Engineering Station,
Advant Controller 100 Series System Software.
The latter one requires a special hardwarethe Processor Module (PM810, PM63x, PM64x).
The two first issues require a PC with Windows NT 4.0 operating system. Minimum hardware
requirement is:
Intel Pentium 90 MHz or equivalent
32 MB memory
100 MB free disk space
V.24 serial interface
3.2 Software
NOTE
This descriptions in this document refer to the versions specified above. Using
lower versions is not recommended since they may show different behavior and
functionality.
NOTE
The programs listed below are not part of the System Software Extension
Diskette; you must purchase them separately.
4.1 Introduction
To get familiar with the option building process, a little bit of theory may make understanding
options easier.
Options are represented differently on Advant Controller and on AS 100ES, or more precise:
AMPL Control Configuration (ACC).
In APML Control configuration we use target description files (*.TED) to describe each
Advant Controller. A TED-file contains one or more options represented by PC element
descriptions (*.PED) and/or DB element descriptions (*.DED).
On Advant Controller an add-on option is represented by the loadable image file
(*.IMG) the option library which itself is built out of one or more option files
(*.ODF).
As we do not have DB elements in our scope, everything melts down to describing and
implementing PC elements. They are more or less shaping the options. PC elements must be
identically described on both sides, Function Chart Builder and Advant Controller, but they are
implemented and running on the Processor Module.
the PC element. Those properties include, among other things, the PC elements type code. For
more information, see Section 4.3.2, Option Definition File Syntax.
This file is then combined with the translated source code to form a so-called loadable image.
The loadable image may then be loaded to Advant Controller 100 Series with the LOADER32
program.
Library 1
Option 1
Option 2
Option 3
Library 2
Option 1
Option 2
The entire collection of files involved in the option building process is shown in following
figure:
Other Other
Ref Ref
Source Heade .ABS .ODF .BLD- .ODF- .ABS-
File(s) r File File File(s) File(s)
File
Compiling
Image
Builder
Object
File(s) .IMG-
File
Linker
Com- Image
mand Loader
Target
Each option is represented by one or more C-source and header files. They are compiled and
linked together to one absolute output file (*.ABS). Several options (ABS-files) are bound
together by the Image Builder, which additionally requires one option definition file (*.ODF)
per option and a library building file (*.BLD).
The image file (*.IMG) as a result of the Image Builder then may be loaded to the target, using
the option Image Loader.
4.2.1 Structure
An add-on library contains one or more options. An option is represented by the definition and
code of one PC element.
System Software
Library 1 Header
Option 1
Interface Library
Option 2
Interface Library
Library 2
NOTE
To save FPROM memory, its wise to embrace as much options as possible with
one library. The library header information then only will be allocated once.
TARGET
Specifies the target, for which the library has been built, e.g. AC 110. The Image Loader
performs a check against the target and denies download if this string does not match the string
delivered by connected target.
LIBNAME
This string specifies the librarys name. It is the string that later on will be displayed on AS
100ES as option available on target.
LIBVERSION
This string specifies the librarys version. It also is displayed on AS 100ES. AS 100ES performs
a version check of the PC element librarys version (TED-file) and denies the download of the
application in case of differences.
BIND
This string specifies the add-on options that shall be bound to this library; thus, several
instances of this command are possible.
The Image Builder assumes that a pair of option files with a prefix that is specified as %BIND
value and suffix .ODF and .ABS are available in current working directory.
If, for instance, the value of %BIND is POWER, the Image Builder assumes following files in
the current working directory:
POWER.ODF (option definition file)
POWER.ABS (linker output of object code)
The %BIND commands must be the last commands in file.
COMMENT
This entry gives the possibility to add comments to the file.
Example
The following Figure 4-4 shows the structure of an Image Builder command file:
%TARGET: AC 110
%LIBNAME: POWER
%LIBVERSION: 1.0/2
%BIND: POWER
%COMMENT: Example of Image Builder Command File
Once the system software has been erased, an initialization of the PM automatically makes a
reload of the entire system software necessary. As long as the FPROM has not been cleared, a
reboot just requires a new option installation.
4.3.1 Structure
Options contain the executable code that is called by the function block (FB) interpreter if it is a
PC element option. The FB interpreter is part of the system software.
The physical structure of an option is illustrated by following figure:
Option 1 Header
Code
Interface Library
Option 2
NAME
This is the name of the option. Although it is not reported to the PC element user, its definition
is mandatory for documentation purposes.
VERSION
This is the version of the option. For documentation purposes, this entry must be set.
TYPE
This specifies the type of the option. Currently, the only valid entry is PC-ELEMENT.
TYPCODE
This is the type code the option shall use. Valid type codes are from 0x400 up to 0x500
(exclusively) in 4 byte increments. The type code must be used for one option exclusively.
RAMSIZE
This entry specifies the size of RAM that is needed in addition to historical data (see Chapter
4.3.6.4 "Historical Data" on page 4-31). The RAM specified in 16-byte pages is reserved
during systems start-up and taken from system RAM resources.
COMMENT
This entry gives the possibility to add comments to the file.
Example
The following Figure 4-6 shows the contents of the option definition file:
%NAME: MODBMON
%VERSION: 1.0/0
%TYPE: PC-ELEMENT
%TYPCODE: 0x404
%RAMSIZE: 0x20
%COMMENT: Example of option definition file
Syntax:
MCC68K <source file> -I<include file directory> -upd -Mcp -nOc -c -A
The -upd, -Mcp, -nOc and -c options are mandatory, the others are recommendations. If
optimization is required, the respective options may be set freely.
NOTE
Due to possible changes in the header files, all source files must be re-compiled
for usage on new versions of Advant Controller 100 Series.
NOTE
An option must not exceed the size of 64 kByte. Each option contains the
Interface Library, from which mathematical or system functions are called. The
distance for jumps to functions has this maximum value.
Necessary Commands:
To generate a Motorola S-record file using the Microtec Linker, the linker command file must
contain the following lines:
Syntax:
LNK68K -c <command file name> -o<output file> -M
NOTE
It is mandatory to load the Interface Library (see also Chapter 4.3.9) with each
option using the LOAD command. Due to possible changes in the library, all
options must be re-linked for usage on new versions of Advant Controller 100
Series.
Option 1 Header
Additional Information
Option 2
Important values that define a PC element option are described in following chapters.
Special Function
This is used to initialize internal variables. It is only executed once, when the PC Element is
called the first time. For instance, it should initialize the local data area.
A typical usage is the initialization of outputs and the local data area.
Add-On option developers must name it PCspecial.
Normal Function
This is the routine which actually does the work of the PC element.
Specify here the normal behavior of the PC Element, for instance the add operation of an adder
PC element.
Add-On option developers must name it PCnormal.
The structure ObjectCode defines how the object code for the PC element looks like. Its
structure is described later in this chapter.
The structure LocalData defines how the local data for the PC element looks like.
Please note, that both pointers objCodeP and localDataP, respectively, may not be changed
during execution of the PC element.
Two parameters *objCodeP and *localDataP, respectively, are given to both routines.
objCodeP points to the object code of the PC element. It is used to access the offsets to the
input/output areas, to the optional call and function parameters and to the also optional local
data area offset.
localDataP points to the PC programs local data area which contains the input/output data and
-optionally-storage for values which must be retained until the next activation of the PC
program. Its actual size, which may depend on the parameters specified by the user, is planned
by AS 100 Series ES during target code generation.
The input values of the PC element are placed in the local data area before the execution of any
PC elements of the application program. Similarly, the output values are stored in the local data
area, too. After execution of all PC elements in an application program, they will be transferred
to I/O modules or other PC programs via the common data area.
The local data area is used for permanent storage of data; this means, the data will be available
again at the next call of that PC element. Several PC elements of the same type will each have
their own local data area.
The memory layout of the local data area is defined with the structure LocalData in the
template.
Access to the local data area is done using the offsets to the respective items which are located
in the object code. Those offsets are added to *localDataP; the resulting pointer is used to
access the value itself.
Please note that the offsets are specified as BYTE distances from *localDataP: casting may by
necessary to obtain the correct data pointer with an add operation.
#include "STANDARD.H"
#include "OSC_IL.H"
/*
* definition of the PC elements object code
*/
typedef struct {
<type> <name>; /* define the elements of the local data area here */
<type> <name>;
....
} LocalData;
typedef struct {
WORD Typcode; /* Type code for the PC element */
WORD Size; /* size of the object code structure (bytes) */
WORD Cp; /* Call parameter(s) */
WORD Fp; /* Function parameter(s) */
/* ... further entries ... */
WORD histdatOffs; /* local data area (optional) */
/* this is relative to to localDataP */
WORD inputOffs; /* PC element input(s) */
WORD outputOffs; /* PC element output(s) */
/* ... further entries ... */
} ObjectCode;
/*
/*************************** PC Elements SPECIAL routine *********************************
*/
void PCspecial (const ObjectCode *objCodeP, WORD * const localDataP) {
/* ...optional special mode code goes here...*/
}
/*
*************************** PC Elements NORMAL routine **********************************
*/
void PCnormal (const ObjectCode *objCodeP, WORD * const localDataP) {
/* ...normal mode code goes here... */
}
CAUTION
Both pointers must not be changed; the FB interpreter increments them before
passing them to the next element.
NOTE
Historical data can be used to reduce system load during normal execution: if
inputs are not changing, output results - previously stored as historical data - may
be written directly to output pins without calculating them again.
Also seldom changing values and constants should be stored in historical data
area for fast access.
CAUTION
Both pointers must not be changed; the FB interpreter increments them before
passing them to the next element.
Type Code
Size (in bytes)
Call Parameters
(if present)
Function Parameters
(if present)
16 bit
Only Type Code and Size are mandatory, all other fields are optional. However, their sequence is
important and may not be altered.
The object code structure delivers values given by the application and offsets to in- or outputs in
local data area, all aligned to WORD (16-bit) boundaries.
Call parameters and Function parameters are always BYTE values. Because of M68000s
addressing mechanism, it is not allowed to have an odd number here. Hence, if a PC element
requires an odd number of these parameters, they must be filled to an even number using a
dummy byte.
When the PC element has to maintain static values (as opposed to temporary values which are
valid only during runtime of the PC element), the offset to historical values will point into the
local data area for that PC element.
Accessing I/O is done via the offsets to terminals. Those point to those locations in the local
data area which are copied to and from by Advant Controllers I/O software.
In the C-language, the structure is to be defined as follows:
#include "STANDARD.H"
typedef struct
{
WORD typeCode;/* Type code for the PC element */
WORD size;/* Size of the object code structure (bytes)*/
BYTE cp1; /* Call parameter(s), if present*/
/* ... further cp entries or dummy ... */
} MyObjectCode;
The real content of the object code structure depends on the definition in the corresponding
PED-fileAS 100ES generates data structure and offsets accordingly.
Thereby, typeCode and size are mandatory - all other entries are user defined.
Except for typeCode, size, fp and cp, all values are 16-bit offsets into the local data area
of the PC element, regardless the data type specified in PED-file.
CAUTION
Since call (cp) and function (fp) parameter values have byte size, the developer
MUST align them to even sizes. That means, that if only one call parameter is
used, another onea dummymust be inserted into the structure. The same
applies to function parameters.
TypeCode
The most important figure for an option is the type code that also is used for built-in PC
elements.
The type code specifies the place within a FB jump table, which serves as an input for the FB
interpreter. At the concerned entry, the interpreter finds the code start addresses for normal and
special functions (see chapters below). Since code addresses have a 4-byte size, only type codes
are allowed, which can be divided by 4 (0x400, 0x404, etc.).
Therefor, it is extremely important to use type codes, which are not occupied by basic PC
elements. For add-on options, generally the range between 0x400 and 0x4FC is reserved.
The type code, chosen for the PC element, must also be inserted into the PED-file.
Size
AS 100ES calculates the size of the object code and inserts it at that location. Normally, it is
used only by the FB interpreter.
Call Parameters
Call parameters are variables for PC elements, defined during their creation.
They often determine the layout of the PC element: the number of its input and output values.
The PC element functions must check those values during in- or output initialization to avoid
accesses into data areas not related to this PC element.
Call parameters cannot be changed on-line.
Function Parameters
Function parameters are inputs that cannot be connected to outputs of other elements or
PCPGM I/O. This means, that the developer has to check for changes of those values only in the
special function of the PC element.
The size of historical data affects the memory consumption of the PM if the application is
loaded; each PC element has its own area. Thus, the structure of it is to be defined by the PC
element developer.
The run-time system handles historical data areas in following cases:
it initializes the data area during a new application download;
it copies the data area during on-line changes, so values are kept.
The calculation of the pointer to historical data is:
WORD myValue;
myValue = *(WORD *)(localDataP + objectCodeP->inputOffs);
Register Usage
A0 Pointer to object code
A1 Base pointer to local data area
A2 Base pointer to function block table, the jump tables
NORTA and SPETA
A5 Reserved for internal use
A7 Stack pointer
D7 Execution mode (normal, special)
CAUTION
Due to possible changes in function prototypes and library contents, all PC
element sources (C- and ASM-files) must be re-compiled and linked for new
versions of a system software.
The global table MainTable contains a pointer to the first unused flash PROM location. The
Option Installer first writes a library control block to this location, containing a pointer to the
end of the new code, and data identifying the library. After that, the options themselves
including their add-on control blocks are written.
To generate a Motorola S-record file usable for the Image Builder, with the public symbols and
their addresses included, the linker command file must contain the following lines:
CHIP 68000
LISTABS PUBLICS
FORMAT S
BASE 0
EXTERN FUNCTION00,FUNCTION01
LISTMAP publics,internals,crossref
LOAD AC100IL.LIB
LOAD MCC68KPC.LIB
END
CAUTION
The type codes and object code structures defined in this file must exactly match
those in corresponding option definition files.
NOTE
For targets supporting application backtranslate functionality, it is absolutely
necessary that the file name prefix does not exceed a length of more than 7
characters. Otherwise, the option will not be correctly supported.
Insert the option distribution diskette into the your PC and use Windows NT Explorer to browse
to the diskette drive. Now load the option to the Processor Module by double-clicking the
<option>.BAT file. The loader pops up and the loading process starts automatically.
NOTE
You may need to select the correct serial interface (COM1, COM2, ) on your
PC before loading.
5.1 Introduction
This chapter describes the system calls which are available for developers who want to develop
an add-on option for Advant Controller 100 Series. The name, the C prototype definition are
listed as well as call parameters and possible restrictions. If necessary, an in-depth description of
the procedures function is added.
Name Description
struct ObNa Defines the name of a memory object as
{ it is used by the memory management.
char type;
char scope;
WORD version;
};
union ObjectNameUnion Union for easier access to memory
{ objects.
DWORD ObjectName;
struct ObNaSplitName;
};
struct date_struc Date representation.
{
short year;
short month;
short day;
};
struct time_struc Time representation.
{
short hour;
short minute;
short second;
short fraction;
};
MASTER time 32 bit unsigned Time representation: 100 micro second units elapsed
since start of the day: 0 to 8639999
16 bit
The contents of the 16 bit are 0xFF00 for TRUE and 0x00FF for FALSE. Any other value is
considered invalid. Symbols are provided for use by the programmer; they are named PCTRUE
and PCFALSE, respectively.
Floating point data is according to the IEEE representation.
Group Functions
Arithmetic functions abs, acos, asin, atan, atan2, atof,
atoi, atol, cabs, ceil, cos, cosh,
exp, fabs, floor, frexp, frexp10,
hypot, labs, ldexp, ldexp10, log,
log10, max, min, modf, pow, sign, sin,
sinh, sqrt, square, tan, tanh
String functions strcat, strncat, strcpy, strncpy,
strchr, strrchr, strpbrk, strcmp,
strncmp, index, rindex, strspn,
strcspn, strlen, lower, reverse,
upper
Character classification functions isalnum, isalpha, isascii, isblank,
iscntrl, isdigit, isgraph, islower,
isodigit, isprint, ispunct, isspace,
isupper, isxdigit
Character conversion functions toascii, toint, tolower, toupper
Byte string manipulation functions bcmp, bcopy, bfill, brev, bzero, ffs,
swab
5.5.1 Overview
This chapter describes the system software function calls, which are offered by the Interface
Library ACxxxIL.LIB (xxx = controller type). For the usage of any function, the statement
#include ACxxxIL.H
must be inserted into C-source modules.
Table 5-6 lists all system calls grouped according to their function.
Name Description
Option Handling
Membase Delivers the options memory base.
StartReason Delivers the reason why the install routine was called.
OptionInstalled Checks wether a Build-In option is activated.
Memory Management
OS_obj_base Get the address of a memory object.
OS_obj_rdy Set memory object to status complete.
OS_obj_size Returns the size of a memory object.
OS_obj_status Get the status of a memory object.
OS_obj_termin Terminates the access to a domain and decrements its in-use counter.
GetIOAddress Fetch the communication memory address of the specified signal from COIA.
TracTrap(1) gets redundancy partner information.
Hardware Access
HW_SetLed Switches an LED on the front panel of a Processor Module on or off.
HW_SetRelay Pick-up or release the built-in relay.
HW_SetOSP Handles the Output to Safe Position signal towards the I/O modules.
HW_rdmodsw Read the position of the start mode switch.
HW_rdtimdat Read time and date from real time clock.
HW_display Shows a string on the display of the Processor Module (consisting of two 7-
segment display units).
ReadLong Read a value from an I/O module.
WriteLong Write a value to an I/O module.
Miscellaneous
gtime_fine Get the system tick count.
getCycletime Get the cycle time of the current task in units of 100 s.
fci4dat Convert date from internal to external representation.
fci4tim Convert time from internal to external representation.
(1) Advant Controller 160 only.
5.5.2 Membase
Abstract
Delivers the options memory base.
Prototype
void *Membase(void);
Input
None.
Output
Pointer to the reserved memory.
Modified Variables
None.
Description
Restrictions
None.
5.5.3 StartReason
Abstract
Delivers the reason why the install routine was called.
Prototype
int StartReason(void);
Input
None.
Output
The reason for the start:
COLD_START Power up or reset, switch in position CLEAR
WARM_START Power up or reset, switch in position AUTO
NOT_AVAILABLE System is running normally
Modified Variables
None.
Description
This call delivers the start reason for the initialization routine.
Restrictions
None.
5.5.4 OptionInstalled
Abstract
Checks wether a Build-In option is activated.
Prototype
int OptionInstalled(short oid);
Input
oid The options ID number.
Output
TRUE Option installed
FALSE Option not installed
Modified Variables
None.
Description
Restrictions
5.5.5 OS_obj_base
Abstract
Get the address of a memory object.
Prototype
void *OS_obj_base(union ObjectNameUnion objnam);
Input
objnam Name of object.
Output
The function returns the objects base address or NULL if it does not exist.
Modified Variables
None.
Description
Besides delivering the base address of a memory object, this call locks that object for the
use of the calling task only. That means no other task may legally access the object while it
is locked. After accessing the object, it must be released for the use of other tasks by
calling OS_obj_termin.
Restrictions
Failing to release a domain with OS_obj_termin will result in erratic system behavior.
5.5.6 OS_obj_rdy
Abstract
Set memory object to status complete.
Prototype
void *OS_obj_rdy(union ObjectNameUnion objnam, int *status);
Input
objnam Name of object.
Output
status Status
RET_OK Object exists and was incomplete
PBJ_COMPLETE Object exists and is complete
OBJ_NOTEXISTS Object does not exist
OBJ_ILLNAME Object name not allowed
Modified Variables
None.
Description
Set an object of the memory management to status complete.
Restrictions
None.
5.5.7 OS_obj_size
Abstract
Returns the size of a memory object.
Prototype
WORD OS_obj_size(DWORD name);
Input
name Name of object.
Output
The function returns the size in bytes of the object or NULL if it does not exist.
Modified Variables
None.
Description
Restrictions
None.
5.5.8 OS_obj_status
Abstract
Get the status of a memory object.
Prototype
WORD OS_obj_status(union ObjectNameUnion name, int *status);
Input
name Name of object.
Output
The function returns the objects version if it exists:
active or alternative if explicit version is requested
explicit version if active or alternative version is requested
NULL if object does not exist.
Status contains the following return code:
OBJ_UNDELETABLE Object is in use
OBJ_COMPLETE Object exists and is complete
OBL_INCOMPL Object exists but incomplete
OBJ_NOTEXISTS Object does not exist
OBJ_ILLNAME Object name not allowed
Modified Variables
None.
Description
If the memory object with the given name exists and is complete, its version is returned.
Restrictions
None.
5.5.9 OS_obj_termin
Abstract
Terminates the access to a domain and decrements its in-use counter.
Prototype
void OS_obj_termin(union ObjectNameUnion id);
Input
id Object identification.
Output
None.
Modified Variables
None.
Description
Restrictions
None.
5.5.10 GetIOAddress
Abstract
Fetch the communication memory address of the specified signal from COIA
Prototype
DWORD GetIOAddress (Module_SixStruct adSIX,
BYTE objectType,
WORD addressBlockOrdinalNo,
WORD addressNo);
Input
stationAndPosition,
object type,
addressBlockOrdinalNo = real or pseudo instance number
addressNo = ordinal number within the addressBlock,
Output
ioAddress, if (ioAddress == InvalidAddress) then an error occurred
Modified Variables
None.
Description
Restrictions
None.
5.5.11 TracTrap
Abstract
For ABB internal use only.
5.5.12 HW_SetLed
Abstract
Switches a LED on the front panel of a Processor Module on or off.
Prototype
void HW_SetLed(int led, int state);
Input
led Denotes the LED to be switched on/off:
Fled = Fault-LED
RunLed = Run-LED
BatteryLed = Battery-LED
state On or Off.
Output
None.
Modified Variables
None.
Description
Restrictions
None.
5.5.13 HW_SetRelay
Abstract
Pick-up or release the built-in relay.
Prototype
void HW_SetRelay(int state);
Input
state On or Off.
Output
None.
Modified Variables
None.
Description
Restrictions
None.
5.5.14 HW_SetOSP
Abstract
Handles the Output to Safe Position signal towards the I/O modules.
Prototype
void HW_SetOSP(int state);
Input
state On or Off.
Output
None.
Modified Variables
None.
Description
Setting the OSP signal to On causes all I/O modules in all connected racks to switch
their outputs to safe position. This is usuallybut not necessarily0 for both digital
and analog outputs.
Restrictions
None.
5.5.15 HW_rdmodsw
Abstract
Read the position of the start mode switch.
Prototype
BYTE HW_rdmodsw(void);
Input
None.
Output
The function returns the position of the start mode switch encoded as follows:
STOP = 1
COLD = 2
WARM = 3
UNDEF = -1
Modified Variables
None.
Description
Restrictions
None.
5.5.16 HW_rdtimdat
Abstract
Read time and date from real time clock.
Prototype
long HW_rdtimdat(long *ldate);
Input
*ldate Address where to store the current date.
Output
Time in internal representation
Date in internal representation.
Modified Variables
None.
Description
Restrictions
None.
5.5.17 HW_display
Abstract
Shows a string on the display of the Processor Module (consisting of two 7-segment
display units).
Prototype
void HW_display(char *string);
Input
string A two-character string.
Output
None.
Modified Variables
None.
Description
The following characters may be displayed:
+, , 09, AZ.
Restrictions
Due to the limited display capabilities of the 7-segment display, some of the characters
cannot be displayed correctly.
5.5.18 ReadLong
Abstract
Read a value from an I/O module.
Prototype
DWORD ReadLong(DWORD addr, WORD *status);
Input
addr Address to read the value from
status Address where the status information for that call is stored:
FALSE No error occurred
TRUE The value could not be read.
Output
The 32-bit value taken from the I/O module.
Modified Variables
None.
Description
This call handles a read access to the BIOB (the back plane I/O bus). Bus errors during the
access are handled properly and the status information is set accordingly. Bus errors may
occur because either the module is not inserted (spare), or not configured correctly.
Restrictions
None.
5.5.19 WriteLong
Abstract
Write a value to an I/O module.
Prototype
void WriteLong(DWORD addr, DWORD data, WORD *status);
Input
addr Address to read the value from
data The value to be written
status Address where the status information for that call is stored:
FALSE No error occurred
TRUE The value could not be read.
Output
None.
Modified Variables
None.
Description
This call handles a write access to the BIOB (the back plane I/O bus). The status reflects
the state of the previous BIOB access. Bus errors occur because either the module is not
inserted (spare), or not configured correctly.
Restrictions
None.
5.5.20 gtime_fine
Abstract
Get the system tick count.
Prototype
DWORD gtime_fine(void);
Input
None.
Output
The 32-bit current system tick value.
Modified Variables
None.
Description
The delivered count represents the system tick with a resolution of 100 s.
Restrictions
None.
5.5.21 getCycletime
Abstract
Get the cycle time of the current task in units of 100 s.
Prototype
DWORD getCycletime(void);
Input
None.
Output
The cycle time of the current task as 32-bit value.
Modified Variables
None.
Description
Restrictions
None.
5.5.22 fci4dat
Abstract
Convert date from internal to external representation.
Prototype
void fci4dat(long date, short extDate[3], *status);
Input
date Date in internal format to be converted
extDate Address where to put the date converted to external format.
Output
extDate List of three 16-bit values: year / month / day.
status Status of conversion:
FALSE Successful
TRUE Input out of range.
Modified Variables
None.
Description
Restrictions
None.
5.5.23 fci4tim
Abstract
Convert time from internal to external representation.
Prototype
void fci4tim(long time, short extTimee[4], *status);
Input
time Time in internal format to be converted
extTime Address where to put the time converted to external format.
Output
extTime List of four 16-bit values: hour / minute / second / fraction.
status Status of conversion:
FALSE Successful
TRUE Input out of range.
Modified Variables
None.
Description
The fraction is given in units of 100 s.
Restrictions
None.
Value for TYPCODE is out of range (400h >= TYPCODE < 500h).
Error: The value specified for %TYPCODE entry in option definition file must match the range
between 0x400 and 0x500 (exclusively).
A.1 Introduction
This chapter describes briefly how the sample option POWER with a single PC element
POWER looks like, and how this option is distributed to AMPL Control Configuration (ACC)
and Advant Controller 110 2.2. We assume that the image file for Advant Controller 110 2.2
exists and has been created as explained in Chapter 4, and focus on the description files for
ACC.
A.2 Layout
The PC element POWER in our example shall have the layout shown below:
POWER
1 VALUE RESULT 2
ERR 3
file name is POWER.PED. The following figure shows the content of the complete file with
brief remarks.
LIBTYPE := "3";
LIBNAME := "POWER";
LIBVERSION := "1.0/0";
PUTGETPLANNINGTYPE := normal;
pc_element POWER
TYPCODE := H0404;
NOBYTESHISTORIC := 10;
COMPUTINGTIME := 400;
NONEXECUTABLE
4 FUNCM BLOCK CONTRM SLAVEM STEP;
LEVEL 1 "POWER";
terminal 1 name "VALUE" type IN I OFFSET := 6;
terminal 2 name "RESULT" type OUT I OFFSET := 8;
terminal 3 name "ERR" type OUT B OFFSET := 10;
end POWER;
pc_element XYZ
(* more definitions *)
end XYZ;
Entries with arrows are to be defined or modified by the developer; other entries are fixed for
Advant Controller 100 Series.
LIBTYPE
For Advant Controller 100 Series, this is always 3.
LIBNAME / LIBVERSION
This library strings are displayed in Application Builder (APB) as available or selected
option after set up of the add-on library.
Both strings must match those in the BLD-file for Image Builder. After loading the library to the
target, the strings are displayed in Report Options dialog.
PUTGETPLANNINGTYPE
For Advant Controller 100 Series, this is always normal.
TYPCODE
This value has to be the same as specified in ODF-file. It defines, which type code has to be
inserted when generating target code for this element.
NOBYTESHISTORIC
Defines the amount of bytes to reserve as historical data. The value must match the memory
requirements on the Controller.
COMPUTINGTIME
This entry allows inserting a value for the computing time of the PC element on target (in micro
seconds). Since this may vary in dependency of call parameters, formulas are allowed. The
value is used by AS 100ES to compute the system load of the application.
terminal <tVal> name <tString> type <dir> <data type> OFFSET := <offset>
This instruction defines the terminal; each terminal needs its own instruction.
<tVal>:
This value is the terminal number displayed in function chart view.
<tString>:
This string is the terminal name displayed in function chart view. Its size is limited to
8 characters.
<dir>:
This value defines the direction of data flow: I defines an input value, O an
output value;
<data type>:
This value specifies the data type of the terminal: B - Master BOOLEAN; I -
Integer (16 bit); IL - Integer Long (32 bit); R - Real Value; T - Time Value;
TR - Time Real.
<offset>:
This value specifies the offset of the terminal within the object code structure.
CAUTION
The PC element developer has to calculate all offsets by hand. Incorrect offsets
may destroy data of other PC elements. The object code structure members in C-
language PC element code must be located at exactly the same offsets.
The calculation in our example shall be explained by this table using two different PC
element layouts: our example POWER and another example with two call
parameters and one function parameter:
NOTE
All offset entries, e.g. to historical data or terminal values, have a size of 16 bit
(WORD). They are not related to the data type which the terminal is assigned to.
syntax 1.1;
add
option "POWER" version 3.0/0;
comment "PC element power";
supports
pc_element library power version 1.0/0 stored in power;
end_option;
NOTE
In this example, Advant Controller 110 version 2.2 is selected as target. You may
wish to adjust the TED-file to another target, e.g., Advant Controller 70 or
Advant Controller 160.
NOTE
You may need to select the correect serial interface (COM1, COM2, ) on your
PC before loading.
INDEX
Symbols Definitions, standard
.ABS-file FALSE 41
See Absolute File PCFALSE 41
.IMG-file PCTRUE 41
See Image File RET_OK 41
.OBJ-file TRUE 41
See Object File
.PED-file E
See PC Element Description File Extension Diskette
.TED-file example 12
See Target Element Description File template files 11, 32
EXTERN 24
A
ABS-file F
See Absolute File FALSE 41
Absolute File 9, 23 FORMAT 24
AC80IL.LIB FUNCTION00 23 to 24
See Interface Library FUNCTION01 23 to 24
Add-On Library Functions
building process 17 arithmetic 42
definition file byte string manipulation 42
See Image Builder Command File character classification 42
structure 17 Character conversion 42
Add-On Option string manipulation 42
alignment 23
PC Elements H
See PC Elements Hardware
size 24 required 13
ALIGNMOD 24 Historical Data 31, 73
Arithmetic functions 42
ASM68K 14 I
IBUILD32
B See Image Builder
BIND 19 Image Builder 8 to 9, 17 to 18, 20, 66, 72
Byte string manipulation functions 42 absolute input file 23
errors amd warnings 66
C syntax 9
Character classification functions 42 Image Builder Command File 19
Character conversion functions 42 BIND 19
CHIP 24 COMMENT 20
COMMENT 20, 22 LIBNAME 19
COMPUTINGTIME 73 LIBVERSION 19
syntax 19
D TARGET 19
Data Types Image File 9, 17
special 41 loading 20
Image Loader 9 P
loading an image file 20 PC Element Description File 35
syntax 9 COMPUTINGTIME 73
IMG-file LIBNAME 72
See Image File LIBTYPE 72
Interface Library 34 LIBVERSION 72
usage 34 NOBYTESHISTORIC 73
PUTGETPLANNINGTYPE 72
L TYPCODE 73
LIBNAME 19, 72 PC Elements 25
Library call parameters 31
interface library. See Interface Library coding 32 to 33
LIBTYPE 72 description file. See PC Element Description File
LIBVERSION 19, 72 function parameters 31
Linker Command File 24 historical data 31
ALIGNMOD 24 See Historical Data
CHIP 24 local data 32
EXTERN 24 normal function 28
FORMAT 24 object code structure 29
LISTABS 24 physical structure in memory 25
LOAD 24 special function 27
LISTABS 24 target element description file. See Target Element
LNK68K 14, 24 Description File
See also Linker Command File type code 31
LOAD 24 PCFALSE 41
LOADER32 PCnormal 29
See Image Loader PCspecial 28
PCTRUE 41
M PED-file
Manual 3 See PC Element Description File
MCC68K 14, 23 PUTGETPLANNINGTYPE 72
N R
NAME 22 RAMSIZE 22
NOBYTESHISTORIC 31, 73 Register Usage 33
Register Usage, processor 33
O RET_OK 41
Object File 23
OBJ-file S
See Object File SIM68K 14
Option Definition File 9 Software
COMMENT 22 by ABB Industrietechnik GmbH 13
NAME 22 Third Party 13
RAMSIZE 22 String manipulation functions 42
TYPCODE 22
TYPE 22 T
VERSION 22 TARGET 19
Target Element Description File 36
TED-file
V
VERSION 22