Hitachi CE50-10 Instruction Manual page 188

Table of Contents

Advertisement

G. Library Interface Reference
Figure G‒1: Format of the area specified for buf
(d) Return values
0
Normal termination
-1
Abnormal termination. One of the following codes is returned for the error number (errno).
Table G‒1: Codes for the error number (errno)
Code
EINVAL
EFAULT
ENXIO
EIO
ETIMEDOUT
(e) Notes
• For the value specified for the buf argument, whether NULL is specified is checked but whether the specified
area is accessible is not checked. Therefore, you must allocate the data storage area and specify the address of that
area. If the specified area is not accessible or is too small, a program error might occur. If a program error occurs,
the application program (process) that called the library terminates abnormally.
• If the external power supply of DO is lost due to a power failure or any other failure, DO data is not output but
didoctl terminates normally. CE50-10 is unable to detect incorrect DO data output caused by a failure in an
external power supply.
(f) Coding example
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <ecextioctl.h>
int main()
{
int
ret, board, cmd, bufdata;
board = BOARD_NO1;
cmd = DIO_READ;
bufdata = 0;
172
The value specified for cmd is neither DIO_READ nor DIO_WRITE. Alternatively, the value
specified for board is not BOARD_NO1.
When DIO_WRITE is specified, the data for bit 10 to bit 31 in the area specified for buf is not
output to DO. Therefore, the specification content is not checked.
NULL is specified for the area specified for buf.
An attempt to open the device to be used within the library failed. Alternatively, an error occurred
in the IPC (shared memory) in the library. Restart the unit.
When DO was accessed, a hardware error was detected by writing and reading back the register.
Message KXDO002-W, KXDO003-W, or KXDO004-W is output.
A timeout was detected during access to DI or DO. A message KXDI001-W or KXDO001-W is
output.
/* Read DI data. */
Description

Advertisement

Table of Contents
loading

Table of Contents