Mitsubishi Electric Q12DCCPU-V User Manual page 434

Melsec q series, c controller module
Hide thumbs Also See for Q12DCCPU-V:
Table of Contents

Advertisement

13
COMMUNICATIONS BETWEEN CPU MODULES
13
- 36
13.3 Data Communications Using CPU Shared Memory
13.3.4 Data communications without using auto refresh
<Interlock program example>
Depending on the following timing, old and new data for each CPU may be mixed
(data separation).
• Writing data to the user setting area in another CPU and reading another
CPU's user setting area data from the host CPU
• Writing data to the user setting area in the host CPU and reading host CPU's
user setting area data from another CPU
The following explains how to avoid data separation in data communications
through user setting areas.
Figure 13.25 shows an example, in which an interlock is programmed for sending
data from CPU No.1 (C Controller module) to CPU No.2 (C Controller module)
using user setting areas in the multiple CPU high speed transmission areas.
Sending side program for CPU No.1 (C Controller module)
{
:
unsigned short
usBuf;
unsigned short
pusData[128];
:
/****************************************************************/
/* CPU No.1 send data are written to the user setting area.
/****************************************************************/
sRet = QBF_ToBuf(lPath, 0x3E0, 10000, 10, pusData, 128);
if( sRet != 0) return(sRet);
/****************************************************************/
/* CPU No.1 data set completion bit turns ON.
/****************************************************************/
usBuf = 1;
sRet = QBF_ToBuf(lPath, 0x3E0, 10010, 1, &usBuf, 1);
if( sRet != 0) return(sRet);
/****************************************************************/
/* The ON status of CPU No.2 data processing completion bit is detected.*/
/****************************************************************/
while(1){
sRet = QBF_FromBuf(lPath, 0x3E1, 10000, 1, &usBuf, 1);
if( sRet != 0) return(sRet);
if( (usBuf & 0x1) == 0x0 ) break;
taskDelay(2);
}
/****************************************************************/
/* CPU No.1 data set completion bit turns OFF.
/****************************************************************/
usBuf = 0;
sRet = QBF_ToBuf(lPath, 0x3E0, 10010, 1, &usBuf, 1);
if( sRet != 0) return(sRet);
}
Figure 13.25 Interlock program example
/* Data storage destination */
/* Data storage destination */
*/
*/
/* When 0 is set, processing gets out from the loop. */
*/
1)
2)
6)
7)

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sw3pvc-ccpu-eQ06ccpu-vQ06ccpu-v-b

Table of Contents