Mitsubishi Electric MELSEC iQ-R Series User Manual page 73

Controller module
Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Source code
The following describes source codes.
/************************************************************************************/
/* Function header */
/************************************************************************************/
#include
<vxworks.h>
#include
<taskLib.h>
#include
<stdio.h>
#include
<string.h>
#include
"CCPUFunc.h"
/************************************************************************************/
/* Definition */
/************************************************************************************/
/* For debugging */
#define
UNIT_XY
0x0010
#define
RY_LED
0x5555
#define
LED_0
0x30
#define
LED_SPACE
0x20
/* For C Controller module dedicated function */
#define
WORD
#define
NORMAL_ACCESS
#define
DUMMY
#define
DISPMODE_ASCII
/************************************************************************************/
/* Processing to output Y signals and to control dot matrix LED */
/************************************************************************************/
void
R12_SampleTask()
{
/* Declare local variables. */
short
sRet;
unsigned short
usDataBuf;
unsigned short
usEmptyDataBuf;
char
pcdata[4];
short
i;
/* Set the output value of Y signals (turn on the even bit). */
usDataBuf = RY_LED;
/* Set the output value of the dot matrix LED (LED1,2: on). */
pcdata[0] = LED_0;
pcdata[1] = LED_0;
pcdata[2] = LED_SPACE;
pcdata[3] = LED_SPACE;
/* Perform an output control and dot matrix LED control in turns for 20 times. */
for(i = 0; i < 20; i++){
/* Output control */
sRet = CCPU_Y_Out_WordEx(NORMAL_ACCESS, UNIT_XY, WORD, &usDataBuf, DUMMY);
if(sRet != 0){
printf("ERROR : CCPU_Y_Out_WordEx_1
return;
}
/* VxWorks function header */
/* VxWorks function header */
/* Standard function header */
/* Standard function header */
/* C Controller module dedicated function header */
/* Start I/O number of the module */
/* Initial output value of Y signals (even bit: on) */
/* Initial output value on the dot matrix LED (LED1,2) */
/* Initial output value on the dot matrix LED (LED3,4) */
1
/* 1-word specification */
0
/* General access specification */
0
/* Dummy */
1
/* Dot matrix LED output mode */
/* Return value of the C Controller module dedicated function */
/* For accessing Y signals */
/* For resetting Y signals */
/* Value on the dot matrix LED */
/* For loop */
[%d(%04hxH)]\n", sRet, sRet);
8 OPERATION EXAMPLE
8.3 Programming
8
71

Advertisement

Table of Contents
loading

This manual is also suitable for:

R12ccpu-v

Table of Contents