Questo sito utilizza i cookie per migliorare servizi ed esperienza degli utenti. Se decidi di continuare la navigazione consideriamo che accetti il loro uso.

Panoramica Cerca Sopra
Dettagli del download
Sample10: module communication: Using data poi Sample10: module communication: Using data pointer
(0 voti)

The communication is represented by a "shared" data area: Provided by one module and accessed by pointers from other modules.

It is not possible that two different data pointers are linked to the same entry in an output or input data area due to synchronization issues, which would occur without this limitation. Therefore a module ModuleDataProvider collects input and output into a standard data area, which does not have this restriction.

Overall this sample contains the following modules:

ModuleDataProvider provides a data area to be accessed from the other modules.
The data area contains 4 Bits (2 are used for input, 2 for output) and 2 Integers (one as input; one as output).
ModuleDataInOut provides "normal" input variables, which are written to the data area of the ModuleDataProvider as well as output variables, which
are read from the data area.
This instance of class CModuleDataInOut acts as a simulation for real IO.
ModuleDataAccessA accesses the data area of the ModuleDataProvider and cyclically works on Bit1 / BitOut1 and the Integers.
ModuleDataAccessB accesses the data area of the ModuleDataProvider and cyclically works on Bit2 / BitOut2 and the Integers.

The user of the sample triggers the ModuleDataInOut by setting the variables ValueIn / Bit1 / Bit2:

By setting input "Bit1" the output "Switch1" will be set respectively.
By setting input "Bit2" the output "Switch2" will be set respectively.
By setting input "ValueIn" the output "ValueOut" will be incremented each cycle twice.

All modules are configured to have the same task context, which is necessary because access through data pointers does not provide any synchronization mechanism. The order of execution is determined by the sort order specified on the context configuration tab. This value is passed as parameter "SortOrder" and it’s stored in cyclic caller smart pointer (m_spCyclicCaller), which also holds the object id of the cyclic caller.

 

The module ModuleDataInOut has input and output variables. These are linked to the corresponding variables of the data provider.

The module ModuleDataProvider provides an input and an output data area and implements the ITcIoCylic interface. The method InputUpdate copies data from the input variables to DataIn symbol of the standard data area "Data" and method OutputUpdate copies data from the DataOut symbol to the output variables.

The modules ModuleDataAccessA and ModuleDataAccessB have pointers to data areas of the data provider by links. These pointers are initialized during the transition from SAFEOP to OP. ModuleDataAccessA cyclically sets the BitOut1 as indicated by Bit1. ModuleDataAccessB respectivelywith BitOut2 / Bit2. Both increment ValueOut by multiplying the internal counter with the ValueIn value.

Informazioni

Versione:
Dimensione29.4 KB
Downloads1
Lingua
Licenza
Autore
Sito Web
Prezzo
Creato17-02-2015
Creato da
Modificato il17-02-2015
Modificato daroby

Solo gli utenti registrati e loggati possono scaricare questo file.

.

.