CMZ CAN Net (En SW nf0)
CMZ CAN Net (En SW nf0)
CAN network
management
Doc. MS269806
Ed. 01 - English - 26 June 1998
CAN management
WARNING
CMZ Sistemi Elettronici can modify or improve the products herein described at any time without prior notice.
This manual has been written by CMZ exclusively for its customers to provide them with the most updated
information on its products. Information in this document is subject to change and does not represent a commitment
on the part of the company.
Special attention is required when using the functions described to avoid any possible danger for workers, damages to
the machines or any consequential damage that may result from wrong installation or misuse of the equipment.
No further guarantees are given by CMZ in particular for imperfections, incomplete information and/or operative
difficulties.
SUMMARY
SUMMARY...................................................................................................................................3
AIM OF THE MANUAL..............................................................................................................4
INTRODUCTION.........................................................................................................................5
chapter 1. NETWORK TEST AND CONFIGURATION ............................................................6
1.1 NETWORK TEST................................................................................................................6
1.1.1 Other messages..............................................................................................................7
1.2 MAXIMUM CONFIGURATION OF THE NETWORK .......................................................8
chapter 2. CAN NETWORK MANAGEMENT IN FORTH .....................................................10
2.1 CAN CONFIGURATION IN FORTH.................................................................................10
2.2 FORTH MANAGEMENT OF THE DIGITAL I/O.............................................................12
2.2.1 Digital inputs management...........................................................................................12
2.2.2 Digital outputs management.........................................................................................13
2.2.3 Activation of the digital inputs/outputs management .....................................................16
2.3 FORTH MANAGEMENT OF THE ANALOG INPUTS .....................................................18
2.3.1 Analog inputs management with module PM8AIA ........................................................18
2.3.2 Analog inputs management with module PM4TIA ........................................................20
2.3.3 Analog inputs management with module PMACQA .....................................................24
2.4 FORTH MANAGEMENT OF THE ANALOG OUTPUTS .................................................24
2.4.1 Analog outputs management with free-standing module PM4ANA ...............................24
2.5 FORTH MANAGEMENT OF THE SPECIAL PERIPHERALS OF THE CAN NETWORK 29
2.5.1 PMVBRA management................................................................................................30
2.5.2 Management of the communication with terminals PMTERM ......................................35
2.6 MALFUNCTIONING FORTH MANAGEMENT ...............................................................36
2.6.1 Probable causes of node alarm ......................................................................................36
chapter 3. CAN NETWORK MANAGEMENT IN AWL .........................................................38
3.1 CAN CONFIGURATION IN AWL.....................................................................................38
3.2 EXAMPLE OF CAN CONFIGURATION IN AWL ............................................................44
3.3 AWL MANAGEMENT OF THE DIGITAL I/O.................................................................46
3.4 AWL MANAGEMENT OF THE ANALOG INPUTS .........................................................48
3.5 AWL MANAGEMENT OF THE ANALOG OUTPUTS .....................................................49
3.6 AWL ACCESS TO OTHER PARAMETERS OF THE NETWORK ...................................50
3.7 MALFUNCTIONING AWL MANAGEMENT ...................................................................52
3.7.1 Probable causes of node alarm
......................................................................................52
3.8 AWL MANAGEMENT OF PERIPHERALS CONFIGURATION CHANGES ...................53
chapter 4. CAN MANAGEMENT SOFTWARE COMPILATION ..........................................56
4.1 INSTALLATION WITH MAKEPRJ
...................................................................................56
4.2 INSTALLATION WITHOUT MAKEPRJ ...........................................................................58
appendix A. PRIMITIVES OF THE COMMANDS
..................................................................59
appendix B. PROGRAM FOR THE COMPLETE TEST OF THE NETWORK
....................61
BIBLIOGRAPHY........................................................................................................................62
This manual supplies general information about software management of the CAN (Control Area
Network), employed in some of the systems projected by CMZ.
Particularly the manual is divided in three sections:
2. Configuration and management of the CAN network for applications written in Forth.
3. Configuration and management of the CAN network for applications written in AWL.
The software for the management of the CAN network is not present in the basic vocabulary of all
the CMZ systems and thus must be compiled. The chapter 4 gives directions for the compilation of
the software package “CAN NETWORK” (see also [6]).
INTRODUCTION
The CAN network projected by CMZ is a field network which allows to manage digital and/or
analog I/O directly in the field by connecting some nodes, so-called PCCDIN nodes, connected
among themselves and with the controller (master node) by mean of a cable with 3 or 4 conductors
(CAN_L, CAN_H, CAN_GND and/or CAN_SHLD).
For more detailed information on the network hardware features, see the hardware manuals of the
single systems and hardware manual of the network [1].
For each system there can be connected several nodes, in particular, the maximum capacity of the
network in terms of number of nodes is reported in the following table:
To each node can be connected one or more of functional modules used for management of signals
towards or from the field. The number of functional modules that can be connected to the same node
is limited by the management capacity of the node itself which is 64 bits for data reading and 64
bits for data writingand anywaycan not exceed 8 modules per node .
The currently managed modules and the number of bits of information which each of them is using is
reported in the following table. For each module the number of bits of information in write mode
(output) is indicated with wdw (Write Data Word), whereas the number of bits of information in
read mode (input) is indicated withrdw (Read Data Word).
This chapter provides the necessary information for testing and configuring the CMZ CAN network.
The nodes PCCDIN provided in the network have to be numbered from 1 to 32 using the dip-
switches present on the board (see [1]). Obviously it is necessary to remember about the limitations
on number of nodes for each system described in the introduction. The nodes are numbered as
follows:
Besides the hardware configuration, also a software configuration of the network is necessary.
The program TST_CAN, which is present in the basic firmware of the system or can be compiled as
additional package (see [6]), allows to verify the functioning of the network, its configuration and
the maximum reachable limit of transmission speed.
It is necessary to specify that this program can be used only in phase of test and that the
configuration of the network in application program, must be realised using the tools described in the
chapter 2 or in the chapter 3, respectively for application programs written in Forth and AWL.
After connecting the master (controller) and different network nodes and the different modules
within the nodes, it is possible to feed the network and the system. From Forth ambient, typing the
command TST_CAN on the PC monitor should appear the following page:
The upper part of the page shows the max. number of nodes that can be connected to that system,
(in the page there are 12 nodes which can be connected to the CTN560) and gives prominence to the
nodes shown in details in the lower part (in this page, the nodes 1,2 and 3).
The lower part shows in details some nodes (in groups of 3): the number of the node, its scanning
time (expressed in msec), the state of the node (active or inactive) and the type of peripherals
connected to the node.
If communication is non active at the centre of the screen will appear the message:
The program recognises the nodes present in the network and the modules connected to each node
(for example the drawing shows only node 1 to which no module is connected). The presence of
communication between the system and the different nodes is identified also by the active
communication LED (Data Flow LED) present on the nodes.
With the function key F2 it is possible to confirm the configuration of the network even if the
configuration has to be done later within the final application program like it is described in the
following chapters.
The keys PGUP and PGDN allow to increment and decrement the communication speed within the
range of the minimum value 10 KHz and the maximum value 1 MHz with 9 different steps.
The keys CTRL+PGUP and CTRL+PGDN allow to visualise the 3 nodes, previous or next to those
selected currently.
The program TST_CAN allows thus to verify the functioning of the network and moreover to
change the communication speed, by evaluating the maximum reachable limit. It will be sufficient to
verify up to which speed the communication stays active with all the nodes. If even one of the nodes
is not able to communicate any more, this means that the limit has been overcame and it is necessary
to select a lower speed. Obviously the maximum speed limit is influenced by the distance between the
master (control system) and the different nodes and also by the quality of the connections.
Besides the message“NETWORK SOFTWARE NOT RUNNING !“there may appear other messages:
3. "CONFIGURATION LOADING"
It informs the user that the configuration is being loaded
4. "CHANGING FREQUENCY"
Informs the user that the speed is changing.
As mentioned in the introduction, for each system, the CAN network can manage a limited number
N of nodes PCCDIN, which in their turn can manage at most M=8 peripheral modules. The number
of modules which can be managed by a single node is mainly limited by the fact that there is a
maximum number of bits (64) of information managed in write mode (wdw) as well as in read mode
(rdw).
The table proposed in the introduction (and repeated here for convenience) shows the number of bits
used in write and read mode for each type of peripheral module.
1. The sum of the wdws of each module connected to the node must not exceed 64.
2. The sum of the rdws of each module connected to the node must not exceed 64.
3. The number of modules connected to the node has to be at most 8.
Examples:
This chapter is addressed to the programmers, who are going to manage the CAN network with
application programs written in Forth. For a better understanding of this chapter, the user is advised
to consult also the manual [2].
The users of AWL language can go directly to the next chapter.
The program TST_CAN should be used for the final test of the network and for the determination of
the maximum communication speed, but, after the tests are finished, the network should be
configured in the application program as well.
In the application program written in Forth must be specified: the network speed; the structure of
each node, indicating the number of inputs banks (byte_in) and of outputs banks (byte_out)
associated to each module connected to it; scanning time; node address.
The following Forth words are available:
NODO_CAN
Syntax: byte_out byte_in ... ... ... ... mod time node ---
Fields:
• byte_out byte_in: couples of numbers which indicate respectively the banks of output and the
banks of input of each single node. It has to be specified a couple of values for each module
connected to the node. For those modules where input or output bank have no sense, it must be
passed anyway the value 0. For the maximum number of managed banks see the paragraph
1.2.
IMPORTANT
The scanning time of a node is always a multiple of 5 milliseconds, and the passed values are
automatically approximated to the upper multiple of 5.
The minimum scanning time of a node is 5 milliseconds.
Examples.
Example 1
Let 2 modules PM8IOA (8 inputs + 8 outputs) be connected to the node number 1. To associate the input bank 0
(inputs 0÷7) and the output bank 0 (outputs 0÷7) to the I/O of the first module, and the input bank 1 (inputs 8÷15) and
the output bank 1 (outputs 8÷15) to the second module, with scanning time 15 msec., it is necessary to write:
0 0 1 1 2 15 1 NODO_CAN
N° bank outputs 2° module PM8IOA
N° bank inputs 2° module PM8IOA N° modules connected to the node
Example 2
Let 3 modules PM8IOA (8 inputs + 8 outputs) and 1 module PM8AIA (8 analog inputs, 12 bits) be connected to the
node number 4. To associate:
- the input bank 2 (inputs 16÷23) and the output bank 2 (outputs 16÷23) to the I/O of the first module PM8IOA
- the input bank 3 (inputs 24÷31) and the output bank 3 (outputs 24÷31) to the I/O of the second module PM8IOA
- the input bank 7 (inputs 56÷63) and the output bank 7 (outputs 56÷63) to the I/O of the third module PM8IOA
- the input bank 0 (inputs 0÷7) to the module PM8AIA (the number of the output bank of the module PM8AIA has no
meaning and thus is set to zero)
it is necessary to write:
N° bank outputs for 5° module PM8IOA
N° bank inputs for 5° module PM8IOA
2 2 3 3 0 0 7 7 4 15 4 NODO_CAN
N° bank outputs for 4° module PM8OIA Number of the node
VEL_CAN
The following table reports the correspondence between code and speed in KHz.
Speed codes
Baud Rate [KHz] Speed code
10 0
25 1
50 2
100 3
125 4
250 5
500 6
800 7
1000 8
GO_CAN
It enables the communication within the CAN network. It returns an error flag (0 if the network was
activated correctly, 1 if an error occurred).
Syntax: --- fl
Fields: fl: error flag
IMPORTANT
The command GO_CAN must be called only once each time the system is started, within the TASK
word, or in order to re-activate the network after it was disactivated with the command STP_CAN.
STP_CAN
Syntax: ---
Fields:
This paragraph describes the Forth commands for the management of digital inputs and outputs
(modules PM8IOA, PM8INA, PM8POA, PM8ROA, PM8ROB) of the network.
INPC
It allows to test the state of the inputn; it returns the state of the input.
Syntax: n --- fl
Fields: n: number of input to test
fl: input state
F-INC
It allows to test the raising edge of the input n; it returns 1 if a raising edge was detected, or 0
otherwise. The test clears the condition .
Syntax: n --- fl
Fields: n: number of input to test
fl: input state
IMPORTANT
The function is available only if the command
Str8IOA was previously launched.
NF-INC
It allows to test the falling edge of the input n; it returns 1 if a falling edge was detected and 0
otherwise. The test clears the condition .
Syntax: n --- fl
Fields: n: number of input to test
fl: input state
IMPORTANT
The function is available only if the command
Str8IOA was previously launched.
OUTC-SET
Syntax: n ---
Fields: n: number of input to set
OUTC-RES
Syntax: n ---
Fields: n: number of input to reset
OUTC-CFG
Syntax: n ---
Fields: n: number of output to toggle
OUTC
It allows to test the state of the outputn. It returns 1 or 0 according to the output state.
Syntax: n --- fl
Fields: n: number of output to test
fl: output state flag
OUTC-PUL
It allows to set the output n for a determined period of time t expressed in hundredths of second
(Off-On-Off impulse).
Syntax: n t ---
Fields: n: number of output to set
t: time in hundredths of second
IMPORTANT
The function is available only if the command Str8IOA was previously launched.
Moreover, since the synchronisation is realised through 16 internal timers which have to be assigned
dynamically, before using the command OUTC-PUL it is necessary to check the availability of
timers, at least in those cases when more than 16 time managements of the outputs are going to be
used within the application program. For this purpose it is possible to use the command PULSEC-
SP described subsequently.
NOUTC-PUL
It allows to reset the output n for a determined period of time t expressed in hundredths of second
(On-Off-On impulse).
Syntax: n t ---
Fields: n: number of output to reset
t: time in hundredths of second
IMPORTANT
The function is available only if the command Str8IOA was previously launched.
Moreover, since the synchronisation is realised through 16 internal timers which have to be assigned
dynamically, before using the command NOUTC-PUL it is necessary to check the availability of
timers, at least in those cases when more than 16 time managements of the outputs are going to be
used within the application program. For this purpose it is possible to use the command NPULSEC-
SP described subsequently.
PULSEC-SP
It allows to test the availability of timers for the management of Off-On-Off impulses at the outputs
(see OUTC-PUL). It returns a flag = 1 if there are timers available and 0 otherwise.
Syntax: --- fl
Fields: fl: timer availability flag
IMPORTANT
The function is available only if the command Str8IOA was previously launched or after the
commands of reset of the outputsINI-IOC and INI-IOT.
NPULSEC-SP
It allows to test the availability of timers for the management of On-Off-On impulses at the outputs
(see NOUTC-PUL). It returns a flag = 1 if there are timers available and 0 otherwise.
Syntax: --- fl
Fields: fl: timer availability flag
IMPORTANT
The function is available only if the command Str8IOA was previously launched or after the
commands of reset of the outputsINI-IOC and INI-IOT.
AZZ-OUT
It allows to reset all the outputs either standard (present in the system) either of the CAN network.
Syntax: ---
Fields:
INI-IOC
It allows to reset all the outputs of the CAN network, to initialize the image of the inputs in the
inactive state and the variables for the management of the outputs as impulsive and inputs as edge-
sensed.
Syntax: ---
Fields:
INI-IOT
It allows to reset all the standard outputs (present in the system) and of the CAN network, to
initialize the image of the standard inputs (present in the system) and of the CAN network in the
inactive state and to initialize the variables for the management of the outputs as impulsive and inputs
as edge-sensed.
Syntax: ---
Fields:
NOTE
The command INI-IOT is analogue to the command INI-IOC, differently it aff
ects all the I/O and not only the
I/O within CAN network.
Str8IOA
It allows to initialize the variables for the management of the I/O of the CAN network (see INI-IOC)
and activate the routine of management of the outputs as impulsive and the inputs as edge-sensed.
Syntax: ---
Fields:
NOTE
The analogue command for the standard inputs and outputs (present in the systems) is
SBK-OUT.
OUTC-TAB
It returns the address of the image table of the digital outputs of the CAN network.
Example
To read the state of the bank (byte_out) 7 of the digital outputs (within a Forth word):
...
...
OUTC-TAB 7 + C@
...
...
NOTE
The command OUTC-TAB cannot be used directly from Forth interpreter. In this case it is necessary to use
the command (OUTC-TAB) which returns the address of the vector containing the address of the image table
of the digital outputs of the CAN network. Thus to read from terminal the state of the bank 7 it is necessary to
write:
(OUTC-TAB) D@ 7 + C@
INPC-TAB
It returns the address of the image table of the digital inputs of the CAN network.
Example
To read the state of the bank (byte_in) 3 of the digital inputs (within a Forth word):
...
...
INPC-TAB 3 + C@
...
...
NOTE
The command INPC-TAB cannot be used directly from Forth interpreter. In this case it is necessary to use the
command (INPC-TAB) which returns the address of the vector containing the address of the image table of
the digital inputs of the CAN network. Thus to read from terminal the state of the bank 3 it is necessary to
write:
(INPC-TAB) D@ 3 + C@
For an application program written in Forth, the various functions for the activation of the
procedures of management of the outputs as impulsive and inputs as edge-sensed (Str8IOA), for the
initial reset of the outputs (AZZ-OUT), etc. have to be present within the word TASK of start of the
application program.
16 Doc. MS269806 - Ed. 01 -26 June 1998
chapter 2. CAN NETWORK MANAGEMENT IN FORTH
As explained in [6] the word TASK, the total reset (RESETT) and the partial reset (RESETP) must
be structured like in the following example:
NOTE
The variable ForApp is a double word which the programmer must foresee for the forced total reset of his
own application program.
( ---------------------------------------------------------------
( Application program total reset
( This word must execute the initialization of the application
( program variables.
( ---------------------------------------------------------------
: ResetApp
( Initialize variables belonging to the application
...
( Set the application program reset flag
$ 12345678 ForApp D!
;
( ---------------------------------------------------------------
( Management of the total unconditioned reset of the whole system
( ---------------------------------------------------------------
: RESETT
RESETT ( Call the basic programs reset
ResetApp ( Application program reset
;
( ---------------------------------------------------------------
( Management of the partial reset of the whole system
( ---------------------------------------------------------------
: RESETP
RESETP ( Call the basic programs partial reset
( Initialize variables belonging to the application
...
;
( ---------------------------------------------------------------
( Start TASK
( ---------------------------------------------------------------
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Operations at the start of the program and thus start of the tasks
( and/or interrupt routines
...
...
;
NOTE
If the management of the outputs as impulsive and of the inputs as edge-sensed is not going to be used, it is
convenient not to enable it by inserting the commandStr8IOA, in order to save system resources.
This paragraph describes the Forth commands for the management of analog inputs connected to the
CAN network (modules PM8AIA, PM4TIA, PMACQA).
IMPORTANT
Notice that in this case wdw=16 and rdw=16; thus only 4 modules can be used per each node
PCCDIN and however the maximum number of modules in the whole network is reported in the
table of the paragraph 1.2.
The Forth management of the analog inputs of the module PM8AIA is implemented through a
routine which executes on time base the scanning of all enabled input channels and makes available
to the user the converted value directly in the RAM. Thus it is necessary to provide read enabling
commands and write commands for themask enabling the inputs which should be acquired.
Str8AIA
IMPORTANT
It must be called only once at each start and thus has to be inserted within the TASK word (see
paragraph 2.1.3)
Syntax: ---
Fields:
Cfg8AIA
WARNING
This command must be called after start of the management done with the command Str8AIA.
Example
In a CAN network are present two modules PM8AIA to which are associated respectively the banks 0 and 1. To enable
the acquisition of the inputs 0, 3 and 5 of the bank 0 (corresponding to the first module PM8AIA) and the inputs 1, 3
and 7 of the bank 1 (corresponding to the second module PM8AIA) the instructions to use within the TASK word are
the following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Partial reset
...
( Other enable
...
( Operations at the start of the program and thus start of the tasks
( and/or interrupt routines
...
;
Read8AIA
It allows to read the input n of the bank byte_in. It returns the 12 bits value of the inputs, with the
following meaning (according to the type of input selected directly on the module hardware):
+ 10 Vdc + 2047
- 10 Vdc - 2048
+ 5 Vdc + 2047
- 5 Vdc - 2048
+ 20 mA + 2047
- 20 mA - 2048
.
Syntax: n byte_in --- value
Fields: n: input number
byte_in: input bank.
value: analog value of the input
Example
To read the input 3 of the bank 1:
3 1 Read8AIA
Val8AIA
It returns the address of the variable which contains the image (word) of the input n of the bank
byte_in of the module PM8AIA.
Example
To read the image in memory of the input 3 of the bank 1:
3 1 Val8AIA @
NOTE
The address returned on the stack belongs to the RAM buffer (named mval8aia); each channel occupies one
word. Thus this buffer can be accessed with index calculated as follows:
(byte_in * 8 + n) * 2.
The module PM4TIA and the node PCCDIN are integrated on the same board since the module
saturates completely the node (wdw=64 and rdw=64)
.
IMPORTANT
The module PM4TIA and the node PCCDIN are integrated on the same board since the module
saturates completely the node (wdw=64 and rdw=64)
.
However, the maximum number of modules in the whole network is reported in the table of the
paragraph 1.2.
The Forth management of the analog inputs of the module PM4TIA is implemented trough a routine
that executes on time base the scanning of all enabled input channels and makes available to the user
the converted value directly in the RAM. Thus it is necessary to provide: read enabling commands,
write commands for the mask enabling the inputs which should be acquired and for the module
configuration parameters.
Str4TIA
IMPORTANT
It must be called only once at each start and thus has to be inserted within the TASK word (see
paragraph 2.1.3)
Syntax: ---
Fields:
Set4TIA
It allows to configure the enabling maskmsk of the bank byte_in and the module parameters.
0 50 Hz / 13,1 Hz Default
1 60 Hz / 15,7 Hz
2 250 Hz / 65,5 Hz
3 500 Hz / 131 Hz
0 FSR=2,5 V
1 FSR=1,25 V
2 FSR=80 mV Default
3 FSR=20 mV
WARNING
This command must be called after starting the channel scanning with Str4TIA.
2,3 freq: Updating frequency and cut-off frequency of the digital filter:
00 - 50 Hz \ 13.1 Hz
01 - 60 Hz \ 15.7 Hz
10 - 250 Hz \ 65.5 Hz
11 - 500 Hz \ 131 Hz
4,5 gain: Conversion gain:
00 - FSR = 2.5 V
01 - FSR = 1.25 V
10 - FSR = 80 mV
11 - FSR = 20 mV
As for the direct usage of the Forth command Set4TIA, in order to store the parameters directly into
memory (according to the previous directions), it is necessary to force the setting of the parameters
(the Forth command does it automatically) writing the value 1 on the 1 byte variable which address
should be calculated in a following way, starting from the initial address
fasi4tia:
fasi4tia + byte_in
When updating of the peripheral parameters is completed, the byte value is cleared to 0.
Example 1
To force the setting of the parameters of the bank 2:
1 fasi4tia 2 + C!
Example 2
In a CAN network are present two modules PM8AIA to which are associated respectively the banks 0 and 1. To enable
the acquisition of the inputs 0, 1 of the bank 0 (corresponding to the first module PM4TIA) and the inputs 2, 3 of the
bank 1 (corresponding to the second module PM4TIA) the instructions to use within the TASK word are the
following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Operations at the start of the program and thus start of the task and/or
( interrupt routines
...
;
Cfg4TIA
It allows to configure the enable mask msk of the bank byte_in. For this purpose it can be used in
place of the commandSet4TIA.
WARNING
This command must be called after starting the channel scanning with Str4TIA.
Example
In a CAN network are present two modules PM4TIA to which are associated respectively the banks 0 and 1. To enable
the acquisition of the inputs 0, 1 of the bank 0 (corresponding to the first free-standing module PM4TIA) and the
inputs 2, 3 of the bank 1 (corresponding to the second free-standing module PM4TIA) the instructions within the
TASK word are the following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Partial reset
...
( Other enable
...
( Operations at the start of the program and thus start of the task and/or
( interrupt routines
...
;
Read4TIA
It allows to read the input n of the bank byte_in. It returns a 16 bits without sign value of the input
(0÷ +65535) which has to be interpreted as follows:
÷+FSR):
- if the unipolar mode was selected (0
0 0
+FSR 65535
-FSR 0
+FSR 65535
Syntax: n byte_in --- value
Fields: n: input number
byte_in: inputs bank.
value: analog value of the input
Example
To read the input 3 of the bank 1:
3 1 Read4TIA
Val4TIA
It returns the address of the variable which contains the image of the input
n of the bank byte_in.
Example
To read the image in memory of the input 3 of the bank 1:
3 1 Val4TIA @
NOTE
The address returned on the stack belongs to the RAM buffer named mval8aia; each channel occupies one
word. Thus this buffer can be accessed with index calculated as follows:
(byte_in * 8 + n) * 2.
At the moment general usage software for this peripheral is not available.
This paragraph describes the Forth commands for the management of analog outputs connected to
the CAN network (PM4ANA).
IMPORTANT
The module PM4ANA and the node PCCDIN are integrated on the same board since the module
saturates completely the node (wdw=64 and rdw=64)
.
However, the maximum number of modules in the whole network is reported in the table of the
paragraph 1.2.
The Forth management of the analog inputs of the module PM4ANA is implemented trough a
routine that executes on time base the scanning of all enabled input channels and allows the user to
input the value directly from RAM. Thus it is necessary to provide: write enabling commands, write
commands for the mask enabling the outputs which should be managed and for the module
configuration parameters.
Str4ANA
IMPORTANT
It must be called only once at each start and thus has to be inserted within the TASK word (see
paragraph 2.1.3)
Syntax: ---
Fields:
Set4ANA
It allows to configure the enabling maskmsk of the bank byte_out and the module parameters.
• n1 ÷ n8: value of increment and decrement for the ramps of the 4 analog outputs. In particular:
WARNING
This command must be called after starting the channels scanning with Str4ANA.
The constants of increment and decrement are stored in a table with address mcfg4ana. Each data is
stored in a single byte, thus the initial address of the buffer of each single outputs bank is calculated
as follows:
The memory is organised as follows starting from the initial address of each bank:
Example 1
To set to the value 100 as increment and decrement for the ramp of the channel 2 of the bank 1:
As for the direct usage of the Forth command Set4ANA, in order to store the parameters directly
into memory (according to the previous directions), it is necessary to force the setting of the
parameters (the Forth command does it automatically) writing the value 1 on the 1 byte variable
which address should be calculated in a following way, starting from the initial address
fasi4ana:
fasi4ana + byte_out
When the updating of the peripheral parameters is completed, the byte value is cleared to 0.
Example 2
To force the setting of the parameters of the bank 2:
1 fasi4ana 2 + C!
Example 3
In a CAN network are present two modules PM4ANA to which are associated respectively the banks 0 and 1. To
enable the management of the outputs 0 and 3 of the bank 0 (corresponding to the first module PM4ANA) and the
outputs 1 and 3 of the bank 1 (corresponding to the second module PM4ANA) the instructions to use within the TASK
word are the following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Total reset conditioned by a test
...
( Partial reset
...
( Other enables
...
Str4ANA ( Enable
( Operations at the start of the program and thus start of the task and/or
( interrupt routine
...
;
Cfg4ANA
It allows to configure the enable mask msk of the bank byte_out. For this purpose it can be used in
place of the commandSet4ANA.
WARNING
This command must be called after starting the channel scanning with Str4ANA.
Example
In a CAN network are present two modules PM4ANA to which are associated respectively the banks 0 and 1. To
enable the management of the outputs 0, 1 of the bank 0 corresponding to the first module PM4ANA) and the outputs
2, 3 of the bank 1 (corresponding to the second module PM4ANA) the instructions within the TASK word are the
following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Total reset conditioned by a test
...
( Partial reset
...
( Other enable
...
Str4ANA ( Enable
% 0011 0 Cfg4ANA ( Select output 0 and 1 o
f the bank 0
% 1100 1 Cfg4ANA ( Select output 2 and 3 of the bank 1
( Operations at the start of the program and thus start of the task and/or
( interrupt routine
...
...
;
Write4ANA
It allows to write the output n of the bank byte_out. Remembering that the analog value ± 10 Vdc is
represented with 11 bits with sign, the written data has to be coded as follows:
Example
To set the value +5 Vdc (+1024) to the output 3 of the bank 1:
1024 3 1 Write4ANA
Read4ANA
It allows to read the value of the output n of the bank byte_out. Remembering that the analog value
± 10 Vdc is represented with 11 bits with sign, the returned data has to be interpreted as follows:
Example
To read the value of the output 3 of the bank 1:
3 1 Read4ANA
Val4ANA
It returns the address of the variable which contains the image of the output
n of the bank byte_out.
Example
To set the value -5 Vdc (-1024) at the output 3 of the bank 1:
-1024 3 1 Val4ANA !
2 2 Val4ANA @
NOTE
The address which is returned on the stack, belongs to RAM buffer named mval4ana; each channel occupies
one word. Thus this buffer can be accessed with index calculated as follows:
( byte_out * 4 + n ) * 2.
Sr4ANA
NOTE
It is possible to modify or test the state of the relays also by reading the information in the table with address
reed4ana. Each byte corresponds to a bank, thus the index should be calculated adding to the basic address
the number of the affected bank:
reed4ana + byte_out
Bit Description
0 Enable relay channel 0
1 Enable relay channel 1
2 Enable relay channel 2
3 Enable relay channel 3
Example
To enable the relay of the channel 1 of the bank 2: reed4ana 2 + 1 BSET
Rr4ANA
It allows to reset the relay of the output n of the bank byte_out (see also the note of the command
Sr4ANA).
?r4ANA
It allows to test the relay of the output n of the bank byte_out. It returns a flag =1 if the relay is
enabled and 0 otherwise (see also the note of the command Sr4ANA).
This paragraph describes the Forth commands for the management of special peripherals connected
to a CAN network. In particular:
1. PMVBRA whichallows partitioning of the current flux in a circuit fed by 220 Vac 50 or 60 Hz.
2. PMTERM for the management of terminals.
IMPORTANT
The module has rdw=8 and wdw=8, and thus it is possible to use up to 8 modules PMVBRA per
each node PCCDIN, and however the maximum number of modules in the whole network is
reported in the table of the paragraph 1.2.
The Forth management of the analog outputs of the module PMVBRA is implemented trough a
routine that executes on time base the scanning of the output channel and allows the user to input the
value directly from RAM. Thus it is necessary to provide: outputs management enable commands,
write commands for the enablemask and for the module configuration parameters.
WARNING
Each module PMVBRA has only one time shutter output and thus the value assigned to the
enabling mask will always be 1 and the number of the output channel 0. This is done in order to
keep for the commands corresponding to this module the same syntax as for the commands used for
the other modules that have more than one input or output.
StrVBRA
It allows to enable the management of the analog output of the modules PMVBRA.
IMPORTANT
It must be called only once at each start and thus has to be inserted within the TASK word (see
paragraph 2.1.3)
Syntax: ---
Fields:
SetVBRA
It allows to configure the enable mask msk of the bank byte_out of the module PMVBRA and the
module parameters.
• n3: duration of the activation (0 ÷ 255) expressed in hundredth of second. The value 0 indicates
that the activation is continuous. Default value is 0.
• n4: resonance frequency for special time shutter (0 ÷ 600) expressed in tenths of Hz. Default
value is 0.
• n5: inhibition threshold of the TRIAC (0÷ 16383). Default value is 16383.
• msk: output enable mask (the board PMVBRA has only one output and thus this value will
always be 1; it was inserted for uniformity with the commands of the other modules)
WARNING
This command must be called after starting the channel scanning with StrVBRA.
The data is stored in a table with address mcfgvbra. The initial address of the buffer of each single
bank has to be calculated as follows:
Example 1
To read the minimum value for trigger of the TRIAC of the bank 2:
mcfgvbra 2 Ldatvbra * + 2 + @
As for the direct usage of the Forth command SetVBRA, in order to store the parameters directly
into memory (according to the previous directions), it is necessary to force the setting of the
parameters (the Forth command does it automatically) writing the value 1 on the 1 byte variable
which address should be calculated in a following way, starting from the initial address
fasivbra:
fasivbra + byte_out
When the updating of the peripheral parameters is completed, the byte value is cleared to 0.
Example 2
To force the setting of the parameters of the bank 2:
1 fasivbra 2 + C!
Example 3
In a CAN network are present two modules PMVBRA to which are associated respectively the bank 0 and 1: the
instructions to use are the following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Partial reset
...
( Other enables
...
StrVBRA ( Enable
( Operations at the start of the program and thus start of the task and/or
( interrupt routine
...
;
CfgVBRA
It allows to configure the enable mask msk of the bank byte_out. For this purpose it can be used in
place of the commandSetVBRA.
WARNING
This command must be called after starting the channel scanning with StrVBRA.
NOTE
The module PMVBRA has only one output, thus the enable mask is always 1.
Example
In a CAN network are present two modules PMVBRA to which are associated respectively the banks 0 and 1. To
enable the management of the outputs the instructions are the following:
: TASK
1000 %WAIT ( Wait for possible interrupt from keyboard
( Partial reset
...
( Other enables
...
StrVBRA ( Enable
% 0001 0 CfgVBRA ( Select output of the bank 0
% 0001 1 CfgVBRA ( Select output of the bank 1
( Operations at the start of the program and thus start of the task and/or
( interrupt routine
...
;
WriteVBRA
It allows to write the output n (with n=0 always because the module PMVBRA provides only one
output) of the bank byte_out. Remembering that the partitioning value 0÷100 % is represented with
15 bits with sign, the written data has to be coded as follows:
0% 0
100 % +32767
IMPORTANT
The value to write should be always 16 bit with sign ( 0 > 32767), the negative values are ignored by
clamping them to 0.
Example
To set the value +50% (+16383) to the output of the bank 1:
1024 0 1 WriteVBRA
ReadVBRA
It allows to read the value of the output n (with n=0 always because the module PMVBRA provides
only one output) of the bank byte_out. Remembering that the partitioning value 0÷100 % is
represented with 15 bits with sign, the returned data has to be interpreted as follows:
0% 0
100 % +32767
Example
To read the partitioning value of the output of the bank 1:
0 1 ReadVBRA
ValVBRA
It returns the address of the variable which contains the image of the output n (with n=0 always
because the module PMVBRA provides only one output) of the bank byte_out of the module
PMVBRA.
Example
To set the partitioning value 10% (3267) to the output of the bank 1:
3267 0 1 ValVBRA !
0 2 ValVBRA @
NOTE
The address which is returned on the stack, belongs to RAM buffer named mvalvbra; each channel occupies
one word. Thus this buffer can be accessed with index calculated as follows:
byte_out * 2
Regarding this module other information about its working state is available. It is stored in a table of
RAM with address stsvbra and each bank occupies one byte, thus the access should be done with
index calculated by summing to the basic address the bank number:
stsvbra + byte_out
Bit Description
0 Mains power supply absence. If for 80 msec is not detected the signal of
synchronism, it is given this signalling which is non-static
1 The driver (TRIAC) does not activate: probable malfunctioning. If after 10
consecutive commands the driver doesn’t activate, it is given this signalling
which is non-static
A further information from the peripheral is the network frequency, measured at the start and at each
insertion of the load, the data is stored in a table with address frqvbra, each bank occupies one byte,
thus the addressing should be done as follows:
frqvbra + byte_out
The read value can be 0 if the network frequency has not been determined yet, otherwise 50 or 60
according to the mains frequency.
SrVBRA
It allows to set the relay of the outputn (n=0 always) of the bankbyte_out.
NOTE
It is possible to modify or test the state of the relays also by reading the information in the table with address
reedvbra. Each byte corresponds to a bank, thus the index should be calculated adding to the basic address
the number of the affected bank:
reedvbra + byte_out
Bit Description
0 Enable relay channel 0
Example
To enable the relay of the bank 2: reed4ana 2 + 0 BSET
RrVBRA
It allows to reset the relay of the output n (n=0 always) of the bank byte_out (see also the note of
the command Sr4VBRA).
?rVBRA
It allows to test the relay of the output n (n=0 always) of the bank byte_out. It returns a flag =1 if
the relay is enabled and 0 otherwise (see also the note of the command SrVBRA).
The software for the management of this module at the moment is not available.
In case of communication error or malfunctioning of a node, this node is excluded (this condition is
signalled by the LEDs on the node PCCDIN).
In the application program the condition of error is tested by mean of the Forth word ?NALR_CAN
(Node Alarm CAN).
?NALR_CAN
It returns a flag which signals the condition of error (=1) of the node specified in the stack.
The format of the command is following:
Syntax: n --- fl
Fields: n: node number
fl: error flag.
In particular if the returned flag is equal to 1, it means that the node n is not in a network or had lost
the communication.
In presence of a node alarm, the first operation is to try to recover the communication by changing
speed, using the Forth command VEL_CAN (even when the speed is reset to a current one, this must
be considered a speed change), since this operation re-starts the whole network..
If the malfunctioning persists, the problem can be of hardware nature. It is suggestible to check the
connections of the network and possibly attempt to communicate again with a lower speed.
For example suppose a CAN network with 3 nodes (node 1, 2 and 3): in order to test the occurrence
of an alarm in the network, should be foreseen a Forth structure for check up and recovery (for
example on the supervisor task of the application program):
...
4 1
DO
I ?NALR_CAN
IF
( signalling alarm, for example
." Alarm node " I .
( Attempt of recovering with a speed change
5 VEL_CAN
200 %WAIT ( Wait network re-initialization
ENDIF
LOOP
...
NOTE
It is important that the test of the network alarm condition is excluded for 0,2 ÷ 0,3 seconds after the system
starts.
This paragraph lists the most common causes of alarm in a node PCCDIN:
• Malfunctions caused by the modules connected to the node. The causes for each module are
reported in the following table:
Module Description
PM8IOA Absence of power supply for the digital outputs (24 Vdc).
PM8INA No cause of error.
PM8POA Absence of power supply for the digital outputs (24 Vdc).
PM8ROA Absence of power supply for the digital outputs (24 Vdc).
PM8ROB Absence of power supply for the digital outputs (24 Vdc).
PM8AIA Absence of power supply for the module (18 Vac, 24 Vdc).
PMVBRA No cause of error.
NOTE
For the free standing modules PM4TIA and PM4ANA there is no sense in indicating causes of error of the
node depending on the module since in these two cases module and node are integrated.
NOTE
For the module PMACQA there is no sense in indicating causes of error of the node depending on the module
since in this case only one module can be connected to the node PCCDIN and the power supply of the
PMACQA is the same of the node.
This chapter is addressed to the programmers, who are going to manage the CAN network with
application programs written in Forth. For a better understanding of this chapter, the user is advised
to consult also the manual [4]. This chapter contains directions on the network configuration and on
the management of the inputs and outputs on the different functional modules.
In ambient AWL the network CAN should be configured within the #DEFPLC block (see [4]) using
some configuration parameters described in this chapter. These parameters are added to the already
known ones (DATA; MERKER; etc.).
It defines the features of the node and opens the definition of the peripheral modules connected to it.
• node: node number. It can assume a value between 1 and 32 compatible with the constraints
given by the type of system.
IMPORTANT
The scanning time of the node is always a multiple of 5 milliseconds and input values are
approximated to the upper multiple of 5.
The minimum scanning time of a node is 5 milliseconds.
• mod: number of modules connected to the node. It can be a number from 1 and 8 compatible
with the constraints given by the saturation of the wdw and rdw and those given by the maximum
number of modules of the same type which can be connected to a network according to the table
of the paragraph 1.2 (repeated here for convenience).
ENDNODO
Parameters
INPCAN byte_in
It defines the total number of banks of digital inputs managed by the network.
Parameters byte_in
• byte_in: number of digital inputs banks of the network. It can assume at most the value defined in
the table Maximum number of modules in a network reported at the beginning of the chapter and
must be alwaysmultiple of 4. Default value is 0.
OUTCAN byte_out
It defines the total number of digital outputs banks managed by the network.
Parameters byte_out
• byte_out: number of digital outputs banks of the network. It can assume at most the value
defined in the table Maximum number of modules in a network reported at the beginning of the
chapter and must be alwaysmultiple of 4. Default value is 0.
AINPCAN byte_in
Parameters byte_in
• byte_in: number of analog inputs banks of the node. It can assume at most the value defined in
the table Maximum number of modules in a network reported at the beginning of the chapter.
Default value is 0.
AOUTCAN byte_out
Parameters byte_in
• byte_out: the number of analog outputs banks of the node. It can assume at most the value
defined in the table Maximum number of modules in a network reported at the beginning of the
chapter. Default value is 0.
VELCAN n
Parameters n
n: speed code. The following table reports the correspondence between code and speed in KHz.
Speed codes
Baud Rate [KHz] Speed code
10 0
25 1
50 2
100 3
125 4
250 5
500 6
800 7
1000 8
It defines the number of the input bank byte_in and number of the output bank byte_out of the
module PM8IOA connected to the node.
It defines the number of the input bankbyte_in of the module PM8INA connected to the node.
Parameters byte_in
It defines the number of the output bankbyte_out of the module PM8POA connected to the node.
Parameters byte_out
It defines the number of the output bankbyte_out of the module PM8ROA connected to the node.
Parameters byte_out
It defines the number of the output bankbyte_out of the module PM8ROB connected to the node.
Parameters byte_out
It defines the number of the analog input bank byte_in and the mask of the enabled inputs msk of
the module PM8AIA connected to the node.
This parameter must be inserted within NODO...ENDNODO and, since it saturates the node,
there cannot be present other modules.
• buff_e: converter input buffer enable flag, with the following meaning:
• freq: updating frequency and cut-off frequency of the digital filter with the following meaning:
0 50 Hz / 13,1 Hz Default
1 60 Hz / 15,7 Hz
2 250 Hz / 65,5 Hz
3 500 Hz / 131 Hz
0 FSR=2,5 V
1 FSR=1,25 V
2 FSR=80 mV Default
3 FSR=20 mV
PMACQA byte_in
This parameter must be inserted within NODO...ENDNODO and, since it saturates the node,
there cannot be present other modules.
• n1 ÷ n8: value of increment and decrement for the ramps of the 4 analog outputs. In particular:
42 Doc. MS269806 - Ed. 01 -26 June 1998
chapter 3. CAN NETWORK MANAGEMENT IN AWL
WARNING
Each module PMVBRA has only one time shutter output and thus the value assigned to the
enabling mask will always be 1 and the number of the output channel 0. This is done in order to
keep for the commands corresponding to this module the same syntax as for the commands used for
the other modules that have more than one input or output.
• msk: output enabling mask (the board PMVBRA has only one output and thus this value will
always be 1; it was inserted for uniformity with the commands of the other modules)
• n3: duration of the activation (0 ÷ 255) expressed in hundredths of second. The value 0 indicates
that the activation is continuous. Default value is 0.
• n4: resonance frequency for special time shutter (0 ÷ 600) expressed in tenths of Hz. Default
value is 0.
• n5: inhibition threshold of the TRIAC (0÷ 16383). Default value is 16383.
GOCAN
Parameters
IMPORTANT
This word has to be the last in the definition of the CAN parameters (see the example of the
following paragraph).
STPCAN
Parameters
NOTE
This word is alternative to GOCAN and should be the last in the definition of the parameters corresponding
to the CAN. It was foreseen in order to allow the allocation of the RAM areas for the CAN without obligatory
activation of the communication.
For better understanding the definitions given in the previous paragraph refer to the following
example.
To configure a CAN network composed of 5 nodes PCCDIN respectively defined as nodes 1, 2, 3,
4, 5.
• PCCDIN+PM8IOA+PM8IOA+PM8IOA
To the node 1 are connected 3 modules PM8IOA (8 digital inputs + 8 digital outputs) to which
are associated respectively the banks 0, 1 and 2 for the inputs (EC0.0÷EC0.7 - EC1.0÷EC1.7 -
EC2.0÷EC2.7) and 0, 1 and 2 for the outputs (AC0.0 ÷AC0.7 - AC1.0÷AC1.7 - AC2.0÷AC2.7).
• PCCDIN+PM8AIA+PMPOA
To the node 2 are connected a module PM8POA (8 digital power outputs) to which is assigned
the output bank 3 (AC3.0÷AC3.7) and a module PM8AIA (8 analog inputs) to which is assigned
the input bank 0 (AEC0.0÷AEC0.7). In particular should be enabled only the acquisition of the
channels 0, 1, 2, and 3.
• PCCDIN+PM4TIA
To the node 3 is connected a module PM4TIA (4 inputs thermocouples), that saturate the node,
to which is assigned the input bank 1 (AEC1.0÷AEC1.3). In particular should be enabled only the
acquisition of the channels 0, and 2.
• PCCDIN+PM4ANA
To the node 4 is connected a module PM4ANA (4 analog outputs) that saturate the node, to
which is assigned the output bank 0 (AAC0.0÷AAC0.3). In particular should be managed only the
outputs 1 and 3.
• PCCDIN+PMVBRA+PMVBRA
To the node 5 are connected two modules PMVBRA to which are assigned the output banks 1
(AAC1.0) and 2 (AAC2.0).
For all the nodes thescanning time is 10 msec., whereas the network speed is 500 KHz(code 6).
Moreover there are 3 banks of digital inputs, 4 of digital outputs, 2 of analog inputs and 3 of analog
outputs.
Within the application program written in AWL this configuration is translated in the following list:
#DEFPLC
....
....
INPCAN 4 * N° banks for the digital inputs multiple of 4
OUTCAN 4 * N° banks for the digital outputs multiple of 4
AINPCAN 2 * N° banks for the analog inputs
AOUTCAN 3 * N° banks for the analog outputs
NOTE
Remember that the definition of peripheral modules must be done within NODO...ENDNODO and the word
GOCAN (or STPCAN) should be the last of the definitions regarding CAN. Otherwise an error will be
signalled in a compilation phase.
Regarding the management of the CAN digital I/O, stay valid the AWL instructions used for the
management of the system standard I/O (see [4]), and are added the new operands described later
on.
NOTE
In the following descriptions changes the method of description of the instruction in respect with the one used
in the manuals AWL [4] and [5] of the system. In facts, in this contest, are described the new operands
related to the CAN network I/O and for each one of them is provided only the list of instructions which can be
used. Remember that in the manual [4] on the contrary it is used the method of providing for each described
instruction the list of allowed operands.
NOTE
In the following definitions it is used the expression "Operand test"; if the operand test is allowed this means
that it is possible to test the operand from the TEST page of the PLC (see[4]).
... EC x.y
Allowed instructions:U UN O ON S R = I
Operand test: Allowed
Example:
... AC x.y
Allowed instructions:U UN O ON S R = I
Operand test: Allowed
... ECB x
Allowed instructions:L LI T TI
Operand test: Allowed
Example:
... ECW x
Allowed instructions:L LI T TI
Operand test: Allowed
... ECD x
Allowed instructions:L LI T TI
Operand test: Allowed
... ACB x
Allowed instructions:L LI T TI
Operand test: Allowed
... ACW x
Allowed instructions:L LI T TI
Operand test: Allowed
... ACD x
Allowed instructions:L LI T TI
Operand test: Allowed
... PEC x
Till now the reference was done always to the image of digital inputs which the PLC updates at each
scanning cycle. To access directly to the peripheral is necessary to use this operand.
Allowed instructions:L
Operand test: Allowed
Example:
L PEC1 * Load in ACC1 the state of the inputs of the bank 1 of the
* ÷ 1.7, reading them directly
CAN network, i.e. inputs 1.0
* from the peripheral.
T MB100 * Transfers the image in the MB 100
Then each single input can be tested making reference to the merker corresponding to MB100.
Also for the AWL management of the analog acquisition modules are foreseen the new operands. In
particular it is necessary to pay attention since the number of the bank identifies the type of module
to which the command is addressed, thus the number of the input must be opportunely indicated.
Allowed instructions:L LI T TI
Operand test: Allowed
Example:
... MEC x
Allowed instructions:L T
Operand test: Allowed
Example:
Also for the AWL management of the modules with analog outputs are foreseen new operands. In
particular it is necessary to pay attention since the number of the bank identifies the type of module
to which the command is addressed, thus the number of the output must be opportunely indicated.
The module PMVBRA is considered like a module of analog outputs.
Allowed instructions:L LI T TI U UN O ON S R =
Operand test: Allowed
Example:
... MAC x
Allowed instructions:L T
Operand test: Allowed
Example:
Also for the access to the other CAN network parameters there were introduced new functions.
... NT n
Allowed instructions:L T
Operand test: Allowed
Example: To change run time the scanning time of the node 4, setting it to 15 msec.
... DSC x
It identifies other parameters of the network. The value x identifies the CAN system variable
according to the following table.
23 Not used
24 R Address RAM for terminals PMTERM
25 Not used
26 Not used
27 Not used
28 Not used
29 Not used
30 R Address of nodes scanning time
31 Not used
32 Not used
33 Not used
34 Not used
35 R Address of the module PM8AIA channels map
36 R Address of the module PM4ANA channels map
37 R Address of the module PM4TIA channels map
38 R Address of the module PMVBRA channels map
39 Not used
40 Not used
41 Not used
42 Not used
43 Not used
44 Not used
45 R Address PM4ANA ramps table (see mcfg4ana)
46 R Address PM4ANA updating phase table (see fasi4ana)
47 R Length of the data table for a PM4ANA bank
48 Not used
49 Not used
50 R Address PM4TIA configuration data table (see mcfg4tia)
51 R Address PM4TIA updating phase table (see fasi4tia)
52 R Length of the data table for a PM4TIA bank
53 Not used
54 Not used
55 R Address PMVBRA configuration data table (see mcfgvbra)
56 R Address PMVBRA updating phase table (see fasivbra)
57 R Address of peripherals state table
58 R Address of measured network frequency table
59 R Length of the data table for a PMVBRA bank
Allowed instructions:L T
Operand test: Allowed
Example: To change run time the network speed, setting it to 1000 KHz (code 8)
... NA x
Allowed instructions:U UN O ON
Operand test: Allowed
In the application program the condition of error is signalled by the operand NAx (where x is the
number of the node to test); in conditions of correct functioning of the CAN network no node has to
be in alarm and thus the operand NA of every node should be 0.
In presence of a node alarm, the first operation is to try to recover the communication by changing
speed (even when the speed is reset to a current one, this must be considered a speed change), since
this operation re-starts the whole network.
If the malfunctioning persists, the problem can be of hardware nature. It is suggestible to check the
connections of the network and possibly attempt to communicate again with a lower speed.
Example
...
...
O NA1 * Test alarm conditions of the nodes
O NA2
O NA3
IF
U T0 * To avoid continuos changes of speed
IF
L KZ-1 * Alters the speed code image
T DSC1
R M0.0 * Re-starts the timer T0
ENDIF
ENDIF
UN M0.0 * Timer management to avoid continuos changes of speed
L KT20.0
SE T0
U T0
S M0.0
...
...
NOTE
The test of the network alarm conditions has to be excluded for 0,2÷ 0,3 seconds after starting of the system.
This paragraph lists the most common causes of alarm from a node PCCDIN:
• Malfunctions caused by the modules connected to the node. The causes for each module are
reported in the following table:
Module Description
PM8IOA Absence of power supply for the digital outputs (24 Vdc).
PM8INA No cause of error.
PM8POA Absence of power supply for the digital outputs (24 Vdc).
PM8ROA Absence of power supply for the digital outputs (24 Vdc).
PM8ROB Absence of power supply for the digital outputs (24 Vdc).
PM8AIA Absence of power supply for the module (18 Vac, 24 Vdc).
PMVBRA No cause of error.
NOTE
For the free standing modules PM4TIA and PM4ANA there is no sense in indicating causes of error of the
node depending on the module since in these two cases module and node are integrated.
NOTE
For the module PMACQA there is no sense in indicating causes of error of the node depending on the module
since in this case only one module can be connected to the node PCCDIN and the power supply of the
PMACQA is the same of the node.
In some cases it may be of use to be able to change run-time the configuration of the peripherals.
Therefore here are reported some examples for the devices for which this operation has sense and in
particular for the modules PM4TIA, PM4ANA and PMVBRA.
Example 1
Configuration change for PM4TIA:
....
Example 2
Configuration change for PM4ANA:
...
* SETTING OF VALUES FOR THE RAMPS PM4ANA BANK 0
U M10.0 * Updating command
IF
L DSC46 * Test if procedure of parameters sending is free
LAB
L KZ0
=F
IF
L DW100 * Channel 0 raising ramp
L DSC45 * Table address
TAB
L DW102 * Channel 1 raising ramp
L DSC45 * Table address
ADD KZ1 * Sum variable offset
TAB * Write byte
L DW104 * Channel 2 raising ramp
L DSC45 * Table address
ADD KZ2
TAB
L DW106 * Channel 3 raising ramp
L DSC45 * Table address
ADD KZ3
TAB
L DW108 * Channel 0 falling ramp
L DSC45 * Table address
ADD KZ4
TAB
L DW110 * Channel 1 falling ramp
L DSC45 * Table address
ADD KZ5
TAB
L DW112 * Channel 2 falling ramp
L DSC45 * Table address
ADD KZ6
TAB
L DW114 * Channel 3 falling ramp
L DSC45 * Table address
ADD KZ7
TAB
L KZ1 * Start the procedure of parameters transmission
L DSC46
TAB
R M10.0
ENDIF
ENDIF
....
Example 3
Configuration change for PMVBRA:
....
* SETTING OF CONFIGURATION PARAMETERS FOR PMVBRA BANK 1
U M10.0
IF
L DSC56 * Test if procedure of parameters sending is free
...
To use the CAN management library, first of all it is necessary to install it in the libraries directory.
Insert the disk ‘CAN NETWORK’ in the drive, launch the program INSTALL and follow directions.
After this operation, in the libraries directory there will be a new sub-directory:
When the program MAKEPRJ is used to begin a new job, there will be a new section ‘RETE CAN’
with the following possible options:
CAN
[ ] CAN network, basic software management
[ ] PM8IOA module driver
[ ] PM8IOA test program
[ ] PM8AIA module driver
[ ] PM8AIA test program
[ ] PM4ANA module driver
[ ] PM4ANA test program
[ ] PM4TIA module driver
[ ] PM4TIA test program
[ ] PMACQA module driver
[ ] PMACQA test program
[ ] PMVBRA module driver
[ ] PMVBRA test program
[ ] CAN network terminals driver
[ ] CAN network terminals test program
[ ] CAN network test program
[ ] CAN network management in AWL
CAN network, basic software management It is the package core; when managing the CAN network
this package has to be always selected.
PM8IOA test program Select to compile the test program for the modules PM8IOA,
PM8INA, PM8POA, PM8ROA, PM8ROAB.
PM8AIA test program Select to compile the test program for the module PM8AIA.
PM4ANA test program Select to compile the test program for the module PM4ANA.
PM4TIA test program Select to compile the test program for the module PM84TIA.
PMACQA test program Select to compile the test program for the module PMACQA.
PMVBRA test program Select to compile the test program for the module
PMVBRA.
CAN network terminals driver Select to manage the terminal of the CAN network.
CAN network terminals test program Select to compile the test program for the CAN network
terminal PM8AIA.
CAN network test program Select to compile the complete test of the CAN network.
CAN network management in AWL Select to manage the CAN network in a AWL program.
NOTE
The software management of the modules PMACQA and PMTERM at the moment is not available.
WARNING
The CAN management is already present in some systems. In this case it is not necessary to compile
it, unless in order to update the library present in EPROM.
For example if in a system CTX618 (331CPU) are selected: the basic software, the drivers and the
tests for the modules PM8IOA and PM4ANA, the general test of the network, the network
management in AWL, the job directory will be:
LIB ( Libraries )
PLC ( Libraries of PLC )
NOTE
The file of the module PM8IOA driver does not exist since the driver of this module, and of the modules
PM8INA - PM8POA - PM8ROA - PM8ROB, are contained in the basic software (can82200.bmp)
NOTE
The files for the CAN network management in AWL are present in the directory PLC and not in the directory
RETECAN.
To compile the CAN network management without using the program makeprj.exe it is necessary to
insert in the compilation list of the application program the files for the basic software management,
the files for the management of the single modules, optionally the files for the module tests, for the
general test and for the management AWL in order to manage the network within a program for the
PLC. For the configuration described in the previous paragraph:
NOTE
Remember that for the AWL management it is necessary to compile also the AWLUTI package.
58 Doc. MS269806 - Ed. 01 -26 June 1998
appendix A. PRIMITIVES OF THE COMMANDS
This appendix lists the primitives (basic routines written in Assembler) of some of the commands
used for the CAN network management which can be utilised within subroutines Assembler.
...
JSR .L & name ;
...
where name is the name of the primitive. The parameters have to be passed using the data register of
the CPU as described for each single primitive:
(INPC)
(OUTC-SET)
Example
To test the input 5 of the CAN network and if it is active to set the output 1, otherwise the output 2.
...
MOVE .W # 5 d0 ;
JSR .L & (INPC) ;
TST .L d0 ;
ne IF,
MOVE .W # 1 d0 ;
ELSE,
MOVE .W # 2 d0 ;
THEN,
JSR .L & (OUTC-SET) ;
...
(OUTC-RES)
(OUTC-CHG)
(OUTC)
In all the systems employing a CAN network is available a special command for the complete test of
the network. This command, TST_CANNET must be called from Forth ambient; the first page
which will appear on the PC is a menu of functions which allows the access also to the tests of the
single peripheral modules, beyond the network test described in the chapter 1 (see TST_CAN).
The different pages of the test are not described since they are of easy usage.
Notice that CAN management software is already present in the basic library in some systems and in
this case the complete test TST_CANNET is also present, whereas for other systems it has be
compiled as explained in the chapter 4; in the second case, in order to have the complete test, it is
necessary to select also the test packages of the different modules employed .
BIBLIOGRAPHY