Mitsubishi Electric MELSEC iQ-R C Series Programming Manual page 158

Controller module
Table of Contents

Advertisement

Specification method for data size
• For the data size (ulSize), specify the number of words according to the label data type.
The following shows an example for specifying data size.
Label data type
Word (signed, unsigned)
Double words (signed, unsigned)
Single precision real number
Double precision real number
*1
Time
*1 Different from the time type in a programmable controller CPU, it cannot be written or read in the 'T#23d23h59m59s999ms' format.
To write data, specify double-words [signed] (in ms unit).
When data is read, the data is read in double-words [signed] (in ms unit).
A value (ms) to be specified can be calculated by the following calculation formula:
⋅ (d (date) specified value × 86,400,000)) + (h (hour) specified value × 3,600,000) + (m (minute) specified value × 60,000) + (s (second)
specified value × 1,000) + ms (millisecond) specified value))
Example: To write 'T#1h30m' (3,780,000 (ms)), the calculation formula is as follows:
⋅ 3,780,000 (ms)=(0 × 86,400,000) + (1 × 3,600,000) + (30 × 60,000) + (0 × 1,000) + 0
Specification method for a module label ID
• For the module label ID (ulUnitLabelID), specify a macro defined in the header file, which includes the information of
module labels output by CW Configurator.
• When specifying '0' for the module label ID (ulUnitLabelID), data will be read from the module label without checking the
module label ID.
The following shows an example for specifying a module label ID.
Header File
/* M+RD78_0000 */
#define RD78_0000_UnitLabelID 1213UL
typedef struct{
struct{
struct{
struct{
unsigned long RamSizeMax;
unsigned long BackupRamSizeMax;
} Addon_AbsSystem;
} PrConst;
}System;
} RD78_0000_TAG;
static const RD78_0000_TAG RD78_0000={{{{0x100000, 0x100020}}}};
User Program
/* Sample */
#include "CCPUFunc.h "
#include "M+RD78_0000.h"
short Test(void){
short sRet = 0;
unsigned short usDataBuf = 2;
sRet = CCPU_WriteMCUnitLabel(
RD78_0000.System.prConst.Addon_AbsSystem.RamSizeMax,
0,
2,
&usDataBuf,
0,
RD78_0000_Unit LabelID
);
return sRet;
}
(1) Defined macro
(2) Module label ID (ulUnitLabelID)
3 DETAILS OF FUNCTION
156
3.1 C Controller Module Dedicated Functions
(1)
(2)
Number of words
1
2
2
4
2

Advertisement

Table of Contents
loading

Table of Contents