AN205051 IR-Remote-control for 16LX-Series.pdf

AN205051
IR-Remote-Control for 16LX-Series
This Application Note gives some ideas and basic information, how to decode the protocol of standard InfraredRemote-Control-Units for TV, VCR, etc. with Cypress microcontrollers.
Contents
1
2
Introduction ...............................................................1
RC5 code.................................................................1
2.1
RC5-decoding with the Reload-Timer ..............3
2.2
Phase 1: Initialisation .......................................4
2.3
Phase 2: Format check ....................................5
2.4
Phase 3: Get the information ...........................6
2.5
Phase 4: Final ..................................................7
2.6
Summary of RC5 protocol................................7
3
PWM-based codes ...................................................8
1
4
5
6
7
3.1
Phase 1: Initialisation ....................................... 9
3.2
Phase 2: Get the information ......................... 10
3.3
Summary of PWM protocol ............................ 11
Perspective............................................................. 11
Appendix A: “RC5”-code - the program .................. 12
Appendix B: “PWM”code - the program .................. 15
Document History ................................................... 17
Introduction
This Application Note gives some ideas and basic information, how to decode the protocol of standard InfraredRemote-Control-Units for TV, VCR, etc. with Cypress microcontrollers.
By using these basics, also decoding of other than the mentioned codes can be realised.
The software-examples are for the MB90540series, but can be used with minor changes for all other 16bit controllers,
too.
2
RC5 code
In Europe the RC5 code, developed by Philips, is a very common standard for data transmission by infrared (IR)
remote controls for consumer products like TV, VCR, etc. The protocol is illustrated in figure 2.1. One data package
consists of totally 14 bits. The first two bits are start-bits and always are „1‟-bits. The next bit toggles each time a new
key is pressed. This means, for example, when the volume-button is held some seconds, this bit will not toggle.
Figure 1. RC5 code
1
Start
www.cypress.com
1
1
tog
0
0
0
0
Address (addr4..addr0)
1
0
1
1
1
0
0
Command (cmd5...cmd0)
Document No. 002-05051 Rev.*A
1
IR-Remote-control for 16LX-Series
The remaining 12 bits carry the real information. In totally 2048 different data-packages can be transmit. In order to
address different products the data is split into a 5 bit system-address (like TV1, TV2, VCR1, VCR2, SAT, CD, etc.)
and a 6 bit command field (like number-keys 0-9, Volume +, Volume -, etc).
All bits are „biphase‟-coded, that means, each bit consist of two alternated half-bits like shown in figure 2.2. A lowhigh transition means logical „1‟, a high-low combination indicates logical „0‟. The time for one bit is constant 1.778ms
and the same for all 14 bits. The transmission time for a whole package amounts to 24.892ms followed by a pause.
The repetition time is 113.778ms.
A dataword always will transmit complete, even if the relevant key is released within the transmission.
Figure 2. „biphase„-coding
1
0
Although a lot of integrated circuits for RC5-encoding (e.g. SAA3006, SAA3010) and decoding (SAA3009, SAA3049)
are available, it is near to use a microcontroller. Special receivers-modules for infrared remote control systems, like
the TSOP12xx family from Vishay Telefunken, may help for easier application because PIN-diode, preamplifier and
IR filter are already included. The demodulated output signal can directly be decoded by the microprocessor. The
main benefit is the reliable function even in disturbed ambient and the protection against uncontrolled output pulses.
Figure 2.3 shows a typical design how to connect an IR-receiver to the microcontroller.
Figure 3. Receiver circuit
TSOP125
6
As easily can be seen the output signal is inverted. This has to be considered when decoding the protocol, and also
for the examples within this documentation.
Because of the relatively slow bit timing, no special requirements for the processor are necessary. It is recommended
to sample the RC5 input signal interrupt driven, so that the performance of the microcontroller will not get lost.
In the following some software examples will be shown, how RC5 protocol can be decoded by using resources of
Cypress‟s 16LX-microcontrollers.
www.cypress.com
Document No. 002-05051 Rev.*A
2
IR-Remote-control for 16LX-Series
2.1
RC5-decoding with the Reload-Timer
All Cypress‟s 16LX-microcontrollers have at least one 16 bit Reload-Timer. It can be used to generate periodical
interrupts. Further an external pin (TIN) can be used as a trigger input where the trigger edge is configurable. Both
features are helpful for decoding a input signal like the RC5 one.
Four phases are necessary while decoding:
Phase 1 : Initialisation
The input pin has to be watched Waiting for transmission begin: The normal output of the IR-receiver is
„high‟-level. Keep in mind, that most IR-receivers, like this one here, will invert the RC5 data-stream. This
means, when any data-transmission begins a high-to-low transition has to be detected.
Phase 2 : Format check
The RC5 code begins with two start-bits. These bits can be used to check the right format of the incoming
signal in order to prevent from any disturbed light. Therefore the signal-structure of the start-bits should be
examined.
Phase 3 : Get the information
Bits containing the information have to be read.
Phase 4 : Final
Preparation for receiving next package
Figure 4. Inverse RC5 code because of receiver-circuit
1
RC5_state
“bit-counter”
1
1
0
0
0
0
1
0
1
1
1
0
0
1 3 5
6
7
8
9
10
11
12
13
14
15
16
17
Start
www.cypress.com
tog
Address (addr4..addr0)
Command (cmd5...cmd0)
Document No. 002-05051 Rev.*A
3
IR-Remote-control for 16LX-Series
2.2
Phase 1: Initialisation
Because the idle level of the RC5-signal is „high‟ any activity will be indicated by a high-to-low-edge.
Therefore the Reload-Timer will be used first to detect a falling edge. This can be realised by its trigger-input TIN. The
operation mode (TMCSR_MOD = “010”) prepares the timer in that way that with a high-to-low edge at TIN the
contents of the reload-register is loaded to the timer. By this the timer starts counting downwards. The Reload-Time is
set in the reload-register TMRLR to the quarter time of one Bit: 1778µs / 4 = 445µs.
The Reload-value is 222 (=445/2) because the clock-source is selected to be 2µs (4 x 222 x 2µs = 1776µs = 1 bittime).
When the Reload-Timer comes to an underflow (0x0000  0xFFFF) an underflow-interrupt will call an interrupthandler exactly in the middle of the first half-bit. Now the format-check can begin.
/* clear „bit-counter“ */
RC5_state = 0;
/* stop the Reload-Timer */
TMCSR0 = 0;
/* set reload-register */
TMRLR0 = 1778/8; /* 1/4 bit-time */
/* configure Reload-Timer: */
- prescaler 2us at 16 MHz
- Trigger-Input falling-edge
- no Reload
- IRQ enable but no trigger
TMCSR0 = 0x91A;
www.cypress.com
Document No. 002-05051 Rev.*A
4
IR-Remote-control for 16LX-Series
2.3
Phase 2: Format check
Each RC5 bit-stream begins with two start-bits „1‟. Because of the „bi-phase‟ decoding the level of the bit will change
from low to high, respectively from high to low because of the inversion by the receiver chip. To check the correct
format the half-bits of both start-bits should be sampled. Well, of course, the first half-bit gets lost, because this just
passed before the first transition.
The reload-timer automatically loads again the counter with the contents of the reload-register and continues counting
downwards. This will call the interrupt-routine periodically each quarter bit-time and the variable RC5_state will be
increased. The variable functions like a pointer to the position within the bit-stream. On the four positions 1, 3 and 5
the input signal is compared with the expected values: “1”, “0”, “1”. If this inspection fail the receiving is aborted and
the Reload-Timer will initialised again. Maybe light disturbing caused noise on the inputs line.
But if all three tests are passed the following bits will interpreted as information bits. It is not more necessary to check
both half-bits, but only the second half. Therefore the reload-time is changed to the time of a full bit length (1778µs).
__interrupt void IRQ_ReloadTimer0 (void)
{
unsigned char RC5_in;
RC5_in
= !PDR5_P56; /* sample RC-stream */
RC5_state++; /* increment bit-pointer */
switch (RC5_state) {
case 1: /* disable Reload-Timer-Trigger
to avoid retrigger */
TMCSR0 = 0x81E;
/* Startbit-control 2. half-bit */
if (RC5_in != 1)
RC5init();
break;
case 3: /* Startbit-control 3. half-bit */
if (RC5_in != 0)
RC5init();
break;
case 5: /* Startbit-control 4. half-bit */
if (RC5_in != 1)
RC5init();
else
{ /* stop reload timer */
TMCSR0 = 0;
/* new reload-value: 1 Bit-length */
/* /2 because of 2us clock ! */
TMRLR0 = 1778/2;
/* prescaler 2us at 16 MHz
Reload, IRQ enable, start */
TMCSR0 = 0x81B;
}
break;
www.cypress.com
Document No. 002-05051 Rev.*A
5
IR-Remote-control for 16LX-Series
2.4
Phase 3: Get the information
case 6: /* Toggle-bit */
RC5_toggle_new = RC5_in;
break;
case
case
case
case
case
7: /*
8: /*
9: /*
10:/*
11:/*
Address-bit
Address-bit
Address-bit
Address-bit
Address-bit
4
3
2
1
0
*/
*/
*/
*/
*/
RC5_address_new=(RC5_address_new<<1)+ RC5_in;
break;
case
case
case
case
case
case
12:/*
13:/*
14:/*
15:/*
16:/*
17:/*
Command-bit
Command-bit
Command-bit
Command-bit
Command-bit
Command-bit
5
4
3
2
1
0
*/
*/
*/
*/
*/
*/
RC5_command_new=(RC5_command_new<<1)+RC5_in;
break;
The first information bit is the toggle-bit. Each time a new key is pressed on the remote-control-unit this bit will change
from „0‟ to 1 or „1‟ to „0‟. If the key is pressed for a longer time the toggle-bit will not change anymore. The next five
bits define the receiver address and subsequently the six command bits are received. Both, address- and commandbits are sent from MSB to LSB. Errors within the information bits can not be found. Checksum or equivalent error
detection does not exist.
For easier data-processing address- and command-bits could be shifted into only one variable. Within the mainprogram the received information can then be handled with a simple case-instruction.
www.cypress.com
Document No. 002-05051 Rev.*A
6
IR-Remote-control for 16LX-Series
2.5
Phase 4: Final
When all 12 information-bits are
received, the Reload-Timer will be
initialised again. This means it wil be
stopped and prepeared to be triggered
again by the next RC5-package.
case 18: /* all bits received
prepare for next packet */
RC5init();
break;
default: break;
} // switch
/* reset underflow interrupt request flag */
TMCSR0_UF = 0;
} // interrupt Reload_Timer0
2.6
Summary of RC5 protocol
The RC5 protocol can be handled very easy. Only one Reload-Time is necessary. We found that the bit length of
1778µs varies between different IR-remote-control-units. So the real bittime has to be measured with an oscilloscope
and the defined bit-time has to be adapted within the sourcecode.
Of course, also the input-capture-unit could be used to measure the bit-time. But this would waste resources of the
microcontroller, because in reality IR-remote-control and the target application will be close together and therefore the
used bit-timing will be known.
Figure 5. Remote-Control CV150 with Code TV 162
0x0C
0x02
0x01
0x04
0x07
0x3A
0x03
0x05
0x06
0x08
0x09
0x00
0x0A
0x21
0x20
0x13
0x11
0x10
0x3A
0x2B
0x1B
0x2F
0x28
0x1A
0x3C
0x3F
0x2F
www.cypress.com
Document No. 002-05051 Rev.*A
7
IR-Remote-control for 16LX-Series
3
PWM-based codes
In contrast to the RC5-code other IR-protocols are using different bitlenght to encode ‚1„ and ‚0„ bits. The receivercircuit is the same that is already mentioned in Chapter 2. An example of the incoming datastream is shown in Figure
7. Please keep in mind that the receiver-circuit has inverted the signal. The protocol begins with a startbit that is
longer than all other bits. By this the receiption can be synchronised.
Figure 6. Remote-Control CV150 with Code 089
information
Start
0
1
0
0
1
1
0
1
“bit-counter”
?
0
1
2
3
4
5
6
7
8
The protocol starts with a start-bit, which is always the longest bit within the whole data-package. Further the length
of the „1‟ bit is longer than the „0‟ bit. This means that three different bit-length are used to distinguish between three
informations:
Length (“start”-bit) > Length (“1” bit) > Length (“0” bit)
The length of each bit depends on the IR-protocol and may differ from company to company. Also the number of bits
will differ as well as the order (MSB/LSB).
Because this application will not refer to any special IR-remote control, no fixed values are given but can be
evaluated easily by an oscilloscope.
For the following software example it is supposed that the protocol will take 12 bits beginning with the start-bit and
followed by the LSB.
www.cypress.com
Document No. 002-05051 Rev.*A
8
IR-Remote-control for 16LX-Series
3.1
Phase 1: Initialisation
In order to evaluate the bit-information the length of one bit has to be measured. This can be done by using the InputCapture-Unit. Therefore the IR-Receiver has to be connected to Pin INx.
In this software example IN0 is used.
With each falling edge of the input signal the ICU will be triggered. Automatically the actual value of the FreeRunning-Timer is stored and an interrupt-service-routine is called.
Figure 7. Inverse PWM-code
/* Initialisation: Input-Capture-Unit */
void InitICU0(void)
{
TCCS = 0x02;
/*Free-Running-Timer:4us@16MHz */
DDR7_D70 = 0;
/*IN0 = P70 = IR-input
*/
ICS01_EG01 = 1; /*TIC0 falling Edge enabled */
ICS01_EG00 = 0; /*TIC0 falling Edge enabled */
ICS01_ICP0 = 0; /*TIC0 Flag cleared
*/
ICS01_ICE0 = 1; /*IRQ
enabled
*/
IRbitcount = 0; /*clear bitcounter
*/
IRcomplete = 0; /*clear receive complete flag*/
IRcommand = 0; /*clear receive comnand
*/
}
www.cypress.com
Document No. 002-05051 Rev.*A
9
IR-Remote-control for 16LX-Series
3.2
Phase 2: Get the information
Each time when the interrupt-service-routine of the Input-Capture-Unit (ICU) is called the bit-counter is increased in
order to find out the last bit. Also the captured value of the Free-Running-Timer is saved. In comparison with the last
(old) value the bit-length is calculated. In case that the bit-time is longer than the given time for a start-bit, the bitcounter and the command-receive-buffer (IRcommandx) are cleared.
If no start-bit but a “1”-bit is detected than “1” is shifted into the receive-buffer from the left, because of LSB-first.
If all bits are received, than the receive-buffer is saved and a complete flag is set. So no overrun will occure.
At last the timer-value is copied in order to save it for the next calculation when the next falling-edge is detected.
Of course, the interrupt-flag has to be cleared, too.
__interrupt void IRQ_ICU0(void)
{
IRbitcount++;
/* Bit-counter
IRtime_new = IPCP0;
/* capture time
*/
*/
if (IRtime_new > IRtime_old)
{
IRtime =(IRtime_new - IRtime_old);
}
else
{
IRtime =(0xffff-IRtime_old + IRtime_new + 1);
}
if (IRtime > IR_TSYNC)
{
IRbitcount = 0;
/* Sync found
*/
IRcommandx = 0;
/* clear receive word */
}
else
{
IRcommandx = (IRcommandx >> 1); /*shift receive data */
if (IRtime>(IR_THIGH))
{
IRcommandx = (IRcommandx | 0x400);
/* high bit */
}
}
if (IRbitcount > 10)
{
IRcommand = IRcommandx;
IRcomplete = 1;
}
IRtime_old = IRtime_new;
ICS01_ICP0 = 0;
/* TIC0
Flag cleared
*/
}
www.cypress.com
Document No. 002-05051 Rev.*A
10
IR-Remote-control for 16LX-Series
Figure 8. Remote-Control CV150 with Code TV 089
0x9
5
0x8
0
0x8
3
0x8
6
0xA
5
0x9
1
0x9
3
0x1C
A 0x9
0x1C5
C
0xB
F
3.3
0x8
0x8
1
0x8 2
0x8
4
0x8 5
0x8
8
0x8 8
0x8
9
0x1C C
8
0x9
0x9 0
4
0x9
2
0x9
0x1C D
E 0x1C
0x1CF
D
0xB
0x9 8
D
Summary of PWM protocol
The PWM protocol is another very simple protocol that can be handled easily. Unfortunately no format check is
possible. When once started the software expects all data-bits. But a new start-bit within the data-transmission will
reject the actual receive-buffer. So receive-error will be very rare, too.
Because only one Free-Running-Timer is available within Cypress ´s 16LX microconroller the user has to take care
that all Input-Capture-Units and also the Output-Compare-Units will use the same Free-Running-Timer. This means,
that the timer should be set to the maximum needed frequency.
4
Perspective
The protocol of standard Infrared-Remote-Control-Units for TV, VCR, etc. is very simple to handle in general. Most
protocols are relatively slow. In most cases the data-format is fixed. The kind of resource that will be the best in use
depends on the protocol.
It is very important to check the used protocol of an Infrared-Remote-Control-Unit by an oscilloscope. In the
meantime there are such a lot of derivatives with small changes that the receiver has to be adapted especially to the
transmitter.
The examples given within this application-note are only basics in order to give an idea how to handle Infraredprotocols, but it can be used also for similar serial data protocols.
Side-effect is that the used microcontroller-resources are explained very detailed together with a practical application.
www.cypress.com
Document No. 002-05051 Rev.*A
11
IR-Remote-control for 16LX-Series
Appendix A: “RC5”-code - the program
5
MAIN.C:
/*-----------------------------------------------------------------------MAIN.C (RC5-Decoding)
/*----------------------------------------------------------------------*/
#include "mb90540.h"
#define RC5_bit_time 1778
/* bit-length: normaly one bit in RC5-code takes 1778 us */
/* but we found changes: within different remote controls*/
//#define RC5_bit_time 1720 /* e.g.: "Commander CV150" (Conrad-Electronic) code=162 */
unsigned
unsigned
unsigned
unsigned
char
char
char
char
RC5_state;
RC5_command, RC5_command_new;
RC5_address, RC5_address_new;
RC5_toggle, RC5_toggle_new;
void RC5init(void)
{
RC5_state
= 0;
RC5_command_new = 0;
RC5_address_new = 0;
RC5_toggle_new = 0;
TMCSR0 = 0;
TMRLR0 = RC5_bit_time/8;
TMCSR0 = 0x91A;
/* set RC5 state-machine to the beginning */
/* stop reload timer
/* set reload value 1/4 Bit-length
(/8 because of 2us clock)
/* prescaler 2us at 16 MHz
Trigger-Input falling-edge
no Reload, IRQ enable but no trigger
*/
*/
*/
}
// Description: RC5-receiver
// IR-Receiver at TIN0
void main(void)
{
InitIrqLevels();
__set_il(7);
/* allow all levels */
DDR5_D56 = 0;
PDR4_P46 = 0;
DDR4_D46 = 1;
/* Input port (P56=TIN0) for RC5 signal */
/* for measurement purposes */
RC5_command = 0;
RC5_address = 0;
RC5init();
__EI();
/* globaly enable interrupts */
while (1)
{
if (RC5_command != 0)
{
/* here you have to put your RC5-handler that reacts depending on
RC5_address, RC5_command and RC5_toggle */
RC5_command = 0;
}
}
} //main
www.cypress.com
Document No. 002-05051 Rev.*A
12
IR-Remote-control for 16LX-Series
__interrupt void IRQ_ReloadTimer0 (void)
{
unsigned char RC5_in;
RC5_in
= !PDR5_P56; /* RC5-signal at TIN0
(inverted because of Receiver-circuit)
PDR4_P46 = !PDR4_P46; /* for measurement purposes:
toggles each time the RC5-signal is scaned
RC5_state++;
*/
*/
/* bit-counter */
switch (RC5_state)
{
case 1: TMCSR0 = 0x81E;
if (RC5_in != 1)
RC5init();
break;
case 3: if (RC5_in != 0)
RC5init();
break;
/* disable Trigger to avoid retrigger
/* Startbit-control
/* if wrong format, then break cycle
*/
*/
*/
/* Startbit-control
/* if wrong format, then break cycle
*/
*/
case 5: if (RC5_in != 1) /* Startbit-control
RC5init();
/* if wrong format, then break cycle
else
{
TMCSR0 = 0;
/* stop reload timer */
TMRLR0 = RC5_bit_time/2;
/* set reload value 1 Bit-length
(/2 because of 2us clock)
TMCSR0 = 0x81B;
/* prescaler 2us at 16 MHz Reload,
IRQ enable, Trigger
}
break;
case 6: RC5_toggle_new = RC5_in;
break;
*/
*/
/* Toggle-bit */
case
case
case
case
case
7: /* Address-bit
8: /* Address-bit
9: /* Address-bit
10: /* Address-bit
11: /* Address-bit
RC5_address_new
break;
4
3
2
1
0
=
*/
*/
*/
*/
*/
(RC5_address_new << 1) + RC5_in;
case
case
case
case
case
case
12: /* Command-bit
13: /* Command-bit
14: /* Command-bit
15: /* Command-bit
16: /* Command-bit
17: /* Command-bit
RC5_command_new
break;
5
4
3
2
1
0
=
*/
*/
*/
*/
*/
*/
(RC5_command_new << 1) + RC5_in;
case 18: /* all bits
RC5_command
RC5_address
RC5_toggle
RC5init();
break;
*/
*/
received, stop RC5-recieve, wait for next packet
= RC5_command_new;
= RC5_address_new;
= RC5_toggle_new;
*/
default: break;
}
TMCSR0_UF = 0;
/* reset underflow interrupt request flag */
}
www.cypress.com
Document No. 002-05051 Rev.*A
13
IR-Remote-control for 16LX-Series
VECTOR.C: only the changes are listed (please refer to template.prj)
/*-----------------------------------------------------------------------VECTOR.C (rot_enc_extIRQ)
/*----------------------------------------------------------------------*/
#include "mb90540.h"
void InitIrqLevels(void)
{
/* ICRxx
shared IRQs for ICR */
ICR02 = 2;
/*
IRQ15 IRQ16 */
__interrupt void IRQ_RotaryEncoder (void);
#pragma intvect IRQ_RotaryEncoder 15
www.cypress.com
/* external interrupt INT0/INT1 */
Document No. 002-05051 Rev.*A
14
IR-Remote-control for 16LX-Series
Appendix B: “PWM”code - the program
6
MAIN.C:
/*-----------------------------------------------------------------------MAIN.C (PWM-Decoding)
/*----------------------------------------------------------------------*/
#include "mb90540.h"
#define IR_TSYNC
#define IR_THIGH
unsigned
unsigned
unsigned
unsigned
int
int
int
char
0.85*3000/4
0.85*1800/4
/* min time for synchronisation */
/* min time for high bit */
IRtime, IRtime_new, IRtime_old;
IRbitcount;
IRcommand, IRcommandx, IRcommand_last;
IRcomplete;
/*-------------------------------------------------------------------*/
void InitICU0(void)
{
TCCS = 0x02;
/*
DDR7_D70 = 0;
/*
ICS01_EG01 = 1; /*
ICS01_EG00 = 0; /*
ICS01_ICP0 = 0; /*
ICS01_ICE0 = 1; /*
IRbitcount = 0; /*
IRcomplete = 0; /*
IRcommand = 0; /*
}
/* Inilisation: Input-Capture-Unit */
Free-Running-Timer: 4us @ 16MHz
IN0 = P70 = IR-input
TIC0 falling Edge enabled
TIC0 falling Edge enabled
TIC0 Flag cleared
IRQ
enabled
clear bitcounter
clear receive complete flag
clear receive comnand
*/
*/
*/
*/
*/
*/
*/
*/
*/
void main (void)
{
InitICU0();
InitIrqLevels();
__set_il(7);
/* allow all levels */
__EI();
/* globaly enable interrupts */
while (1)
{
if (IRcomplete)
{
switch (IRcommand)
{ /* Buttons :
*/
case 0x80: /* 1 */
break;
default
: /* unknown
break;
*/
}
IRcomplete = 0;
}
}
}
www.cypress.com
Document No. 002-05051 Rev.*A
15
IR-Remote-control for 16LX-Series
__interrupt void IRQ_ICU0(void)
{
IRbitcount++;
/* Bit-counter
IRtime_new = IPCP0;
/* capture time
*/
*/
if (IRtime_new > IRtime_old)
{
IRtime =(IRtime_new - IRtime_old);
}
else
{
IRtime =(0xffff-IRtime_old + IRtime_new + 1);
}
if (IRtime > IR_TSYNC)
{
IRbitcount = 0;
/* Sync found
*/
IRcommandx = 0;
/* clear receive word */
}
else
{
IRcommandx = (IRcommandx >> 1); /* shift receive data */
if (IRtime>(IR_THIGH))
{
IRcommandx = (IRcommandx | 0x400); /* high bit found */
}
}
if (IRbitcount > 10)
{
IRcommand = IRcommandx;
IRcomplete = 1;
}
IRtime_old = IRtime_new;
ICS01_ICP0 = 0;
/* TIC0
Flag cleared
*/
}
VECTOR.C: only the changes are listed (please refer to template.prj)
/*-----------------------------------------------------------------------VECTOR.C (IR_PWM)
/*----------------------------------------------------------------------*/
#include "mb90540.h"
void InitIrqLevels(void)
{
/* ICRxx
shared IRQs for ICR */
ICR06 = 6;
/*
IRQ23
IRQ24 */
__interrupt void IRQ_ICU0 (void);
#pragma intvect IRQ_ICU0
www.cypress.com
23
/* input capture CH.0
Document No. 002-05051 Rev.*A
*/
16
IR-Remote-control for 16LX-Series
7
Document History
Document Title: AN205051 - IR-Remote-control for 16LX-Series
Document Number: 002-05051
Revision
**
*A
www.cypress.com
ECN
-
5226949
Orig. of
Change
NOFL
NOFL
Submission
Date
Description of Change
01/24/2002
Initial release, RC5-code
02/26/2002
“PWM”-code
04/18/2016
Migrated Spansion Application Note MCU-AN-390054-E-V11 to
Cypress format
Document No. 002-05051 Rev.*A
17
IR-Remote-control for 16LX-Series
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer‟s representatives, and distributors. To find
the office closest to you, visit us at Cypress Locations.
Products
®
®
PSoC® Solutions
ARM Cortex Microcontrollers
cypress.com/arm
Automotive
cypress.com/automotive
Clocks & Buffers
cypress.com/clocks
Interface
cypress.com/interface
Lighting & Power Control
cypress.com/powerpsoc
Memory
cypress.com/memory
Technical Support
PSoC
cypress.com/psoc
cypress.com/support
Touch Sensing
cypress.com/touch
USB Controllers
cypress.com/usb
Wireless/RF
cypress.com/wireless
cypress.com/psoc
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Cypress Developer Community
Community | Forums |Blogs | Video |Training
PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks
referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone
Fax
Website
: 408-943-2600
: 408-943-4730
: www.cypress.com
© Cypress Semiconductor Corporation, 2002-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by
Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such
laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other
intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to
sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of
Cypress‟s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for
use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or
circuit described in this document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and
safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as
critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances
management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A
critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or
system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim,
damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or
registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other
names and brands may be claimed as property of their respective owners
www.cypress.com
Document No. 002-05051 Rev.*A
18