s5u1c33000c Epson Electronics America, Inc., s5u1c33000c Datasheet - Page 122

no-image

s5u1c33000c

Manufacturer Part Number
s5u1c33000c
Description
Cmos 32-bit Single Chip Microcomputer S5u1c33000c Manual
Manufacturer
Epson Electronics America, Inc.
Datasheet
CHAPTER 8: ANSI LIBRARY
8.4 Lower-level Functions
The following three functions (read, write, and _exit) are the lower-level functions called by a library function.
Since these functions depend on hardware, they are not provided in the library. If these functions are desired,
define them in the user program.
For an example of a C source file that defines these functions, refer to sys.c in the sample\ansilib\ directory.
8.4.1 "read" Function
Contents of read function
Definition of input buffer
Precautions on using a simulated I/O
106
Format:
Argument:
Functionality:
Returned value: Number of bytes actually read from the input buffer
Library functions that call the read function:
Format:
Buffer contents: The size of the input data (1 to max. 64) is stored at the beginning of the buffer
When using the debugger's simulated I/O, define in the read function the global label "READ_FLASH" that
is required for the debugger to update the input buffer, then create the function so that new data will be read
into the input buffer at that position. (For details about the simulated I/O function, refer to the chapter
where the debugger is discussed.)
int read(int fd, char *buf, int nbytes);
int fd;
char *buf;
int nbytes; Number of bytes transferred
This function reads up to nbytes of data from the user-defined input buffer, and stores it in
the buffer indicated by buf.
If the input buffer is empty (EOF) or nbytes = 0, 0 is returned.
If an error occurs, -1 is returned.
Direct call: fread, getc, _doscan (_doscan is a scanf-series internal function)
Indirect call: fgetc, fgets, getchar, gets (calls getc)
unsigned char READ_BUF[65]; (Variable name is arbitrary; size is fixed to 65 bytes)
unsigned char READ_EOF;
(READ_BUF[0]). 0 denotes EOF.
The input data is stored in READ_BUF[1], and the following locations.
READ_EOF stores the status that indicates whether EOF is reached.
File descriptor denoting input
When called from a library function, 0 (stdin) is passed.
Pointer to the buffer that stores input data
scanf, fscanf, sscanf (calls _doscan)
EPSON
(C COMPILER PACKAGE FOR S1C33 FAMILY) (Ver. 4)
S5U1C33000C MANUAL

Related parts for s5u1c33000c