Mitsubishi Electric MELSEC iQ-R Series Quick Start Manual

Hide thumbs Also See for MELSEC iQ-R Series:

Quick Links

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC iQ-R Series

  • Page 3: Table Of Contents

    CONTENTS RELEVANT MANUALS ..............2 CHAPTER 1 INTRODUCTION CHAPTER 2 USING C CONTROLLER MODULE Preparing for Operation .
  • Page 4: Relevant Manuals

    RELEVANT MANUALS This guide explains the basic operations of a C Controller module. To make maximum use of a C Controller module, refer to the following manuals according to a purpose. Manual name [manual number] Description Available form MELSEC iQ-R C Controller Module User's Manual Explains the performance specifications, procedure before operation, and Print book (Startup)
  • Page 5: Chapter 1 Introduction

    MELSEC iQ-R series C Controller module R12CCPU-V (hereafter abbreviated as a C Controller module). This guide is targeted for users who use the MELSEC iQ-R series for the first time and are in the following situations: • Users with experience in C language or C++ language programming •...
  • Page 6 MEMO 1 INTRODUCTION...
  • Page 7: Chapter 2 Using C Controller Module

    USING C CONTROLLER MODULE Preparing for Operation Prepare necessary devices. 1) C Controller system 2) Personal computer 3) CW Configurator (SW1DND-RCCPU) Installation*1 For modules, refer to the Windows -installed next page. personal computer 4) CW Workbench 5) Ethernet cable (SW1DND-CWWR-E/EZ/EVZ) Installation*1 Either a straight cable or a cross cable...
  • Page 8: Configuring The System

    Configuring the System System configuration example This guide uses the following system configuration as an example. Name Model name Description Base unit R35B A unit to mount a power supply module, a C Controller module, and I/O modules. Power supply module R62P A module which supplies power to modules, such as a C Controller module and I/O modules.
  • Page 9: Mounting The Modules

    Mounting the modules Mount the prepared modules on a base unit. Precautions Before mounting modules, be sure to power OFF the system. Mounting procedure When a cap is attached to the module connector on the base unit, remove it. Place the concave part (1) of the module onto the guide (2) of the base unit.
  • Page 10: Wiring The Modules

    Wiring the modules Wire the power supply module. Precautions Before wiring modules, be sure to power OFF the system. For wiring precautions, refer to the following manual. MELSEC iQ-R Module Configuration Manual Wiring the power supply module. The following shows an example of wiring the power wire and the ground wire to the power supply module. Grounding should be provided to prevent electric shock and malfunction.
  • Page 11: Checking The Power Supply Module

    Checking the power supply module After installing the system, mounting the modules, and wiring the system, check that the power supply module works properly. Operating procedure Check the following before powering ON the system. • Wiring to the power supply module •...
  • Page 12: Setting The Module

    Setting the Module Initializing the C Controller module Check that the RESET/STOP/RUN switch is positioned at the center at first. Put and hold the MODE/SELECT switch (1) on the MODE position. Turn the power of the C Controller module ON. The BUS RUN LED (2) turns ON, and "M-00"...
  • Page 13: Setting Parameters

    Resetting procedure C Controller module can be reset by operating the switch by the following procedure. Hold the RESET/STOP/RUN switch (1) in the RESET position. Check that all LEDs turn OFF after the ERROR LED (2) flashes several times. Release the RESET/STOP/RUN switch (1) and put it back to the STOP position.
  • Page 14 Starting CW Configurator to create a project Operating procedure Select [Start]  [All Programs]  [MELSOFT]  [CW Configurator]  [CW Configurator]. Select [Project]  [New]. Check that "RCPU" and "R12CCPU-V" are selected, and click the [OK] button. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 15 Establishing communication with the C Controller module Operating procedure Select [Online]  [Current Connection Destination] from the menu of CW Configurator. Click the [CPU Module Direct Coupled Setting] button in the "Specify Connection Destination" screen. Select "Ethernet", and click the [Yes] button. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 16 Click the [Connection Test] button, and check that the message "Successfully connected with the R12CCPU-V." appears. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 17 Setting parameters Set the parameters for the system and modules. Operating procedure Double-click "Module Configuration" in the "Navigation" window to open, and select [Online]  [Read Module Configuration from PLC]. When the following message appears, click the [Yes] button. Click the [OK] button when the following message appears after reading is completed. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 18 The system parameters are automatically set, and the actual system configuration is displayed in the "Module Configuration" window. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 19 Writing parameters to the C Controller module Write the parameters to the C Controller module using CW Configurator. Operating procedure Select [Online]  [Write to PLC]. Click the [Yes] button. Check that the "Online Data Operation" screen appears. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 20 Select "System Parameter/CPU Parameter" and "Module Parameter", and click the [Execute] button. Click the [Yes to all] button. Writing the parameters starts. Click the [Close] button when writing to the C Controller module is completed. 2 USING C CONTROLLER MODULE 2.3 Setting the Module...
  • Page 21: Knowledge Required For Programming

    C Controller module dedicated function C Controller module dedicated function is one of the 'dedicated function libraries' for C Controller modules. Using this function in a user program allows a C Controller module to easily control MELSEC iQ-R series modules. I/O access 1-point access and 1-word access are available.
  • Page 22: C Controller Module Dedicated Function Used In This Guide

    C Controller module dedicated function used in this guide Create a program using basic C Controller module dedicated functions (output access and dot matrix LED control). Output access: CCPU_Y_Out_WordEx function ■Format short CCPU_Y_Out_WordEx (short sFlg, unsigned, short usYNo, unsigned short usSize, unsigned short* pusDataBuf, unsigned short usBufSize);...
  • Page 23 Dot matrix LED control: CCPU_SetDotMatrixLED function ■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 24: Programming

    Programming Create a program in which lamps connected to an output module and the dot matrix LED on the front of the C Controller module flash. Program example and control description When the C Controller module is set to RUN, the output lamps Y10 and Y11 alternately turn ON. Synchronizing with the output lamps, the dot matrix LED on the front of the C Controller module switches alternately between "00__"...
  • Page 25 Source code The following describes source codes. /************************************************************************************/ /* Function header */ /************************************************************************************/ #include /* VxWorks function header */ #include /* VxWorks function header */ #include /* Standard function header */ #include /* Standard function header */ #include "CCPUFunc.h"...
  • Page 26 /* Dot matrix LED control */ sRet = CCPU_SetDotMatrixLED(DISPMODE_ASCII, &pcdata[0]); if(sRet != 0){ printf("ERROR : CCPU_SetDotMatrixLED_1 [%d(%04hxH)]\n", sRet, sRet); return; /* Invert the output value of Y signals (turn on the bits in order of odd bit -> even bit -> ...). */ usDataBuf = ~usDataBuf;...
  • Page 27: Creating A Project

    Creating a project Starting CW Workbench Operating procedure Select [Start]  [All Programs]  [Wind River]  [CW Workbench 3.3]  [CW Workbench 3.3]. After CW Workbench is started, enter the save destination folder for a project. In this procedure, enter 'C:\WindRiver\workspace'. Click the [OK] button.
  • Page 28 Creating a new project Operating procedure Select [File]  [New]  [Wind River Workbench Project]. Select "Wind River VxWorks 6.9", and click the [Next] button. Select "Downloadable Kernel Module", and click the [Next] button. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 29 Enter a project name, and click the [Finish] button. (Project name: 'R12_SampleProject' in this chapter) 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 30 Setting properties of the project Configure the settings to convert (build) the created project into a module that can be executed on the C Controller module. Build: An operation that compiles source codes according to a processor and links the code to the include file. ■Setting a processor Operating procedure Select the created project in the "Project Explorer"...
  • Page 31 Select the [Build Support and Specs] tab. Select only the checkbox of "ARMARCH7gnu_SMP" in "Available and enabled build specs". 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 32 Select the checkbox of "Debug mode". For the actual system operation, unselect the checkbox of "Debug mode". Select the [Tools] tab, enter "-mlong-calls" in the field next to the [Tool Flags] button. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 33 Enter "-fsigned-char" in the fields next to the [Debug mode] button and [Non Debug mode] button under "Debug mode flags". ■Setting an include file Operating procedure Select the [Paths] tab, and click the [Add] button. Click the [Browse] button. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 34 Select the include folder for the C Controller module in the "Select directory" screen, and click the [OK] button. In this procedure, the include file is stored in "C:\MELSEC\R12CCPU-V". Check that the selected folder is specified in the "Add include search path to selected build spec" screen, and click the [OK] button.
  • Page 35 Add the include file to the include folder added in step 1 to 5. To acquire an include file stored in the C Controller module, start Explorer and enter the following address in the address bar. ftp://192.168.3.3/SYSTEMROM/INCLUDE/ The "Log On As" screen appears. Enter the following user name and password in the "Log On As"...
  • Page 36: Preparing A User Program

    Prepare a user program that controls the C Controller system. A sample program for C Controller modules is used in this guide. For sample programs for this guide, please contact your local Mitsubishi Electric sales office or representative. Adding a sample program Operating procedure Store a sample program for this guide immediately under the created project folder.
  • Page 37 The sample program stored in step 1 is added to the project. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 38 Generating an execution module from the user program Convert (build) the created program into a module that can be executed on the C Controller module. Operating procedure Select and right-click the created project in the "Project Explorer" window, and click [Rebuild Project]. If the following message appears after selecting [Rebuild Project], click the [Continue] button.
  • Page 39 Connecting the C Controller module with CW Workbench Connect the user Ethernet port CH1 of the C Controller module with CW Workbench to perform debugging in CW Workbench. Operating procedure To acquire a VxWorks image file from the C Controller module, start Explorer and enter the following address in the address bar.
  • Page 40 Click in the "Remote Systems" window. The "New Connection" screen appears. Select "Wind River VxWorks 6.x Target Server Connection" in the "New Connection" screen. Click the [Next] button. Set the following items in "Backend settings". • Processor : ARM9 (Click the [Select] button and select the processor.) •...
  • Page 41 Select "File" in "Kernel image". Click the [Browse] button. The "Open File" screen appears. Select the VxWorks image file copied to the "C:\MELSEC\R12CCPU-V\CCPUTool" folder in step 4, and click the [Open] button. Click the [Finish] button. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 42 The connection is completed when "Connected - Target server running" is displayed at the bottom of the "Remote Systems" window. If "Connected - Target server running" is not displayed, check that the C Controller module is normally powered ON, and perform the operation again from 'Page 37 Connecting the C Controller module with CW Workbench'.
  • Page 43 Debugging the user program Check if the created program runs properly. ■Downloading the user program on the C Controller module To debug the user program, download the execution module on the memory in the C Controller module. By downloading a user program, the program can be executed with no script file. Script file: A file to describe a loading location of a user program that starts at the start of a C Controller module and a startup order of the user program.
  • Page 44 The "Launch Configuration Selection" screen appears on and after the second operation of the step 2. Select "Launch the selected launch configuration", and click the [OK] button. ■Debugging the user program Operating procedure Select the created project in the "Project Explorer" window, and click the [] button on the right side of on the toolbar.
  • Page 45 Select a target server indicating connection to the C Controller module. Click the [Browse] button. The "Entry Points" screen appears. Select the function "R12_SampleTask" that starts debugging, and click the [OK] button. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 46 Check that the function name selected in step 6 is set for "Entry Point", and click the [Debug] button. Debugging starts. Program execution stops at the start of the function specified for "Entry Point". Click in the "Debug" window to debug a program by one step. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 47 Variable values can be checked and changed in the "Variables" window on the bottom right of the screen. Check that 'sRet', return value of the CCPU function, is '0' (normal value) in this step. (a) Run the programs to the line indicated with the red arrow '→' by the step execution in step 9. (b) Check that the value of sRet is '0' (normal value) in the [Variables] tab.
  • Page 48 ■Debugging using breakpoint As well as debugging in units of one step described in step 9 , debugging using a breakpoint is available. Operating procedure Double-click the left edge of the source file window and insert a breakpoint. Click The program runs to the position where the breakpoint is specified. 2 USING C CONTROLLER MODULE 2.5 Programming...
  • Page 49 The descriptions of icons are as follows: • : Step Into Steps into the called function and stops at the first line of the function. • : Step Over Executes the current line of the function and then stops at the next line of the function. •...
  • Page 50 Registering the execution module Build the created program for operation, and store the program on the C Controller module. ■Building the user program Operating procedure Select the created project in the "Project Explorer" window, and click [Project]  [Properties]. Select "Build Properties" from the tree to the left in the screen, unselect the "Debug mode" checkbox, and click the [OK] button.
  • Page 51 ■Storing the user program Operating procedure Start Explorer, and enter the following address in the address bar. ftp://192.168.3.3/0 After login to the C Controller module, the address is displayed as follows. Copy the created user program "R12_SampleProject.out" to the program memory '0' in the C Controller module by a drag and drop operation.
  • Page 52 ■Creating and storing a script file Create a script file that automatically downloads the execution module at the start of the C Controller module. Operating procedure Open a text file and describe a script file that downloads a user program and generates a task, as shown below. The "R12_SampleProject.out"...
  • Page 53: Checking Operations

    Checking Operations Run the program registered in the C Controller module to check its operations. The status of the C Controller module can be changed by the RESET/STOP/RUN switch on the front of the module. Change the status of the RESET/STOP/RUN switch as follows, depending on the purpose. •...
  • Page 54: Checking Operations With The Dot Matrix Led And Lamps

    Checking operations with the dot matrix LED and lamps The dot matrix LED on the front of the C Controller module and output lamps operate as follows: The display of the dot matrix LED on the front of the C Controller module switches alternately ten times. Synchronizing with the dot matrix LED, the output lamps Y10 and Y11 alternately turn ON.
  • Page 55: Chapter 3 Frequently-Used Functions

    FREQUENTLY-USED FUNCTIONS This chapter describes functions frequently used for the start-up and the maintenance after operation of a C Controller system. Checking Errors An error can be checked and the corrective action can be taken using CW Configurator. Checking an error Operating procedure Start CW Configurator.
  • Page 56 An error code is displayed in the screen. The detailed information such as cause and corrective action can be checked. 3 FREQUENTLY-USED FUNCTIONS 3.1 Checking Errors...
  • Page 57: Checking Error History

    Checking error history Errors occurred up to the present and the error details can be checked. When and what kind of error occurs can be checked, useful in error analysis. Operating procedure Start CW Configurator. Select [Diagnostics]  [Module Diagnostics (CPU Diagnostics)]. The "Module Diagnostics"...
  • Page 58 Click the [Event History] button. Error history and the error details are displayed. To see more details of an error, click the error. 3 FREQUENTLY-USED FUNCTIONS 3.1 Checking Errors...
  • Page 59 The detailed information is displayed. 3 FREQUENTLY-USED FUNCTIONS 3.1 Checking Errors...
  • Page 60: Monitoring Module Status And Testing Operations

    Monitoring Module Status and Testing Operations Module I/O status and buffer memory status can be checked through CW Configurator. In addition, I/O status can be checked and operations can be tested at start-up and maintenance. Monitoring module status The status of input (X), output (Y), and buffer memory in the module can be monitored. Buffer memory: The internal memory of an intelligent function module (such as A/D conversion module and D/ A conversion module having a function other than input and output) used to send and receive data (such as setting values and monitored values) for communication with a C Controller module...
  • Page 61 The "Device/Buffer Memory Batch Monitor" screen appears. Enter a target device (start) for "Device Name", and click the [Start Monitoring] button. The following shows an example for "D0". The status of "D0" can be checked. 3 FREQUENTLY-USED FUNCTIONS 3.2 Monitoring Module Status and Testing Operations...
  • Page 62: Testing Operations By Forced Output

    Testing operations by forced output Module operations can be tested by forced output from an output (Y). The following shows the procedure for forced output (Y). Operating procedure Start CW Configurator. Select [Online]  [Monitor]  [Device/Buffer Memory Batch Monitor]. The "Device/Buffer Memory Batch Monitor"...
  • Page 63 Double-click the 0th bit of Y0. The 0th bit of Y0 is changed from '0' to '1', and the output (Y) is output forcibly. An operation test by forced write to a buffer memory can be executed in the same manner. 3 FREQUENTLY-USED FUNCTIONS 3.2 Monitoring Module Status and Testing Operations...
  • Page 64: Trademarks

    Before using the products, always read the product user manuals. Mitsubishi Electric will not be held liable for damage caused by factors found not to be the cause of Mitsubishi Electric; opportunity loss or lost profits caused by faults in Mitsubishi Electric products; damage, secondary damage, or accident compensation, whether foreseeable or not, caused by special factors;...

This manual is also suitable for:

C controller

Table of Contents