2SD1898T100Q [RENESAS]

Sample Program (Remote Control Transmission/Reception); 示例程序(遥控发送/接收)
2SD1898T100Q
型号: 2SD1898T100Q
厂家: RENESAS TECHNOLOGY CORP    RENESAS TECHNOLOGY CORP
描述:

Sample Program (Remote Control Transmission/Reception)
示例程序(遥控发送/接收)

晶体 晶体管 遥控 开关 PC
文件: 总18页 (文件大小:532K)
中文:  中文翻译
下载:  下载PDF数据表文档文件
Application Notes  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
1. Summary  
This sample program performs remote control transmission/reception by using the Renesas Starter Kit for M16C/26A  
(R0K33026AS000BE).  
Receiver  
Received data  
Transmitter  
Transmitted data  
The extension board used here is a product  
from PI System Co., Ltd.  
2. Introduction  
The example described in this document applies to the microcomputers listed below:  
Microcomputers: M16C26A  
This sample program runs on the Renesas Starter Kit for M16C/26A (R0K33026AS000BE).  
Prepare an extension board available for the Renesas Starter Kit or create a circuit similar to the one shown in the circuit diagram on page  
15 and then connect it to the Starter Kit.  
This program uses RSK_LIB. For details about RSK_LIB, see the RSK_LIB reference manual. (RSK_LIB is the library software provided  
for use with the Renesas Starter Kit for M16C/26A.)  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 1 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
3. Port Arrangement  
The key matrix, infrared-ray transmitter/receiver and the buzzer are the facilities mounted on an extension board for the Renesas Starter  
Kit. To use these facilities, connect an extension board to the Starter Kit.  
LCD  
LCD E  
P74  
P75  
P76  
P77  
P91  
P90  
P63  
keymatrix  
LCD R  
LCD D7  
LCD D6  
LCD D5  
LCD D4  
I R - T R A N S  
R C V -  
P62  
P61  
P60  
-
-
-
P104  
P105  
P80/TA4OUT  
P82/INT0  
P106  
P107  
Xin  
10MHz  
M30260F8AGP  
4. Remote Control Specification  
4.1 Remote Control Format  
10ms  
10ms  
Data section  
Leader section  
100ms  
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7  
Inverted remote control data  
Remote control data  
Data section  
Data “0”  
Data “1”  
1ms  
1ms  
1ms  
3ms  
Per-bit waveform  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 2 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
4.2 Determination of the Leader and Data Sections  
When the received waveform falls within one of the ranges shown below, it is determined to be a leader or a data section.  
Leader section  
Leader low-level  
duration (10 ms)  
8ms - 12ms  
Leader pulse width (20 ms)  
18ms - 22ms  
Data section  
Data “0”  
(2ms)  
Data “1”  
(4ms)  
3.0ms - 5.0ms  
1.0ms - 3.0ms  
4.3 Carrier Frequency  
38.46kHz  
13us 13us  
26us  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 3 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
5. Operational Outline  
<Remote control transmission>  
Each time a switch is depressed, the buzzer is sounded and remote control code is transmitted from the infrared LED.  
<Remote control reception>  
The transmitted code is received in the remote control photodetector, and the received data is shown on liquid crystal display.  
Liquid crystal display (LCD)  
Liquid crystal display (LCD)  
Remote control  
photodetector  
Infrared LED  
M16C26A  
M16C26A  
Code: 00H  
Remote control transmission  
Remote control reception  
The operation described above is accomplished using the following microcomputer facilities:  
• Timer A0 (timer mode, main 2 ms cycle)  
This timer counts 2 milliseconds using the main clock of the microcomputer as the count source.  
It is used as the basic timer of RSK_LIB.  
Time management, key scan and LCD display management are performed using this timer.  
• Timer A4 (timer mode, carrier output)  
This timer counts 26 microseconds using the main clock of the microcomputer as the count source.  
It generates a carrier (frequency 38.46 kHz) that is output during transmission.  
• Timer B0 (timer mode, remote control transmission “500 µs”)  
This timer counts 500 microseconds using the main clock of the microcomputer as the count source.  
It turns carrier output on and off in a 500 microsecond cycle to generate a remote control transmission waveform.  
• Timer B2 (timer mode, remote control reception “250 µs”)  
This timer counts 250 microseconds using the main clock of the microcomputer as the count source.  
It generates remote control receive data from the port input level in a 250 microsecond cycle.  
• Timer A1 (pulse modulation mode, buzzer output)  
This timer outputs a waveform with different high and low pulse widths using the main clock of the microcomputer as the count source.  
It is used to sound a buzzer each time a key is touched.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 4 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
6. Operational Specification  
<Remote control transmission>  
When a switch is depressed, the remote control code (hex code) corresponding to the switch and the inverted data (hex code) of the remote  
control code are transmitted. While a switch is held down, data is transmitted successively at 100 millisecond intervals.  
Note: In this program, pressing two or more switches at the same time has no effect (i.e., ignored).  
<Remote control reception>  
(1) Immediately after the reset switch is depressed, the LCD  
shows “-----.”  
(1) Reset switch depressed  
(2) While remote control code is being received, the LCD shows  
the received code.  
I R - T R A N S  
* If the length of reception period is less than or equal to 500 ms,  
the received code is displayed for 500 ms.  
R C V  
-
-
-
-
(2) Reception underway  
(e.g., SW3 held down)  
I R - T R A N S  
R C V  
0 1- F E  
(3) 500 ms after reception  
I R - T R A N S  
R C V -  
-
-
-
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 5 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
7. Definition of the RSK Functionality and the RSK_LIB APIs and Common Functions Used by  
Remote Control Transmission/Reception  
7.1 Definition of the RSK Functionality  
RSKdefine.h file  
In this application, the following functionalities (those shown in red) are set.  
/*********************************************************  
The boot information on CPU is defined  
Usually, this mode is used  
*********************************************************/  
#define _CPU_M16C26A_NORMAL_MOD  
/* Use in low power mode can be performed. */  
//#define _CPU_M16C26A_32KHZ_MOD  
/* Use of access of a flash can be performed. */  
//#define _CPU_M16C26A_DATAFLASF_USE  
/********************************************************  
The hardware function which RSK supports is chosen  
/********************************************************/  
#define _USE_KEY  
#define _USE_BUZZER  
//#define _OPTION_USE_AD  
//#define _OPTION_USE_COM_RX  
//#define _OPTION_USE_COM_TX  
#define _OPTION_USE_INFRAEDRX  
#define _OPTION_USE_INFRAEDTX  
//#define _OPTION_USE_SW  
//#define _OPTION_USE_LED  
//#define _OPTION_USE_IO  
Individual definition of each selected functionality  
#if defined _USE_KEY  
/* A key matrix continues pushing and existence is defined.*/  
/*When not using  
-USE_KEY_CONTINU is made a comment. */  
#define _USE_KEY_CONTINU  
#if defined _USE_KEY_CONTINU  
Continuous key depressions are accepted.  
#define _CONTINU_SW1 _KEY_CONTEINU_ON  
#define _CONTINU_SW2 _KEY_CONTEINU_ON  
#define _CONTINU_SW3 _KEY_CONTEINU_ON  
#define _CONTINU_SW4 _KEY_CONTEINU_ON  
#define _CONTINU_SW5 _KEY_CONTEINU_ON  
#define _CONTINU_SW6 _KEY_CONTEINU_ON  
#define _CONTINU_SW7 _KEY_CONTEINU_ON  
#define _CONTINU_SW8 _KEY_CONTEINU_ON  
#define _CONTINU_SW9 _KEY_CONTEINU_ON  
#define _CONTINU_SW10 _KEY_CONTEINU_ON  
#define _CONTINU_SW11 _KEY_CONTEINU_ON  
#define _CONTINU_SW12 _KEY_CONTEINU_ON  
#define _CONTINU_SW13 _KEY_CONTEINU_ON  
#define _CONTINU_SW14 _KEY_CONTEINU_ON  
#define _CONTINU_SW15 _KEY_CONTEINU_ON  
#define _CONTINU_SW16 _KEY_CONTEINU_ON  
#else  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 6 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
7.2 APIs and Common Functions Used  
ApiStatusType RL_SetTimerReq( unsigned int TimerValue, char TimerMode, int *TimerNo, int *ERcode );  
ApiStatusType RL_StartTimer( int TimerNo, int *ERcode );  
ApiStatusType RL_CheckTimer( int TimerNo, int *ERcode );  
ApiStatusType RL_Get_Key( int *Inkey, int *ERcode );  
ApiStatusType RL_Getc_Ir( int *IrCode, int *ERcode );  
ApiStatusType RL_Putc_Ir( int IrCode, int *ERcode );  
ApiStatusType RL_Start_Buzzer( char freqNo, int *ERcode );  
ApiStatusType RL_Stop_Buzzer( int *ERcode );  
ApiStatusType RL_Putc_Lcd( char Ylocation, char outc, int *ERcode );  
ApiStatusType RL_Puts_LcdLoc( char Xlocation, char Ylocation, char RvTime, const char far* outc, int  
*ERcode );  
ApiStatusType RL_Putc_LcdLoc( char Xlocation, char Ylocation, char RvTime, char outc, int *ERcode );  
void RL_ErrorHook( int FuncNo, int ErrorNo );  
For details about the APIs and common functions used by the sample program (remote control transmission/reception), see the  
Renesas Starter Kit Library V.1.00 Reference Manual.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 7 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
8. Flowchart  
Remote control  
transmission/recept  
Clear display on LCD  
Show the initial screen  
Request timer setup  
Start timers  
Input keys  
Process buzzer  
NO  
Keys input?  
YES  
Transmit key code  
Check reception  
Check reception  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 8 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
9. Tutorial  
1
Launch the HEW by double-clicking its icon.  
2
Change the session name from “default Session” to “SessionM16C_E8_System.”  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 9 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
3
Select “M30260F8A” for Device.  
Select “Download emulator firmware” for Mode.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 10 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
Check the box labeled “Power supply is carried out. (MAX 300mA)” and then select “5.0V.”  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 11 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
4
In the program and the work RAM text boxes of Firmware Location Address, enter “FA0” and “0B8” respectively.  
Leave the box labeled “Debug a program using the WDT” unchecked.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 12 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
5
Choose Download from the Debug tab and download a module.  
The upper-side choices for Download show the location from which a project was downloaded.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 13 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
6
Click “Start after Reset” to start program execution.  
7
Please do "Cancellation" when "The file is opened" window opens.  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 14 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
10. Circuit Diagram  
11. Part List  
Part name  
Part No.  
U1  
Q’ty  
1
Manufacturer  
SHARP  
Type number  
Value  
Remark  
38kHz  
Remote control  
photodetector  
Infrared LED  
Transistor  
GP1UM281YK  
LED1  
Q1  
1
Panasonic  
ROHM  
LNA2801L  
1
2SD1898T100Q  
B3FS-1000P  
1A/0.5W  
Tact switch  
SW1 -  
SW16  
D2D5  
C1  
16  
OMRON  
Switching diode  
Electrolytic capacitor  
Chip resistor  
4
1
1
1
1
ROHM  
1SS355TE-17  
Panasonic  
ROHM  
ECE-V1HS010SR  
MCR10EZHF470  
MCR10EZHF561  
ERJ-1TRQJ6R8U  
1uF/50V  
47  
R1  
1/8W, 1%(5% also acceptable)  
1/8W, 1%(5% also acceptable)  
1W,5%  
Chip resistor  
R2  
ROHM  
560  
Chip resistor  
R5  
Panasonic  
6.8  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 15 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
12.  
Web Sitet  
Renesas Technology Web site  
http://www.renesas.com/  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 16 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
Revision History  
Content of revision  
Points  
Rev.  
Date of issue  
Page  
1.00  
1.10  
2006.06.30  
2007.12.03  
-
-
First revision issued  
RSK_LIB APIs supported  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 17 of 18  
M16C/26A Group  
Sample Program (Remote Control Transmission/Reception)  
REJ05B0814-0110 Rev.1.10  
2007.12  
Page 18 of 18  

相关型号:

2SD1898T100R

Power Transistor (80V, 1A)
ROHM

2SD1898T101

Small Signal Bipolar Transistor, 1A I(C), 80V V(BR)CEO, 1-Element, NPN, Silicon,
ROHM

2SD1898T101/PQ

Small Signal Bipolar Transistor, 1-Element, Silicon,
ROHM

2SD1898T101/PR

Small Signal Bipolar Transistor, 1-Element, Silicon,
ROHM

2SD1898T101/Q

Si, SMALL SIGNAL TRANSISTOR
ROHM

2SD1898T101/QR

Small Signal Bipolar Transistor, 1-Element, Silicon,
ROHM

2SD1898T101/R

Si, SMALL SIGNAL TRANSISTOR
ROHM

2SD1898T101N

Small Signal Bipolar Transistor, 1A I(C), 80V V(BR)CEO, 1-Element, NPN, Silicon,
ROHM

2SD1898T101P

Small Signal Bipolar Transistor, 1A I(C), 80V V(BR)CEO, 1-Element, NPN, Silicon,
ROHM

2SD1898T101Q

Small Signal Bipolar Transistor, 1A I(C), 80V V(BR)CEO, 1-Element, NPN, Silicon,
ROHM

2SD1898T101R

Small Signal Bipolar Transistor, 1A I(C), 80V V(BR)CEO, 1-Element, NPN, Silicon
ROHM

2SD1898_09

Power Transistor (80V, 1A)
ROHM