Download Table of Contents Print this page

Mitsubishi Electric MELSEC iQ-R C Programming Manual

Melsec iq-r series programmable controller
Hide thumbs Also See for MELSEC iQ-R C:

Advertisement

Quick Links

MELSEC iQ-R C Controller Module
Programming Manual

Advertisement

loading

Related Manuals for Mitsubishi Electric MELSEC iQ-R C

Summary of Contents for Mitsubishi Electric MELSEC iQ-R C

  • Page 1 MELSEC iQ-R C Controller Module Programming Manual...
  • Page 3: Safety Precautions

    SAFETY PRECAUTIONS (Read these precautions before using this product.) Before using C Controller module, please read this manual and the relevant manuals carefully and pay full attention to safety to handle the product correctly. Make sure that the end users read this manual and then keep the manual in a safe place for future reference. CONDITIONS OF USE FOR THE PRODUCT (1) Mitsubishi programmable controller ("the PRODUCT") shall be used in conditions;...
  • Page 4: Considerations For Use

    CONSIDERATIONS FOR USE Considerations for the Wind River Systems product C Controller module has an embedded real-time operating system, VxWorks, manufactured by Wind River Systems, Inc. in the United States. We, Mitsubishi, make no warranty for the Wind River Systems product and will not be liable for any problems and damages caused by the Wind River Systems product during use of C Controller module.
  • Page 5: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 CONDITIONS OF USE FOR THE PRODUCT .
  • Page 6 Appendix 3 Correspondence Table to Conventional Functions ........194 C Controller module dedicated functions.
  • Page 7: Relevant Manuals

    RELEVANT MANUALS Manual name [manual number] Description Available form MELSEC iQ-R C Controller Module Programming Manual Explains the programming specifications and dedicated e-Manual [SH-081371ENG] (this manual) function library of a C Controller module. MELSEC iQ-R C Controller Module User's Manual...
  • Page 8: Terms

    TERMS Unless otherwise specified, this manual uses the following terms. Term Description Basic model QCPU A generic term for Q00JCPU, Q00CPU, and Q01CPU. C Controller module A generic term for MELSEC iQ-R series C Controller module. C Controller module dedicated function A dedicated function library offered by C Controller module.
  • Page 9: Chapter 1 Common Items

    • MELSEC Data Link Functions For the execution procedure of user programs, refer to the following manual. MELSEC iQ-R C Controller Module User's Manual (Startup) Header Files Include the following header files in a user program to use the dedicated function library.
  • Page 10: C Controller Module Dedicated Functions

    C Controller Module Dedicated Functions C Controller dedicated functions of the dedicated function libraries are used to control C Controller module. These functions can be used for reading status of C Controller module or accessing resources such as LED control and clock. Program processing The following shows the user program processing using the C Controller module dedicated function.
  • Page 11: Argument Specification

    Argument specification This section shows the argument specifications of the C Controller module dedicated functions. Device type The following tables show the device types specified to the C Controller module dedicated functions. Devices are defined in the header file "CCPUFunc.h". Either a code or a device name can be specified as a device type.
  • Page 12: Melsec Data Link Functions

    MELSEC Data Link Functions MELSEC data link functions are the integrated communication function libraries which are independent of the communication protocols. A program to communicate with a CPU module can be created regardless of a target hardware or communication protocols by using the MELSEC data link functions.
  • Page 13: Considerations

    Considerations The following shows the considerations when using the MELSEC data link functions. Considerations for programming ■Open/close processing of a communication line (mdOpen/mdClose function) Perform the open/close processing of communication line (the mdOpen/mdClose function) only once at the start of task (task activation) and at the end of task (task completion) respectively in each user program.
  • Page 14 Accessing devices of the own station and of a CPU module on other stations An interlock may be required to be provided depending on the link status of the own station and other stations. ■Access to devices on the own station Create a user program that provides an interlock to enable reading/writing data when the following conditions are satisfied to access devices via each network module.
  • Page 15: Accessible Range And Devices

    Accessible range and devices This section explains the accessible range and accessible devices when using MELSEC data link functions. Bus interface communication The following explains the accessible range and devices for bus interface communication. ■Accessible range The accessible range for bus interface communication includes the own station (C Controller module), and the CPU module and C Controller module in a multiple CPU system.
  • Page 16 • Accessing the other CPU The following table shows the accessible devices when accessing the other CPUs (that is a CPU module and a C Controller module in a multiple CPU system). Access target CPU RCPU R12CCPU-V : Accessible, : Not accessible Device Access method Access target CPU...
  • Page 17 Device Access method Access target CPU   Link direct device (Link special relay) Jn\SB Batch/random   Link direct device (Link special register) Jn\SW Batch/random Intelligent function module device, module access device Un\G Batch/random      Other station buffer memory Batch/random Other station random access buffer...
  • Page 18 CC-Link IE Controller Network communication The following explains the range and devices accessible for communication via a CC-Link IE Controller Network module. ■Accessible range The system configuration in the accessible range and the accessibility of each access target CPU via a CC-Link IE Controller Network module are shown below.
  • Page 19 ■Applicable access Accessibility is shown in the following table. The own station and the connected station CPU are accessible. : Accessible, : Not accessible 3. Network to be 4. Access target CPU Connected Connected routed Programmable controller C Controller module WinCPU Interface network...
  • Page 20 ■Accessible devices The devices accessible for communication via a CC-Link IE Controller Network module are shown below. • 'Batch' and 'Random' in the following table indicate as follows: Batch: Batch write (mdSendEx function), batch read (mdReceiveEx function) Random: Random write (mdRandWEx function), random read (mdRandREx function), bit set (mdDevSetEx function), bit reset (mdDevRstEx function), random write by using a label name (mdRandWLabelEx function), random read by using a label name (mdRandRLabelEx function) •...
  • Page 21 • Accessing other stations Access target CPU Basic model QCPU, high performance model QCPU, process CPU, redundant CPU, universal model QCPU Q12DCCPU-V, Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS Personal computer, WinCPU module L02CPU, L26CPU-BT, L02CPU-P, L26CPU-PBT, LJ72GF15-T2, NZ2GF-ETB, L02SCPU, L26CPU, L06CPU RCPU R12CCPU-V : Accessible, : Not accessible...
  • Page 22 Device Access method Access target CPU        Own station buffer memory Batch/random        SEND function (with arrival Batch confirmation) Random         ...
  • Page 23 Device Access method Access target CPU       Safety link relay SA\B Batch/random       Safety timer SA\T Batch/random Safety retentive timer SA\ST Batch/random         ...
  • Page 24 CC-Link IE Field Network communication The following explains the range and devices accessible for communication via a CC-Link IE Field Network module. ■Accessible range The system configuration in the accessible range and the accessibility of each access target CPU via a CC-Link IE Field Network module are shown below.
  • Page 25 ■Applicable access Accessibility is shown in the following table. The own station and the connected station CPU are accessible. : Accessible, : Not accessible 3. Network to be 4. Access target CPU Connected Connected routed Programmable controller C Controller module WinCPU Interface network...
  • Page 26 • 'Batch' and 'Random' in the following table indicate as follows: Batch: Batch write (mdSendEx function), batch read (mdReceiveEx function) Random: Random write (mdRandWEx function), random read (mdRandREx function), bit set (mdDevSetEx function), bit reset (mdDevRstEx function), random write by using a label name (mdRandWLabelEx function), random read by using a label name (mdRandRLabelEx function) •...
  • Page 27 • Accessing other stations Access target CPU Basic model QCPU, high performance model QCPU, process CPU, redundant CPU, universal model QCPU Q12DCCPU-V, Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS WinCPU module and personal computer L26CPU-BT, L02CPU, L02CPU-P, L26CPU-PBT, LJ72GF15-T2, NZ2GF-ETB, L02SCPU, L26CPU, and L06CPU RCPU R12CCPU-V : Accessible, : Not accessible...
  • Page 28 Device Access Access target CPU method        SEND function (without arrival confirmation) Batch       Random Link direct device (Link input) Jn\X Batch/random        ...
  • Page 29 *1 The following CPUs are accessible: Q12DCCPU-V with a serial number of which the first 5 digits are '12042' or later Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS *2 Q00JCPU is not accessible. *3 The following CPUs are accessible: Q12DCCPU-V (Extended mode) Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS 1 COMMON ITEMS 1.3 MELSEC Data Link Functions...
  • Page 30 MELSECNET/H network communication The following explains the range and devices accessible for communication via a MELSECNET/H network module. ■Accessible range The system configuration in the accessible range and the accessibility of each access target CPU via a MELSECNET/H network module are shown below. System configuration C Controller module Connected network...
  • Page 31 ■Applicable access Accessibility is shown in the following table. The own station and the connected station CPU are accessible. : Accessible, : Not accessible 3. Network to be 4. Access target CPU Connected Connected routed Programmable controller C Controller module WinCPU Interface network...
  • Page 32 ■Accessible devices The devices accessible for communication via a MELSECNET/H network module are shown below. • 'Batch' and 'Random' in the following table indicate as follows: Batch: Batch write (mdSendEx function), batch read (mdReceiveEx function) Random: Random write (mdRandWEx function), random read (mdRandREx function), bit set (mdDevSetEx function), bit reset (mdDevRstEx function), random write by using a label name (mdRandWLabelEx function), random read by using a label name (mdRandRLabelEx function) •...
  • Page 33 • Accessing other stations Access target CPU Basic model QCPU, high performance model QCPU, process CPU, redundant CPU, universal model QCPU Q12DCCPU-V, Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS WinCPU module and personal computer L26CPU-BT, L02CPU, L02CPU-P, L26CPU-PBT, LJ72GF15-T2, NZ2GF-ETB, L02SCPU, L26CPU, and L06CPU RCPU R12CCPU-V : Accessible, : Not accessible...
  • Page 34 Device Access Access target CPU method        SEND function (without arrival confirmation) Batch       Random Link direct device (Link input) Jn\X Batch/random        ...
  • Page 35 *1 The following CPUs are accessible: Q12DCCPU-V with a serial number of which the first 5 digits are '12042' or later Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS *2 Q00JCPU is not accessible. *3 The following CPUs are accessible: Q12DCCPU-V (Extended mode) Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS *4 A message is send to a network module on the other station via a MELSECNET/H network module.
  • Page 36 CC-Link communication The following explains the accessible range and devices for CC-Link communication. ■Accessible range The accessible range for CC-Link communication includes the own station (master station or local station controlled by C Controller module), master station or local station controlled by other stations (CPU module, C Controller module, PC CPU module, WinCPU module), intelligent device station and a personal computer on which a CC-Link board is installed.
  • Page 37 • Accessing other stations Access target CPU Basic model QCPU, high performance model QCPU, process CPU, redundant CPU, universal model QCPU Q12DCCPU-V, Q24DHCCPU-V, Q24DHCCPU-LS, Q24DHCCPU-VG, and Q26DHCCPU-LS PC CPU module, WinCPU module, personal computer, and intelligent device station L02CPU, L26CPU-BT, L02CPU-P, L26CPU-PBT, L02SCPU, L26CPU, and L06CPU RCPU R12CCPU-V : Accessible, : Not accessible...
  • Page 38 Device Access Access target CPU method       Link direct device (Link input) Jn\X Batch/random       Link direct device (Link output) Jn\Y Batch/random Link direct device (Link relay) Jn\B Batch/random  ...
  • Page 39: Argument Specification

    Argument specification This section shows the argument specification of the MELSEC data link functions. Channel A channel implies a network and communication route to be used when communicating with a C Controller module. It needs to be set for each module in a user program. Channels to be used for MELSEC data link functions are as follows: Channel Network...
  • Page 40 Network number and station number ■Network number and station number for MELSEC data link functions (excluding the mdControl function and the mdTypeRead function) Network numbers and station numbers to be specified to MELSEC data link functions are as follows: To specify station numbers for the mdControl function and mdTypeRead function, refer to "Network number and station number for MELSEC data link functions (the mdControl function and the mdTypeRead function)".
  • Page 41 ■Network number and station number for MELSEC data link functions (the mdControl function and the mdTypeRead function) Network numbers and station numbers to be specified to the mdControl function or the mdTypeRead function are as follows: Communication Station number specification method Bus interface Own station: 255 (FFH) Other station: 1 (CPU No.1), 2 (CPU No.2), 3 (CPU No.3), 4 (CPU No.4)
  • Page 42 Device type The following tables show the device types specified to the MELSEC data link functions. Devices are defined in the header file "MDFunc.h". Either a code or a device name can be specified as a device type. ■Common device types Device (Device name) Device type Code...
  • Page 43 Device (Device name) Device type Code Device name Decimal Hexadecimal Edge relay (V) DevQV Refresh data register (RD) DevRD Global label (GV) For word, double word, and quad word size 258H DevGV For bit 0 259H DevGV_0 For bit 1 25AH DevGV_1 For bit 2...
  • Page 44 ■Device types for accessing CC-Link IE Controller Network modules The device types shown in the following table can be specified in the user program: • For sending/receiving message Device Device type Code Device name Decimal Hexadecimal SEND function (with arrival confirmation) and RECV function DevMAIL SEND function (without arrival confirmation) DevMAILNC...
  • Page 45: Considerations On Interrupt Service Routine (Isr)

    Considerations on Interrupt Service Routine (ISR) Fully understand the restrictions of VxWorks, operating system, before creating a routine which is executed in an interrupt service routine (ISR: InterruptServiceRoutine). To use another dedicated function by synchronizing it to an interrupt, implement the notification processing in a user program and perform it in a task. Setting an inappropriate value or executing a function other than a C Controller module dedicated function for ISR from an interrupt service routine may cause the VxWorks runaway.
  • Page 46: Chapter 2 Function List

    FUNCTION LIST This chapter describes the functions that can be used for a C Controller module. C Controller Module Dedicated Functions The C Controller module dedicated functions are as listed below. C Controller module dedicated functions Function name Function Reference CCPU_ChangeCCIEFBCycPrm To change the operation parameter of the cyclic transmission of the CC-Link Page 48 CCPU_ChangeCCIEFBCycPrm...
  • Page 47 Function name Function Reference CCPU_ReadDevice To read data from internal user devices and internal system devices of a C Page 89 CCPU_ReadDevice Controller module. CCPU_ReadLinkDevice To read data from the own station link devices of CC-Link IE Controller Page 90 CCPU_ReadLinkDevice Network module, CC-Link IE Field Network module, Ethernet module (when CC-Link IE Field Network is selected), and MELSECNET/H network module.
  • Page 48: C Controller Module Dedicated Functions For Isr

    C Controller module dedicated functions for ISR Function name Function Reference CCPU_DisableInt_ISR To disable the routine registered with the CCPU_EntryInt function. Page 125 CCPU_DisableInt_ISR CCPU_EnableInt_ISR To enable the routine registered with the CCPU_EntryInt function. Page 126 CCPU_EnableInt_ISR CCPU_FromBuf_ISR To read data from the CPU buffer memory of the CPU module and the buffer Page 127 CCPU_FromBuf_ISR memory of the intelligent function module which are mounted on the specified module position.
  • Page 49: Melsec Data Link Functions

    MELSEC Data Link Functions The MELSEC data link functions are as listed below. Function name Function Reference mdClose To close a communication line (channel). Page 146 mdClose mdControl To perform remote operations (remote RUN/STOP/PAUSE) for the CPU Page 147 mdControl module.
  • Page 50: Chapter 3 Details Of Function

    DETAILS OF FUNCTION This chapter explains the details of the C Controller module dedicated function and the MELSEC data link function. C Controller Module Dedicated Functions This section explains the details of the C Controller module dedicated function. C Controller module dedicated functions CCPU_ChangeCCIEFBCycPrm This function changes operation parameter of cyclic transmission of the CC-Link IE Field Network Basic function.
  • Page 51 CCPU_ChangeFileSecurity This function changes the file access restriction status of a C Controller module. ■Format short CCPU_ChangeFileSecurity(short sMode, char* pcPass); ■Argument Argument Name Description IN/OUT sMode File access mode Specify the file access mode. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 52 CCPU_ClearError This function clears errors of a C Controller module. ■Format short CCPU_ClearError (long* plErrorInfo) ■Argument Argument Name Description IN/OUT plErrorInfo Error information Unused (Even if a value is specified, the operation is not affected.) ■Description • This function clears errors occurred in a C Controller module. •...
  • Page 53 CCPU_Control This function performs remote operations (remote RUN/STOP/PAUSE) for a CPU module. ■Format short CCPU_Control (short sCpuNo, short sCode) ■Argument Argument Name Description IN/OUT sCpuNo CPU number Specify the target CPU module number. Specify '0' to perform the remote operation for the host CPU. (When the CPU module specified with 1 to 4 is the host CPU, an error is returned.) •...
  • Page 54 CCPU_DedicatedDInst This function executes dedicated instructions categorized as 'D' or 'DP'. ■Format short CCPU_DedicatedDInst (char* pcInstName, short sCPUNo, short* psArg1, short sArg1Size, short* psArg2, short sArg2Size, short* psArg3, short sArg3Size, short* psArg4, short sArg4Size, short* psArg5, short sArg5Size, short* psArg6, short sArg6Size, short* psArg7, short sArg7Size, short* psArg8, short sArg8Size, short* psArg9, short sArg9Size) ■Argument Argument...
  • Page 55 ■Description The dedicated instructions that can be specified to the instruction name (pcInstName) are as shown below. For the specifications of each dedicated function and the completion status, refer to the programming manual of each module. Instruction name Description Instruction CHGA To request a motion CPU to change the current value.
  • Page 56 CCPU_DedicatedGInst This function executes dedicated instructions categorized as 'G' or 'GP'. ■Format short CCPU_DedicatedGInst (char* pcInstName, short sIoNo, short* psArg1, short sArg1Size, short* psArg2, short sArg2Size, short* psArg3, short sArg3Size, short* psArg4, short sArg4Size, short* psArg5, short sArg5Size, short* psArg6, short sArg6Size, short* psArg7, short sArg7Size, short* psArg8, short sArg8Size, short* psArg9, short sArg9Size) ■Argument Argument...
  • Page 57 ■Description The dedicated instructions that can be specified to the instruction name (pcInstName) are as shown below. For the specifications of each dedicated function and the completion status, refer to the programming manual of each module. Instruction name Description Instruction SEND Sends data to other station programmable controller.
  • Page 58 CCPU_DedicatedJInst This function executes dedicated instructions categorized as 'J' or 'JP'. ■Format short CCPU_DedicatedJInst (char* pcInstName, short sNetNo, short* psArg1, short sArg1Size, short* psArg2, short sArg2Size, short* psArg3, short sArg3Size, short* psArg4, short sArg4Size, short* psArg5, short sArg5Size, short* psArg6, short sArg6Size, short* psArg7, short sArg7Size, short* psArg8, short sArg8Size, short* psArg9, short sArg9Size) ■Argument Argument...
  • Page 59 ■Description The dedicated instructions that can be specified to the instruction name (pcInstName) are as shown below. For the specifications of each dedicated function and the completion status, refer to the programming manual of each module. Instruction name Description Instruction SEND Sends data to other station programmable controller.
  • Page 60 CCPU_DedicatedMInst This function executes dedicated instructions categorized as 'M' or 'MP'. ■Format short CCPU_DedicatedMInst (char* pcInstName, short sCPUNo, short* psArg1, short sArg1Size, short* psArg2, short sArg2Size, short* psArg3, short sArg3Size, short* psArg4, short sArg4Size, short* psArg5, short sArg5Size, short* psArg6, short sArg6Size, short* psArg7, short sArg7Size, short* psArg8, short sArg8Size, short* psArg9, short sArg9Size) ■Argument Argument...
  • Page 61 ■Description The dedicated instructions that can be specified to the instruction name (pcInstName) are as shown below. For the specifications of each dedicated function and the completion status, refer to the programming manual of each module. Instruction name Description Instruction GINT Issues an interrupt to motion CPU and C Controller module.
  • Page 62 CCPU_DisableInt This function disables the routine registered with the CCPU_EntryInt function. ■Format short CCPU_DisableInt (short sSINo) ■Argument Argument Name Description IN/OUT sSINo Interrupt pointer number Specify the interrupt pointer number. ■Description • This function disables the routine registered with the CCPU_EntryInt function. (The routine is not executed when an interrupt occurs.) •...
  • Page 63 CCPU_EnableInt This function enables the routine registered with the CCPU_EntryInt function. ■Format short CCPU_EnableInt (short sSINo) ■Argument Argument Name Description IN/OUT sSINo Interrupt pointer number Specify the interrupt pointer number. ■Description • This function enables the routine registered with the CCPU_EntryInt function. (The routine is executed when an interrupt occurs.) •...
  • Page 64 CCPU_EndCCIEFBDataAssurance This function ends data assurance for one link scan of CC-Link IE Field Network Basic. ■Format short CCPU_EndCCIEFBDataAssurance (unsigned short usGroupNo) ■Argument Argument Name Description IN/OUT usGroupNo Group No. Specify a group number to end data assurance. (1 to 4) ■Description •...
  • Page 65 CCPU_EntryCCIEFBRefEndFunc This function registers a routine to be called when the link scan of CC-Link IE Field Network Basic is completed. ■Format short CCPU_EntryCCIEFBRefEndFunc (CCPU_REFENDFUNCPTR pREFENDFuncPtr) ■Argument Argument Name Description IN/OUT pREFENDFuncPtr Registered routine Specify a routine to be registered. (The routine is deregistered by specifying NULL.) The data type of the registered routine (pREFENDFuncPtr) is defined in the header file 'CCPUFunc.h' as follows.
  • Page 66 CCPU_EntryInt This function registers a routine to be called when an interrupt occurs. ■Format short CCPU_EntryInt (short sSINo, CCPU_FUNCPTR pFuncPtr) ■Argument Argument Name Description IN/OUT sSINo Interrupt pointer number Specify the interrupt pointer number. pFuncPtr Registered routine Specify a routine to be registered. (The routine is deregistered by specifying NULL.) •...
  • Page 67 CCPU_EntryTimerEvent This function registers a timer event. ■Format short CCPU_EntryTimerEvent (long* plEvent) ■Argument Argument Name Description IN/OUT plEvent Registered event Specify a timer event to be registered. The specification method of the registered event (plEvent) is as follows: plEvent Description plEvent[0] Number of timer event settings (1 to 16) plEvent[1]...
  • Page 68 CCPU_EntryWDTInt This function registers a routine to be called when a user WDT error interrupt occurs. ■Format short CCPU_EntryWDTInt (short sType, CCPU_FUNCPTR pFuncPtr) ■Argument Argument Name Description IN/OUT sType WDT type Specify the WDT type. (If reserve is specified, an error is returned.) •...
  • Page 69 CCPU_FromBuf This function reads data from the CPU buffer memory of the CPU module and the buffer memory of the intelligent function module which are mounted on the specified module position. (FROM instruction) ■Format short CCPU_FromBuf (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument...
  • Page 70 CCPU_FromBufHG This function reads data from the fixed cycle communication area of the CPU module mounted on the specified module position. ■Format short CCPU_FromBufHG(unsigned short usIoNo, unsigned long short ulOffset, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument Name Description...
  • Page 71 CCPU_GetCCIEFBDiagnosticInfo This function acquires the diagnostic information of CC-Link IE Field Network Basic. ■Format short CCPU_GetCCIEFBDiagnosticInfo (unsigned short usSlave, short* psStatusBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT usSlave Slave station number Specify a slave station to acquire diagnostic information. (1 to 64) psStatusBuf Diagnostic information storage Specify a storage destination for diagnostic information.
  • Page 72 *1 The fixed cycle processing includes the refresh processing with network modules, the reset processing of watchdog timer, and the self- diagnostic processing. For more details on the functions, refer to the following manual. MELSEC iQ-R C Controller Module User's Manual (Application) ■Return value...
  • Page 73 CCPU_GetCounterMicros This function acquires a 1 μs counter value of a C Controller module. ■Format short CCPU_GetCounterMicros(unsigned long* pulMicros) ■Argument Argument Name Description IN/OUT pulMicros 1μs counter value storage Specify the storage destination of the 1μs counter value. destination ■Description •...
  • Page 74 CCPU_GetCounterMillis This function acquires a 1 ms counter value of a C Controller module. ■Format short CCPU_GetCounterMillis(unsigned long* pulMillis) ■Argument Argument Name Description IN/OUT pulMillis 1 ms counter value storage Specify the storage destination of the 1 ms counter value. destination ■Description •...
  • Page 75 CCPU_GetCpuStatus This function acquires the operating status of a C Controller module. ■Format short CCPU_GetCpuStatus(long* plStatusBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT plStatusBuf Operating status storage Specify the storage destination of the operating status. destination ulBufSize Operating status storage Specify the size of area reserved in the operating status storage destination in double destination size word units.
  • Page 76 CCPU_GetDotMatrixLED This function acquires the value displayed on the dot matrix LED of a C Controller module, and stores it to the LED data storage destination (pcData). ■Format short CCPU_GetDotMatrixLED(char* pcData, unsigned long ulDataSize) ■Argument Argument Name Description IN/OUT pcData LED data storage destination Specify the storage destination of LED data.
  • Page 77 CCPU_GetErrInfo This function acquires the error information of a C Controller module. ■Format short CCPU_GetErrInfo(unsigned short* pusErrorInfo, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT pusErrorInfo Error information storage Specify the error information storage destination . destination ulBufSize Error information storage Specify the error information storage destination size in word units.
  • Page 78 CCPU_GetFileSecurity This function acquires the file access mode of a C Controller module. ■Format short CCPU_GetFileSecurity(short* psMode); ■Argument Argument Name Description IN/OUT psMode File access mode Stores the file access mode. • 0: Access restriction clear mode • 1: Access restriction mode ■Description This function acquires the current file access mode, and stores it to the file access mode (psMode).
  • Page 79 CCPU_GetIDInfo This function acquires the individual identification information of a C Controller module. ■Format short CCPU_GetIDInfo(unsigned char *pucGetData, unsigned long ulBufSize); ■Argument Argument Name Description IN/OUT pucGetData Individual identification Specify the individual identification information storage destination. information storage destination ulBufSize Individual identification Specify the individual identification information storage destination size in word units.
  • Page 80 CCPU_GetLEDStatus This function acquires the LED status of a C Controller module. ■Format short CCPU_GetLEDStatus(long lLed, unsigned short* pusLedInfo, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT lLed Target LED Specify the target LED. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 81 ■Return value Return value Description 0 (0000H) Normal Other than 0 Error For details on the error, refer to the following chapter. Page 174 ERROR CODE LIST ■Relevant function • Page 75 CCPU_GetErrInfo 3 DETAILS OF FUNCTION 3.1 C Controller Module Dedicated Functions...
  • Page 82 CCPU_GetOpSelectMode This function acquires the operation selection mode of a C Controller module. ■Format short CCPU_GetOpSelectMode(long lModeInfo, long* plSelectMode) ■Argument Argument Name Description IN/OUT lModeInfo Mode information Specify the mode information. • 1: Operation selection mode when the MODE/SELECT switch is held in the SELECT position •...
  • Page 83 CCPU_GetPowerStatus This function acquires the power status of C Controller module. ■Format short CCPU_GetPowerStatus(long* plStatusBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT plStatusBuf Power status storage destination Specify the storage destination of the power status. ulBufSize Power status storage destination Specify the power status storage destination size in double word units.
  • Page 84 CCPU_GetRTC This function acquires the clock data (local time) of a C Controller module. ■Format short CCPU_GetRTC(short* psGetData,unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT psGetData Clock data storage destination Specify the storage destination of the clock data (local time). ulBufSize Clock data storage destination Specify the clock data (local time) storage destination size in word units.
  • Page 85 CCPU_GetSerialNo This function acquires the serial number of a C Controller module. ■Format short CCPU_GetSerialNo(char* pcGetData, unsigned long ulDataSize) ■Argument Argument Name Description IN/OUT pcGetData Serial number storage destination Specify the serial number storage destination. ulDataSize Serial number storage destination Specify the serial number storage destination in byte units.
  • Page 86 CCPU_GetSwitchStatus This function acquires the switch status of a C Controller module. ■Format short CCPU_GetSwitchStatus(long* plStatusBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT plStatusBuf Switch status storage destination Specify the switch status storage destination. ulBufSize Switch status storage destination Specify the switch status storage destination size in double word units.
  • Page 87 CCPU_GetUnitInfo This function acquires the module configuration information. ■Format short CCPU_GetUnitInfo (unsigned short* pusUnitInfo1, unsigned short* pusUnitInfo2, unsigned short* pusUnitInfo3) ■Argument Argument Name Description IN/OUT pusUnitInfo1 Module configuration information Specify the storage destination of module configuration information 1. pusUnitInfo2 Module configuration information Specify the storage destination of module configuration information 2.
  • Page 88 pusUnitInfo Description Storage position Status pusUnitInfo1[0-64] bit15 Module mounting status • 0: Not mounted • 1: Mounted bit14 Series information 1: MELSEC iQ-R series (0: MELSEC-Q series)  bit13-0 Reserved  pusUnitInfo2[0-64] bit15-8 Reserved bit7-4 Module type information • 0000: Input module •...
  • Page 89 ■Series information is MELSEC-Q series The series can be checked in the 14th bit of pusUnitInfo1[0-64]. CPU slot information pusUnitInfo1[0] 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 pusUnitInfo1[1] Information on slot 0 Series information Input/output point information pusUnitInfo1[63]...
  • Page 90 CCPU_MountMemoryCard This function mounts the SD memory card inserted to a C Controller module. ■Format short CCPU_MountMemoryCard (short sDrive) ■Argument Argument Name Description IN/OUT sDrive Target drive Specify a target drive. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 91 CCPU_ReadDevice This function reads data from internal user devices and internal system devices of C Controller module. ■Format short CCPU_ReadDevice (short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type.
  • Page 92 CCPU_ReadLinkDevice This function reads data from the own station link devices of CC-Link IE Controller Network module, CC-Link IE Field Network module, Ethernet module (when CC-Link IE Field Network is selected), and MELSECNET/H network module. ■Format short CCPU_ReadLinkDevice (unsigned short usIoNo, short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument...
  • Page 93 CCPU_RegistEventLog This function registers an event log in the event history of a C Controller module. ■Format short CCPU_RegistEventLog (long lEventCode, char* pcEventMsg) ■Argument Argument Name Description IN/OUT lEventCode Detailed code Specify a detailed event code to be registered in the event history. pcEventMsg Detailed information Specify detailed information character string data of an event to be registered in the event...
  • Page 94 For the remote operation and the operating status of a C Controller module, refer to the following manual. MELSEC iQ-R C Controller Module User's Manual (Application) • When this function is executed, no value is returned because a C Controller module is restarted from an operating system.
  • Page 95 CCPU_ResetDevice This function resets internal user devices and internal system devices (bit devices) of C Controller module. ■Format short CCPU_ResetDevice (short sDevType, unsigned long ulDevNo) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Start device number Specify the start device number.
  • Page 96 CCPU_ResetWDT This function resets the user WDT of a C Controller module. ■Format short CCPU_ResetWDT (short sType) ■Argument Argument Name Description IN/OUT sType WDT type Specify the WDT type. (If reserve is specified, an error is returned.) • 0: User WDT •...
  • Page 97 CCPU_RestoreDefaultCCIEFBCycPrm This function restores the operation parameter of cyclic transmission of CC-Link IE Field Network Basic to the default value (which is set in the parameter). ■Format short CCPU_RestoreDefaultCCIEFBCycPrm (void) ■Argument None ■Description • This function restores the all group operation parameters of cyclic transmission to their default value (which are set in the parameter).
  • Page 98 CCPU_SetDevice This function sets internal user devices and internal system devices (bit devices) of C Controller module. ■Format short CCPU_SetDevice (short sDevType, unsigned long ulDevNo) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Device number Specify the device number.
  • Page 99 CCPU_SetDotMatrixLED This function sets a value to be displayed on the dot matrix LED of C Controller module. ■Format short CCPU_SetDotMatrixLED(unsigned short usLedMode, char* pcData) ■Argument Argument Name Description IN/OUT usLedMode Output mode Specify the output mode to the dot matrix LED. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 100 (usLedMode). Precautions • To display data on the dot matrix LED, selecting 'USER' in the operation selection mode is required. (MELSEC iQ-R C Controller Module User's Manual (Startup)) • When checking an operation or checking the selected operation with the MODE/SELECT switch, an error occurs at the time of executing the CCPU_SetDotMatrixLED function even when "USER"...
  • Page 101 CCPU_SetLEDStatus This function sets the LED status of a C Controller module. ■Format short CCPU_SetLEDStatus(long lLed, unsigned short usLedInfo) ■Argument Argument Name Description IN/OUT lLed Target LED Specify the target LED. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 102 CCPU_SetOpSelectMode This function sets the operation selection mode of C Controller module. ■Format short CCPU_SetOpSelectMode(long lModeInfo, long lSelectMode) ■Argument Argument Name Description IN/OUT lModeInfo Mode information Specify the mode information. lSelectMode Operation selection mode Specify the operation selection mode. The specification method of the mode information (lModeInfo) and operation selection mode (lSelectMode) is as follows: lModeInfo lSelectMode Description...
  • Page 103 CCPU_SetRTC This function sets the clock data (local time) of C Controller module. ■Format short CCPU_SetRTC(short* psSetData) ■Argument Argument Name Description IN/OUT psSetData Clock data Specify the clock data (local time) to be set. • Specify the clock data (local time) to the clock data (psSetData) as follows. (Available range: January 1, 1980 to December 31, 2079) psSetData Description...
  • Page 104 CCPU_ShutdownRom This function shuts down the program memory and data memory of a C Controller module. ■Format short CCPU_ShutdownRom (void) ■Argument None ■Description • This function shuts down the program memory and data memory of a C Controller module. The BUS RUN LED starts flashing at high speed after the shutdown.
  • Page 105 CCPU_StartCCIEFBDataAssurance This function starts data assurance for one link scan of CC-Link IE Field Network Basic. ■Format short CCPU_StartCCIEFBDataAssurance (unsigned short usGroupNo, unsigned long ulTimeout) ■Argument Argument Name Description IN/OUT usGroupNo Group No. Specify a group number to start data assurance. (1 to 4) ulTimeout Timeout value Specify a timeout time until data assurance is started in milliseconds.
  • Page 106 CCPU_StartWDT This function sets and starts the user WDT of a C Controller module. ■Format short CCPU_StartWDT(short sType, short sInterval) ■Argument Argument Name Description IN/OUT sType WDT type Specify the WDT type. (If reserve is specified, an error is returned.) •...
  • Page 107 CCPU_StopWDT This function stops the user WDT of a C Controller module. ■Format short CCPU_StopWDT(short sType) ■Argument Argument Name Description IN/OUT sType WDT type Specify the WDT type. (If reserve is specified, an error is returned.) • 0: User WDT •...
  • Page 108 CCPU_SysClkRateGet This function reads the system clock rate specified with the CCPU_SysClkRateSet function from the backup RAM. ■Format short CCPU_SysClkRateGet(short* psTicks) ■Argument Argument Name Description IN/OUT psTicks Clock rate Stores the system clock rate in the unit of clock frequency (Hz) per one second. •...
  • Page 109 CCPU_SysClkRateSet This function saves the specified system clock rate in the backup RAM. ■Format short CCPU_SysClkRateSet(short sTicks, short* psRestart) ■Argument Argument Name Description IN/OUT sTicks Clock rate Specify the system clock rate in the unit of clock frequency (Hz) per one second. •...
  • Page 110 CCPU_ToBuf This function writes data to the CPU buffer memory of the CPU module (host CPU) and the buffer memory of the intelligent function module which are mounted on the specified module position. (TO instruction) ■Format short CCPU_ToBuf (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument...
  • Page 111 CCPU_ToBufHG This function writes data to the fixed cycle communication area of the CPU module mounted on the specified module position. ■Format short CCPU_ToBufHG(unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT...
  • Page 112 CCPU_UnmountMemoryCard This function unmounts the SD memory card and USB Mass Storage Class-compliant device inserted to a C Controller module. ■Format short CCPU_UnmountMemoryCard (short sDrive) ■Argument Argument Name Description IN/OUT sDrive Target drive Specify a target drive. (When 'Reserved' is specified, this function ends normally without processing.) •...
  • Page 113 CCPU_WaitEvent This function waits for an interrupt event notification from other CPUs. ■Format short CCPU_WaitEvent (short* psEvent, unsigned long ulTimeout, short* psSetEventNo) ■Argument Argument Name Description IN/OUT psEvent Interrupt event setting Specify the interrupt event. ulTimeout Timeout value Specify the timeout value in milliseconds (0H to FFFFFFFFH). (When FFFFFFFFH is specified, the function waits for an event infinitely.) psSetEventNo Occurred event...
  • Page 114 Setting of psEvent to wait for interrupt event 0 and 1 for CPU No.1, and interrupt event 10 for CPU No.2 psEvent[0] = 3; psEvent[1] = 1; psEvent[2] = 0; psEvent[3] = 1; psEvent[4] = 1; psEvent[5] = 2; psEvent[6] = 10; When interrupt event 10 for CPU No.2 occurs, '2' and '10' are returned to psSetEventNo[0] and psSetEventNo[1], respectively.
  • Page 115 • To issue the switch interrupt event by holding the MODE/SELECT switch in the SELECT position, selecting "EVENT" in the operation selection mode is required. (MELSEC iQ-R C Controller Module User's Manual (Startup)) • For the SELECT switch interrupt event, an event issuance status cannot be judged from the appearance. To check the issued status of SELECT switch interrupt event, implement the processing such as receiving a switch interrupt event using this function and making the USER LED turn ON.
  • Page 116 CCPU_WaitTimerEvent This function waits for a timer event to occur. ■Format short CCPU_WaitTimerEvent (long lEventNo) ■Argument Argument Name Description IN/OUT lEventNo Timer event number Specify a timer event number that waits for a timer event to occur. (1 to 16) ■Description •...
  • Page 117 CCPU_WaitUnitEvent This function waits for an interrupt event notification from modules. ■Format short CCPU_WaitUnitEvent (short* psEvent, unsigned long ulTimeout, short* psSetEventNo) ■Argument Argument Name Description IN/OUT psEvent Event setting Specify the interrupt event. ulTimeout Timeout value Specify the timeout value in milliseconds (0H to FFFFFFFFH). (When FFFFFFFFH is specified, the function waits for an event infinitely.) psSetEventNo Occurred event...
  • Page 118 Setting of psEvent when waiting for interrupt event 0, interrupt event 1, interrupt event 50, and interrupt event 51 psEvent[0] = 4; psEvent[1] = 0; psEvent[2] = 1; psEvent[3] = 50; psEvent[4] = 51; When event 51 occurs, 51 is returned to psSetEventNo. The event numbers (interrupt pointer numbers) are as follows.
  • Page 119 CCPU_WriteDevice This function writes data to internal user devices and internal system devices of C Controller module. ■Format short CCPU_WriteDevice (short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type.
  • Page 120 CCPU_WriteLinkDevice This function writes data to the own station link devices of CC-Link IE Controller Network module, CC-Link IE Field Network module, Ethernet module (when CC-Link IE Field Network is selected), and MELSECNET/H network module. ■Format short CCPU_WriteLinkDevice (unsigned short usIoNo, short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf, unsigned long ulBufSize) ■Argument Argument...
  • Page 121 CCPU_X_In_BitEx This function reads an input signal (X) in bit (1-point) units. ■Format short CCPU_X_In_BitEx (short sFlg, unsigned short usXNo, unsigned short* pusData) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. • 0: Normal access • Others: Reserved usXNo Input signal Specify an input signal (X).
  • Page 122 CCPU_X_In_WordEx This function reads an input signal (X) in word (16-point) units. ■Format short CCPU_X_In_WordEx (short sFlg, unsigned short usXNo, unsigned short usSize, unsigned short* pusDataBuf, unsigned short usBufSize) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. •...
  • Page 123 CCPU_Y_In_BitEx This function reads an output signal (Y) in bit (1-point) units. ■Format short CCPU_Y_In_BitEx (short sFlg, unsigned short usYNo, unsigned short* pusData) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. • 0: Normal access • Others: Reserved usYNo Output signal Specify an output signal (Y).
  • Page 124 CCPU_Y_In_WordEx This function reads an output signal (Y) in word (16-point) units. ■Format short CCPU_Y_In_WordEx (short sFlg, unsigned short usYNo, unsigned short usSize, unsigned short* pusDataBuf, unsigned short usBufSize) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. •...
  • Page 125 CCPU_Y_Out_BitEx This function outputs an output signal (Y) in bit (1-point) units. ■Format short CCPU_Y_Out_BitEx (short sFlg, unsigned short usYNo, unsigned short usData) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. • 0: Normal access • Others: Reserved usYNo Output signal Specify an output signal (Y).
  • Page 126 CCPU_Y_Out_WordEx This function outputs an output signal (Y) in word (16-point) units. ■Format short CCPU_Y_Out_WordEx (short sFlg, unsigned short usYNo, unsigned short usSize, unsigned short* pusDataBuf, unsigned short usBufSize) ■Argument Argument Name Description IN/OUT sFlg Access flag Specify an access flag. •...
  • Page 127: C Controller Module Dedicated Functions For Isr

    C Controller module dedicated functions for ISR CCPU_DisableInt_ISR This function disables the routine registered with the CCPU_EntryInt function. ■Format short CCPU_DisableInt (short sSINo) ■Argument Argument Name Description IN/OUT sSINo Interrupt pointer number Specify the interrupt pointer number. ■Description • This function disables the routine registered with the CCPU_EntryInt function. (The routine is not executed when an interrupt occurs.) •...
  • Page 128 CCPU_EnableInt_ISR This function enables the routine registered with the CCPU_EntryInt function. ■Format short CCPU_EnableInt (short sSINo) ■Argument Argument Name Description IN/OUT sSINo Interrupt pointer number Specify the interrupt pointer number. ■Description • This function enables the routine registered with the CCPU_EntryInt function. (The routine is executed when an interrupt occurs.) •...
  • Page 129 CCPU_FromBuf_ISR This function reads data from the CPU buffer memory of the CPU module and the buffer memory of the intelligent function module which are mounted on the specified module position. (FROM instruction) ■Format short CCPU_FromBuf_ISR (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument...
  • Page 130 CCPU_FromBufHG_ISR This function reads data from the fixed cycle communication area of the CPU module mounted on the specified module position. ■Format short CCPU_FromBufHG_ISR (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT usIoNo Module position...
  • Page 131 CCPU_GetCounterMicros_ISR This function acquires a 1 μs counter value of a C Controller module. ■Format short CCPU_GetCounterMicros_ISR(unsigned long* pulMicros) ■Argument Argument Name Description IN/OUT pulMicros 1μs counter value storage Specify the storage destination of the 1μs counter value. destination ■Description •...
  • Page 132 CCPU_GetCounterMillis_ISR This function acquires a 1 ms counter value of a C Controller module. ■Format short CCPU_GetCounterMillis_ISR(unsigned long* pulMillis) ■Argument Argument Name Description IN/OUT pulMillis 1 ms counter value storage Specify the storage destination of the 1 ms counter value. destination ■Description •...
  • Page 133 CCPU_GetDotMatrixLED_ISR This function acquires the value displayed on the dot matrix LED of a C Controller module, and stores it to the LED data storage destination (pcData). ■Format short CCPU_GetDotMatrixLED_ISR (char* pcData, unsigned long ulDataSize) ■Argument Argument Name Description IN/OUT pcData LED data storage destination Specify the storage destination of LED data.
  • Page 134 ■ WARNING If any function in which an invalid argument is specified is executed, an error such as hardware failure (3C02H) may occur on C Controller module. ■Return value Return value Description 0 (0000H) Normal ■Relevant function • Page 137 CCPU_SetDotMatrixLED_ISR 3 DETAILS OF FUNCTION 3.1 C Controller Module Dedicated Functions...
  • Page 135 CCPU_ReadDevice_ISR This function reads data from internal user devices and internal system devices of C Controller module. ■Format short CCPU_ReadDevice_ISR (short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Start device number...
  • Page 136 CCPU_RegistEventLog_ISR This function registers an event log in the event history of a C Controller module. ■Format short CCPU_RegistEventLog_ISR (long lEventCode, char* pcEventMsg) ■Argument Argument Name Description IN/OUT lEventCode Detailed code Specify a detailed event code to be registered in the event history. pcEventMsg Detailed information Specify detailed information character string data of an event to be registered in the event...
  • Page 137 CCPU_ResetDevice_ISR This function resets internal user devices and internal system devices (bit devices) of C Controller module. ■Format short CCPU_ResetDevice_ISR(short sDevType, unsigned long ulDevNo) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Start device number Specify the start device number.
  • Page 138 CCPU_SetDevice_ISR This function sets internal user devices and internal system devices (bit devices) of C Controller module. ■Format short CCPU_SetDevice_ISR (short sDevType, unsigned long ulDevNo) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Device number Specify the device number.
  • Page 139 CCPU_SetDotMatrixLED_ISR This function sets a value to be displayed on the dot matrix LED of C Controller module. ■Format short CCPU_SetDotMatrixLED_ISR (unsigned short usLedMode, char* pcData) ■Argument Argument Name Description IN/OUT usLedMode Output mode Unused (Even if a value is specified, the operation is not affected.) pcData LED data Specify the LED data.
  • Page 140 ■ WARNING If any function in which an invalid argument is specified is executed, an error such as hardware failure (3C02H) may occur on C Controller module. ■Return value Return value Description 0 (0000H) Normal ■Relevant function • Page 131 CCPU_GetDotMatrixLED_ISR 3 DETAILS OF FUNCTION 3.1 C Controller Module Dedicated Functions...
  • Page 141 CCPU_SetLEDStatus_ISR This function sets the LED status of a C Controller module. ■Format short CCPU_SetLEDStatus_ISR(long lLed, unsigned short usLedInfo) ■Argument Argument Name Description IN/OUT lLed Target LED Unused (Even if a value is specified, the operation is not affected.) usLedInfo LED status information Specify the LED status information.
  • Page 142 CCPU_ToBuf_ISR This function writes data to the CPU buffer memory of the CPU module (host CPU) and the buffer memory of the intelligent function module which are mounted on the specified module position. (TO instruction) ■Format short CCPU_ToBuf_ISR (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument Name...
  • Page 143 CCPU_ToBufHG_ISR This function writes data to the fixed cycle communication area of the CPU module mounted on the specified module position. ■Format short CCPU_ToBufHG_ISR (unsigned short usIoNo, unsigned long ulOffset, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT usIoNo Module position...
  • Page 144 CCPU_WriteDevice_ISR This function writes data to internal user devices and internal system devices of C Controller module. ■Format short CCPU_WriteDevice_ISR (short sDevType, unsigned long ulDevNo, unsigned long ulSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT sDevType Device type Specify the device type. Page 9 Argument specification ulDevNo Start device number...
  • Page 145 CCPU_X_In_Word_ISR This function reads an input signal (X) in word (16-point) units. ■Format short CCPU_X_In_Word_ISR (unsigned short usXNo, unsigned short usSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT usXNo Start input signal Specify a start input signal (X). (Specify a multiple of 16.) usSize Read data size Specify the read data size in word units.
  • Page 146 CCPU_Y_In_Word_ISR This function reads an output signal (Y) in word (16-point) units. ■Format short CCPU_Y_In_Word_ISR (unsigned short usYNo, unsigned short usSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT usYNo Start output signal Specify a start output signal (Y). (Specify a multiple of 16.) usSize Read data size Specify the read data size in word units.
  • Page 147 CCPU_Y_Out_Word_ISR This function outputs an output signal (Y) in word (16-point) units. ■Format short CCPU_Y_Out_Word_ISR (unsigned short usYNo, unsigned short usSize, unsigned short* pusDataBuf) ■Argument Argument Name Description IN/OUT usYNo Start output signal Specify a start output signal (Y). (Specify a multiple of 16.) usSize Output size Specify the output size in word units.
  • Page 148: Melsec Data Link Functions

    MELSEC Data Link Functions This section explains the details of the MELSEC data link function. mdClose This function closes a communication line (channel). ■Format short mdClose(long lPath) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. ■Description •...
  • Page 149 mdControl This function performs remote operations (remote RUN/STOP/PAUSE) for a CPU module. ■Format short mdControl(long lPath, short sStNo, short sCode) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. sStNo Station number Specify the network number and station number of the target module. Page 9 Argument specification sCode Instruction code...
  • Page 150 mdDevRstEx This function resets bit devices. ■Format long mdDevRstEx(long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module. lStNo Station number Specify the station number of target module.
  • Page 151 mdDevSetEx This function sets bit devices. ■Format long mdDevSetEx (long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module. lStNo Station number Specify the station number of target module.
  • Page 152 mdGetLabelInfo This function acquires device information corresponding to label names. ■Format long mdGetLabelInfo (long lPath, long lNetNo, long lStNo, long lLbCnt, void* pLbLst, long* plDevLst, unsigned long long* pullLbCode) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module.
  • Page 153 • DevGV can be specified only with the functions supporting label access (mdRandRLabelEx/mdRandWLabelEx). • For accessible CPU modules, refer to the following manual. MELSEC iQ-R C Controller Module User's Manual (Application) 3 DETAILS OF FUNCTION 3.2 MELSEC Data Link Functions...
  • Page 154 ■Example The following tables show the examples of values specified to the label name array (pLbLst) and data read to the device name array (plDevLst). (For five labels to be read: Label 1 to 5). Describe a target label name in a text file, and save it by specifying Unicode (UTF-16). Read the label name in a binary format on a user program from the saved text file, and store the address of the label name to pass to the label name array (pLbLst) on the memory.
  • Page 155 mdInit This function initializes communication route information. ■Format short mdInit(long lPath) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. ■Description This function clears communication route information using the path of the specified channel. ■Return value Return value Description...
  • Page 156 mdOpen This function opens a communication line (channel). ■Format short mdOpen(short sChan, short sMode, long* plPath) ■Argument Argument Name Description IN/OUT sChan Channel Specify a communication line (channel). Page 9 Argument specification sMode Mode Specify '-1'. plPath Path of channel Specify the storage destination (address) of the path of the channel.
  • Page 157 mdRandREx This function reads devices randomly. ■Format long mdRandREx(long lPath, long lNetNo, long lStNo, long* plDev, short* psBuf, long lBufSize) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module. Page 9 Argument specification lStNo Station number...
  • Page 158 ■Example The following tables show the examples of values specified to the randomly selected device (plDev), values read to the read data storage destination (psBuf), and the number of bytes of read data. Device to be read randomly Current value M100 to M115 All bits are OFF.
  • Page 159 ■Return value Return value Description 0 (0000H) Normal Other than 0 Error For details on the error, refer to the following chapter. Page 174 ERROR CODE LIST ■Relevant functions • Page 154 mdOpen • Page 146 mdClose • Page 161 mdRandWEx 3 DETAILS OF FUNCTION 3.2 MELSEC Data Link Functions...
  • Page 160 mdRandRLabelEx This function reads devices corresponding to labels randomly. ■Format long mdRandRLabelEx(long lPath, long lNetNo, long lStNo, long* plDev, short* psBuf, long lBufSize, unsigned long long ullLbCode) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module.
  • Page 161 ■Example The following tables show the examples of values specified to the randomly selected device (plDev), values read to the read data storage destination (psBuf), and the number of bytes of read data. Device to be read randomly Current value M100 Bit is OFF.
  • Page 162 ■Return value Return value Description 0 (0000H) Normal Other than 0 Error For details on the error, refer to the following chapter. Page 174 ERROR CODE LIST *1 For a return value which does not exist in the reference, refer to the manual for the programmable controller CPU. (MELSEC iQ-R CPU Module User's Manual (Application)) ■Relevant functions •...
  • Page 163 mdRandWEx This function writes devices randomly. ■Format long mdRandWEx(long lPath, long lNetNo, long lStNo, long* plDev, short* psBuf, long lBufSize) ■Argument Argument Name Description IN/OUT lPath Channel Specify the path of the channel. lNetNo Network number Specify the network number of target module. Page 9 Argument specification lStNo Station number...
  • Page 164 ■Example The following tables show the examples of values specified to the randomly selected device (plDev) and the write data storage destination (psBuf), and the number of bytes of write data. Device to be written randomly Description M100 to M115 Turns all the bits OFF.
  • Page 165 mdRandWLabelEx This function writes devices corresponding to labels randomly. ■Format long mdRandWLabelEx(long lPath, long lNetNo, long lStNo, long* plDev, short* psBuf, long lBufSize, unsigned long long ullLbCode) ■Argument Argument Name Description IN/OUT lPath Channel Specify the path of the channel. lNetNo Network number Specify the network number of target module.
  • Page 166 ■Example The following tables show the examples of values specified to the randomly selected device (plDev) and the write data storage destination (psBuf), and the number of bytes of write data. Device to be written randomly Description M100 Turns the bit OFF. D10 to D13 Stores 10 in D10, 200 in D11, 300 in D12, and 400 in D13.
  • Page 167 mdReceiveEx This function reads devices in a batch. ■Format long mdReceiveEx(long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo, long* plSize, short* psData) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module.
  • Page 168 mdReceiveEx This function receives messages. (RECV function) ■Format long mdReceiveEx(long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo, long* plSize, short* psData) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify '0' (0H).
  • Page 169 • The arguments of this function correspond to the control data (device) of the dedicated instruction (RECV) as shown below: Device Item Corresponding argument and return value  Error completion type Completion status sRet Own station storage channel lDevNo Channel used by send station psData[2] Send station network number psData[0]...
  • Page 170 mdSendEx This function writes devices in a batch. ■Format long mdSendEx(long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo, long* plSize, short* psData) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module.
  • Page 171 mdSendEx This function sends messages. (SEND function) ■Format long mdSendEx(long lPath, long lNetNo, long lStNo, long lDevType, long lDevNo, long* plSize, short* psData) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. lNetNo Network number Specify the network number of target module.
  • Page 172 • The arguments of this function correspond to the control data (device) of the dedicated instruction (SEND) as shown below: Device Item Corresponding argument and return value Execution/error completion type lDevType Completion status sRet Own station channel lDevNo Target station storage channel lDevNo Target station network number lNetNo...
  • Page 173 mdTypeRead This function reads the model code of a CPU module. ■Format short mdTypeRead(long lPath, short sStNo, short* psCode) ■Argument Argument Name Description IN/OUT lPath Path of channel Specify the path of the opened channel. sStNo Station number Specify the network number and station number of the target module. Page 9 Argument specification psCode Model code...
  • Page 174 Model code (hexadecimal) CPU module 036AH Q13UDVCPU 036CH Q26UDVCPU 0541H L02CPU 0543H L02SCPU 0544H L06CPU 0545H L26CPU 0548H L26CPU-BT 0549H L02CPU-P 054AH L26CPU-PBT 0641H LJ72GF15-T2 0642H NZ2GF-ETB 2014H Q172DCPU(-S1) 2015H Q173DCPU(-S1) 2018H Q172DSCPU 2019H Q173DSCPU 2043H Q12DCCPU-V 2044H Q24DHCCPU-V 2045H Q24DHCCPU-LS 2046H Q24DHCCPU-VG...
  • Page 175 ■Return value Return value Description 0 (0000H) Normal Other than 0 Error For details on the error, refer to the following chapter. Page 174 ERROR CODE LIST ■Relevant functions • Page 154 mdOpen • Page 146 mdClose 3 DETAILS OF FUNCTION 3.2 MELSEC Data Link Functions...
  • Page 176: Chapter 4 Error Code List

    ERROR CODE LIST This chapter shows the codes for errors occurred in the dedicated function library and the corrective actions. Common Error Codes The following table shows the common error codes for the dedicated function library. Error code Description Corrective action Decimal Hexadec imal...
  • Page 177 Error code Description Corrective action Decimal Hexadec imal ■Number of device points error 0083H Check the specified number of device points. • The specified number of device points is out of range. • The specified number of bit device points is not a multiple of 8. 16384 to 4000H to ■Errors detected in the access target CPU module...
  • Page 178 Error code Description Corrective action Decimal Hexadec imal ■Transient unsupported error -28627 902DH • Check the communication route and target which support the Transient transmission cannot be performed via the specified transient request. communication route and target. (Another station was specified •...
  • Page 179 Error code Description Corrective action Decimal Hexadec imal ■Area number error -28669 9003H Review the area number, offset address, and mode. The specified area number, offset address, and mode are out of range. -28671 9001H ■Module identification error • Review the parameters. •...
  • Page 180: C Controller Module Dedicated Functions

    C Controller Module Dedicated Functions The following table shows the error codes of the C Controller module dedicated functions. Error code Description Corrective action Decimal Hexadec imal ■Module identification error -201 FF37H Check the specified module identification. The specified module identification is unavailable. ■I/O signal error -203 FF35H...
  • Page 181 Error code Description Corrective action Decimal Hexadec imal ■Event wait error -234 FF16H • Check if a program is forcibly being terminated. An error other than timeout occurred while the function waits • Check if the C Controller module is running normally. for the event.
  • Page 182 Error code Description Corrective action Decimal Hexadec imal ■Interrupt event type specification error -257 FEFFH Check the specified value. The value specified to the interrupt event type is out of range. ■Interrupt pointer number specification error -258 FEFEH Check the specified value. The value specified as the interrupt pointer number is out of range.
  • Page 183 Error code Description Corrective action Decimal Hexadec imal ■Program memory shutdown error -292 FEDCH • Check if files in the program memory are being accessed. The shutdown processing of the program memory failed. • Check if all files in the program memory have been closed. -293 FEDBH ■Data memory shutdown error...
  • Page 184 Error code Description Corrective action Decimal Hexadec imal ■Operation error -312 FEC8H Change the fixed cycle communication function in the multiple CPU The CCPU_DedicatedDInst function was executed in the setting to "Use". state where the fixed cycle communication function is set to "Not Use"...
  • Page 185 Error code Description Corrective action Decimal Hexadec imal ■CC-Link IE Field Network Basic parameter unset -331 FEB5H Set the CC-Link IE Field Network Basic parameters with CW The function is executed without setting CC-Link IE Field Configurator. Network Basic parameters. -332 FEB4H ■Slave station timeout time specification error...
  • Page 186: Melsec Data Link Functions

    MELSEC Data Link Functions The following table shows the error codes of MELSEC data link functions. Error code Description Corrective action Decimal Hexadec imal ■Path error FFFFH • Use a path pointer returned with the mdOpen function. • The specified path is unavailable. •...
  • Page 187 • Reset the C Controller module or turn the power OFF and ON after checking the parameters with CW Configurator again and writing them. • Check if the access target module supports dedicated function libraries. (MELSEC iQ-R C Controller Module User's Manual (Startup)) FFDCH ■Registry write error •...
  • Page 188 Error code Description Corrective action Decimal Hexadec imal -475 to - FE25H to Refer to the following manual.  Q Corresponding MELSECNET/H Network System Reference Manual (PLC to PLC network) 3839 F101H -4097 to - EFFFH to Refer to the following manuals. MELSEC iQ-R CC-Link IE Controller Network User's Manual (Application) 8192 E000H...
  • Page 189: Error Codes Different From Conventional Functions

    Error Codes Different From Conventional Functions Error code (return value) for replaced functions may differ from the one for conventional functions. Be sure to refer to the list of error code in this manual (Page 174 ERROR CODE LIST) to perform the troubleshooting. 4 ERROR CODE LIST 4.4 Error Codes Different From Conventional Functions...
  • Page 190: Appendix

    APPENDIX Appendix 1 Example for Replacing Ladder by C Language This section shows program examples for replacing ladder by C language. Program example The following shows a program for writing the data in psData[5] of the station number 0 (own station) to the buffer memory (address: 0 to 4) of the intelligent device station/remote device station on the station number 1 (target station).
  • Page 191 The CPU module is C Controller module ■Example for using the C Controller module dedicated function short CCPU_DedicatedJInstSample(void){ short sRet=0; /*(1)*/ char pcInstName[8]="REMTO"; /*(2)*/ short sNetNo=1; /*(3)*/ short sChan=1; /*(4)*/ short sStNo=1; /*(5)*/ short sIoNo=0x0000; /*(6)*/ short sAdd=0; /*(7)*/ short psData[5]={1,2,3,4,5}; /*(8)*/ short sSize=5;...
  • Page 192: Appendix 2 How To Replace An Existing Product

    Appendix 2 How to Replace an Existing Product Replacement of projects Import the Q12DCCPU-V projects by using the Import function of CW Workbench (SW1DND-CWWR-E/EZ/EVZ). Select the "Build Support and Specs" tab on the screen of property for the imported project, and change "Active build spec" to "ARMARCH7gnu_SMP".
  • Page 193 MELSEC data link functions ■Device types for accessing CC-Link modules Device type deleted from R12CCPU-V Alternative method Device Device name specification Own station remote input DevX The area (device) corresponding to the device type deleted from R12CCPU-V can be accessed with either of the methods below. Own station remote output DevY Page 192 Refreshing device, The access target is a network module on the...
  • Page 194 ■Device types for accessing CC-Link IE Field Network modules Device type deleted from R12CCPU-V Alternative method Device Device name specification Own station remote input DevLX(0) The area (device) corresponding to the device type deleted from R12CCPU-V can be accessed with either of the methods below. Own station remote output DevLY(0) Page 192 Refreshing device, The access target is a network...
  • Page 195: Compilation Of Replaced Project

    Compilation of replaced project Compile the replaced project in CW Workbench. APPX Appendix 2 How to Replace an Existing Product...
  • Page 196: Appendix 3 Correspondence Table To Conventional Functions

    Appendix 3 Correspondence Table to Conventional Functions : Conventional functions can be used. : Conventional functions cannot be used. : Replacement of functions is not required. Not available: No functions are available to be replaced. C Controller module dedicated functions Function name (conventional) Mode type Availability in R12CCPU-V Function name (replaced)
  • Page 197: Bus Interface Functions

    Bus interface functions Function name (conventional) Mode type Availability in R12CCPU- Function name (replaced)  QBF_Close Basic mode/Extended mode Not available QBF_ControlEx Basic mode/Extended mode  CCPU_Control  QBF_ControlProgram Basic mode/Extended mode Not available QBF_FromBuf Basic mode/Extended mode  CCPU_FromBuf CCPU_FromBufHG ...
  • Page 198: Bus Interface Functions For Isr

    Function name (conventional) Mode type Availability in R12CCPU- Function name (replaced) QBF_ClearError Basic mode/Extended mode  CCPU_ClearError  QBF_Control Basic mode/Extended mode CCPU_Control QBF_Control7SegLED Basic mode/Extended mode  CCPU_SetDotMatrixLED  QBF_ControlLED Basic mode/Extended mode CCPU_SetLEDStatus  QBF_EntryTimerEvent Basic mode/Extended mode CCPU_EntryTimerEvent ...
  • Page 199 MELSEC data link functions Function name (conventional) Mode type Availability in R12CCPU- Function name (replaced)   mdClose Basic mode/Extended mode mdControl Basic mode/Extended mode     mdDevRstEx Basic mode/Extended mode mdDevSetEx Basic mode/Extended mode    ...
  • Page 200: Index

    INDEX ... . . 10,13 Bus interface communication ..6,7 C Controller module dedicated function ....10,34 CC-Link communication CC-Link IE Controller Network communication .
  • Page 201 MEMO...
  • Page 202: Function Index

    FUNCTION INDEX ..103 CCPU_StartCCIEFBDataAssurance ..... . .104 CCPU_StartWDT ... . . 48 CCPU_ChangeCCIEFBCycPrm .
  • Page 203 MEMO...
  • Page 204: Revisions

    Japanese manual number: SH-081370-F This manual confers no industrial property rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.
  • Page 205: Warranty

    WARRANTY Please confirm the following product warranty details before using this product. 1. Gratis Warranty Term and Gratis Warranty Range If any faults or defects (hereinafter "Failure") found to be the responsibility of Mitsubishi occurs during use of the product within the gratis warranty term, the product shall be repaired at no cost via the sales representative or Mitsubishi Service Company.
  • Page 206: Trademarks

    TRADEMARKS Microsoft, Microsoft Access, Excel, SQL Server, Visual Basic, Visual C++, Visual Studio, Windows, Windows NT, Windows Server, Windows Vista, and Windows XP are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Celeron, Intel, and Pentium are either registered trademarks or trademarks of Intel Corporation in the United States and/or other countries.
  • Page 208 SH(NA)-081371ENG-F(1710) MODEL:RCCPU-P-E HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN NAGOYA WORKS : 1-14 , YADA-MINAMI 5-CHOME , HIGASHI-KU, NAGOYA , JAPAN When exported from Japan, this manual does not require application to the Ministry of Economy, Trade and Industry for service transaction permission. Specifications subject to change without notice.