0% found this document useful (0 votes)
118 views

PAM Serial Line

This document provides technical details about the PAM Serial Line Protocol for communicating between a PAM controller and an external device via an RS422 connection. It describes the attributes of exchanged variables, the software requirements, file structures, configuration and execution phases, communication protocols, and hardware configuration of the PAM module. The goal is bi-directional exchange of variables in a robust and efficient manner over the serial connection.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

PAM Serial Line

This document provides technical details about the PAM Serial Line Protocol for communicating between a PAM controller and an external device via an RS422 connection. It describes the attributes of exchanged variables, the software requirements, file structures, configuration and execution phases, communication protocols, and hardware configuration of the PAM module. The goal is bi-directional exchange of variables in a robust and efficient manner over the serial connection.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Socapel PAM

A Programmable Axes Manager

PAM Serial Line


Protocol V2.5
Technical Manual

Ordering Number: 006.8021.C


Rev. May 1995

This upgraded and improved


version replaces all the previous.
We reserve the right to amend this
document without prior notice and
decline all responsibilities for
eventual errors.
Doc. No. 006.8021.C/PB-CHH
Atlas Copco Controls SA
En Montillier 4  May 95
CH-1303 PENTHAZ by Atlas Copco Controls SA (previously SOCAPEL SA).
Switzerland All rights reserved.
SOCAPEL SA PAM Technical Manual 006.8021.C

TABLE OF CONTENTS

1 INTRODUCTION 1

1.1 ATTRIBUTE OF VARIABLES _________________________________________________ 1

1.1.1 N AME OF A VARIABLE 1


1.1.2 ID OF A VARIABLE 1
1.1.3 CRC OF A VARIABLE 1
1.1.4 KEY OF A VARIABLE 1

2 RS422 SOFTWARE ON USER SIDE 2

3 USING PAM RS422 C UTILITIES 3

3.1 RS422 UTILITIES DELIVERY AND CONTENTS __________________________________ 3

3.2 RS422 UTILITIES IN USER CONTEXT _________________________________________ 4

3.3 PAM & USER FILES OVERVIEW_____________________________________________ 5

3.4 USER SOFTWARE REQUIREMENT_____________________________________________ 6

3.5 USER' S VARIABLE DATABASE _______________________________________________ 6

3.6 FILES OF THE RS422 UTILITIES _____________________________________________ 7

3.7 USER MAIN PROGRAM FLOW _______________________________________________ 7

4 CONFIGURATION PHASE 8

4.1 CONFIGURATION OF INPUT VARIABLES _______________________________________ 8

4.1.1 V ARIABLE ID & KEY IN F UNCTION OF DECLARATION ORDER 8


4.2 CONFIGURATION OF OUTPUTS VARIABLES ____________________________________ 8

5 RS422 UTILITIES, CONFIGURATION FUNCTIONS 10

5.1 INITIALISATION FUNCTION ________________________________________________ 10

5.2 COMMUNICATION REQUEST FUNCTION ______________________________________ 10

5.2.1 C OMM. R EQUEST, M ASTER AND PAM ACTION 11


5.3 FUNCTION FOR EXCHANGE OF CONFIGURATION COMMANDS ___________________ 11

Table of Contents I
Technical Manual 006.8021.C PAM SOCAPEL SA

5.4 EXCHANGE OF VARIABLE DEFINITION _______________________________________ 12

5.4.1 C ONFIGURATION ORDER 13


5.5 EXCHANGE OF OUTPUT KEY ______________________________________________ 14

5.6 INITIALISING SOME INPUT VALUE ___________________________________________ 15

5.7 STARTING PAM _________________________________________________________ 16

5.7.1 STARTING PAM WITH UPDATE OF OUTPUTS 17


5.8 PAM ERROR MESSAGES DURING CONFIGURATION _____________________________ 18

6 EXECUTION PHASE 20

6.1 HANDLING OF INPUTS BY PAM_____________________________________________ 20

6.2 HANDLING OF OUTPUTS BY PAM ___________________________________________ 20

6.3 HANDLING OF INPUTS BY RS422 MASTER ____________________________________ 20

6.4 HANDLING OF OUTPUTS BY RS422 MASTER __________________________________ 20

6.5 COMMUNICATION WATCH DOG ____________________________________________ 21

6.5.1 PAM ACTION WHEN RS422 MASTER IS NOT RUNNING 21


6.5.2 PAM BEHAVIOUR IN CASE OF FATAL ERROR 21

7 RS422 UTILITIES, EXECUTION FUNCTIONS 22

7.1 SEND VARIABLES FUNCTIONS ______________________________________________ 22

7.2 SCAN PAM MESSAGES FUNCTION __________________________________________ 24

7.3 RS422 EXECUTION PHASE ERRORS _________________________________________ 25

8 RS422 COMMUNICATION PROTOCOL 28

8.1 BLOCKS PROTOCOL ______________________________________________________ 28

8.2 ERROR DETECTION ______________________________________________________ 28

8.3 BLOCKS RESYNCHRONISATION _____________________________________________ 29

8.4 XON XOFF CONSIDERATIONS ______________________________________________ 29

9 APPLICATION PROTOCOL 30

9.1 FUNCTION CODES ________________________________________________________ 30

9.1.1 M ULTIBYTES VALUES 31


9.2 MESSAGE COMM_REQ __________________________________________________ 31

II Table of Contents
SOCAPEL SA PAM Technical Manual 006.8021.C

9.3 MESSAGE COMM_ACK __________________________________________________ 31

9.4 CONFIGURATION MESSAGES _______________________________________________ 32

9.4.1 M ESSAGE CONFIG_CMD 32


9.4.2 M ESSAGE CONFIG_ANSW 34
9.4.3 M ESSAGE RS_WATCH_DOG 35
9.5 MESSAGES FOR EXCHANGE OF VARIABLES ___________________________________ 35

9.5.1 E XCHANGE MESSAGE ACCESS TYPE 35


9.5.2 M ESSAGE XNG_FLAG 36
9.5.3 M ESSAGE XNG_WORD 37
9.5.4 M ESSAGE XNG_LONG 38
9.5.5 M ESSAGE XNG_REAL 39
9.5.6 M ESSAGE XNG_FLAG_KEY32 41
9.5.7 M ESSAGE XNG_WORD_KEY_32 42
9.5.8 M ESSAGE XNG_LONG_KEY32 43
9.5.9 M ESSAGE XNG_REAL_KEY32 45

10 PAM RS422 XON-XOFF HANDLING 47

10.1 PAM SEND XOFF _______________________________________________________ 47

10.2 PAM RECEIVE XOFF ____________________________________________________ 48

10.3 XON/XOFF CONSIDERATIONS _____________________________________________ 49

10.3.1 BUFFERS SITUATION 49


10.3.2 REACTION TO XOFF 49
10.4 HOST POSSIBLE IMPROVEMENTS _________________________________________ 50

10.4.1 MODIFICATION OF NEAR TO FULL VALUE 50


10.4.2 MAINTAINING OUTPUT BUFFER EMPTY 50
10.4.3 XON/XOFF MANAGEMENT AT CHAR LEVEL 50

11 PAM RS422 TIMEOUT AND PERIOD 51

11.1 WATCH DOG MECHANISM ________________________________________________ 51

11.1.1 RELATION BETWEEN TIMEOUT AND PERIOD 51


11.1.2 RS422 PORT SPECS 51

12 COMMUNICATION CONFIGURATION 53

12.1 PAM HARDWARE CONFIGURATION ________________________________________ 53

Table of Contents III


Technical Manual 006.8021.C PAM SOCAPEL SA

12.1.1 INSTALLATION OF MODULE 004.7025 53


12.1.2 J UMPERS CONFIGURATION ON PAM BOARD 53
12.1.3 PAM RS422 9 PINS CONNECTOR 55
12.2 PAM COMMUNICATION PARAMETERS______________________________________ 55

12.3 BAUD RATE FUNCTION OF PAM CYCLE ____________________________________ 55

APPENDIX A CRC COMPUTATION OF A VARIABLE 56

IV Table of Contents
SOCAPEL SA PAM Technical Manual 006.8021.C

1 INTRODUCTION
The RS422 serial communication channel allow to exchange variables between PAM and the RS422
Master.

The RS422 variables must be allocated in both PAM and RS422 Master memory.

In the PAM application language RS422 variables get a name, but to exchange variable value trough
the RS422 serial communication channel a KEY value is more fast and easy to use. The values of
these keys are exchanged during the configuration phase using the CRC value of the variable
definition in order to identify the variable. The KEY is a "user" reference, it can be the address of a
memory location, the index of an array, etc...

The communication protocol define the blocks protocol and the application protocol. The aim is to
exchange variable value in both direction.

1.1 ATTRIBUTE OF VARIABLES


RS422 variables have four attributes :

1.1.1 NAME OF A VARIABLE


The name of a variable is the name given in the PAM application language.

1.1.2 ID OF A VARIABLE
The PAM compiler affect an ID value for each PAM object, the ID value range from 0 to n
for each main class of object ( for example INTERNAL variables or RS422 variables)
The value of the ID is function of the position of the declared name in the application source
file. In PAM, objects are accessed only in using the ID value.

1.1.3 CRC OF A VARIABLE


The CRC value of a variable is a CRC computation applied to the name and parameters of the
variable declaration. This value is used instead of the name of the variable to identify with
only a numeric value a variable declaration.

1.1.4 KEY OF A VARIABLE


The KEY of a variable is used to access a variable, the KEY value (32 bits) may be the
location of the variable , an index to a table of variable, a case value for a switch statement,
etc...
For PAM RS422 inputs the KEY is an index value, for PAM RS422 outputs the key values
must be defined by the user.

Serial Line Protocol 1


Technical Manual 006.8021.C PAM SOCAPEL SA

2 RS422 SOFTWARE ON USER SIDE


In order to communicate with PAM a software that manage the rs422 communication channel at
characters level, blocks level and application level must be written.

If the user system support C language, the user may use the RS422 C utilities and examples to write
this software. If not, the user need to implement management of blocks and application protocol
with respect of protocol definitions.

There is 3 working phase for the RS422 software :

• Communication request.
• Configuration phase ( exchange of variables definitions).
• Execution phase ( exchange of variables values).

The PAM RS422 C utilities provide for the user all the functions needed for communication
request, configuration phase and the exchange of variable value during execution phase. Protocols
details at blocks level and application level, are hidden by the PAM RS422 utilities.

The RS422 utilities need to call some low level function in order to send and receive characters
trough the RS422 serial communication port.

The RS422 utilities need to call some application level function in order to update user variables.

2 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

3 USING PAM RS422 C UTILITIES


The PAM RS422 C utilities are provided to help the user to implement the RS422 application
interface on the user system.

The PAM RS422 C utilities is a library of C functions, designed to hide protocol details and to be
easy to use in order to realise the configuration phase and execution phase.

3.1 RS422 UTILITIES DELIVERY AND CONTENTS


The PAM RS422 Utilities are delivered as a part of the PAMTOOLS

After installation of the PAMTOOLS you will find 3 directories :

PAM\RS422\RS_UTIL
PAM\RS422\RS_USER
PAM\RS422\AGL

The .sub directory\RS_UTIL contents the main part of the RS422 C utilities

! 

Some functions have been modified in order to handel 32 bits unsigned integer
timouts

The .sub directory \RS_USER contents C files that show how to use functions of the RS422
utilities. You will also find a PC executable files (PC_DEMO.EXE ). To check RS422 link you
may run the PC_DEMO after having loading into PAM the application that you will find in the sub
directory \AGL.

Serial Line Protocol 3


Technical Manual 006.8021.C PAM SOCAPEL SA
3.2 RS422 UTILITIES IN USER CONTEXT
4 Serial Line Protocol
SOCAPEL SA PAM Technical Manual 006.8021.C
3.3 PAM & USER FILES OVERVIEW
is com piled by
Serial Line Protocol 5
Technical Manual 006.8021.C PAM SOCAPEL SA

3.4 USER SOFTWARE REQUIREMENT


The PAM RS422 C Utilities need to call some user functions :

The file USR_COMM.H (given by Socapel) define the functions prototypes used to interface the
PAM RS422 Utilities with the RS422 communication port (hardware dependant)

The user must implement the body of the functions describe in the USR_COMM.H file.

The file USR_FUNC.H (given by Socapel) define the functions prototypes used to interface the
PAM RS422 Utilities with the application level of the user software.
These functions allow to access the RS422 user's variable from the PAM RS422 utilities.

The user must implement the body of the functions describe in the USR_FUNC.H file.

Remark : in order to implement these functions the user need to create a kind of variables database.
This database must be accessed from some user functions, but if the user want to store the "RS422
software" in EPROM, the RS422 software must not be linked with the database, because the
database is application dependant.

3.5 USER' S VARIABLE DATABASE


For configuration phase and exchange of variable during execution phase, the user need to
create a kind of variable database in order to store the following information for each variable
(suggested structure) :

CRC identifier Application dependant, value are given in


a file generated by PAMCOMP
Variable type (use PAM class) given by PAM during configuration phase
maximum number of items given by PAM during configuration phase
KEY (RS422 key for output, space to PAM keys for inputs given by PAM
store PAM key for input) during configuration phase, RS422 key
for output determined by user.
address of the value of the variable. User information

The file PAMRS422.H depends of the application and is automatically generated during
execution of PAMCOMP.
This file is generated into the \AGL sub directory of the compiled application.

This file contents the CRC value corresponding to the variable declaration, the variable
identifier is used to give a name to the CRC value. We use the #define directive of the pre-
processor for C language :

#define <RS422 Variable identifier> <CRC value>

6 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

3.6 FILES OF THE RS422 UTILITIES


The file TYPE_DEF.H (given by Socapel, but user modifiable) defines somes scalar data
types in order to get for example a 16 bit integer, independently of the C compiler and the
target CPU.
This file must be included in the user file USR_FUNC.C

The file RS_CLASS.H depends of the PAM system version and defines the classes value of
RS422 variables.

The file RS_UTIL.H contents all the struct definitions and functions prototype of the PAM
RS422 C utilities.

The file RS_UTIL.C contents all the body of functions of the PAM RS422 C utilities.

The file RS_COMM.Ccontents functions for sending and receiving blocks


CRC_UTIL.C and FIFO.C are utility files.

This file and, sub files attached, must be compiled and linked with all other files of the user
software.

3.7 USER MAIN PROGRAM FLOW

Serial Line Protocol 7


Technical Manual 006.8021.C PAM SOCAPEL SA

4 CONFIGURATION PHASE
The declaration of RS422 variables at PAM application language level contents the identifier (or
name) of the variable, the type of the variable and the number of items of the variable.

On the RS422 master side, the variables must also be declared. The aim of the configuration phase
is to check if both declarations match and to exchange and store the KEY value of each variable.

To allow to identify a variable in order to check the declaration we use the CRC value. The CRC is
a number computed by the PAMCOMP compiler, using a 16 bits cyclic redundancy check applied
to all items of the variable declaration (name, type, size,...).
These CRC values are given in a include file for C programming language. The user must use these
CRC values to establish a list that make the relation between the CRC identifier and user
information on the user implementation of the variable corresponding to the PAM RS422 variable.

4.1 CONFIGURATION OF INPUT VARIABLES


A RS422 input variable is a variable that PAM read and RS422 master write.

For each input variable, the RS422 master must ask PAM to send to it the KEY value used by
PAM for this input. PAM send also the CRC value, class, number of items, ... to allow
checking.

The master have to store the receved KEY value for use in execution phase and also if master
need to send the initial value of the variable. ( the initial value is to be sent if non zero).

4.1.1 VARIABLE ID & KEY IN FUNCTION OF DECLARATION ORDER


The value of the PAM KEY for input variables is corresponding to the value of the ID.

REMARK : the value of the ID are given into the .DOC file

EXAMPLE :

INPUT FLAG_VAR toto_in ID = 0 KEY = 0


OUTPUT FLAG_VAR toto_out ID = 1 KEY = user
INPUT FLAG_VAR titi_in ID = 2 KEY = 2
OUTPUT FLAG_VAR titi_out ID = 3 KEY = user

8 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

4.2 CONFIGURATION OF OUTPUTS VARIABLES


A RS422 output variable is a variable that RS422 master read and PAM write.

For each output variable, the RS422 master must send to PAM the KEY value used by the
RS422 master for this output. PAM send also the CRC value, class, number of items, ... to
allow checking.

PAM store the KEY value for use during the execution phase.

Serial Line Protocol 9


Technical Manual 006.8021.C PAM SOCAPEL SA

5 RS422 UTILITIES, C ONFIGURATION FUNCTIONS


Here are the description of the functions of the RS422 utilities and the corresponding actions in
PAM.

5.1 INITIALISATION FUNCTION


extern usint16 init_pam_rs422_util(usint16 send_buffer_size,
usint16 receive_buffer_size,
usint32 disconnect_timeout,
usint16 cycle_time);

This function initialise the messages queue and memorise send and receive buffer size. The size of
buffer must be the same value used by the function that initilise the port.
The disconnect_timeout in [ms ] ( reception timeout for execution phase) is memorised.
The cycle_time in [ms] is memorised.

Before using the function init_pam_rs422_util, the user must initialise the RS422
! communication port and allocate the communication buffers.

5.2 COMMUNICATION REQUEST FUNCTION


/* get communication with pam */
/* return 0 = communication OK , 1 communication unsuccessfull */
extern int8 get_pam_rs422_comm(int32 timeout_value);

The timeout_value [ms] is the time during which the master try to get the
communication with PAM
WARNING This function call the user function :
extern void rs422_user_system_call(int16 cycle_time);
The function rs422_user_system_call (whose function prototype is given by file
USR_FUNC.H ) is needed to wait answer and to be able to manage a time out.

10 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

5.2.1 COMM. R EQUEST, M ASTER AND PAM ACTION


Master and PAM action when using get_pam_rs422_comm

-->

<--

5.3 FUNCTION FOR EXCHANGE OF CONFIGURATION COMMANDS

/* function for exchange with PAM of configuration command */


/* return : configuration answer sub_code (0 = no answer ) */

extern int8 xchng_config_cmd(s_config_cmd *p_cmd,


s_config_answ *p_answ,
int32 timeout_value );

The timeout_value [ms] is the time used to declare that there is no answer from PAM, we
recommand a value of 5000 ms.

Structure of the configuration command bloc :

typedef struct {
usint8 sub_code;
usint16 crc;
usint16 lsw_key;
usint16 msw_key;
} s_config_cmd ;

Serial Line Protocol 11


Technical Manual 006.8021.C PAM SOCAPEL SA

Structure of the configuration answer bloc :

typedef struct {
usint8 sub_code;
usint16 crc;
usint16 pam_key;
usint8 var_class /* class of the variable (PAM class value) */
usint8 item_nb /* max items of multiple variable */
} s_config_answ ;
LIST OF COMMAND SUB CODE VALUE:
RS_ASK_DEF_VAR 1 master ask PAM to send one RS422 definition.
RS_DEF_OUT_KEY16 2 master send one definition of output for PAM
(16 bits Key).
RS_DEF_OUT_KEY32 3 master send one definition of output for PAM
(32 bits Key).
RS_BEG_INIT_IN 4 master start to send initial value of some inputs
RS_START 5 master request PAM to start RS422 normal handling.

RS_START_AND_UPDATE_OUT 6 master request PAM to send all outputs value and
start RS422 normal handling.

LIST OF ANSWER SUB CODE VALUE:


RS_NO_ANSWER 0 answer missing (comm error or PAM disconnected).
RS_DEF_VAR_ANSW 1 variable definition answer.
RS_END_DEF_VAR 2 end of variable definition answer.
RS_DEF_OUT_ANSW 3 output definition answer.
RS_INIT_IN_OK 4 ready for receiving initial values
RS_BAD_OUT_CRC 5 crc of output definition not found.
RS_BAD_CFG_CMD 6 unknown configuration command received.
RS_STARTED 7 PAM start RS422 execution phase.
RS_START_REFUSED 8 PAM unable to start execution phase

5.4 EXCHANGE OF VARIABLE DEFINITION


Command and answer bloc contents :

RS422 Master --> RS_ASK_DEF_VAR

RS_DEF_VAR_ANSW <-- PAM


PAM crc value
PAM input key value, -1 for
Output
PAM class of variable
max. number of item

12 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

RS_END_DEF_VAR <-- PAM


To signal end
of variables
definitions

RS422 MASTER ACTION :

The RS422 master must send command RS_ASK_DEF_VAR until PAM acknowledge
RS_END_DEF_VAR.

For each definition the master must check if the given CRC value exist in its own list.
When CRC do not match, PAM have extra variables.
When CRC match, if master have fixed reservation, check of class and number of items must be
done.
For input with not matching definition, the RS422 master must cancel this input by using -1 for key
value, error may be reported but master must continue the configuration.
When all match, master store the input key.

For Output with not matching definition, the RS422 master must tag this output in order to avoid to
send later the key of this output.

PAM ACTION :

Pam return the variable definition as answer at each RS_ASK_DEF_VAR command.

i PAM initialises all input values at zero !

When PAM as no more variables definitions to send, the answer is RS_END_DEF_VAR

MASTER ACTION :

When RS422 master receive the answer RS_END_DEF_VAR, it must check in its own list if extra
variable definition remain.

5.4.1 CONFIGURATION ORDER


The PAM answers to the configuration commands RS_ASK_DEF_VAR, are corresponding
to the variable information given from ID = 0 to ID = RS422 var. NB -1

Serial Line Protocol 13


Technical Manual 006.8021.C PAM SOCAPEL SA

5.5 EXCHANGE OF OUTPUT KEY


The KEY of Output variables must be send to PAM

Command and answer bloc contents :

RS422 Master --> RS_DEF_OUT_KEY16


CRC value
master key

RS422 Master --> RS_DEF_OUT_KEY32


CRC value
lsw of master key
msw of master key

RS_DEF_OUT_ANSW <-- PAM

OR
RS_BAD_OUT_CRC <-- PAM

MASTER OUTPUT CONFIGURATION ACTIONS :

The RS422 master send all the output keys that are present in its own list.

When the master get the answer RS_DEF_OUT_ANSW, the master may initialise the output value
to 0 and send the next definition.

When master receive RS_BAD_OUT_CRC : error may be reported and master send the next
definition.

Master must initialise the outputs values in his own memory to 0


! PAM will only send changes from initial value. (All outputs are initialised at 0 on
PAM side)

The master send a command RS_BEG_INIT_IN or RS_START to signalise the end of output keys
definition !

14 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

PAM OUTPUT CONFIGURATION ACTIONS :

PAM check if CRC value match.


If CRC is OK, PAM store the master key and acknowledge RS_DEF_OUT_ANSW.

The value of each output is initialised to 0 !


If CRC not OK, PAM send back acknowledge BAD_CRC. (this output don' t exist for PAM) and
display error [0700003B]

When PAM receive command RS_BEG_INIT_IN or RS_START, it must check in its own list if
extra output definition remain. The key value of these extra definitions are set to -1 to cancel them.
No error are displayed.

5.6 INITIALISING SOME INPUT VALUE


This command allow the master to send the initial value of some inputs (other than 0 because PAM
initialise by default all inputs to 0) before PAM start the normal processing of all the application.

The master sends initial values of inputs using the stantard exchange variable functions !

Command and answer bloc contents :

RS422 Master --> RS_BEG_INIT_IN

Normal answer
RS_INIT_IN_OK <-- PAM

PAM and Master action :

When PAM receive the command RS_BEG_INIT_IN, PAM answer RS_INIT_IN_OK and wait for
exchange variable commands, PAM don't answer to the exchange variable command.

The master must send a RS_START command to tell PAM that there no more initial value for
inputs.

Serial Line Protocol 15


Technical Manual 006.8021.C PAM SOCAPEL SA

5.7 STARTING PAM


Command and answer bloc contents :

RS422 Master --> RS_START

PAM answer
RS_STARTED <-- PAM

Start refused answer


RS_START_REFUSED <-- PAM

Master Action :

If answer is RS_STARTED, the Master start to perform normal work.


If answer is RS_START_REFUSED the master may try to continue with a variable configutation
that is not garantee.

PAM action :

Answers RS_STARTED if all phases of configuration are done, then PAM start to write into
OUTPUT FIFO new value of OUTPUTS, start to scan input fifo and PAM start the watch dog
handling.
Send RS_START_REFUSED if configuration phases are missing, and display error [0700003D],
but PAM try to continue working.

16 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

5.7.1 STARTING PAM WITH UPDATE OF OUTPUTS



The command RS_START_AND_UPDATE_OUT is introduced as reserve for a future
implementation.

The command RS_START_AND_UPDATE_OUT acts exactly like command


! RS_START

Need of updating outputs at start :

During the disconnection of the serial line, the PAM application continue working and may
internally update RS422 output variables.
When the MASTER connects again to PAM, the configuration phase do not reset the value of
outputs as the first configuration after PAM power up do. This leads to a situation where
value of outputs may be different between PAM and Master.

Serial Line Protocol 17


Technical Manual 006.8021.C PAM SOCAPEL SA

5.8 PAM ERROR MESSAGES DURING CONFIGURATION


During configuration of Outputs PAM display the following error :

[0700003B] "Automate" Error


==========================
Unvalid RS422 Output CRC !
==========================

Description : This error may appear during configuration


phase when the received CRC of the definition of an RS422
Output variable is not known from PAM.

D1 : given CRC value


D2 : given KEY value
D3 : 0

During initialisation of input value PAM display the following errors :

[0700003C] "Automate" Error


===========================
Bad RS422 Input KEY value !
===========================

Description : This error may appear during configuration


phase, when master send initial value for inputs, if the
received KEY of an RS422 Input variable is not known from
PAM.
D1 : given KEY value
D2 : PAM KEY value if unmatch, FFFFFFFf if unvalid key
D3 : 0

[0700003E] "Automate" Error


=======================
Bad RS422 Input class !
=======================

Description : This error may appear during configuration


phase, when master send initial value for inputs, if the
received class of an RS422 do not match with PAM class of
the variable. The class is given by the XNG_xxx command.

D1 : given class
D2 : PAM class
D3 : 0

18 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

Global configuration error :

[0700003D] "Automate" Error


=========================
Bad RS422 Configuration !
=========================

Description : This error may appear after configuration


phase, when some configuration errors did appear during
the configuration.

Serial Line Protocol 19


Technical Manual 006.8021.C PAM SOCAPEL SA

6 EXECUTION PHASE

6.1 HANDLING OF INPUTS BY PAM


PAM checks each 5 PAM basic cycles if some RS422 messages are queued.
When PAM find a message, the key value is extracted and used to find the variable information. If
the key received and the key stored do not match, PAM skip treatment of this bloc. If keys are
matching, PAM then check the index value, if not correct the treatment is also skipped.
If the value of index is correct then PAM update the input variable and propagate the change to
Boolean equations using this variable.

6.2 HANDLING OF OUTPUTS BY PAM


When PAM detects a change on an RS422 output variable, PAM prepares a message ( key, index,
new value) and queue it into the RS422 send message list.

Refer to protocol description for detailed message contents.

6.3 HANDLING OF INPUTS BY RS422 MASTER


When the RS422 master detects a change on an RS422 input variable, the master uses the
send_variables functions of the PAM RS422 to send this information to PAM.

Refer to protocol description for detailed message contents.

6.4 HANDLING OF OUTPUTS BY RS422 MASTER


The RS422 master must cyclically call the function scan_rs422_pam_out in order to process
messages sent by PAM.
The function process the content of the message and execute a call to user function in order to
update the variable. The update parameters are : key, index (0 if single variable, new value).
The user must implement these funtions for updating variables in taking care of checking key
validity and index validity for multiple variable.
The prototypes of these functions are described in the file USR_FUNC.H

20 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

6.5 COMMUNICATION WATCH DOG


In order to check if master and PAM are still connected the watch dog message must be exchanged
between master and PAM.

The watch dog message must be sent if no other message as been sent during approximatively "n"
ms. The "n" value is specified by the PAM_WATCHDOG_MESSAGE_PERIOD parameter.

Disconnection is detected if no message received during approximately "t" ms. The "t" value is
specified by the MASTER_INACTIVITY_TIMEOUT parameter.
t
According with n ≤
2
This value must be greater than the time of inactivity required to send watch dog message.
These values are given on PAM side as parameters of the RS422 declaration in the application.

The cyclically called function scan_rs422_pam_out perform watch dog handling on master side.

6.5.1 PAM ACTION WHEN RS422 MASTER IS NOT RUNNING


When the master is considered as inactive because the MASTER_INACTIVITY_TIMEOUT
has been reached, PAM acts as follows:
• The RS422Port ? error becames true.
• Application continue to be executed but with all RS422 variables handled as internal
variables.
• PAM is waiting for next master communication request.

6.5.2 PAM BEHAVIOUR IN CASE OF FATAL ERROR


In case of fatal error PAM stops to send messages.

If the fatal error is a ring broken error, PAM is still able to answer a COMM_REQ from
MASTER and to start the configuration phase. But when the execution phase starts, because
of the fatal error, PAM do not send any messages. So this situation leads to an endless
connection requested from MASTER and disconnection by PAM.


To avoid the mentioned situation, PAM, in case of fatal error do not answer to COMM_REQ
command.

Serial Line Protocol 21


Technical Manual 006.8021.C PAM SOCAPEL SA

7 RS422 UTILITIES, E XECUTION FUNCTIONS


The PAM RS422 C utilities contents one function per type of variable to send and one general
receive function.

7.1 SEND VARIABLES FUNCTIONS


Like there is four type of PAM inputs : flag, word, long, real ; and like we consider multiple and
single variables, there is four send functions for single variables and four for multiple variable :

/* send functions for PAM single inputs */


/* return RS_SEND_OK or RS_SEND_NO_MEMORY or RS_SEND_BUFFER_FULL */
With :
RS_SEND_OK 0
RS_SEND_NO_MEMORY 1
RS_SEND_BUFFER_FULL 2

extern int16 send_rs422_single_flag( usint16 pam_key, int8 value);


extern int16 send_rs422_single_word( usint16 pam_key, int16 value);
extern int16 send_rs422_single_long( usint16 pam_key, int32 value);
extern int16 send_rs422_single_real( usint16 pam_key, float64 value);

/* send functions for multiple PAM inputs */


/* return RS_SEND_OK or RS_SEND_NO_MEMORY or RS_SEND_BUFFER_FULL */

extern int16 send_rs422_flag( usint8 access, /* acces code */


usint8 lwr_index, /* lower index */
usint8 upr_index, /* upper index */
usint16 pam_key,
int8 *p_val); /* ptr to first val*/
extern int16 send_rs422_word( usint8 access, /* acces code */
usint8 lwr_index, /* lower index */
usint8 upr_index, /* upper index */
usint16 pam_key,
int16 *p_val); /* ptr to first val*/
extern int16 send_rs422_long( usint8 access, /* acces code */
usint8 lwr_index, /* lower index */
usint8 upr_index, /* upper index */
usint16 pam_key,
int32 *p_val); /* ptr to first val*/
extern int16 send_rs422_real( usint8 access, /* acces code */
usint8 lwr_index, /* lower index */
usint8 upr_index, /* upper index */
usint16 pam_key,
float64 *p_val); /* ptr to first val*/

22 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

The parameters of these functions take care of the multiple variable handling capability of PAM.
The access code is a parameter that define how the contents of multiple variables must be accessed:

ACCESS_SINGLE 0 Access to a single variable.


ACCESS_ONE 1 Access to an item of a multiple variable.
ACCESS_RANGE 2 Access to some item of a multiple variable, one
value
for all items.
ACCESS_RANGE_CORR 3 Access to some item of a multiple variable, one
particular value for each item.
ACCESS_ALL 4 Access to all items of a multiple variable, one value
for
all items.
ACCESS_ALL_CORR 5 Access to all items of a multiple variable, one
particular value for each item.

Access to p_val in function of access code :

ACCESS_SINGLE access to *p_val


ACCESS_ONE access to *(p_val + lwr_index)
ACCESS_RANGE access to *p_val
ACCESS_RANGE_CORR access to *(p_val + i ) with i ranging from lower to upper index
ACCESS_ALL access to *p_val
ACCESS_ALL_CORR access to *(p_val + i ) with i ranging from lower to upper index

Serial Line Protocol 23


Technical Manual 006.8021.C PAM SOCAPEL SA

7.2 SCAN PAM MESSAGES FUNCTION


The PAM RS422 Utilities provide only one function for receiving PAM message, this function must
be cyclically called. This function perform the following actions:
• messages building and queuing
• communication error detection
• communication supervision.

The function scan_rs422_pam_out contents a loop that call the block sender and
i block receiver a number of time that correspond to the given cycle_time value divide
by 2
This to have a block production and consommtion indepandant of the duration of the
user cycle.

User working with concurrent operating system may modify the scan_rs422_pam_out
i function and make call from concurrent routine to block sender and block receiver.

This function returns the rx_error_code :

typedef enum { RS_RECEIVE_OK,


RS_RECEIVE_COMM_ERROR,
RS_RECEIVE_PAM_INACTIVE,
RS_RECEIVE_COMMAND_REFUSED,
RS_RECEIVE_BAD_COMMAND_CODE,
RS_CONFIG_START_REFUSED
} rx_error_code;
extern rx_error_code scan_rs422_pam_out();

In order to update user's variables, this function need to call the following user funtions :

extern void update_rs422_flag (usint16 lsw_key, usint16 msw_key,


usint16 index, int8 value );
extern void update_rs422_word (usint16 lsw_key, usint16 msw_key,
usint16 index, int16 value );
extern void update_rs422_long (usint16 lsw_key, usint16 msw_key,
usint16 index, int32 value );
extern void update_rs422_real (usint16 lsw_key, usint16 msw_key,
usint16 index, float64 value );

24 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

7.3 RS422 EXECUTION PHASE ERRORS


The various error messages related to RS422 communication during execution phase are given
below:
[07000033] "Automate" System Error
======================
Access type refused !
======================
Description : attempt to read or write into an PAM object
with an ACCESS TYPEthat can not be used with the accessed
object

Current access type are :


ACCESS_SINGLE 0 access to a single variable.
ACCESS_ONE 1 access to an item of a multiple
variable.
ACCESS_RANGE 2 access to some items of a multiple
variable, one value for all items.
ACCESS_RANGE_CORR 3 access to some items of a multiple var,
one particular value for each item.
ACCESS_ALL 4 access to all items of a multiple
variable, one value for all items.
ACCESS_ALL_CORR 5 access to all items of a multiple var,
one particular value for each item.
System error : This error must normally never appear.

[07000034] "Automate" System Error


===================
Bad access type !
===================

Description : attempt to read or write into an PAM object


with an ACCESS TYPE those value is not in the above list.

System error : This error must normally never appear.

[07000035] "Automate" Error


=========================
RS422 User no activity !
=========================
Description : This message appear with a RS422 communication
when PAM detect that the elapsed time without receiving
any messages from the RS422 master is beyond the given time.

Serial Line Protocol 25


Technical Manual 006.8021.C PAM SOCAPEL SA

[07000036] "Automate" Error


=======================
RS422 Command refused !
=======================
Description : This message appear with a RS422 communication
when PAM receive a valid RS422 command but not executable
within the phase in witch PAM works. Examples : configuration
command during execution phase or execution command during
configuration phase.

[07000037] "Automate" Error


========================
RS422 bad command code !
========================

Description : This message appear with a RS422 communication


when PAM receive an non valid RS422 command.

[07000038] "Automate" Error


===============================
RS422 timeout waiting to send !
===============================

Description : This message appear with a RS422 communication


only with rs422 variables linked to equations, when time
is over waiting to insert a message in the send queue.

Cause of error : too many equations with linked output to


RS422 variables with too many changes at the same time.
Solution : Check linked equations to RS422 outputs and try
to reduce number of changes at the same time.

[07000039] "Automate" Error


===================================
RS422 communication disconnected !
===================================
Description : This message appear with a RS422 communication
in two cases :
1. When PAM is waiting for communication request from master
and that the elapsed time without receiving communication
request command is beyond the given time.

2. If communication errors occurs during execution phase.


In this case the error 07000039 is displayed after the error
0700003A that display the detail of the communication problem.

26 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

[0700003A] "Automate" Error

============================
RS422 communication error !
============================

Description : This message give the description of a RS422


communication error :
D1: communication status :
1 memory allocation error
2 port error
3 bad message crc
4 bad message END char.
5 bad message START char.
6 receive chars buffer full
D2 : 0
D3 : 0

Serial Line Protocol 27


Technical Manual 006.8021.C PAM SOCAPEL SA

8 RS422 COMMUNICATION PROTOCOL


The communication protocol is designed to have a full duplex communication betwen the PAM and
the RS422 Master. This protocol is oriented to exchange small bloks of binary information. The
flow control is implemented by software using XON/XOFF characters inserted between blocks.

This communication protocol is designed for a high quality communication line.

The communication line is considered to be perfect or broken.


!
There are two levels of protocols:
Blocks protocol, describe delimiters characters needed to exchange the application message.
Application protocol, describe the contents of the application messages.

8.1 BLOCKS PROTOCOL

STX block size Application message 16 bits CRC ETX

<STX> : Start of text ASCII control character. (0x02)

<block size> : size in byte of the application message. (0 ÷255)

<application message> : n bytes of application data (binary)

< 16 bits CRC> : Cyclic Redundancy check applied application message (2 bytes,
first = lsb )

<ETX> : End of text ASCII control character (0x03)

8.2 ERROR DETECTION


The error detection is based on the Cyclic Redundancy check of the message in order to detect if a
block is correct or not.

In the case of bad block received the content of the block is lost, and there no special procedure for
repeating the block.

It is considered that the communication line is perfect or broken.

28 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

8.3 BLOCKS RESYNCHRONISATION


After reception of a bad block, the block building function search for the next STX and try to build
a block from here. With this method a block more may be lost, but we consider if a bad block is
received, that the line, in 99 % of the cases, begin to be disconnected.

8.4 XON XOFF CONSIDERATIONS


Some considerations can be given:
• Xon and Xoff characters may only be inserted between blocks (messages)
• Standard send characters functions like the requested put_char_in_rs422_buffer queue the
Xoff char.
• The reception of characters is often made under interrupt and due to the binary contents of
messages Xon and Xoff char. may only be treated at block level.

The above considerations show us that in case of exchange of messages in both direction using the
maximum capability of the RS422 channel, if the receiver need to send the Xoff char., the free
space of the input buffer must be in the worst case : size of output buffer + "near full" size of input
buffer of the other system.
We can conclude that it is not possible to dimension the buffer size for the worst case !

Recommendation to get a reliable Xoff Xon management:


! • Output buffer size must be half the free size of input buffer when near full.
• Example with input buffer of 1000 , near full at 75% output buffer size will
be 250 / 2 = 125.

Serial Line Protocol 29


Technical Manual 006.8021.C PAM SOCAPEL SA

9 APPLICATION PROTOCOL
The application protocol describes the content of the application message. The message contents at
least a function code. The content of the message depends of the function code.

The PAM RS422 C Utilities hides all the details of this protocol, except for some function codes the
user have to know for the configuration phase.
The examples given with the RS422 C utilities will show the usage of all functions.

This part describes the detailed structure of all messages.

9.1 FUNCTION CODES


Code Sub code or
access type
4 bits 4 bits

LIST OF FUNCTION CODES :

COMM_REQ 1 Master -> PAM, communication reqest.


COMM_ACK 2 Master <- PAM, communication acknowledge.
CONFIG_CMD 3 Master -> PAM, configuration command.
CONFIG_ANSW 4 Master <- PAM, configuration answer.
RS_WATCH_DOG 5 Master <-> PAM, watch dog message.
XNG_FLAG 6 Master <-> PAM, exchang of Flag variable.
XNG_WORD 7 Master <-> PAM, exchang of Word variable (16 bits)
XNG_LONG 8 Master <-> PAM, exchang of Long variable (32 bits)
XNG_REAL 9 Master <-> PAM, exchang of Real variable (64 bits float).
XNG_FLAG_KEY32 10 Master <-- PAM, exchang of 32 bits key, Flag variable.
XNG_WORD_KEY32 11 Master <-- PAM, exchang of 32 bits key, Word variable.
XNG_LONG_KEY32 12 Master <-- PAM, exchang of 32 bits key, Long variable.
XNG_REAL_KEY32 13 Master <-- PAM, exchang of 32 bits key, Real variable.

Remarks : PAM use the XNG_xxxx_KEY32 to send outputs to the master if the msw of the key
value is non zero. The PAM key is always 16 bits.

30 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

9.1.1 MULTIBYTES VALUES


Any multi bytes values are described as array of bytes (unsigned char in C)

Example, a 32 bits KEY is describe as :

KEY [0] KEY [1] KEY [2] KEY [3]

Where KEY[0] is the less significant byte.

This way of weighting the bytes is corresponding to the C compiler implementation when
using for example an union.

typedef union {
unsigned char bytes[4];
long value;
} u_key_4 ;
with:
u_key_4 test = 0x12345678 we get :
test.bytes[0] = 0x78, test.bytes[1] = 0x56, test.bytes[2] = 0x34, test.bytes[3] = 0x12

9.2 MESSAGE COMM_REQ


Message structure :
[0]
cod&sub
1 ][ 0

9.3 MESSAGE COMM_ACK


Message structure :
[0]
cod&sub
2 ][ 0

Serial Line Protocol 31


Technical Manual 006.8021.C PAM SOCAPEL SA

9.4 CONFIGURATION MESSAGES

9.4.1 MESSAGE CONFIG_CMD


LIST OF SUB CODE VALUE :
RS_ASK_DEF_VAR 1 master ask PAM to send one PAM variable definition.
RS_DEF_OUT_KEY16 2 master send one definition of output for PAM (16 bits Key).
RS_DEF_OUT_KEY32 3 master send one definition of output for PAM (32 bits Key).
RS_BEG_INIT_IN 4 master start to send initial value of some inputs
RS_START 5 master request PAM to start RS422 normal handling.

RS_START_AND_UPDATE_OUT 6 master request PAM to send all outputs value
and start RS422 normal handling.

Message structure with sub code RS_ASK_DEF_VAR :


[0]
cod&sub
3 ][ 1

Message structure with sub code DEF_OUT_KEY16 :


[0] [1] [2] [3] [4]
cod&sub Pam def. Pam def. Master Master
3 ][ 2 CRC [0] CRC [1] KEY [0] KEY [1]

Message structure with sub code DEF_OUT_KEY32 :


[0] [1] [2] [3] [4] [5] [6]
cod&sub Pam def. Pam def. Master Master Master Master
3 ][ 3 CRC [0] CRC [1] KEY [0] KEY [1] KEY [2] KEY [3]

Message structure with sub code RS_BEG_INIT_IN :


[0]
cod&sub
3 ][ 4

Message structure with sub code RS_START:


[0]
cod&sub
3 ][ 5

32 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C


Message structure with sub code RS_START_AND_UPDATE_OUT:
[0]
cod&sub
3 ][ 6

Serial Line Protocol 33


Technical Manual 006.8021.C PAM SOCAPEL SA

9.4.2 MESSAGE CONFIG_ANSW

LIST OF SUB CODE VALUE :


RS_NO_ANSWER 0 answer missing (comm error or PAM disconnected).
RS_DEF_VAR_ANSW 1 variable definition answer.
RS_END_DEF_VAR 2 end of variables definition.
RS_DEF_OUT_ANSW 3 output definition answer.
RS_INIT_IN_OK 4 ready for receiving initial values
RS_BAD_OUT_CRC 5 crc of output definition not found.
RS_BAD_CFG_CMD 6 unknown configuration command received.
RS_STARTED 7 PAM start RS422 execution phase.
RS_START_REFUSED 8 PAM unable to start execution phase

Message structure with sub code RS_NO_ANSWER :


[0]
cod&sub
4 ][ 0

Message structure with sub code RS_DEF_VAR_ANSW :


[0] [1] [2] [3] [4] [5] [6]
cod&sub Pam def. Pam def. PAM PAM Variable max
4 ][ 1 CRC [0] CRC [1] KEY [0] KEY [1] class number

Message structure with sub code RS_END_DEF_VAR :


[0]
cod&sub
4 ][ 2

Message structure with sub code RS_DEF_OUT_ANSW :


[0]
cod&sub
4 ][ 3

Message structure with sub code RS_INIT_IN_OK :


[0]
cod&sub
4 ][ 4

34 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

Message structure with sub code RS_BAD_OUT_CRC :


[0]
cod&sub
4 ][ 5

Message structure with sub code RS_BAD_CFG_CMD :


[0]
cod&sub
4 ][ 6

Message structure with sub code RS_STARTED :


[0]
cod&sub
4 ][ 7

Message structure with sub code RS_START_REFUSED :


[0]
cod&sub
4 ][ 8

9.4.3 MESSAGE RS_WATCH_DOG


Message structure :
[0]
cod&sub
5 ][ 0

9.5 MESSAGES FOR EXCHANGE OF VARIABLES

9.5.1 EXCHANGE MESSAGE ACCESS TYPE


ACCESS_SINGLE 0 Access to a single variable.
ACCESS_ONE 1 Access to an item of a multiple variable.
ACCESS_RANGE 2 Access to some item of a multiple variable, one
value for all items.
ACCESS_RANGE_CORR 3 Access to some item of a multiple variable, one
particular value for each item.
ACCESS_ALL 4 Access to all items of a multiple variable, one value
for all items.
ACCESS_ALL_CORR 5 Access to all items of a multiple variable, one
particular value for each item.

Serial Line Protocol 35


Technical Manual 006.8021.C PAM SOCAPEL SA

9.5.2 MESSAGE XNG_FLAG


Message structure with ACCESS_SINGLE (16 bits key) :
[0] [1] [2] [3]
cod&sub KEY [0] KEY [1] Value
6 ][ 0 (0 or 1)

Message structure with ACCESS_ONE (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] INDEX Value
6 ][ 1 (0 or 1)

Message structure with ACCESS_RANGE (16 bits key) :


[0] [1] [2] [3] [4] [5]
cod&sub KEY [0] KEY [1] LOWER UPPER Value
6 ][ 2 INDEX INDEX (0 or 1)

Message structure with ACCESS_RANGE_CORR (16 bits key) :


[0] [1] [2] [3] [4] [5] [6] [?]
cod&sub KEY [0] KEY [1] LOWER UPPER Bits Bits Bits
6 ][ 3 INDEX INDEX [0..7] [8..15] [x..x+7]
Remark : bit 0 is the value for lower index.

Message structure with ACCESS_ALL (16 bits key) :


[0] [1] [2] [3] [4] [5]
cod&sub KEY [0] KEY [1] 0 UPPER Value
6 ][ 4 INDEX (0 or 1)

Message structure with ACCESS_ALL_CORR (16 bits key) :


[0] [1] [2] [3] [4] [5] [6] [?]
cod&sub KEY [0] KEY [1] 0 UPPER Bits Bits Bits
6 ][ 5 INDEX [0..7] [8..15] [x..x+7]

36 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

9.5.3 MESSAGE XNG_WORD


Message structure with ACCESS_SINGLE (16 bits key) :
[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] Value Value
7 ][ 0 [0] [1]

Message structure with ACCESS_ONE (16 bits key) :


[0] [1] [2] [3] [4] [5]
cod&sub KEY [0] KEY [1] INDEX Value Value
7 ][ 1 [0] [1]

Message structure with ACCESS_RANGE (16 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub PAM PAM LOWER UPPER Value Value
7 ][ 2 KEY [0] KEY [1] INDEX INDEX [0] [1]

Message structure with ACCESS_RANGE_CORR (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] LOWER UPPER
7][ 3 INDEX INDEX

[5] [6] [?] [?]


Value Value Value Value
[lower,0] [lower,1] [upper,0] [upper,1]

Message structure with ACCESS_ALL (16 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub PAM PAM 0 UPPER Value Value
7 ][ 4 KEY [0] KEY [1] INDEX [0] [1]

Message structure with ACCESS_ALL_CORR (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] 0 UPPER
7][ 5 INDEX

[5] [6] [?] [?]


Value Value Value Value
[0,0] [0,1] [upper,0] [upper,1]

Serial Line Protocol 37


Technical Manual 006.8021.C PAM SOCAPEL SA

9.5.4 MESSAGE XNG_LONG


Message structure with ACCESS_SINGLE (16 bits key) :
[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] Value Value Value Value
8 ][ 0 [0] [1] [2] [3]

Message structure with ACCESS_ONE (16 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7]
cod&sub KEY [0] KEY [1] INDEX Value Value Value Value
8][ 1 [0] [1] [2] [3]

Message structure with ACCESS_RANGE (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] LOWER UPPER
8][ 2 INDEX INDEX

[5] [6] [7] [8]


Value Value Value Value
[0] [1] [2] [3]

Message structure with ACCESS_RANGE_CORR (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] LOWER UPPER
8][ 3 INDEX INDEX

[5] [6] [7] [8] [?] [? [?] [?]


Value Value Value Value Value Value Value Value
[lower,0] [lower,1] [lower,2] [lower,3] [upper,0] [upper,1] [upper,2] [upper,3]

Message structure with ACCESS_ALL (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] 0 UPPER
8][ 4 INDEX

[5] [6] [7] [8]


Value Value Value Value
[0] [1] [2] [3]

38 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

Message structure with ACCESS_ALL_CORR (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] 0 UPPER
8][ 5 INDEX

[5] [6] [7] [8] [?] [? [?] [?]


Value Value Value Value Value Value Value Value
[0,0] [0,1] [0,2] [0,3] [upper,0] [upper,1] [upper,2] [upper,3]

9.5.5 MESSAGE XNG_REAL


Message structure with ACCESS_SINGLE (16 bits key) :
[0] [1] [2]
cod&sub KEY [0] KEY [1]
9 ][ 0

[3] [4] [5] [6] [7] [8] [9] [10]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_ONE (16 bits key) :


[0] [1] [2] [3]
cod&sub KEY [0] KEY [1] INDEX
9][ 1

[4] [5] [6] [7] [8] [9] [10] [11]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_RANGE (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] LOWER UPPER
9 ][ 2 INDEX INDEX

[5] [6] [7] [8] [9] [10] [11] [12]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Serial Line Protocol 39


Technical Manual 006.8021.C PAM SOCAPEL SA

Message structure with ACCESS_RANGE_CORR (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] LOWER UPPER
9][ 3 INDEX INDEX

[5] [6] [7] [8] [9] [10] [11] [12]


Value Value Value Value Value Value Value Value
[lower,0] [lower,1] [lower,2] [lower,3] [lower,4] [lower,5] [lower,6] [lower,7]

[?] [?] [?] [?] [?] [?] [?] [?]


Value Value Value Value Value Value Value Value
[upper,0] [upper,1] [upper,2] [upper,3] [upper,4] [upper,5] [upper,6] [upper,7]

Message structure with ACCESS_ALL (16 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] 0 UPPER
9 ][ 4 INDEX

[5] [6] [7] [8] [9] [10] [11] [12]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_ALL_CORR (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] 0 UPPER
9][ 5 INDEX

[5] [6] [7] [8] [9] [10] [11] [12]


Value Value Value Value Value Value Value Value
[0,0] [0,1] [0,2] [0,3] [0,4] [0,5] [0,6] [0,7]

[?] [?] [?] [?] [?] [?] [?] [?]


Value Value Value Value Value Value Value Value
[upper,0] [upper,1] [upper,2] [upper,3] [upper,4] [upper,5] [upper,6] [upper,7]

40 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

9.5.6 MESSAGE XNG_FLAG_KEY32


Message structure with ACCESS_SINGLE (32 bits key) :
[0] [1] [2] [3] [4] [5]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] Value
10 ][ 0 (0 or 1)

Message structure with ACCESS_ONE (32 bits key) :


[6] [7] [8] [9] [10] [11] [12]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] INDEX Value
10 ][ 1 (0 or 1)

Message structure with ACCESS_RANGE (32 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] LOWER UPPER Value
10 ][ 2 INDEX INDEX (0 or 1)

Message structure with ACCESS_RANGE_CORR (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
10 ][ 3

[5] [6] [7] [8] [?]


LOWER UPPER Bits Bits Bits
INDEX INDEX [0..7] [8..15] [x..x+7]
Remark : bit 0 is the value for lower index.

Message structure with ACCESS_ALL (32 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] 0 UPPER Value
10 ][ 4 INDEX (0 or 1)

Message structure with ACCESS_ALL_CORR (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
10 ][ 5

[5] [6] [7] [8] [?]


0 UPPER Bits Bits Bits
INDEX [0..7] [8..15] [x..x+7]

Serial Line Protocol 41


Technical Manual 006.8021.C PAM SOCAPEL SA

9.5.7 MESSAGE XNG_WORD_KEY_32


Message structure with ACCESS_SINGLE (32 bits key) :
[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] Value Value
11 ][ 0 [0] [1]

Message structure with ACCESS_ONE (32 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] INDEX Value Value
11 ][ 1 [0] [1]

Message structure with ACCESS_RANGE (32 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7] [8]
cod&sub PAM PAM PAM PAM LOWER UPPER Value Value
11 ][ 2 KEY [0] KEY [1] KEY [2] KEY [3] INDEX INDEX [0] [1]

Message structure with ACCESS_RANGE_CORR (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
11][ 3

[5] [6] [7] [8] [?] [?]


LOWER UPPER Value Value Value Value
INDEX INDEX [lower,0] [lower,1] [upper,0] [upper,1]

Message structure with ACCESS_ALL (32 bits key) :


[0] [1] [2] [3] [4] [5] [6] [7] [8]
cod&sub PAM PAM PAM PAM 0 UPPER Value Value
11 ][ 4 KEY [0] KEY [1] KEY [2] KEY [3] INDEX [0] [1]

Message structure with ACCESS_ALL_CORR (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
11][ 5

[5] [6] [7] [8] [?] [?]


LOWER UPPER Value Value Value Value
INDEX INDEX [0,0] [0,1] [upper,0] [upper,1]

42 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

9.5.8 MESSAGE XNG_LONG_KEY32


Message structure with ACCESS_SINGLE (32 bits key) :
[0] [1] [2] [3] [4] [5] [6] [7] [8]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] Value Value Value Value
12 ][ 0 [0] [1] [2] [3]

Message structure with ACCESS_ONE (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
12][ 1

[5] [6] [7] [8] [9]


INDEX Value Value Value Value
[0] [1] [2] [3]

Message structure with ACCESS_RANGE (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
12][ 2

[5] [6] [7] [8] [9] [10]


LOWER UPPER Value Value Value Value
INDEX INDEX [0] [1] [2] [3]

Message structure with ACCESS_RANGE_CORR (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] LOWER UPPER
12][ 3 INDEX INDEX

[7] [8] [9] [10] [?] [? [?] [?]


Value Value Value Value Value Value Value Value
[lower,0] [lower,1] [lower,2] [lower,3] [upper,0] [upper,1] [upper,2] [upper,3]

Serial Line Protocol 43


Technical Manual 006.8021.C PAM SOCAPEL SA

Message structure with ACCESS_ALL (32 bits key) :


[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
12][ 4

[5] [6] [7] [8] [9] [10]


0 UPPER Value Value Value Value
INDEX [0] [1] [2] [3]

Message structure with ACCESS_ALL_CORR (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] 0 UPPER
12][ 5 INDEX

[7] [8] [9] [10] [?] [? [?] [?]


Value Value Value Value Value Value Value Value
[0,0] [0,1] [0,2] [0,3] [upper,0] [upper,1] [upper,2] [upper,3]

44 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

9.5.9 MESSAGE XNG_REAL_KEY32


Message structure with ACCESS_SINGLE (32 bits key) :
[0] [1] [2] [3] [4]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3]
13 ][ 0

[5] [6] [7] [8] [9] [10] [11] [12]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_ONE (32 bits key) :


[0] [1] [2] [3] [4] [5]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] INDEX
13][ 1

[6] [7] [8] [9] [10] [11] [12] [13]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_RANGE (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] LOWER UPPER
13 ][ 2 INDEX INDEX

[7] [8] [9] [10] [11] [12] [13] [14]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Serial Line Protocol 45


Technical Manual 006.8021.C PAM SOCAPEL SA

Message structure with ACCESS_RANGE_CORR (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] LOWER UPPER
13][ 3 INDEX INDEX

[7] [8] [9] [10] [11] [12] [13] [14]


Value Value Value Value Value Value Value Value
[lower,0] [lower,1] [lower,2] [lower,3] [lower,4] [lower,5] [lower,6] [lower,7]

[?] [?] [?] [?] [?] [?] [?] [?]


Value Value Value Value Value Value Value Value
[upper,0] [upper,1] [upper,2] [upper,3] [upper,4] [upper,5] [upper,6] [upper,7]

Message structure with ACCESS_ALL (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] 0 UPPER
13 ][ 4 INDEX

[7] [8] [9] [10] [11] [12] [13] [14]


Value Value Value Value Value Value Value Value
[0] [1] [2] [3] [4] [5] [6] [7]

Message structure with ACCESS_ALL_CORR (32 bits key) :


[0] [1] [2] [3] [4] [5] [6]
cod&sub KEY [0] KEY [1] KEY [2] KEY [3] 0 UPPER
13][ 5 INDEX0

[7] [8] [9] [10] [11] [12] [13] [14]


Value Value Value Value Value Value Value Value
[0,0] [0,1] [0,2] [0,3] [0,4] [0,5] [l0,6] [0,7]

[?] [?] [?] [?] [?] [?] [?] [?]


Value Value Value Value Value Value Value Value
[upper,0] [upper,1] [upper,2] [upper,3] [upper,4] [upper,5] [upper,6] [upper,7]

46 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

10 PAM RS422 XON-XOFF HANDLING


This chapter describes the principles used to generates the Xon and Xoff characters to control the
communication flow.

10.1 PAM SEND XOFF


PAM inserts the Xoff character when the following situation appears:
• When the char input buffer is near Full (75 %), an Xoff character is inserted in the Output
buffer.
The Xoff character can only be inserted after the last queued bloc into the output buffer. If
the output buffer is near full, all the output buffer contents must be sent before the Xoff
character can be sent on the line.

Received messages and RX driver


pointer queue 1024 Char Input Buffer
RX
R
Near full
(free space < 25 %)

Messages
Receiver

COMM.
HANDLER
Messages To Send and
pointer queue

Messages
Sender
Insert Xoff
TX driver

W
TX
1024 Char Output Buffer

Xoff emission principle

Serial Line Protocol 47


Technical Manual 006.8021.C PAM SOCAPEL SA

10.2 PAM RECEIVE XOFF


PAM can only process the Xoff character when all characters into the input buffer have been red.
When the Xoff char is red from the input buffer, the driver stop to send characters.

The following situation appears:

Received messages and RX driver


pointer queue Xoff 1024 Char Input Buffer

RX
R

Messages
Receiver

COMM.
HANDLER
Messages To Send and
pointer queue
Stop to send
Messages
Sender
TX driver

W
TX
1024 Char Output Buffer

Xoff reception principle

48 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

10.3 XON/XOFF CONSIDERATIONS


Due to binary contents of the messages, the Xon or Xoff characters can only by processed at block
level, because it is not easy to give the frame structure knowledge at characters driver level. It
means that Xon or Xoff characters can only be added or read after the current frame.

10.3.1 BUFFERS SITUATION


The host and PAM buffers situation can be illustrated in the figure below.

HOST PAM
Input buffer Input buffer

R W W R
Read Xoff
and Stop to send
Output buffer Output buffer
R R

W Xoff  W

Buffers situation

10.3.2 REACTION TO XOFF


If the RS422 Host uses the same Xon/Xoff mechanism as PAM do, when Host input buffer is
near full, the Xoff char is queued in the Host output buffer after the last queued frame.
PAM can read the received Xoff char only after having red the contents of the input buffer.
Then PAM stop to send.

HOBS = Host Output Buffer Size POBS = Pam Output Buffer size
HIBS = Host Input Buffer Size PIBS = Pam Input Buffer Size
HNFR = Host Near Full Ratio PNFR = Pam Near Full Ratio

Number of characters still received by Host when Host send Xoff (worst case)
NRH = HOBS + (PIBS * PNFR)
NRH = 1024 + (1024 * 0.75) = 1792

Theoretical size of HIBS to avoid overflow :


HIBS = NRH / (1- HNFR) = 1792 / 0.25 = 7168

REMARK:
It is only possible to adapt the input buffer size for PAM or for HOST, but not for both.
Because Host Input Buffer Size (HIBS) is dependant of PAM Input Buffer Size (PIBS) and
PIBS is dependant of HIBS.

Serial Line Protocol 49


Technical Manual 006.8021.C PAM SOCAPEL SA

10.4 HOST POSSIBLE IMPROVEMENTS

10.4.1 MODIFICATION OF NEAR TO FULL VALUE


By reducing the near to full ratio at 25 % instead of 75 %, Xoff character is send earlier and
there is more free space to queue extra character.
The above example becames: 1024 + 0.25 1024 = 1280.
Total Input buffer will be 1280 /(1-0.25) = 1706.

10.4.2 MAINTAINING OUTPUT BUFFER EMPTY


One problem of the Xoff propagation is the number of characters queued into the output
buffer. A solution to minimise this value is to wait till the output buffer is empty before
writing a new frame. In this case the maximum number of character queued is reduced to the
size of the longest messages (255 + 5 ) = 260 characters.

! It is not easy to modify the buffers size when using Greenleaf communication utility

In bringing the 2 improvements we get:


Requested free characters = 260 + 0.25 * 1024 = 516.
Input buffer size will be 516 / (1-0.75) = 688. So the standard 1024 chars buffer is OK.
Near full may be set to 37 % ( 260 + 0.37 * 1024 ) * 1/(1-0.37) = (260 * 382) / 0.63 =
1019.

10.4.3 XON/XOFF MANAGEMENT AT CHAR LEVEL


This improvement is only possible by modifying the software at character receiver level.
The character receiver must have the frame structure knowledge in order to detect when start
and end a frame when copying it into the input buffer.

It is not possible to manage Xoff & Xoff at char level when using Greenleaf
! communication utility

50 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

11 PAM RS422 TIMEOUT AND PERIOD


This chapter describes the relations between the communication timeouts and the watchdog period
in order to specify their values.

11.1 WATCH DOG MECHANISM


The watchdog principle is illustrated in the figure below.

HOST PAM
Send watch Master
dog period Inactivity
Timeout

PAM
Inactivity
 Watch dog
Timeout message period


Watchdog mechanism.

11.1.1 RELATION BETWEEN TIMEOUT AND PERIOD


Timeouts value must be at least two time the period. Four times is a practical good value.
When the sender can not guarantee the period, increase the ratio up to 10.
The PAM «Master Inactivity timeout» is related with HOST «send watch dog period».
The HOST «PAM inactivity timeout» is related with PAM «PAM watchdog message period».

11.1.2 RS422 PORT SPECS


PAM timeout and period are specified for each PAM application. These values must be given
in the RS422 PORT header. Example :

RS422 PORT SPECS


PERIOD = 20;
MASTER_READY_TIMEOUT = 20000;
MASTER_CONFIGURATION_TIMEOUT = 10000;
MASTER_INACTIVITY_TIMEOUT = 8000;
PAM_WATCHDOG_MESSAGE_PERIOD = 1000;
END_SPECS

Serial Line Protocol 51


Technical Manual 006.8021.C PAM SOCAPEL SA

Corresponding host specifications are :


Host «send watch dog period» is MASTER_INACTIVITY_TIMEOUT / 4 = 2000.
Host «PAM inactivity timeout» is PAM_WATCHDOG_MESSAGE_PERIOD * 4 = 4000.
Remark : with these value the host react twice faster to PAM inactivity than PAM react to
HOST inactivity.

52 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

12 COMMUNICATION CONFIGURATION
To be able to communicate with PAM, a plug-in module must be added on the PAM board and the
RS422 port connector assignement must be configured by jumpers.
The communication parameters (baud rate, parity, NB of bits) must be configured in accordance
with PAM.

12.1 PAM HARDWARE CONFIGURATION


This paragraph gives the installation procedure of galvanic insulation module NB 004.7025 and
jumper configuration.

12.1.1 INSTALLATION OF MODULE 004.7025


- Remove pin protections from the PAM board.(if existing).
- Unscrew the 2 nuts and remove from each screw only 1 insulating disc
- Plug gently the module ( components up).
- Put back the discs and screw the nuts.

12.1.2 JUMPERS CONFIGURATION ON PAM BOARD

Serial Line Protocol 53


Technical Manual 006.8021.C PAM SOCAPEL SA

12.1.3 PAM RS422 9 PINS CONNECTOR


The 9 Pins connector assignment in function of indicated Jumpers configuration is:

Pin Number Function

2 RECEIVE -

3 TRANSMIT +

7 RECEIVE +

8 TRANSMIT -

12.2 PAM COMMUNICATION PARAMETERS


The PAM firmware sets the following communication parameters:

• Parity OFF
• Stop bit 1
• Data bits 8
• 19200 bauds for BASIC_PAM_CYCLE = 3 ( 1 ms cycle)

12.3 BAUD RATE FUNCTION OF PAM CYCLE


The characters reception mechanism used in PAM is dependant of the selected
BASIC_PAM_CYCLE at application level.

BASIC_PAM_CYCLE BAUD RATE


3 (1 ms) 19200
4 9600
5 9600
6 (2 ms) 9600
7 4800
8 4800
9 4800
10 4800
11 4800
12 (4 ms) 4800
13 2400
14 2400
15 2400

54 Serial Line Protocol


SOCAPEL SA PAM Technical Manual 006.8021.C

APPENDIX A CRC COMPUTATION OF A VARIABLE


The program below gives the algorithm used in the PAM compiler to compute the CRC of a
variable.

/*-----*/
/* crc */
/*=====*/

unsigned int PamObject::crc (void)

{
/* Allocate a buffer */
char *buffer = new (char[255]) ;
if ( !buffer )
passert(0) ;

/* filling of the buffer */


/* add number and period converted to string*/
WARNING : the period function returns the period as a double and %d is used in sprintf to keep
the same CRC value.
sprintf (buffer, "%d%d", number(), period()) ;
/* add the variable name */
strcat (buffer, symbol()) ;
/* add the nodes group name or "---" if none */
strcat (buffer, nodes_group_symbol()) ;
/* add the object cathegory (constant string) */
strcat (buffer, "BINARY") ;
/* add the object direction (constant string) */
strcat (buffer, "BIDIR") ;
/* add the object layout (constant string) */
strcat (buffer, "FLAG") ;

/* CRC computation*/
returns string_CRC (buffer) ;

} /* crc */

REMARK:
The way of creating the string on which the crc16 computation is applied was not designed to
be used as a user function.
This algorithm may be subject to change in order to simplify and make easier the string
composition by external user.

CRC16 COMPUTATION:
The CRC16 computation used is the same as furnished with the RS422 utilities.
Refer to file CRC_UTIL.C for computation algorithm.

Serial Line Protocol 55


Technical Manual 006.8021.C PAM SOCAPEL SA

INDEX

TYPE_DEF.H 7
USR_COMM.H 6
A USR_FUNC.H 6
Function
Application Protocol 30
get_pam_rs422_comm 10
init_pam_rs422_util 10
B scan_rs422_pam_out 24
send_rs422_flag 22
baud rate 54 send_rs422_long 22
Blocks Protocol 28 send_rs422_real 22
send_rs422_single_flag 22
send_rs422_single_long 22
C send_rs422_single_real 22
Communication send_rs422_single_word 22
configuration 53 send_rs422_word 22
parameters 54 xchng_config_cmd 11
Protocol 28
Request 10 H
Configuration
Error messages 18 Handling of
Jumpers 53 Inputs by PAM 20
Configuration of Inputs by RS422 master 20
Input Variables 8 Outputs by PAM 20
Output Variables 9 Outputs by RS422 master 20
Configuration phase 8 Hardware configuration 53
Connector 54

M
E
Message
Exchange of COMM_ACK 31
Output KEY 14 COMM_REQ 31
Variable definition 12 CONFIG_ANSW 34
Execution Phase 20 CONFIG_CMD 32
Execution Phase Errors 25 RS_WATCH_DOG 35
XNG_FLAG 36
XNG_FLAG_KEY32 41
F XNG_LONG 38
Files XNG_LONG_KEY32 43
Overwiew 5 XNG_REAL 39
PAMRS422.H 6 XNG_REAL_KEY32 45
RS_CLASS.H 7 XNG_WORD 37
RS_COMM 7 XNG_WORD_KEY32 42
RS_UTIL 7 Module 004.7025 53

lvi Serial Line Protocol


Technical Manual 006.8021.C PAM SOCAPEL SA

Database 6
P ID 1
KEY 1
Protocol 28; 30
Name 1

S W
Starting PAM 16
Watchdog 21; 51

T X
timeouts 51
Xoff 29; 47
Xon 29; 47
V
Variable
CRC 1

ii Index

You might also like