Renesas Computer Hardware M16C 62P Group User Guide

REC10B0002-0100  
M16C/62P Group  
Renesas Embedded  
Application Programming Interface  
Reference Manual  
Rev.1.00  
Revision Date: Nov.1, 2007  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Table of Contents  
Rev.1.00  
2007.11.1  
3
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Rev.1.00  
2007.11.1  
4
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
1. Introduction  
The Renesas Embedded Application Programming Interface (API) is a unified API for  
the microcomputers made by Renesas Technology Corporation.  
Rev.1.00  
2007.11.1  
5
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2. Driver  
2.1 Overview  
The library described herein provides a peripheral facility control program (peripheral  
driver) for microcomputers. Use of the Renesas API permits the peripheral driver to be  
built into a user program.  
2.2 Driver Features  
The library described herein has the following features available as a peripheral driver.  
(1) Serial I/O control feature  
It comprises a serial interface driver, which sets or clears the conditions of serial  
communication, as well as controls and manages the transmission/reception of  
communication data.  
(2) Timer control feature  
It comprises a timer driver, which sets or clears the operating conditions of timers,  
as well as controls the timer operation.  
(3) I/O port control feature  
It comprises an I/O port driver, which sets or clears the usage conditions of I/O ports, as  
well as control data read/write operation.  
(4) External interrupt control feature  
It comprises an external interrupt driver, which sets or clears the usage conditions of  
external interrupts, as well as controls interrupt operation.  
(5) A/D converter control feature  
It comprises an A/D converter driver, which sets or clears the usage conditions of A/D  
converters, as well as controls A/D converter operation.  
Rev.1.00  
2007.11.1  
6
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2.3 Serial Interface Driver  
The serial interface driver sets serial communication, clears settings, transmit/receives  
data, and controls the status of serial communication.  
There are two kinds of serial interface driver: a single-data transmission/reception API  
and a multi-data transmission/reception API.  
Rev.1.00  
2007.11.1  
7
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2.4 Timer Driver  
The timer driver sets the timer, clears timer settings, controls timer operation, and  
acquires a counter value with respect to the following modes:  
Timer mode  
Event counter mode  
Pulse width modulation mode (PWM mode)  
Pulse period measurement mode  
Pulse width measurement mode  
2.4.1 Timer Mode  
In this mode, the timer counts the internally generated count source. When an  
underflow or an overflow interrupt occurs, it calls a preset callback function.  
2.4.2 Event Counter Mode  
In this mode, the timer counts the external signal fed in from an input pin or an  
overflow or underflow from other timer. When an underflow or an overflow interrupt  
occurs, it calls a preset callback function.  
2.4.3 Pulse Width Modulation Mode (PWM Mode)  
In this mode, the timer outputs pulses in a given width successively. When an  
underflow or an overflow interrupt occurs, it calls a preset callback function.  
2.4.4 Pulse Period Measurement Mode  
In this mode, the timer measures the pulse period of an external signal fed in from an  
input pin. When an underflow or an overflow interrupt occurs, it calls a preset callback  
function.  
2.4.5 Pulse Width Measurement Mode  
In this mode, the timer measures the pulse width of an external signal fed in from an  
input pin. When an underflow or an overflow interrupt occurs, it calls a preset callback  
function.  
Rev.1.00  
2007.11.1  
8
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2.5 I/O Port Driver  
The I/O port driver sets the I/O port for input or output, writes data to the I/O port, and  
reads data from the I/O port.  
Rev.1.00  
2007.11.1  
9
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2.6 External Interrupt Driver  
The external interrupt driver sets external interrupts, controls external interrupts,  
acquires the status of external interrupt flags, and clears external interrupt flags.  
Rev.1.00  
2007.11.1  
10  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2.7 A/D Converter Driver  
The A/D converter driver sets the A/D converter, controls the A/D converter, clears  
settings of the A/D converter, acquires the A/D converter value, acquires the status of the  
A/D converter, and clears the status of the A/D converter.  
Rev.1.00  
2007.11.1  
11  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3. Standard Types  
This section describes the standard types defined in the library. For details about the  
set values, refer to the description of each API.  
Standard type  
Description  
Boolean  
The Boolean type represents the enum-type data that indicates  
whether successful (RAPI_TRUE (= 1)) or failed (RAPI_FALSE (=  
0)).  
VoidFuncNotify  
The VoidFuncNotify type represents the type of the notification  
function to be registered.  
Rev.1.00  
2007.11.1  
12  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4. Library Reference  
4.1 API List by Peripheral Facility  
The table below lists the Renesas Embedded APIs classified by peripheral facility.  
NO  
Facility  
API  
API operation  
classification  
Opens serial port  
Single-data  
serial I/O  
1
2
Closes serial port  
Sets serial communication  
Receives 1 data  
3
4
Transmits 1 data  
5
Reads receive status  
Reads transmit status  
Stops reception  
6
7
8
Stops transmission  
9
Opens serial port  
Multi-data  
serial I/O  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
Closes serial port  
Registers notification function  
Sets serial communication  
Sets transmit/receive interrupt  
Starts reception  
Starts transmission  
Stops reception  
Stops transmission  
Receives by polling  
Transmits by polling  
Sets timer mode  
Timer  
Controls timer mode operation  
Clears timer mode setting  
Sets event counter mode  
Controls operation of event counter  
mode  
Clears setting of event counter  
mode  
Gets event counter mode counter  
value  
26  
27  
Sets pulse width modulation mode  
28  
29  
Controls operation of pulse width  
modulation mode  
Clears setting of pulse width  
modulation mode  
Sets pulse period measurement  
mode  
Controls operation of pulse period  
measurement mode  
Clears setting of pulse width  
measurement mode  
30  
31  
32  
33  
34  
Acquires measured value of pulse  
period measurement mode  
Rev.1.00  
2007.11.1  
13  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Sets pulse width measurement  
mode  
Controls operation of pulse width  
measurement mode  
Clears setting of pulse width  
measurement mode  
Acquires measured value of pulse  
width measurement mode  
Sets timer register  
35  
36  
37  
38  
Timer  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
Controls operation of timer register  
Clears timer register  
Gets timer register value  
Sets I/O port  
I/O port  
Reads from I/O port  
Writes to I/O port  
Sets I/O port register  
Reads from I/O port register  
Writes to I/O port register  
Sets external interrupt  
External  
interrupt  
Controls external interrupt  
Gets flag status of external interrupt  
Clears flag of external interrupt  
Sets A/D converter  
A/D converter  
Controls operation of A/D converter  
Discards settings of A/D converter  
Gets A/D conversion value (register  
specified)  
Gets A/D conversion value (all  
registers)  
67  
Rev.1.00  
2007.11.1  
14  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4.2 Description of Each API  
This section describes each API and explains how to use them, showing a program  
example for each.  
The description of each API is divided into the following items.  
• Synopsis  
:
Outlines the content of processing performed by the function. It  
also shows the syntax of the function, followed by a brief  
explanation of arguments.  
• Description  
• Return value  
• Functionality  
• Reference  
:
:
:
:
:
:
Describes the function and how to use it in detail.  
Explains the returned value of the function.  
Indicates the functional classification of the function.  
Indicates the related functions.  
• Remark  
Describes the precautions to be taken when using the API.  
Presents a program showing how to use the function.  
• Program example  
Rev.1.00  
2007.11.1  
15  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4.2.1 Serial I/O  
__BasicOpenSerialDriver  
Synopsis  
<Open a serial port>  
Boolean __BasicOpenSerialDriver(unsigned long data)  
data  
Setup data  
Description  
Opens and initializes a specified serial port.  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Open serial driver */  
return __BasicOpenSerialDriver( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
16  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicCloseSerialDriver  
Synopsis  
<Close a serial port>  
Boolean __BasicCloseSerialDriver(unsigned long data)  
data  
Setup data  
Description  
Closes a specified serial port. For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Close serial driver */  
return __BasicCloseSerialDriver( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
17  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicSetSerialFormat  
Synopsis  
<Set serial communication>  
Boolean __BasicSetSerialFormat(unsigned long data1, unsigned char data2)  
data1  
data2  
Setup data 1  
Setup data 2  
Description  
Sets serial communication according to specified parameters.  
[data1]  
For data1, the following values can be set. To set multiple definition values at the same  
time, use the symbol “|” to separate each specified value.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
For serial communication mode, the following values can be set.  
(UART0, UART1, UART2)  
RAPI_SM_SYNC  
RAPI_SM_ASYNC  
(SI/O3, SI/O4)  
Clock synchronous serial communication mode  
Clock asynchronous serial communication mode  
RAPI_SIO_SM_SYNC  
Clock synchronous serial communication mode  
For the data length format of clock asynchronous serial communication, the following  
values can be set.  
If the API is used in clock synchronous serial communication mode, do not set these  
values.  
(UART0, UART1, UART2)  
RAPI_BIT_7  
RAPI_BIT_9  
Transfer data length 7 bits RAPI_BIT_8  
Transfer data length 9 bits  
Transfer data length 8 bits  
For the clock source of serial communication, the following values can be set.  
(UART0, UART1, UART2)  
RAPI_CKDIR_INT  
RAPI_CKDIR_EXT  
(SI/O3, SI/O4)  
Internal clock is used as the clock source of serial communication.  
External clock is used as the clock source of serial communication.  
RAPI_SIO_CKDIR_INT  
Internal clock is used as the clock source of serial communication.  
RAPI_SIO_CKDIR_EXT External clock is used as the clock source of serial communication.  
For the stop bit length of clock asynchronous serial communication, the following  
values can be set.  
If the API is used in clock synchronous serial communication mode, do not set these  
values.  
(UART0, UART1, UART2)  
RAPI_STPB_1  
1 stop bit  
RAPI_STPB_2  
2 stop bits  
For the parity bit of clock asynchronous serial communication, the following values can  
be set.  
Rev.1.00  
2007.11.1  
18  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
If the API is used in clock synchronous serial communication mode, do not set these  
values.  
(UART0, UART1, UART2)  
RAPI_PARITY_NON No parity bit  
RAPI_PARITY_ODD Odd parity bit  
RAPI_PARITY_EVEN  
Even parity bit  
For the clock polarity of serial communication, the following values can be set.  
If the API is used in clock asynchronous serial communication mode, do not set these  
values.  
(UART0, UART1, UART2)  
RAPI_DPOL_NON  
(SI/O3, SI/O4)  
Polarity not inverted  
RAPI_DPOL_INV  
Polarity inverted  
Polarity inverted  
RAPI_SIO_DPOL_NON Polarity not inverted  
RAPI_SIO_DPOL_INV  
For the count source of the built-in baud rate generator, the following values can be set.  
(UART0, UART1, UART2)  
RAPI_BCSS_F1  
RAPI_BCSS_F8  
f1SIO  
f8SIO  
RAPI_BCSS_F2  
RAPI_BCSS_F32  
f2SIO  
f32SIO  
(SI/O3, SI/O4)  
RAPI_SIO_BCSS_F1  
RAPI_SIO_BCSS_F8  
f1SIO  
f8SIO  
RAPI_SIO_BCSS_F2  
f2SIO  
RAPI_SIO_BCSS_F32 f32SIO  
For the _CTS/_RTS function, the following values can be set.  
If the internal clock is selected for use in clock synchronous serial communication  
mode, the _RTS function has no effect.  
(UART0, UART1, UART2)  
RAPI_CTSRTS_DIS  
RAPI_CTS_SEL  
RAPI_RTS_SEL  
_CTS/_RTS functions are not used.  
_CTS function is selected.  
_RTS function is selected.  
For the transfer format, the following values can be set.  
If the data length selected for use in clock asynchronous serial communication mode is  
7 or 9 bits long, do not set these values.  
(UART0, UART1, UART2)  
RAPI_LSB_SEL  
(SI/O3, SI/O4)  
LSB first  
RAPI_MSB_SEL  
MSB first  
MSB first  
RAPI_SIO_LSB_SEL  
LSB first  
RAPI_SIO_MSB_SEL  
For serial data logic switchover, the following values can be set.  
(UART0, UART1, UART2)  
RAPI_LOGIC_NO_REV The value written in the transmit buffer register does not have its  
logic inverted.  
RAPI_LOGIC_REV  
The value written in the transmit buffer register is inverted before  
being transmitted.  
[data2]  
Sets the divide-by-N value of a communication speed.  
Return value  
Rev.1.00  
2007.11.1  
19  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
If serial communication was successfully set, RAPI_TRUE is returned; if settings failed,  
RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
Boolean func( void )  
{
/* Set the data of RAPI_COM1 to serial driver */  
Return _BasicSetSerialFormat(RAPI_COM1 | RAPI_SM_SYNC | RAPI_CKDIR_INT  
| RAPI_BCSS_F1 | RAPI_DPOL_NON | RAPI_LSB_SEL, 20);  
}
Rev.1.00  
2007.11.1  
20  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__BasicStartSerialReceiving  
Synopsis  
<Receive 1 data>  
Boolean __BasicStartSerialReceiving(unsigned long data)  
data  
Setup data  
Description  
Starts receiving 1 data of serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If data reception in serial communication was successfully started, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
..........  
__BasicStartSerialReceiving( RAPI_COM1 );  
..........  
}
Rev.1.00  
2007.11.1  
21  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicStartSerialSending  
Synopsis  
<Transmit 1 data>  
Boolean _BasicStartSerialSending(unsigned long data1, unsigned int data2)  
data  
data  
Setup data  
Transmit data  
Description  
Starts sending 1 data of serial communication.  
For data1, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If data transmission in serial communication was successfully started, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
Void func( void )  
{
..........  
__BasicStartSerialSending( RAPI_COM1, 0x00AA );  
..........  
}
Rev.1.00  
2007.11.1  
22  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicReceivingStatusRead  
Synopsis  
<Read receive status>  
unsigned int __BasicReceivingStatusRead(unsigned long data)  
data  
Setup data  
Description  
Returns the receive status of serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
The receive status of serial communication is returned. The returned value is one of  
the following.  
(UART0, UART1, UART2)  
RAPI_RX_INCOMPLETE Reception not complete yet.  
Other than above  
Reception complete. The value read from the UARTi receive  
buffer register (i = 0 to 2).  
(SI/O3, SI/O4)  
RAPI_RX_INCOMPLETE Reception not complete yet.  
Other than above Reception complete. Low-order 8 bits: The value read from the  
SI/Oi transmit/receive register (i = 3, 4).  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
unsigned int rcv_data;  
..........  
rcv_data = __BasicReceivingStatusRead( RAPI_COM1 );  
..........  
}
Rev.1.00  
2007.11.1  
23  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicSendingStatusRead  
Synopsis  
<Read transmit status>  
Boolean __BasicSendingStatusRead(unsigned long data)  
data  
Setup data  
Description  
Returns the transmit status of serial communication. For data, the following values can  
be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If no data exists in the transmit buffer, RAPI_TRUE is returned; if data exists,  
RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
..........  
if (__BasicSendingStatusRead( RAPI_COM1 ) == RAPI_TRUE) {  
/* Transmission completion */  
}
..........  
}
Rev.1.00  
2007.11.1  
24  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicStopSerialReceiving  
Synopsis  
<Stop reception>  
Boolean Rapi_BasicStopSerialReceiving(unsigned long data)  
data  
Setup data  
Description  
Stops receiving data in serial communication  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
UART0  
UART2  
RAPI_COM2  
UART1  
Return value  
If data reception in serial communication was successfully stopped, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
For the M16C SI/03 and SI/04, this API cannot be used.  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Stop receiving data in serial communication */  
__BasicStopSerialReceiving ( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
25  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__BasicStopSerialSending  
Synopsis  
<Stop transmission>  
Boolean __BasicStopSerialSending(unsigned long data)  
data  
Setup data  
Description  
Stops transmitting data in serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
UART0  
UART2  
RAPI_COM2  
UART1  
Return value  
If data transmission in serial communication was successfully stopped, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
For the M16C SI/03 and SI/04, this API cannot be used.  
When operating in clock synchronous serial communication mode, data reception is  
stopped at the same time by this API.  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Stop sending data in serial communication */  
__BasicStopSerialSending ( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
26  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__OpenSerialDriver  
Synopsis  
<Open a serial port>  
Boolean __OpenSerialDriver(unsigned long data)  
data  
Setup data  
Description  
Opens and initializes a specified serial port.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Open serial driver */  
return __OpenSerialDriver( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
27  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__CloseSerialDriver  
Synopsis  
<Close a serial port>  
Boolean __CloseSerialDriver(unsigned long data)  
data  
Setup data  
Description  
Closes a specified serial port.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Close serial driver */  
return __CloseSerialDriver( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
28  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__ConfigSerialDriverNotify  
Synopsis  
<Register a notification function>  
Boolean __ConfigSerialDriverNotify(unsigned long data, VoidFuncNotify *func)  
data  
func  
Setup data  
Function pointer to be registered  
Description  
Registers the notification function necessary to get various transmit/receive information  
of serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
[func]  
The function to be registered in func must be supplied to the serial I/O driver by the  
user.  
The serial I/O driver calls the function registered in func.  
The serial I/O driver notifies the user of the transmit/receive status by an argument.  
The type of the function to be registered is shown below.  
void “any function name” (unsigned char notify);  
The argument is detailed below.  
(UART0, UART1, UART2)  
b7 b6 b5 b4 b3 b2 b1 b0  
0
0 X  
X
0 X  
X
X
0 No error  
1 Error occurred  
Overrun error  
Framing error  
Parity error  
0 No error  
1 Error occurred  
0 No error  
1 Error occurred  
0 Not completed  
1 Completed  
Transmission completed  
Reception completed  
0 Not completed  
1 Completed  
(SI/O3,SI/O4)  
b7 b6 b5 b4 b3 b2 b1 b0  
0 X 0  
0
X
0
0
0
0 Not completed  
1 Completed  
Transmission completed  
Reception completed  
0 Not completed  
1 Completed  
Rev.1.00  
2007.11.1  
29  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void Notify(unsigned char result) {  
if ((result&RAPI_OVER_ERR) == RAPI_OVER_ERR) {  
/* Overrun error */  
}
if ((result&RAPI_FRAMING_ERR) == RAPI_FRAMING_ERR) {  
/* Framing error */  
}
if ((result&RAPI_PARITY_ERR) == RAPI_PARITY_ERR) {  
/* Parity error */  
}
if ((result&RAPI_TX_END) == RAPI_TX_END) {  
/* Transmission completion */  
}
if ((result&RAPI_RX_END) == RAPI_RX_END) {  
/* Reception completion */  
}
}
Boolean func( void )  
{
/* Set callback functions of RAPI_COM1 to serial driver */  
return __ConfigSerialDriverNotify( RAPI_COM1, Notify );  
}
Rev.1.00  
2007.11.1  
30  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__SetSerialFormat  
Synopsis  
<Set serial communication>  
Boolean __SetSerialFormat(unsigned long data1, unsigned char data2)  
data1  
data2  
Setup data 1  
Setup data 2  
Description  
Sets serial communication according to specified parameters.  
For details about parameters, refer to the description of __BasicSetSerialFormat.  
Return value  
If serial communication was successfully set, RAPI_TRUE is returned; if settings failed,  
RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
Boolean func( void )  
{
/* Set the data of RAPI_COM1 to serial driver */  
return __SetSerialFormat(RAPI_COM1 | RAPI_SM_SYNC | RAPI_CKDIR_INT |  
RAPI_BCSS_F1|RAPI_DPOL_NON|RAPI_LSB_SEL,20);  
}
Rev.1.00  
2007.11.1  
31  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__SetSerialInterrupt  
Synopsis  
<Set serial interrupts>  
Boolean __SetSerialInterrupt(unsigned long data)  
data  
Setup data  
Description  
Sets serial interrupts according to specified parameters.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
For interrupt settings, the following values can set.  
(UART0, UART1, UART2)  
RAPI_INT_TX_DIS  
RAPI_INT_TX_LV_1  
RAPI_INT_TX_LV_2  
RAPI_INT_TX_LV_3  
RAPI_INT_TX_LV_4  
RAPI_INT_TX_LV_5  
RAPI_INT_TX_LV_6  
RAPI_INT_TX_LV_7  
RAPI_INT_RX_DIS  
RAPI_INT_RX_LV_1  
RAPI_INT_RX_LV_2  
RAPI_INT_RX_LV_3  
RAPI_INT_RX_LV_4  
RAPI_INT_RX_LV_5  
RAPI_INT_RX_LV_6  
RAPI_INT_RX_LV_7  
(SI/O3, SI/O4)  
Transmit interrupt disabled  
Transmit interrupt priority level 1  
Transmit interrupt priority level 2  
Transmit interrupt priority level 3  
Transmit interrupt priority level 4  
Transmit interrupt priority level 5  
Transmit interrupt priority level 6  
Transmit interrupt priority level 7  
Receive interrupt disabled  
Receive interrupt priority level 1  
Receive interrupt priority level 2  
Receive interrupt priority level 3  
Receive interrupt priority level 4  
Receive interrupt priority level 5  
Receive interrupt priority level 6  
Receive interrupt priority level 7  
RAPI_INT_SIO_DIS  
SI/O interrupt disabled  
RAPI_INT_SIO_LV_1 SI/O interrupt priority level 1  
RAPI_INT_SIO_LV_2 SI/O interrupt priority level 2  
RAPI_INT_SIO_LV_3 SI/O interrupt priority level 3  
RAPI_INT_SIO_LV_4 SI/O interrupt priority level 4  
RAPI_INT_SIO_LV_5 SI/O interrupt priority level 5  
RAPI_INT_SIO_LV_6 SI/O interrupt priority level 6  
RAPI_INT_SIO_LV_7 SI/O interrupt priority level 7  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Rev.1.00  
2007.11.1  
32  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
Boolean func( void )  
{
/* Set interrupt of RAPI_COM1 to serial driver */  
return  
__SetSerialInterrupt(  
RAPI_COM1  
|
RAPI_INT_TX_LV_1  
|
RAPI_INT_RX_LV_2 );  
}
Rev.1.00  
2007.11.1  
33  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__StartSerialReceiving  
Synopsis  
<Start reception>  
Boolean __StartSerialReceiving(unsigned long data, unsigned char wordNum,  
unsigned int *RcvDtBuf)  
data  
Setup data  
wordNum  
RcvDtBuf  
Number of words received  
Pointer to the buffer in which received data is stored  
Description  
Starts reception of serial communication and gets received data by a specified number  
of words. When acquisition of received data is complete, this API calls a notification  
function (if a notification function is registered).  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If reception of serial communication was successfully started, RAPI_TRUE is returned;  
if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
unsigned int buffer[10];  
void func( void )  
{
/* Get 5 word data received in serial communication */  
__StartSerialReceiving( RAPI_COM1, 5, buffer );  
}
Rev.1.00  
2007.11.1  
34  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__StartSerialSending  
Synopsis  
<Start transmission>  
Boolean __StartSerialSending(unsigned long data, unsigned char wordNum,  
unsigned int *SndDtBuf)  
data  
Setup data  
wordNum  
SndDtBuf  
Number of words transmitted  
Pointer to the transmit data  
Description  
Starts transmission of serial communication and writes transmit data to the transmit  
buffer by a specified number of words. When transmission of all transmit data is  
complete, this API calls a notification function (if a notification function is registered).  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If transmission of serial communication was successfully started, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
unsigned int buffer[10];  
void func( void )  
{
/* Set 5 word data to transmit buffer of serial communication */  
__StartSerialSending( RAPI_COM1, 5, buffer );  
}
Rev.1.00  
2007.11.1  
35  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__StopSerialReceiving  
Synopsis  
<Stop reception>  
Boolean __StopSerialReceiving(unsigned long data)  
data  
Setup data  
Description  
Stops reception of serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
UART0  
UART2  
RAPI_COM2  
UART1  
Return value  
If reception of serial communication was successfully stopped, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
For the M16C SI/03 and SI/04, this API cannot be used.  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Stop receiving data in serial communication */  
__StopSerialReceiving ( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
36  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__StopSerialSending  
Synopsis  
<Stop transmission>  
Boolean __StopSerialSending(unsigned long data)  
data  
Setup data  
Description  
Stops transmission of serial communication.  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
UART0  
UART2  
RAPI_COM2  
UART1  
Return value  
If transmission of serial communication was successfully stopped, RAPI_TRUE is  
returned; if failed, RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
For the M16C SI/03 and SI/04, this API cannot be used.  
When operating in clock synchronous serial communication mode, data reception is  
stopped at the same time by this API.  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
void func( void )  
{
/* Stop sending data in serial communication */  
__StopSerialSending ( RAPI_COM1 );  
}
Rev.1.00  
2007.11.1  
37  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__PollingSerialReceiving  
Synopsis  
<Polling reception>  
Boolean __PollingSerialReceiving(unsigned long data)  
data  
Setup data  
Description  
Performs reception of serial communication by polling. This API gets received data by  
an amount specified by __StartSerialReceiving. When acquisition of received data is  
complete, it calls a notification function (if a notification function is registered).  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
unsigned int buffer[10];  
void func( void )  
{
/* Reception interrupt disable */  
__SetSerialInterrupt( RAPI_COM1 | RAPI_INT_TX_DIS | RAPI_INT_RX_DIS );  
/* Start reception */  
__StartSerialReceiving( RAPI_COM1, 5, buffer );  
while(1){  
__PollingSerialReceiving( RAPI_COM1 );  
}
}
Rev.1.00  
2007.11.1  
38  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__PollingSerialSending  
Synopsis  
<Polling transmission>  
Boolean __PollingSerialSending(unsigned long data)  
data  
Setup data  
Description  
Performs transmission of serial communication by polling. This API sends transmit data  
by an amount specified by __StartSerialSending from the transmit data buffer specified  
by __StartSerialSending. When transmission of all transmit data is complete, it calls a  
notification function (if a notification function is registered).  
[data]  
For data, the following values can be set.  
RAPI_COM1  
RAPI_COM3  
RAPI_COM5  
UART0  
UART2  
SI/O4  
RAPI_COM2  
RAPI_COM4  
UART1  
SI/O3  
Return value  
If the serial port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Serial I/O  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include ”rapi_sif_m16c_62p”  
unsigned int buffer[10];  
void func( void )  
{
/* Transmission interrupt disable */  
__SetSerialInterrupt( RAPI_COM1 | RAPI_INT_TX_DIS | RAPI_INT_RX_DIS );  
/* Start transmission */  
__StartSerialSending( RAPI_COM1, 5, buffer );  
while(1){  
__PollingSerialSending( RAPI_COM1 );  
}
}
Rev.1.00  
2007.11.1  
39  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4.2.2 Timer  
__CreateTimer  
Synopsis  
<Set timer mode>  
Boolean __CreateTimer(unsigned long data1, unsigned int data2, unsigned int  
data3, unsigned int data4, void* func)  
data1  
data2  
data3  
data4  
func  
Setup data 1  
Setup data 2  
Setup data 3  
Setup data 4  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified timer to timer mode.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_F1  
Uses timer A channel 0.  
Uses timer A channel 1.  
Uses timer A channel 2.  
Uses timer A channel 3.  
Uses timer A channel 4.  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Selects f1 for the count source.  
Selects f2 for the count source.  
Selects f8 for the count source.  
Selects f32 for the count source.  
Selects fc32 for the count source.  
Sets the timer to start operating in __CreateTimer.  
Sets the timer to stop operating in __CreateTimer.  
Selects a gate facility that counts a period during which input at  
TAiIN pin remains low.  
RAPI_F2  
RAPI_F8  
RAPI_F32  
RAPI_FC32  
RAPI_TIMER_ON  
RAPI_TIMER_OFF  
RAPI_GATE_L  
RAPI_GATE_H  
Selects a gate facility that counts a period during which input at  
TAiIN pin remains high.  
RAPI_PULSE_ON  
RAPI_PULSE_OFF  
Selects that pulses are output from TAiIN pin.  
Selects that no pulses are output from TAiIN pin.  
• Specifiable definition values when timer A is used (RAPI_TIMER_A0 to  
RAPI_TIMER_A4 specified)  
Rev.1.00  
2007.11.1  
40  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
(Count source)  
Specify one from { RAPI_F1, RAPI_F2, RAPI_F8, RAPI_F32,  
RAPI_FC32 }. The default value is RAPI_F2.  
(Operating states set)  
(Pulse output state)  
(Gate facility)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The  
default value is RAPI_TIMER_OFF.  
Specify one from { RAPI_PULSE_ON, RAPI_PULSE_OFF }. The  
default value is RAPI_PULSE_OFF.  
Specify one from { RAPI_GATE_L, RAPI_GATE_H }. If omitted,  
“No gate facility” is set.  
Specifiable definition values when timer B is used (RAPI_TIMER_B0 to  
RAPI_TIMER_B5 specified)  
(Count source)  
Specify one from { RAPI_F1, RAPI_F2, RAPI_F8, RAPI_F32,  
RAPI_FC32 }. The default value is RAPI_F2.  
(Operating states set)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The  
default value is RAPI_TIMER_OFF.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
[data3]  
Specify the value to be set in the timer register in 16 bits.  
[data4]  
Specify 0.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (timer mode)  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void TimerIntFunc( void ){}  
void func( void )  
{
/* Set up timer A0 as timer mode */  
__CreateTimer( RAPI_TIMER_A0|RAPI_TIMER_ON|RAPI_F8, 5, 0x80, 0,  
TimerIntFunc );  
}
Rev.1.00  
2007.11.1  
41  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnableTimer  
Synopsis  
<Control operation of timer mode>  
Boolean __EnableTimer(unsigned long data)  
data  
Setup data  
Description  
Controls operation of the timer that is set to specified timer mode by starting or  
stopping it.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_TIMER_ON  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Sets the timer that is set to timer mode to start operating.  
RAPI_TIMER_OFF Sets the timer that is set to timer mode to stop operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Timer (timer mode)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Disable timer A1 as timer mode */  
__EnableTimer( RAPI_TIMER_A1 | RAPI_TIMER_OFF );  
}
Rev.1.00  
2007.11.1  
42  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__DestroyTimer  
Synopsis  
<Discard settings of timer mode>  
Boolean __DestroyTimer(unsigned long data)  
data  
Setup data  
Description  
Discards settings of the timer that is set to specified timer mode.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (timer mode)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Destroy the setting of timer A2 as timer mode */  
__DestroyTimer( RAPI_TIMER_A2 );  
}
Rev.1.00  
2007.11.1  
43  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__CreateEventCounter  
Synopsis  
<Set event counter mode>  
Boolean __CreateEventCounter(unsigned long data1, unsigned int data2,  
unsigned int data3, unsigned int data4, void* func)  
data1  
data2  
data3  
data4  
func  
Setup data 1  
Setup data 2  
Setup data 3  
Setup data 4  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified timer to event counter mode.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_EV_EXTERNAL  
Uses timer A channel 0.  
Uses timer A channel 1.  
Uses timer A channel 2.  
Uses timer A channel 3.  
Uses timer A channel 4.  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Selects the external signal input to TAiIN pin (when using timer Ai)  
or TBiIN pin (when using timer Bi) for the count source.  
Selects overflow or underflow of timer Aj (j = i-1, however j = 4 if i =  
0) for the count source.  
RAPI_EV_TIMER_AJ  
RAPI_EV_TIMER_AK  
Selects overflow or underflow of timer Ak (k = i+1, however k = 0 if i  
= 4) for the count source.  
RAPI_EV_TIMER_B2  
RAPI_EV_TIMER_BJ  
Selects overflow or underflow of timer B2 for the count source.  
Selects overflow or underflow of timer Bj (j = i – 1, however j = 2 if i  
= 0, j = 5 if i = 3 ) for the count source.  
Sets the timer to start operating in __CreateEventCounter.  
Sets the timer to stop operating in __CreateEventCounter.  
Selects that pulses are output from TAiIN pin.  
Selects that no pulses are output from TAiIN pin.  
Selects reload type for the count type.  
Selects free-run type for the count type.  
RAPI_TIMER_ON  
RAPI_TIMER_OFF  
RAPI_PULSE_ON  
RAPI_PULSE_OFF  
RAPI_AUTO_RELOAD  
RAPI_FREE_RUN  
Rev.1.00  
2007.11.1  
44  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_UP_COUNT  
Selects up-count for the count operation.  
Selects down-count for the count operation.  
RAPI_DOWN_COUNT  
RAPI_UDF_REGISTER Selects the UDF register for the cause of up/down switching.  
RAPI_TAIOUT  
Selects the input signal at TAiOUT pin for the cause of up/down  
switching.  
RAPI_RISING  
RAPI_FALLING  
RAPI_BOTH  
Selects the rising edge of count source as active edge.  
Selects the falling edge of count source as active edge.  
Selects both rising and falling edges of count source as active  
edges.  
• Specifiable definition values when timer A is used (RAPI_TIMER_A0 to RAPI_TIMER_A4  
specified)  
(Count source)  
Specify one from  
{
RAPI_EV_EXTERNAL, RAPI_EV_TIMER_AJ,  
RAPI_EV_TIMER_AK, RAPI_EV_TIMER_B2 }. The default value is  
RAPI_EV_EXTERNAL.  
(Operating  
states set)  
(Pulse output  
facility)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The default  
value is RAPI_TIMER_OFF.  
Specify one from { RAPI_PULSE_ON, RAPI_PULSE_OFF }. The default  
value is RAPI_PULSE_OFF.  
(Gate facility)  
Specify one from { RAPI_GATE_L, RAPI_GATE_H }. If omitted, “No gate  
facility” is set.  
(Count type)  
Specify one from { RAPI_AUTO_RELOAD, RAPI_FREE_RUN }. The  
default value is RAPI_AUTO_RELOAD.  
(Count  
Specify one from { RAPI_UP_COUNT, RAPI_DOWN_COUNT }. The  
default value is RAPI_DOWN_COUNT. The count direction can only be set  
when the UDF register is used.  
direction)  
(Count direction Specify one from { RAPI_UDF_REGISTER, RAPI_TAIOUT }. The default  
switching)  
value is RAPI_UDF_REGISTER.  
(Count edge)  
Specify one from { RAPI_RISING, RAPI_FALLING }. The default value is  
RAPI_FALLING.  
• Specifiable definition values when timer B is used (RAPI_TIMER_B0 to RAPI_TIMER_B4  
specified)  
(Count source)  
Specify one from { RAPI_EV_EXTERNAL, RAPI_EV_TIMER_BJ }. The  
default value is RAPI_EV_EXTERNAL.  
(Operating  
states set)  
(Count edge)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The default  
value is RAPI_TIMER_OFF.  
Specify one from { RAPI_RISING, RAPI_FALLING, RAPI_BOTH }. The  
default value is RAPI_FALLING.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
[data3]  
Specify the value to be set in the timer register in 16 bits.  
Rev.1.00  
2007.11.1  
45  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
[data4]  
Specify 0.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (event counter mode)  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void TimerIntFunc( void ){}  
void func( void )  
{
/* Set up timer B0 as event counter mode */  
__CreateEventCounter( RAPI_TIMER_B0|RAPI_TIMER_ON|RAPI_FALLING, 5,  
0x80, 0, TimerIntFunc );  
}
Rev.1.00  
2007.11.1  
46  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnableEventCounter  
Synopsis  
<Control operation of event counter mode>  
Boolean __EnableEventCounter(unsigned long data)  
data  
Setup data  
Description  
Controls operation of the timer that is set to specified timer mode by starting or  
stopping it.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_TIMER_ON  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Sets the timer that is set to event counter mode to start  
operating.  
RAPI_TIMER_OFF  
Sets the timer that is set to event counter mode to stop  
operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (event counter mode)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Disable timer B1 as event counter mode */  
__EnableEventCounter( RAPI_TIMER_B1|RAPI_TIMER_OFF );  
}
Rev.1.00  
2007.11.1  
47  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__DestroyEventCounter  
Synopsis  
<Discard settings of event counter mode>  
Boolean __DestroyEventCounter(unsigned long data)  
data  
Setup data  
Description  
Discards settings of the timer that is set to specified timer mode.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (event counter mode)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Destroy the setting of timer B2 as event counter mode */  
__DestroyEventCounter( RAPI_TIMER_B2 );  
}
Rev.1.00  
2007.11.1  
48  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetEventCounter  
Synopsis  
<Get event counter mode counter value>  
Boolean __GetEventCounter(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data 1  
Pointer to the buffer in which counter value is stored  
Description  
Gets the counter value of the timer that is set to specified event counter mode.  
[data1]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (event counter mode)  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
unsigned int data[2];  
/* Get the counter of timer B3 as event counter mode */  
__GetEventCounter(RAPI_TIMER_B3, data );  
}
Rev.1.00  
2007.11.1  
49  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__CreatePulseWidthModulationMode  
Synopsis  
<Set pulse width modulation mode>  
Boolean __CreatePulseWidthModulationMode(unsigned long data1, unsigned int  
data2, unsigned int* data3, void* data4)  
data1  
data2  
data3  
func  
Setup data 1  
Setup data 2  
Setup data 3  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified timer to pulse width modulation mode.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_F1  
Uses timer A channel 0.  
Uses timer A channel 1.  
Uses timer A channel 2.  
Uses timer A channel 3.  
Uses timer A channel 4.  
Selects f1 for the count source.  
Selects f2 for the count source.  
Selects f8 for the count source.  
Selects f32 for the count source.  
Selects fC32 for the count source.  
Sets the timer to start operating in __CreatePulseWidthModulationMode.  
RAPI_F2  
RAPI_F8  
RAPI_F32  
RAPI_FC32  
RAPI_TIMER_ON  
RAPI_TIMER_OFF Sets the timer to stop operating in __CreatePulseWidthModulationMode.  
RAPI_TG_TAIIN  
RAPI_EV_  
Selects external trigger input from TAiIN pin for the count start condition.  
Selects overflow or underflow of timer Aj (j = i – 1, however j = 4 if i = 0)  
as the trigger for the timer to start counting.  
TIMER_AJ  
RAPI_EV_TIMER_ Selects overflow or underflow of timer Ak (k = i + 1, however k = 0 if i =  
AK 4) as the trigger for the timer to start counting.  
RAPI_EV_TIMER_ Selects overflow or underflow of timer B2 as the trigger for the timer to  
B2  
start counting.  
RAPI_TG_TAIS  
Only writing 1 to the TAiS bit of the TABSR register causes the timer to  
start counting.  
RAPI_PULSE_ON  
Selects that pulses are output from TAiIN pin. Selectable only when timer  
Ai is used.  
RAPI_PULSE_OFF Selects that no pulses are output from TAiIN pin. Selectable only when  
timer Ai is used.  
RAPI_PWM_16  
RAPI_PWM_8  
RAPI_RISING  
Selects operation as a 16-bit pulse width modulator.  
Selects operation as an 8-bit pulse width modulator.  
Selects the rising edge of TAiIN pin input signal as active edge.  
Rev.1.00  
2007.11.1  
50  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_FALLING  
Selects the falling edge of TAiIN pin input signal as active edge.  
• Specifiable definition values when timer A is used (RAPI_TIMER_A0 to  
RAPI_TIMER_A4 specified)  
(Count source)  
Specify one from { RAPI_F1, RAPI_F2, RAPI_F32, RAPI_FC32 }.  
The default value is RAPI_F2.  
(Operating states set) Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The  
default value is RAPI_TIMER_OFF.  
(Count start condition) Specify one from { RAPI_TG_TAIS, RAPI_TG_TAIIN,  
RAPI_EV_TIMER_AJ, RAPI_EV_TIMER_AK,  
RAPI_EV_TIMER_B2 }. The default value is RAPI_TG_TAIIN.  
(Pulse output facility) Specify one from { RAPI_PULSE_ON, RAPI_PULSE_OFF }. The  
default value is RAPI_PULSE_OFF.  
(Modulator)  
Specify one from { RAPI_PWM_16, RAPI_PWM_8 }. The default  
value is RAPI_PWM_16.  
(TAiIN pin input)  
Specify one from { RAPI_RISING, RAPI_FALLING }. The default  
value is RAPI_FALLING. The active edge of TAiIN pin input can only  
be set when RAPI_TG_TAIIN is selected.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
[data3]  
Specify a pointer to the 16-bit variable in which the set value for the timer register is  
stored.  
For 16-bit PWM, specify the value of ‘n’ in “high-level width n/fj, period 65535/fj” in  
16 bits.  
For 8-bit PWM, specify the values of ‘n’ and ‘m’ in “high-level width n (m + 1)/f,  
period 255 (m + 1)/fj” in the 8 high-order bits and the 8 low-order bits, respectively.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (pulse width modulation mode (PWM mode))  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void TimerIntFunc( void ){}  
Rev.1.00  
2007.11.1  
51  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
void func( void )  
{
unsigned int p_tim[] = {0xAA, 0xBB, 0xCC};  
/* Set up timer A3 as pulse width modulation mode */  
__CreatePulseWidthModulationMode( RAPI_TIMER_A3|RAPI_TIMER_ON|RAPI_F8,  
5, p_tim, TimerIntFunc);  
}
Rev.1.00  
2007.11.1  
52  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnablePulseWidthModulationMode  
Synopsis  
<Control operation of pulse width modulation mode>  
Boolean __EnablePulseWidthModulationMode(unsigned long data)  
data  
Setup data  
Description  
Controls operation of the timer that is set to specified pulse width modulation mode by  
starting or stopping it.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_ON  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Sets the timer that is set to pulse width modulation mode to  
start operating.  
RAPI_TIMER_OFF  
Sets the timer that is set to pulse width modulation mode to  
stop operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (pulse width modulation mode (PWM mode))  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Enable timer A2 as pulse width modulation mode */  
__EnablePulseWidthModulationMode( RAPI_TIMER_A2|RAPI_TIMER_ON );  
}
Rev.1.00  
2007.11.1  
53  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__DestroyPulseWidthModulationMode  
Synopsis  
<Discard settings of pulse width modulation mode>  
Boolean __DestroyPulseWidthModulationMode(unsigned long data)  
data  
Setup data  
Description  
Discards settings of the timer that is set to specified pulse width modulation mode.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (pulse width modulation mode (PWM mode))  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Destroy the setting of timer A1 as pulse width modulation mode */  
__DestroyPulseWidthModulationMode( RAPI_TIMER_A1 );  
}
Rev.1.00  
2007.11.1  
54  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__CreatePulsePeriodMeasurementMode  
Synopsis  
<Set pulse period measurement mode>  
Boolean __CreatePulsePeriodMeasurementMode(unsigned long data1,  
unsigned int data2, unsigned int data3, unsigned int data4, void* func)  
data1  
data2  
data3  
data4  
func  
Setup data 1  
Setup data 2  
Setup data 3  
Setup data 4  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified timer to pulse period measurement mode.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values  
at the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_F1  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Selects f1 for the count source.  
Selects f2 for the count source.  
Selects f8 for the count source.  
Selects f32 for the count source.  
Selects fC32 for the count source.  
RAPI_F2  
RAPI_F8  
RAPI_F32  
RAPI_FC32  
RAPI_TIMER_ON Sets the timer to start operating in __CreatePulsePeriodMeasurementMode.  
RAPI_TIMER_OFF Sets the timer to stop operating in __CreatePulsePeriodMeasurementMode.  
RAPI_RISING_  
RISING  
Selects measurement of an interval from the rise to the next rise of a  
measurement pulse.  
RAPI_FALLING_  
FALLING  
Selects measurement of an interval from the fall to the next fall of a  
measurement pulse.  
• Specifiable definition values when timer B is used (RAPI_TIMER_B0 to  
RAPI_TIMER_B5 specified)  
(Count source) Specify one from  
{
RAPI_F1, RAPI_F2, RAPI_F8, RAPI_F32,  
RAPI_FC32 }. The default value is RAPI_F2.  
(Operating  
states set)  
(Measurement  
pulse)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The default  
value is RAPI_TIMER_OFF.  
Specify one from { RAPI_RISING_RISING, RAPI_FALLING_FALLING }.  
The default value is RAPI_FALLING_FALLING.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
Rev.1.00  
2007.11.1  
55  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
[data3]  
Specify 0.  
[data4]  
Specify 0.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Timer (pulse period measurement mode)  
Remark  
If an undefined value is specified in the first argument, operation of the API  
cannot be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void TimerIntFunc( void ){}  
void func( void )  
{
/* Set up timer B0 as pulse period measurement mode */  
__CreatePulsePeriodMeasurementMode(  
RAPI_TIMER_B0|RAPI_TIMER_ON|RAPI_FALLING_FALLING|RAPI_F8,  
5, 0, 0, TimerIntFunc);  
}
Rev.1.00  
2007.11.1  
56  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnablePulsePeriodMeasurementMode  
Synopsis  
<Control operation of pulse period measurement mode>  
Boolean __EnablePulsePeriodMeasurementMode(unsigned long data)  
data  
Setup data  
Description  
Controls operation of the timer that is set to specified pulse period measurement mode  
by starting or stopping it.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_TIMER_ON  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Sets the timer that is set to pulse period measurement mode to start  
operating.  
RAPI_TIMER_OFF Sets the timer that is set to pulse period measurement mode to stop  
operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse period measurement mode)  
Remark  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Enable timer B1 as pulse period measurement mode */  
__EnablePulsePeriodMeasurementMode( RAPI_TIMER_B1|RAPI_TIMER_ON );  
}
Rev.1.00  
2007.11.1  
57  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__DestroyPulsePeriodMeasurementMode  
Synopsis  
<Discard settings of pulse period measurement mode>  
Boolean __DestroyPulsePeriodMeasurementMode(unsigned long data)  
data  
Setup data  
Description  
Discards settings of the timer that is set to specified pulse period measurement mode.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse period measurement mode)  
Remark  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Destroy the setting of timer B2 as pulse period measurement mode */  
__DestroyPulsePeriodMeasurementMode( RAPI_TIMER_B2 );  
}
Rev.1.00  
2007.11.1  
58  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetPulsePeriodMeasurementMode  
Synopsis  
<Get measured value in pulse period measurement mode>  
Boolean __GetPulsePeriodMeasurementMode(unsigned long data1, unsigned  
int *data2)  
data1  
data2  
Setup data 1  
Pointer to the buffer in which counter value is stored  
Description  
Gets the counter value of the timer that is set to specified pulse period measurement  
mode.  
[data1]  
For data, the following definition values can be set.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse period measurement mode)  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
unsigned int data[2];  
/* Get the measured value of timer B3 as pulse period measurement mode  
*/  
__GetPulsePeriodMeasurementMode( RAPI_TIMER_B3, data );  
}
Rev.1.00  
2007.11.1  
59  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__CreatePulseWidthMeasurementMode  
Synopsis  
<Set pulse width measurement mode>  
Boolean __CreatePulseWidthMeasurementMode(unsigned long data1, unsigned  
int data2, unsigned int data3, unsigned int data4, void* func)  
data1  
data2  
data3  
data4  
func  
Setup data 1  
Setup data 2  
Setup data 3  
Setup data 4  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified timer to pulse with measurement mode.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_F1  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Selects f1 for the count source.  
Selects f2 for the count source.  
Selects f8 for the count source.  
Selects f32 for the count source.  
Selects fC32 for the count source.  
Sets the timer to start operating in  
__CreatePulseWidthMeasurementMode.  
RAPI_F2  
RAPI_F8  
RAPI_F32  
RAPI_FC32  
RAPI_TIMER_ON  
RAPI_TIMER_OFF Sets the timer to stop operating in  
__CreatePulseWidthMeasurementMode.  
• Specifiable definition values when timer B is used (RAPI_TIMER_B0 to  
RAPI_TIMER_B2 specified)  
(Count source) Specify one from { RAPI_F1, RAPI_F2, RAPI_F8, RAPI_F32, RAPI_FC32 }.  
The default value is RAPI_F2.  
(Operating  
states set)  
Specify one from { RAPI_TIMER_ON, RAPI_TIMER_OFF }. The default  
value is RAPI_TIMER_OFF.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
[data3]  
Specify 0.  
Rev.1.00  
2007.11.1  
60  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
[data4]  
Specify 0.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse width measurement mode)  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void TimerIntFunc( void ){}  
void func( void )  
{
/* Set up timer B4 as pulse width measurement mode */  
__CreatePulseWidthMeasurementMode(  
RAPI_TIMER_B4|RAPI_TIMER_ON|RAPI_RISING_FALLING|RAPI_F8,  
5, 0, 0, TimerIntFunc);  
}
Rev.1.00  
2007.11.1  
61  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnablePulseWidthMeasurementMode  
Synopsis  
<Control operation of pulse width measurement mode>  
Boolean __EnablePulseWidthMeasurementMode(unsigned long data)  
data  
Setup data  
Description  
Controls operation of the timer that is set to specified pulse width measurement mode.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_TIMER_ON  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Sets the timer that is set to pulse width measurement mode to start  
operating.  
RAPI_TIMER_OFF Sets the timer that is set to pulse width measurement mode to stop  
operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse width measurement mode)  
Remark  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Disable timer B5 as pulse width measurement mode */  
__EnablePulseWidthMeasurementMode( RAPI_TIMER_B5|RAPI_TIMER_OFF );  
}
Rev.1.00  
2007.11.1  
62  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__DestroyPulseWidthMeasurementMode  
Synopsis  
<Discard settings of pulse width measurement mode>  
Boolean __DestroyPulseWidthMeasurementMode(unsigned long data)  
data  
Setup data  
Description  
Discards settings of the timer that is set to specified pulse width measurement mode.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse width measurement mode)  
Remark  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Destroy the setting of timer B0 as pulse width measurement mode */  
__DestroyPulseWidthMeasurementMode( RAPI_TIMER_B0 );  
}
Rev.1.00  
2007.11.1  
63  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetPulseWidthMeasurementMode  
Synopsis  
<Get measured value in pulse width measurement mode>  
Boolean __GetPulseWidthMeasurementMode(unsigned long data1, unsigned int  
*data2)  
data1  
data2  
Setup data 1  
Pointer to the buffer in which counter value is stored  
Description  
Gets the counter value of the timer that is set to specified pulse width measurement  
mode.  
[data1]  
For data, the following definition values can be set.  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Uses timer B channel 0.  
Uses timer B channel 1.  
Uses timer B channel 2.  
Uses timer B channel 3.  
Uses timer B channel 4.  
Uses timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Timer (pulse width measurement mode)  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_timer_m16c_62p.h"  
void func( void )  
{
unsigned int data[2];  
/* Get the measured value of timer B1 as pulse width measurement mode  
*/  
__GetPulseWidthMeasurementMode( RAPI_TIMER_B1, data );  
}
Rev.1.00  
2007.11.1  
64  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__SetTimerRegister  
Synopsis  
<Set timer register>  
Boolean __SetTimerRegister(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data 1  
Pointer to the buffer in which register value is stored  
Description  
Sets the registers of a specified timer.  
[data1]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
[data2]  
The content of a pointer to the buffer in which the register value is stored must be specified  
as described below. The value is set in each register in order of buffer pointer elements.  
• When using timer A (RAPI_TIMER_A0 to RAPI_TIMER_A4 specified)  
[0]: Specify the set value for the timer Ai mode register (i = 0–4).  
[1]: Specify the set value for the timer Ai register (i = 0–4).  
[2]: Specify the set value for the up/down flag register.  
[3]: Specify the set value for the one-shot start flag register.  
[4]: Specify the set value for the trigger select register.  
[5]: Specify the set value for the time-clock prescaler reset register.  
[6]: Specify the set value for the count start flag register.  
• When using timer B (RAPI_TIMER_B0 to RAPI_TIMER_B5)  
[0]: Specify the set value for the timer Bi mode register (i = 0–5).  
[1]: Specify the set value for the timer Bi register (i = 0–5).  
[3]: Specify the set value for the time-clock prescaler reset register.  
[4]: Specify the set value for the count start flag register.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (register manipulation)  
Rev.1.00  
2007.11.1  
65  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
The specifiable timers differ with each CPU used.  
Program example  
#include " rapi_timer_m16c_62p.h"  
void func( void )  
{
unsigned char data[] = {0,0,0,0,0,0,0};  
/* Set up timer A0 register */  
__SetTimerRegister( RAPI_TIMER_A0, data );  
}
Rev.1.00  
2007.11.1  
66  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnableTimerRegister  
Synopsis  
<Control operation of timer register>  
Boolean __EnableTimerRegister(unsigned long data)  
data  
Setup data  
Description  
Controls operation of a specified timer by starting or stopping it.  
[data]  
For data, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
RAPI_TIMER_ON  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Sets the selected timer to start operating.  
RAPI_TIMER_OFF Sets the selected timer to stop operating.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Functionality  
Reference  
Remark  
Timer (register manipulation)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include " rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Activate timer A1 */  
__EnableTimerRegister( RAPI_TIMER_A1|RAPI_TIMER_ON );  
}
Rev.1.00  
2007.11.1  
67  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__ClearTimerRegister  
Synopsis  
<Clear timer register>  
Boolean __ClearTimerRegister(unsigned long data)  
data  
Setup data  
Description  
Sets the timer register of a specified timer to its initial value after reset.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
Return value  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
Timer (register manipulation)  
If an undefined value is specified in the argument, operation of the API cannot be  
guaranteed.  
Program example  
#include " rapi_timer_m16c_62p.h"  
void func( void )  
{
/* Clear the setting of timer A2 */  
__ClearTimerRegister( RAPI_TIMER_A2 );  
}
Rev.1.00  
2007.11.1  
68  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetTimerRegister  
Synopsis  
<Get timer register value>  
Boolean __GetTimerRegister(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data  
Pointer to the buffer in which register value is stored  
Description  
Gets the counter value of a specified timer.  
[data]  
For data, the following definition values can be set.  
RAPI_TIMER_A0  
RAPI_TIMER_A1  
RAPI_TIMER_A2  
RAPI_TIMER_A3  
RAPI_TIMER_A4  
RAPI_TIMER_B0  
RAPI_TIMER_B1  
RAPI_TIMER_B2  
RAPI_TIMER_B3  
RAPI_TIMER_B4  
RAPI_TIMER_B5  
Selects timer A channel 0.  
Selects timer A channel 1.  
Selects timer A channel 2.  
Selects timer A channel 3.  
Selects timer A channel 4.  
Selects timer B channel 0.  
Selects timer B channel 1.  
Selects timer B channel 2.  
Selects timer B channel 3.  
Selects timer B channel 4.  
Selects timer B channel 5.  
[data2]  
Specify a pointer to the array in which the acquired register value is stored.  
The content of the array is described below.  
When using timer A (RAPI_TIMER_A0 to RAPI_TIMER_A4 specified)  
[0]: Store the value of timer Ai mode register (i = 0–4).  
[1]: Store the value of timer Ai register (i = 0–4).  
[2]: Store the value of the up/down flag register.  
[3]: Store the value of the one-shot start flag register.  
[4]: Store the value of the trigger select register.  
[5]: Store the value of the time-clock prescaler reset flag register.  
[6]: Store the value of the count start flag register.  
When using timer B (RAPI_TIMER_B0 to RAPI_TIMER_B5 specified)  
[0]: Store the value of timer Bi mode register (i = 0–5).  
[1]: Store the value of timer Bi register (i = 0–5).  
[2]: Store the value of the time-clock prescaler reset flag register.  
[3]: Store the value of the count start flag register.  
Return value  
Functionality  
If the timer specification is incorrect, RAPI_FALSE is returned; otherwise, RAPI_TRUE  
is returned.  
Timer (register manipulation)  
Rev.1.00  
2007.11.1  
69  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Reference  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_timer_m16c_62p.h"  
void func( void )  
{
unsigned int data[7];  
/* Get the value of timer A3 registers */  
__GetTimerRegister( RAPI_TIMER_A3, data );  
}
Rev.1.00  
2007.11.1  
70  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4.2.3 I/O Port  
__SetIOPort  
Synopsis  
<Set I/O port>  
Boolean __SetIOPort(unsigned long data1, unsigned int data2)  
data1  
data2  
Setup data 1  
Setup data 2  
Description  
Sets the operating conditions of a specified I/O port.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value. Note, however, that  
multiple ports cannot be specified at the same time.  
The definition values corresponding to each I/O port are listed below.  
RAPI_PORT_0_0  
RAPI_PORT_0_2  
RAPI_PORT_0_4  
RAPI_PORT_0_6  
RAPI_PORT_1_0  
RAPI_PORT_1_2  
RAPI_PORT_1_4  
RAPI_PORT_1_6  
RAPI_PORT_2_0  
RAPI_PORT_2_2  
RAPI_PORT_2_4  
RAPI_PORT_2_6  
RAPI_PORT_3_0  
RAPI_PORT_3_2  
RAPI_PORT_3_4  
RAPI_PORT_3_6  
RAPI_PORT_4_0  
RAPI_PORT_4_2  
RAPI_PORT_4_4  
RAPI_PORT_4_6  
RAPI_PORT_5_0  
RAPI_PORT_5_2  
RAPI_PORT_5_4  
RAPI_PORT_5_6  
RAPI_PORT_6_0  
RAPI_PORT_6_2  
RAPI_PORT_6_4  
RAPI_PORT_6_6  
RAPI_PORT_7_0  
Port P00  
Port P02  
Port P04  
Port P06  
Port P10  
Port P12  
Port P14  
Port P16  
Port P20  
Port P22  
Port P24  
Port P26  
Port P30  
Port P32  
Port P34  
Port P36  
Port P40  
Port P42  
Port P44  
Port P46  
Port P50  
Port P52  
Port P54  
Port P56  
Port P60  
Port P62  
Port P64  
Port P66  
Port P70  
RAPI_PORT_0_1  
RAPI_PORT_0_3  
RAPI_PORT_0_5  
RAPI_PORT_0_7  
RAPI_PORT_1_1  
RAPI_PORT_1_3  
RAPI_PORT_1_5  
RAPI_PORT_1_7  
RAPI_PORT_2_1  
RAPI_PORT_2_3  
RAPI_PORT_2_5  
RAPI_PORT_2_7  
RAPI_PORT_3_1  
RAPI_PORT_3_3  
RAPI_PORT_3_5  
RAPI_PORT_3_7  
RAPI_PORT_4_1  
RAPI_PORT_4_3  
RAPI_PORT_4_5  
RAPI_PORT_4_7  
RAPI_PORT_5_1  
RAPI_PORT_5_3  
RAPI_PORT_5_5  
RAPI_PORT_5_7  
RAPI_PORT_6_1  
RAPI_PORT_6_3  
RAPI_PORT_6_5  
RAPI_PORT_6_7  
RAPI_PORT_7_1  
Port P01  
Port P03  
Port P05  
Port P07  
Port P11  
Port P13  
Port P15  
Port P17  
Port P21  
Port P23  
Port P25  
Port P27  
Port P31  
Port P33  
Port P35  
Port P37  
Port P41  
Port P43  
Port P45  
Port P47  
Port P51  
Port P53  
Port P55  
Port P57  
Port P61  
Port P63  
Port P65  
Port P67  
Port P71  
Rev.1.00  
2007.11.1  
71  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_PORT_7_2  
RAPI_PORT_7_4  
RAPI_PORT_7_6  
RAPI_PORT_8_0  
RAPI_PORT_8_2  
RAPI_PORT_8_4  
RAPI_PORT_8_6  
RAPI_PORT_9_0  
RAPI_PORT_9_2  
RAPI_PORT_9_4  
RAPI_PORT_9_6  
RAPI_PORT_10_0  
RAPI_PORT_10_2  
RAPI_PORT_10_4  
RAPI_PORT_10_6  
RAPI_PORT_11_0  
RAPI_PORT_11_2  
RAPI_PORT_11_4  
RAPI_PORT_11_6  
RAPI_PORT_12_0  
RAPI_PORT_12_2  
RAPI_PORT_12_4  
RAPI_PORT_12_6  
RAPI_PORT_13_0  
RAPI_PORT_13_2  
RAPI_PORT_13_4  
RAPI_PORT_13_6  
RAPI_PORT_14_0  
Port P72  
Port P74  
Port P76  
Port P80  
Port P82  
Port P84  
Port P86  
Port P90  
Port P92  
Port P94  
Port P96  
Port P100  
Port P102  
Port P104  
Port P106  
Port P110  
Port P112  
Port P114  
Port P116  
Port P120  
Port P122  
Port P124  
Port P126  
Port P130  
Port P132  
Port P134  
Port P136  
Port P140  
RAPI_PORT_7_3  
RAPI_PORT_7_5  
RAPI_PORT_7_7  
RAPI_PORT_8_1  
RAPI_PORT_8_3  
RAPI_PORT_8_5  
RAPI_PORT_8_7  
RAPI_PORT_9_1  
RAPI_PORT_9_3  
RAPI_PORT_9_5  
RAPI_PORT_9_7  
RAPI_PORT_10_1  
RAPI_PORT_10_3  
RAPI_PORT_10_5  
RAPI_PORT_10_7  
RAPI_PORT_11_1  
RAPI_PORT_11_3  
RAPI_PORT_11_5  
RAPI_PORT_11_7  
RAPI_PORT_12_1  
RAPI_PORT_12_3  
RAPI_PORT_12_5  
RAPI_PORT_12_7  
RAPI_PORT_13_1  
RAPI_PORT_13_3  
RAPI_PORT_13_5  
RAPI_PORT_13_7  
RAPI_PORT_14_1  
Port P73  
Port P75  
Port P77  
Port P81  
Port P83  
Port P85  
Port P87  
Port P91  
Port P93  
Port P95  
Port P97  
Port P101  
Port P103  
Port P105  
Port P107  
Port P111  
Port P113  
Port P115  
Port P117  
Port P121  
Port P123  
Port P125  
Port P127  
Port P131  
Port P133  
Port P135  
Port P137  
Port P141  
The definition values related to port settings are described below.  
RAPI_PORT_INPUT  
RAPI_PORT_OUTPUT  
RAPI_PULLED_HIGH  
RAPI_NOT_PULLED  
_HIGH  
Sets a selected port for input.  
Sets a selected port for output.  
Sets a selected port to be pulled high.  
Sets a selected port not to be pulled high.  
RAPI_LATCH  
Sets a selected port to read the port latch regardless of whether it  
is set for input or output. Specifiable only when port P1 is used.  
[data2]  
Specify 0.  
Return value  
If the I/O port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Rev.1.00  
2007.11.1  
72  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Functionality  
Reference  
I/O port  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
/* Set up port P03 as input port */  
__SetIOPort(RAPI_PORT_0_3| RAPI_PORT_INPUT| RAPI_PULLED_HIGH, 0 );  
}
Rev.1.00  
2007.11.1  
73  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__ReadIOPort  
Synopsis  
<Read from I/O port>  
Boolean __ReadIOPort(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data 1  
Pointer to the variable in which the value read from I/O port is stored.  
Description  
Gets the value of a specified I/O port.  
[data1]  
Specify an I/O port from which data is read. The definition values corresponding to  
each I/O port are listed below.  
RAPI_PORT_0_0  
RAPI_PORT_0_2  
RAPI_PORT_0_4  
RAPI_PORT_0_6  
RAPI_PORT_1_0  
RAPI_PORT_1_2  
RAPI_PORT_1_4  
RAPI_PORT_1_6  
RAPI_PORT_2_0  
RAPI_PORT_2_2  
RAPI_PORT_2_4  
RAPI_PORT_2_6  
RAPI_PORT_3_0  
RAPI_PORT_3_2  
RAPI_PORT_3_4  
RAPI_PORT_3_6  
RAPI_PORT_6_0  
RAPI_PORT_6_2  
RAPI_PORT_6_4  
RAPI_PORT_6_6  
RAPI_PORT_7_0  
RAPI_PORT_7_2  
RAPI_PORT_7_4  
RAPI_PORT_7_6  
RAPI_PORT_8_0  
RAPI_PORT_8_2  
RAPI_PORT_8_4  
RAPI_PORT_8_6  
RAPI_PORT_9_0  
RAPI_PORT_9_2  
RAPI_PORT_9_4  
Port P00  
Port P02  
Port P04  
Port P06  
Port P10  
Port P12  
Port P14  
Port P16  
Port P20  
Port P22  
Port P24  
Port P26  
Port P30  
Port P32  
Port P34  
Port P36  
Port P60  
Port P62  
Port P64  
Port P66  
Port P70  
Port P72  
Port P74  
Port P76  
Port P80  
Port P82  
Port P84  
Port P86  
Port P90  
Port P92  
Port P94  
RAPI_PORT_0_1  
RAPI_PORT_0_3  
RAPI_PORT_0_5  
RAPI_PORT_0_7  
RAPI_PORT_1_1  
RAPI_PORT_1_3  
RAPI_PORT_1_5  
RAPI_PORT_1_7  
RAPI_PORT_2_1  
RAPI_PORT_2_3  
RAPI_PORT_2_5  
RAPI_PORT_2_7  
RAPI_PORT_3_1  
RAPI_PORT_3_3  
RAPI_PORT_3_5  
RAPI_PORT_3_7  
RAPI_PORT_6_1  
RAPI_PORT_6_3  
RAPI_PORT_6_5  
RAPI_PORT_6_7  
RAPI_PORT_7_1  
RAPI_PORT_7_3  
RAPI_PORT_7_5  
RAPI_PORT_7_7  
RAPI_PORT_8_1  
RAPI_PORT_8_3  
RAPI_PORT_8_5  
RAPI_PORT_8_7  
RAPI_PORT_9_1  
RAPI_PORT_9_3  
RAPI_PORT_9_5  
Port P01  
Port P03  
Port P05  
Port P07  
Port P11  
Port P13  
Port P15  
Port P17  
Port P21  
Port P23  
Port P25  
Port P27  
Port P31  
Port P33  
Port P35  
Port P37  
Port P61  
Port P63  
Port P65  
Port P67  
Port P71  
Port P73  
Port P75  
Port P77  
Port P81  
Port P83  
Port P85  
Port P87  
Port P91  
Port P93  
Port P95  
Rev.1.00  
2007.11.1  
74  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_PORT_9_6  
RAPI_PORT_10_0  
RAPI_PORT_10_2  
RAPI_PORT_10_4  
RAPI_PORT_10_6  
RAPI_PORT_11_0  
RAPI_PORT_11_2  
RAPI_PORT_11_4  
RAPI_PORT_11_6  
RAPI_PORT_12_0  
RAPI_PORT_12_2  
RAPI_PORT_12_4  
RAPI_PORT_12_6  
RAPI_PORT_13_0  
RAPI_PORT_13_2  
RAPI_PORT_13_4  
RAPI_PORT_13_6  
RAPI_PORT_14_0  
Port P96  
RAPI_PORT_9_7  
RAPI_PORT_10_1  
RAPI_PORT_10_3  
RAPI_PORT_10_5  
RAPI_PORT_10_7  
RAPI_PORT_11_1  
RAPI_PORT_11_3  
RAPI_PORT_11_5  
RAPI_PORT_11_7  
RAPI_PORT_12_1  
RAPI_PORT_12_3  
RAPI_PORT_12_5  
RAPI_PORT_12_7  
RAPI_PORT_13_1  
RAPI_PORT_13_3  
RAPI_PORT_13_5  
RAPI_PORT_13_7  
RAPI_PORT_14_1  
Port P97  
Port P100  
Port P102  
Port P104  
Port P106  
Port P110  
Port P112  
Port P114  
Port P116  
Port P120  
Port P122  
Port P124  
Port P126  
Port P130  
Port P132  
Port P134  
Port P136  
Port P140  
Port P101  
Port P103  
Port P105  
Port P107  
Port P111  
Port P113  
Port P115  
Port P117  
Port P121  
Port P123  
Port P125  
Port P127  
Port P131  
Port P133  
Port P135  
Port P137  
Port P141  
Return value  
If the I/O port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
I/O port  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
/* Get the value of port P12 */  
__ReadIOPort(RAPI_PORT_1_2, &data );  
}
Rev.1.00  
2007.11.1  
75  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__WriteIOPort  
Synopsis  
<Write to I/O port>  
Boolean __WriteIOPort(unsigned long data1, unsigned int data2)  
data1  
data2  
Setup data 1  
Data to be written to I/O port  
Description  
Writes data to a specified I/O port.  
[data1]  
Specify an I/O port to which data is written. The definition values corresponding to each  
I/O port are listed below.  
RAPI_PORT_0_0  
RAPI_PORT_0_2  
RAPI_PORT_0_4  
RAPI_PORT_0_6  
RAPI_PORT_1_0  
RAPI_PORT_1_2  
RAPI_PORT_1_4  
RAPI_PORT_1_6  
RAPI_PORT_2_0  
RAPI_PORT_2_2  
RAPI_PORT_2_4  
RAPI_PORT_2_6  
RAPI_PORT_3_0  
RAPI_PORT_3_2  
RAPI_PORT_3_4  
RAPI_PORT_3_6  
RAPI_PORT_6_0  
RAPI_PORT_6_2  
RAPI_PORT_6_4  
RAPI_PORT_6_6  
RAPI_PORT_7_0  
RAPI_PORT_7_2  
RAPI_PORT_7_4  
RAPI_PORT_7_6  
RAPI_PORT_8_0  
RAPI_PORT_8_2  
RAPI_PORT_8_4  
RAPI_PORT_8_6  
RAPI_PORT_9_0  
RAPI_PORT_9_2  
RAPI_PORT_9_4  
Port P00  
Port P02  
Port P04  
Port P06  
Port P10  
Port P12  
Port P14  
Port P16  
Port P20  
Port P22  
Port P24  
Port P26  
Port P30  
Port P32  
Port P34  
Port P36  
Port P60  
Port P62  
Port P64  
Port P66  
Port P70  
Port P72  
Port P74  
Port P76  
Port P80  
Port P82  
Port P84  
Port P86  
Port P90  
Port P92  
Port P94  
RAPI_PORT_0_1  
RAPI_PORT_0_3  
RAPI_PORT_0_5  
RAPI_PORT_0_7  
RAPI_PORT_1_1  
RAPI_PORT_1_3  
RAPI_PORT_1_5  
RAPI_PORT_1_7  
RAPI_PORT_2_1  
RAPI_PORT_2_3  
RAPI_PORT_2_5  
RAPI_PORT_2_7  
RAPI_PORT_3_1  
RAPI_PORT_3_3  
RAPI_PORT_3_5  
RAPI_PORT_3_7  
RAPI_PORT_6_1  
RAPI_PORT_6_3  
RAPI_PORT_6_5  
RAPI_PORT_6_7  
RAPI_PORT_7_1  
RAPI_PORT_7_3  
RAPI_PORT_7_5  
RAPI_PORT_7_7  
RAPI_PORT_8_1  
RAPI_PORT_8_3  
RAPI_PORT_8_5  
RAPI_PORT_8_7  
RAPI_PORT_9_1  
RAPI_PORT_9_3  
RAPI_PORT_9_5  
Port P01  
Port P03  
Port P05  
Port P07  
Port P11  
Port P13  
Port P15  
Port P17  
Port P21  
Port P23  
Port P25  
Port P27  
Port P31  
Port P33  
Port P35  
Port P37  
Port P61  
Port P63  
Port P65  
Port P67  
Port P71  
Port P73  
Port P75  
Port P77  
Port P81  
Port P83  
Port P85  
Port P87  
Port P91  
Port P93  
Port P95  
Rev.1.00  
2007.11.1  
76  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_PORT_9_6  
RAPI_PORT_10_0  
RAPI_PORT_10_2  
RAPI_PORT_10_4  
RAPI_PORT_10_6  
RAPI_PORT_11_0  
RAPI_PORT_11_2  
RAPI_PORT_11_4  
RAPI_PORT_11_6  
RAPI_PORT_12_0  
RAPI_PORT_12_2  
RAPI_PORT_12_4  
RAPI_PORT_12_6  
RAPI_PORT_13_0  
RAPI_PORT_13_2  
RAPI_PORT_13_4  
RAPI_PORT_13_6  
RAPI_PORT_14_0  
Port P96  
RAPI_PORT_9_7  
RAPI_PORT_10_1  
RAPI_PORT_10_3  
RAPI_PORT_10_5  
RAPI_PORT_10_7  
RAPI_PORT_11_1  
RAPI_PORT_11_3  
RAPI_PORT_11_5  
RAPI_PORT_11_7  
RAPI_PORT_12_1  
RAPI_PORT_12_3  
RAPI_PORT_12_5  
RAPI_PORT_12_7  
RAPI_PORT_13_1  
RAPI_PORT_13_3  
RAPI_PORT_13_5  
RAPI_PORT_13_7  
RAPI_PORT_14_1  
Port P97  
Port P100  
Port P102  
Port P104  
Port P106  
Port P110  
Port P112  
Port P114  
Port P116  
Port P120  
Port P122  
Port P124  
Port P126  
Port P130  
Port P132  
Port P134  
Port P136  
Port P140  
Port P101  
Port P103  
Port P105  
Port P107  
Port P111  
Port P113  
Port P115  
Port P117  
Port P121  
Port P123  
Port P125  
Port P127  
Port P131  
Port P133  
Port P135  
Port P137  
Port P141  
Return value  
If the I/O port specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
I/O port  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Remark  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
unsigned int data;  
/* Set the data to port P05 */  
__WriteIOPort( RAPI_PORT_0_5, 0 );  
}
Rev.1.00  
2007.11.1  
77  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__SetIOPortRegister  
<Set I/O port register>  
Synopsis  
Boolean __SetIOPortRegister(unsigned long data1, unsigned int data2, unsigned  
int data3, unsigned int data4)  
data1  
data2  
data3  
data4  
Setup data 1  
Setup data 2  
Setup data 3  
Setup data 4  
[data1]  
Description  
Set the operating condition of a specified I/O port in each relevant register.  
The definition values corresponding to each I/O port register are listed below.  
RAPI_PORT_0  
RAPI_PORT_2  
RAPI_PORT_4  
RAPI_PORT_6  
RAPI_PORT_8  
RAPI_PORT_10  
RAPI_PORT_12  
RAPI_PORT_14  
Port P0 register  
Port P2 register  
Port P4 register  
Port P6 register  
Port P8 register  
Port P10 register  
Port P12 register  
Port P14 register  
RAPI_PORT_1  
RAPI_PORT_3  
RAPI_PORT_5  
RAPI_PORT_7  
RAPI_PORT_9  
RAPI_PORT_11  
RAPI_PORT_13  
Port P1 register  
Port P3 register  
Port P5 register  
Port P7 register  
Port P9 register  
Port P11 register  
Port P13 register  
The definition values related to port settings are described below.  
RAPI_LATCH  
Set to read the port latch regardless of whether the port is set for input or  
output. Specifiable only when port P1 is used.  
[data2]  
Specify the set value for the port direction register corresponding to a selected port.  
[data3]  
Specify the set value for the pullup control register corresponding to a selected port.  
[data4]  
Specify 0.  
Return value  
If the I/O port register specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
I/O port  
Remark  
Rev.1.00  
2007.11.1  
78  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
/* Set inputs/outputs of port P1 register */  
__SetIOPortRegister(RAPI_PORT_1, 0xAA, 0, 0 );  
}
Rev.1.00  
2007.11.1  
79  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__ReadIOPortRegister  
Synopsis  
<Read from I/O port register>  
Boolean __ReadIOPortRegister(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data 1  
Pointer to the variable in which the value read from I/O port register is stored.  
Description  
Gets the value of a specified I/O port from each relevant register.  
[data1]  
Specify an I/O port register from which data is read. The definition values  
corresponding to each I/O port register are listed below.  
RAPI_PORT_0  
RAPI_PORT_2  
RAPI_PORT_4  
RAPI_PORT_6  
RAPI_PORT_8  
RAPI_PORT_10  
RAPI_PORT_12  
RAPI_PORT_14  
Port P0 register  
Port P2 register  
Port P4 register  
Port P6 register  
Port P8 register  
Port P10 register  
Port P12 register  
Port P14 register  
RAPI_PORT_1  
RAPI_PORT_3  
RAPI_PORT_5  
RAPI_PORT_7  
RAPI_PORT_9  
RAPI_PORT_11  
RAPI_PORT_13  
Port P1 register  
Port P3 register  
Port P5 register  
Port P7 register  
Port P9 register  
Port P11 register  
Port P13 register  
Return value  
If the I/O port register specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
I/O port  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
unsigned int data;  
/* Get the value of port P1 register */  
__ReadIOPortRegister( RAPI_PORT_1, &data );  
}
Rev.1.00  
2007.11.1  
80  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__WriteIOPortRegister  
Synopsis  
<Write to I/O port register>  
Boolean __WriteIOPortRegister(unsigned long data1, unsigned int data2)  
data1  
data2  
Setup data 1  
Data to be written to I/O port register  
Description  
Writes the value for a specified I/O port to each relevant register.  
[data1]  
Specify an I/O port register to which data is written. The definition values  
corresponding to each I/O port register are listed below.  
RAPI_PORT_0  
RAPI_PORT_2  
RAPI_PORT_4  
RAPI_PORT_6  
RAPI_PORT_8  
RAPI_PORT_10  
RAPI_PORT_12  
RAPI_PORT_14  
Port P0 register  
Port P2 register  
Port P4 register  
Port P6 register  
Port P8 register  
Port P10 register  
Port P12 register  
Port P14 register  
RAPI_PORT_1  
RAPI_PORT_3  
RAPI_PORT_5  
RAPI_PORT_7  
RAPI_PORT_9  
RAPI_PORT_11  
RAPI_PORT_13  
Port P1 register  
Port P3 register  
Port P5 register  
Port P7 register  
Port P9 register  
Port P11 register  
Port P13 register  
Return value  
If the I/O port register specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
I/O port  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Remark  
Program example  
#include " rapi_io_port_m16c_62p.h"  
void func( void )  
{
/* Set the data to port P2 register */  
__WriteIOPortRegister( RAPI_PORT_2, 0xFF );  
}
Rev.1.00  
2007.11.1  
81  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4.2.4 External interrupt  
__SetInterrupt  
Synopsis  
<Set external interrupt>  
Boolean __SetInterrupt(unsigned long data1, unsigned int data2, void* func)  
data1  
data2  
func  
Setup data 1  
Setup data 2  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets a specified external interrupt.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value. Note, however, that  
multiple external interrupts cannot be specified at the same time.  
RAPI_INT0  
RAPI_INT1  
RAPI_INT2  
RAPI_INT3  
RAPI_INT4  
RAPI_INT5  
RAPI_KEY  
Uses _INT0 interrupt.  
Uses _INT1 interrupt.  
Uses _INT2 interrupt.  
Uses _INT3 interrupt.  
Uses _INT4 interrupt.  
Uses _INT5 interrupt.  
Uses key input interrupt.  
Specifies a rising edge for the active edge of a selected external  
interrupt.  
RAPI_INT_RISING  
RAPI_INT_FALLING Specifies a falling edge for the active edge of a selected external  
interrupt.  
RAPI_INT_BOTH  
Specifies both edges for the active edge of a selected external  
interrupt.  
RAPI_KI0_ENABLE  
RAPI_KI1_ENABLE  
RAPI_KI2_ENABLE  
RAPI_KI3_ENABLE  
Uses _KI0 pin input.  
Uses _KI1 pin input.  
Uses _KI2 pin input.  
Uses _KI3 pin input.  
• Specifiable definition values when _INT05 interrupts are used (RAPI_INT0 to  
RAPI_INT5 specified)  
(Polarity)  
Specify one from { RAPI_INT_RISING, RAPI_INT_FALLING,  
RAPI_INT_BOTH }. The default value is RAPI_INT_FALLING.  
• Specifiable definition values when key input interrupt is used (RAPI_KEY specified)  
(Input pin)  
To use _KI0, _KI1, _KI2, or _KI3 pin input, specify RAPI_KI0_ENABLE,  
RAPI_KI1_ENABLE, RAPI_KI2_ENABLE, or RAPI_KI3_ENABLE,  
respectively. The default value is RAPI_INT_FALLING.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
Rev.1.00  
2007.11.1  
82  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Return value  
If the external interrupt specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
External interrupt  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_interrupt_m16c_62p.h"  
void IntFunc( void ){}  
void func( void )  
{
/* Set up _INT0 interrupt */  
__SetInterrupt( RAPI_INT0|RAPI_INT_FALLING, 0, IntFunc );  
}
Rev.1.00  
2007.11.1  
83  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnableInterrupt  
Synopsis  
<Control external interrupt>  
Boolean __EnableInterrupt(unsigned long data1, unsigned int data2)  
data1  
data2  
Setup data 1  
Setup data 2  
Description  
Changes the operating condition of a specified external interrupt.  
[data1]  
RAPI_INT0  
RAPI_INT1  
RAPI_INT2  
RAPI_INT3  
RAPI_INT4  
RAPI_INT5  
RAPI_KEY  
Uses _INT0 interrupt.  
Uses _INT1 interrupt.  
Uses _INT2 interrupt.  
Uses _INT3 interrupt.  
Uses _INT4 interrupt.  
Uses _INT5 interrupt.  
Uses key input interrupt.  
[data2]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
Return value  
If the external interrupt specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
External interrupt  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_interrupt_m16c_62p.h"  
void func( void )  
{
/* Activate _INT1 interrupt ( interrupt priority level 5 ) */  
__EnableInterrupt( RAPI_INT1, 5 );  
}
Rev.1.00  
2007.11.1  
84  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetInterruptFlag  
Synopsis  
<Get the status of external interrupt flag>  
Boolean __GetInterruptFlag(unsigned long data1, unsigned int *data2))  
data1  
data2  
Setup data 1  
Pointer to the buffer in which the acquired flag data is stored  
Description  
Gets the value of interrupt request flag of a specified external interrupt.  
[data1]  
RAPI_INT0  
RAPI_INT1  
RAPI_INT2  
RAPI_INT3  
RAPI_INT4  
RAPI_INT5  
RAPI_KEY  
Uses _INT0 interrupt.  
Uses _INT1 interrupt.  
Uses _INT2 interrupt.  
Uses _INT3 interrupt.  
Uses _INT4 interrupt.  
Uses _INT5 interrupt.  
Uses key input interrupt.  
[data2]  
0 0 0 0 0 0 0  
Value of interrupt request flag (0: Interrupt not requested; 1: Interrupt requested)  
Return value  
If the external interrupt specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
External interrupt  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_interrupt_m16c_62p.h"  
void func( void )  
{
unsigned char data;  
/* Get flag of _INT2 interrupt */  
__GetInterruptFlag( RAPI_INT2, &data );  
}
Rev.1.00  
2007.11.1  
85  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__ClearInterruptFlag  
Synopsis  
<Clear external interrupt flag>  
Boolean __ClearInterruptFlag(unsigned long data)  
data  
Setup data  
Description  
Clears the interrupt request flag of a specified external interrupt.  
[data]  
RAPI_INT0  
RAPI_INT1  
RAPI_INT2  
RAPI_INT3  
RAPI_INT4  
RAPI_INT5  
RAPI_KEY  
Uses _INT0 interrupt.  
Uses _INT1 interrupt.  
Uses _INT2 interrupt.  
Uses _INT3 interrupt.  
Uses _INT4 interrupt.  
Uses _INT5 interrupt.  
Uses key input interrupt.  
Return value  
If the external interrupt specification is incorrect, RAPI_FALSE is returned; otherwise,  
RAPI_TRUE is returned.  
Functionality  
Reference  
Remark  
External interrupt  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_interrupt_m16c_62p.h"  
void func( void )  
{
/* Clear status of _INT0 interrupt */  
__ClearInterruptFlag( RAPI_INT0 );  
}
Rev.1.00  
2007.11.1  
86  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4.2.5 A/D converter  
__CreateADC  
Synopsis  
<Set A/D converter>  
Boolean __CreateADC(unsigned long data1, unsigned int data2, unsigned int  
data3, void* func)  
data1  
data2  
data3  
func  
Setup data 1  
Number of analog input pins used by A/D converter  
Setup data 3  
Callback function pointer  
(Specify 0 if no callback functions are set.)  
Description  
Sets the A/D converter to specified mode and operating condition.  
[data1]  
For data1, the following definition values can be set. To set multiple definition values at  
the same time, use the symbol “|” to separate each specified value. Note, however,  
that multiple analog input pin symbols cannot be specified at the same time.  
RAPI_ONE_SHOT  
RAPI_REPEAT  
RAPI_SINGLE_SWEEP  
RAPI_REPEAT_SWEEP0  
RAPI_REPEAT_SWEEP1  
RAPI_AN0  
Selects one-shot mode.  
Selects repeat mode.  
Selects single sweep mode.  
Selects repeat sweep mode 0.  
Selects repeat sweep mode 1.  
Uses AN0 pin for the analog input pin.  
Uses AN1 pin for the analog input pin.  
Uses AN2 pin for the analog input pin.  
Uses AN3 pin for the analog input pin.  
Uses AN4 pin for the analog input pin.  
Uses AN5 pin for the analog input pin.  
Uses AN6 pin for the analog input pin.  
Uses AN7 pin for the analog input pin.  
Uses AN00 pin for the analog input pin.  
Uses AN01 pin for the analog input pin.  
Uses AN02 pin for the analog input pin.  
Uses AN03 pin for the analog input pin.  
Uses AN04 pin for the analog input pin.  
Uses AN05 pin for the analog input pin.  
Uses AN06 pin for the analog input pin.  
Uses AN07 pin for the analog input pin.  
Uses AN20 pin for the analog input pin.  
Uses AN21 pin for the analog input pin.  
Uses AN22 pin for the analog input pin.  
Uses AN23 pin for the analog input pin.  
Uses AN24 pin for the analog input pin.  
Uses AN25 pin for the analog input pin.  
Uses AN26 pin for the analog input pin.  
RAPI_AN1  
RAPI_AN2  
RAPI_AN3  
RAPI_AN4  
RAPI_AN5  
RAPI_AN6  
RAPI_AN7  
RAPI_AN00  
RAPI_AN01  
RAPI_AN02  
RAPI_AN03  
RAPI_AN04  
RAPI_AN05  
RAPI_AN06  
RAPI_AN07  
RAPI_AN20  
RAPI_AN21  
RAPI_AN22  
RAPI_AN23  
RAPI_AN24  
RAPI_AN25  
RAPI_AN26  
Rev.1.00  
2007.11.1  
87  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_AN27  
Uses AN27 pin for the analog input pin.  
RAPI_P0_GROUP  
RAPI_P10_GROUP  
RAPI_P2_GROUP  
RAPI_FAD  
Uses port P0 group for the analog input pin.  
Uses port P10 group for the analog input pin.  
Uses port P2 group for the analog input pin.  
Sets the AD converter’s operating frequency to fAD  
.
Sets the AD converter’s operating frequency to fAD divided by 2.  
Sets the AD converter’s operating frequency to fAD divided by 3.  
Sets the AD converter’s operating frequency to fAD divided by 4.  
Sets the AD converter’s operating frequency to fAD divided by 6.  
Sets the AD converter’s operating frequency to fAD divided by 12.  
Sets the AD converter’s resolution to 10 bits.  
RAPI_FAD2  
RAPI_FAD3  
RAPI_FAD4  
RAPI_FAD6  
RAPI_FAD12  
RAPI_10BIT  
RAPI_8BIT  
Sets the AD converter’s resolution to 8 bits.  
RAPI_AD_ON  
Sets the AD converter to start operating.  
RAPI_AD_OFF  
Sets the AD converter to stop operating.  
RAPI_WITH_SAMPLE_HOLD  
RAPI_WITHOUT_SAMPLE_  
HOLD  
Specifies that sample-and-hold action is applied.  
Specifies that sample-and-hold action is not applied.  
RAPI_SOFTWARE_TRIGGER  
RAPI_EXTERNAL_TRIGGER  
RAPI_ANEX_UNUSED  
RAPI_ANEX0  
Selects software trigger.  
Selects external trigger.  
ANEX0 and ANEX1 are not used  
ANEX0 input is A/D converted  
ANEX1 input is A/D converted  
External op-amp connection mode  
RAPI_ANEX1  
RAPI_EXTERNAL_OP_AMP  
• Specifiable definition values when one-shot mode is used (RAPI_ONE_SHOT specified)  
Specify one from { RAPI_AN0, RAPI_AN1, RAPI_AN2, RAPI_AN3, RAPI_AN4,  
RAPI_AN5, RAPI_AN6, RAPI_AN7, RAPI_AN00, RAPI_AN01, RAPI_AN02,  
RAPI_AN03, RAPI_AN04, RAPI_AN05, RAPI_AN06, RAPI_AN07, RAPI_AN20,  
RAPI_AN21, RAPI_AN22, RAPI_AN23, RAPI_AN24, RAPI_AN25, RAPI_AN26,  
RAPI_AN27, RAPI_ANEX0, RAPI_ANEX1 }. The default is RAPI_AN0.  
(Input pin)  
(Operating  
frequency)  
(Resolution)  
Specify one from { RAPI_FAD, RAPI_FAD2, RAPI_FAD3, RAPI_FAD4,  
RAPI_FAD6, RAPI_FAD12 }. The default value is RAPI_FAD4.  
Specify one from { RAPI_10BIT, RAPI_8BIT }. The default value is  
RAPI_8BIT.  
(Operating  
states set)  
(Conversion  
method)  
Specify one from { RAPI_AD_ON, RAPI_AD_OFF }. The default value is  
RAPI_AD_OFF.  
Specify one from { RAPI_WITH_SAMPLE_HOLD,  
RAPI_WITHOUT_SAMPLE_HOLD }. The default value is  
RAPI_WITHOUT_SAMPLE_HOLD.  
(Trigger)  
Specify one from { RAPI_SOFTWARE_TRIGGER,  
RAPI_EXTERNAL_TRIGGER }.  
The default value is RAPI_SOFTWARE_TRIGGER.  
Specify one from { RAPI_ANEX_UNUSED, RAPI_EXTERNAL_OP_AMP }.  
The default value is RAPI_ANEX_UNUSED.  
(External  
Op-Amp  
Connection)  
• Specifiable definition values when repeat mode is used (RAPI_REPEAT specified)  
Rev.1.00  
2007.11.1  
88  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Specify one from { RAPI_AN0, RAPI_AN1, RAPI_AN2, RAPI_AN3, RAPI_AN4,  
RAPI_AN5, RAPI_AN6, RAPI_AN7, RAPI_AN00, RAPI_AN01, RAPI_AN02,  
RAPI_AN03, RAPI_AN04, RAPI_AN05, RAPI_AN06, RAPI_AN07, RAPI_AN20,  
RAPI_AN21, RAPI_AN22, RAPI_AN23, RAPI_AN24, RAPI_AN25, RAPI_AN26,  
RAPI_AN27, RAPI_INEX0, RAPI_ANEX1 }. The default is RAPI_AN0.  
(Input pin)  
(Operating  
frequency)  
(Resolution)  
Specify one from { RAPI_FAD, RAPI_FAD2, RAPI_FAD3, RAPI_FAD4,  
RAPI_FAD6, RAPI_FAD12 }. The default value is RAPI_FAD4.  
Specify one from { RAPI_10BIT, RAPI_8BIT }. The default value is  
RAPI_8BIT.  
(Operating  
states set)  
(Conversion  
method)  
Specify one from { RAPI_AD_ON, RAPI_AD_OFF }. The default value is  
RAPI_AD_OFF.  
Specify one from { RAPI_WITH_SAMPLE_HOLD,  
RAPI_WITHOUT_SAMPLE_HOLD }.  
The default value is RAPI_WITHOUT_SAMPLE_HOLD.  
Specify one from { RAPI_SOFTWARE_TRIGGER,  
RAPI_EXTERNAL_TRIGGER }.  
(Trigger)  
The default value is RAPI_SOFTWARE_TRIGGER.  
Specify one from { RAPI_ANEX_UNUSED, RAPI_EXTERNAL_OP_AMP }.  
(External  
Op-Amp  
The default value is RAPI_ANEX_UNUSED.  
Connection)  
• Specifiable definition values when single sweep mode is used  
(RAPI_SINGLE_SWEEP specified)  
(Input pin)  
Specify one from { RAPI_P0_GROUP, RAPI_P10_GROUP,  
RAPI_P2_GROUP }. The default value is RAPI_P10_GROUP.  
Specify one from { RAPI_FAD, RAPI_FAD2, RAPI_FAD3, RAPI_FAD4,  
RAPI_FAD6, RAPI_FAD12 }. The default value is RAPI_FAD4.  
Specify one from { RAPI_10BIT, RAPI_8BIT }. The default value is  
RAPI_8BIT.  
(Operating  
frequency)  
(Resolution)  
(Operating  
states set)  
(Conversion  
method)  
Specify one from { RAPI_AD_ON, RAPI_AD_OFF }. The default value is  
RAPI_AD_OFF.  
Specify one from { RAPI_WITH_SAMPLE_HOLD,  
RAPI_WITHOUT_SAMPLE_HOLD }.  
The default value is RAPI_WITHOUT_SAMPLE_HOLD.  
Specify one from { RAPI_SOFTWARE_TRIGGER,  
RAPI_EXTERNAL_TRIGGER }.  
(Trigger)  
The default value is RAPI_SOFTWARE_TRIGGER.  
Specify one from { RAPI_ANEX_UNUSED, RAPI_EXTERNAL_OP_AMP }.  
(External  
Op-Amp  
The default value is RAPI_ANEX_UNUSED.  
Connection)  
• Specifiable definition values when repeat sweep mode 0 is used  
(RAPI_REPEAT_SWEEP0 specified)  
(Input pin)  
Specify one from { RAPI_P0_GROUP, RAPI_P10_GROUP,  
RAPI_P2_GROUP }. The default value is RAPI_P10_GROUP.  
Specify one from { RAPI_FAD, RAPI_FAD2, RAPI_FAD3, RAPI_FAD4,  
RAPI_FAD6, RAPI_FAD12 }. The default value is RAPI_FAD4.  
Specify one from { RAPI_10BIT, RAPI_8BIT }. The default value is  
RAPI_8BIT.  
(Operating  
frequency)  
(Resolution)  
Rev.1.00  
2007.11.1  
89  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
(Operating  
states set)  
(Conversion  
method)  
Specify one from { RAPI_AD_ON, RAPI_AD_OFF }. The default value is  
RAPI_AD_OFF.  
Specify one from { RAPI_WITH_SAMPLE_HOLD,  
RAPI_WITHOUT_SAMPLE_HOLD }. The default value is  
RAPI_WITHOUT_SAMPLE_HOLD.  
Specify one from { RAPI_SOFTWARE_TRIGGER,  
RAPI_EXTERNAL_TRIGGER }. The default value is  
RAPI_SOFTWARE_TRIGGER.  
(Trigger)  
(External  
Op-Amp  
Specify one from { RAPI_ANEX_UNUSED, RAPI_EXTERNAL_OP_AMP }.  
The default value is RAPI_ANEX_UNUSED.  
Connection)  
• Specifiable definition values when repeat sweep mode 1 is used  
(RAPI_REPEAT_SWEEP1 specified)  
(Input pin)  
Specify one from { RAPI_P0_GROUP, RAPI_P10_GROUP,  
RAPI_P2_GROUP }. The default value is RAPI_P10_GROUP.  
Specify one from { RAPI_FAD, RAPI_FAD2, RAPI_FAD3, RAPI_FAD4,  
RAPI_FAD6, RAPI_FAD12 }. The default value is RAPI_FAD4.  
Specify one from { RAPI_10BIT, RAPI_8BIT }. The default value is  
RAPI_8BIT.  
(Operating  
frequency)  
(Resolution)  
(Operating  
states set)  
(Conversion  
method)  
Specify one from { RAPI_AD_ON, RAPI_AD_OFF }. The default value is  
RAPI_AD_OFF.  
Specify one from { RAPI_WITH_SAMPLE_HOLD,  
RAPI_WITHOUT_SAMPLE_HOLD }.  
The default value is RAPI_WITHOUT_SAMPLE_HOLD.  
Specify one from { RAPI_SOFTWARE_TRIGGER,  
RAPI_EXTERNAL_TRIGGER }.  
(Trigger)  
The default value is RAPI_SOFTWARE_TRIGGER.  
Specify one from { RAPI_ANEX_UNUSED, RAPI_EXTERNAL_OP_AMP }.  
(External  
Op-Amp  
The default value is RAPI_ANEX_UNUSED.  
Connection)  
[data2]  
The set value differs with the A/D conversion mode used.  
One-shot mode  
Specify 1.  
Repeat mode  
Single sweep mode  
Repeat sweep mode 0  
Repeat sweep mode1  
Specify 2, 4, 6, or 8.  
Specify 1, 2, 3, or 4.  
[data3]  
Specify the interrupt priority level (07) to be set in the interrupt control register.  
Return value  
If A/D converter was successfully set, RAPI_TRUE is returned; if failed, RAPI_FALSE  
is returned.  
Functionality  
Reference  
A/D converter  
Rev.1.00  
2007.11.1  
90  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include " rapi_ad_m16c_62p.h"  
void AdIntFunc( void ){}  
void func( void )  
{
/* Set up A/D converter as one short mode */  
__CreateADC( RAPI_ONE_SHOT|RAPI_AN2|RAPI_FAD2| RAPI_WITH_SAMPLE_HOLD  
| RAPI_EXTERNAL_TRIGGER |RAPI_AD_ON|RAPI_10BIT| RAPI_ANEX_UNUSED,  
1, 5, AdIntFunc );  
}
Rev.1.00  
2007.11.1  
91  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__EnableADC  
Synopsis  
<Control operation of A/D converter>  
Boolean __EnableADC (unsigned long data1, unsigned int data2)  
data1  
data2  
Setup data 1  
Number of analog input pins used by A/D converter  
Description  
Controls operation of the A/D converter by starting or stopping it.  
[data1]  
RAPI_AN0  
RAPI_AN1  
RAPI_AN2  
RAPI_AN3  
RAPI_AN4  
RAPI_AN5  
RAPI_AN6  
RAPI_AN7  
RAPI_AN00  
RAPI_AN01  
RAPI_AN02  
RAPI_AN03  
RAPI_AN04  
RAPI_AN05  
RAPI_AN06  
RAPI_AN07  
RAPI_AN20  
Uses AN0 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN1 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN2 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN3 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN4 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN5 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN6 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN7 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN00 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN01 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN02 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN03 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN04 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN05 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN06 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN07 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN20 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Rev.1.00  
2007.11.1  
92  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
RAPI_AN21  
RAPI_AN22  
RAPI_AN23  
RAPI_AN24  
RAPI_AN25  
RAPI_AN26  
RAPI_AN27  
RAPI_ANEX0  
RAPI_ANEX1  
RAPI_P0_GROUP  
Uses AN21 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN22 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN23 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN24 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN25 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN26 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses AN27 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses ANEX0 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses ANEX1 pin for the analog input pin.  
Selectable only when one-shot mode or repeat mode is used.  
Uses port P0 group for the analog input pin. Selectable only when  
sweep mode, repeat sweep mode 0, or repeat sweep mode 1 is used.  
RAPI_P10_GROUP Uses port P10 group for the analog input pin. Selectable only when  
sweep mode, repeat sweep mode 0, or repeat sweep mode 1 is used.  
RAPI_P2_GROUP  
Uses port P2 group for the analog input pin. Selectable only when  
sweep mode, repeat sweep mode 0, or repeat sweep mode 1 is used.  
Sets the A/D converter to start operating.  
RAPI_AD_ON  
RAPI_AD_OFF  
Sets the A/D converter to stop operating.  
[data2]  
The set value differs with the A/D conversion mode used.  
One-shot mode  
Specify 1.  
Repeat mode  
Single sweep mode  
Repeat sweep mode 0  
Repeat sweep mode 1  
Specify 2, 4, 6, or 8.  
Specify 1, 2, 3, or 4.  
Return value  
Functionality  
If A/D converter was successfully controlled, RAPI_TRUE is returned; if failed,  
RAPI_FALSE is returned.  
A/D converter  
Reference  
Remark  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Rev.1.00  
2007.11.1  
93  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Program example  
#include "rapi_ad_m16c_62p.h"  
void func( void )  
{
/* Disable A/D converter */  
__EnableADC( RAPI_AN0|RAPI_AD_OFF, 1 );  
}
Rev.1.00  
2007.11.1  
94  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
__DestroyADC  
Synopsis  
<Discard settings of A/D converter>  
Boolean __DestroyADC(void)  
Description  
Discards settings of a specified A/D converter.  
Return value  
If converter setting was successfully discarded, RAPI_TRUE is returned; if failed,  
RAPI_FALSE is returned.  
Functionality  
Reference  
A/D converter  
Program example  
#include "rapi_ad_m16c_62p.h"  
void func( void )  
{
/* Destroy A/D converter */  
__DestroyADC();  
}
Rev.1.00  
2007.11.1  
95  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetADC  
Synopsis  
<Get A/D converted value (register specified)>  
Boolean __GetADC(unsigned long data1, unsigned int *data2)  
data1  
data2  
Setup data 1  
Pointer to the buffer in which A/D converted value is stored.  
Description  
Gets the A/D converted value from a specified A/D register.  
For data1, the following values can be set.  
RAPI_AD0  
RAPI_AD1  
RAPI_AD2  
RAPI_AD3  
RAPI_AD4  
RAPI_AD5  
RAPI_AD6  
RAPI_AD7  
Selects A/D register 0.  
Selects A/D register 1.  
Selects A/D register 2.  
Selects A/D register 3.  
Selects A/D register 4.  
Selects A/D register 5.  
Selects A/D register 6.  
Selects A/D register 7.  
Return value  
If A/D converted value was successfully acquired, RAPI_TRUE is returned; if failed,  
RAPI_FALSE is returned.  
Functionality  
Reference  
Remark  
A/D converter  
If an undefined value is specified in the first argument, operation of the API cannot  
be guaranteed.  
Program example  
#include "rapi_ad_m16c_62p.h"  
void func( void )  
{
unsigned int data;  
/* Get an A/D convertered data of A/D register 0 */  
__GetADC( RAPI_AD0, &data );  
}
Rev.1.00  
2007.11.1  
96  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
__GetADCAll  
Synopsis  
<Get A/D converted value (all registers)>  
Boolean __GetADCAll(unsigned int *data)  
data  
Pointer to the buffer in which A/D converted value is stored.  
Description  
Gets the A/D converted value from all A/D registers.  
The A/D registers from which A/D converted values are acquired are listed below.  
[M16C]  
:
[0] A/D register 0  
[1] A/D register 1  
[2] A/D register 2  
[3] A/D register 3  
[4] A/D register 4  
[5] A/D register 5  
[6] A/D register 6  
[7] A/D register 7  
(16 bytes)  
Return value  
If A/D converted values were successfully acquired, RAPI_TRUE is returned; if failed,  
RAPI_FALSE is returned.  
Functionality  
Reference  
A/D converter  
Program example  
#include "rapi_ad_m16c_62p.h"  
void func( void )  
{
unsigned int data[8];  
/* Get A/D convertered datas of A/D register */  
__GetADCAll( data );  
}
Rev.1.00  
2007.11.1  
97  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
M16C/62P Group  
Renesas Embedded  
Application Programming Interface  
Reference Manual  
Rev. 1.00  
Issued: November 2007  
Rev.1.00  
2007.11.1  
98  
REC10B0002-0100  
Download from Www.Somanuals.com. All Manuals Search And Download.  

Rackmount Solutions Projector RP 1020QD User Guide
Radica Games Range 76003 User Guide
Raypak Boiler 42 66 User Guide
RCA Flat Panel Television HD61W140 User Guide
Samsung Microcassette Recorder 256K User Guide
Sanyo Power Supply KR FH User Guide
Sears Home Gym 831288261 User Guide
Sears Humidifier 758144131 User Guide
Sears Water Dispenser 6253444 User Guide
Sennheiser Headphones HD HME 46 User Guide