DRM082, Multi-Button IR Remote Control using the

DRM082, Multi-Button IR Remote Control using the
Multi-Button IR Remote Control
using the MC68HC908LT8
Designer Reference Manual
M68HC08
Microcontrollers
DRM082
Rev. 0
09/2006
freescale.com
Multi-Button IR Remote Control
using the MC68HC908LT8
Designer Reference Manual
by: T.C. Lun
Freescale Semiconductor, Inc.
Hong Kong
To provide the most up-to-date information, the revision of our documents on the World Wide Web will be
the most current. Your printed copy may be an earlier revision. To verify that you have the latest
information available, refer to http://www.freescale.com
The following revision history table summarizes changes contained in this document. For your
convenience, the page number designators have been linked to the appropriate location.
Revision History
Date
Revision
Level
September,
2006
0
Description
Initial release
Page
Number(s)
N/A
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
This product incorporates SuperFlash® technology licensed from SST.
© Freescale Semiconductor, Inc., 2006. All rights reserved.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
3
Revision History
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
4
Freescale Semiconductor
Table of Contents
Chapter 1
Introduction
1.1
1.2
1.3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Freescale’s MC68HC908LT8 Low-Cost MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Reference Demo Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Chapter 2
Fundamentals of IR Remote Control Communication
2.1
2.2
Configuration of the IR Remote Control Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Control Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Chapter 3
System Concept
3.1
3.2
3.3
System Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Application Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Control Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 4
Hardware
4.1
Hardware Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2
MC68HC908LT8 IR Remote Control Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.1
Oscillator Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2
Keypad Scanning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2.1
Transmitter Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2.2.2
Receiver Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3
Transmitter LCD and LED Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4
IR Transmitter Diode Drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5
Infrared Receiving Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6
MON08 Interface Header. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
17
17
18
18
20
21
22
23
24
Chapter 5
Software Design
5.1
5.2
5.2.1
5.2.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transmitter Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Receiver Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
25
25
27
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
5
Table of Contents
5.3
5.3.1
5.3.2
5.3.3
5.3.4
5.4
5.4.1
5.4.2
5.4.3
5.4.4
Transmitter Software Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Key Decoding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transmission Control Frame Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LCD Display Update. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Receiver Software Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Key Decoding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transmission Control Frame Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LCD and LED Display Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
29
30
31
31
31
31
32
32
32
Appendix A
Schematic
A.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Appendix B
Program Listing
B.1
B.2
Transmitter Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Receiver Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
6
Freescale Semiconductor
Chapter 1
Introduction
1.1 Introduction
This document describes a reference design for an infrared (IR) remote control (RC) solution using the
MC68HC908LT8 microcontroller.
For many air conditioner and small home appliance applications, there is a need for a wireless user
interface such as a remote control unit to send data from a transmitter to a receiver using infrared
communication. The basic requirements of an IR remote control unit are: lower power consumption in
standby mode; low operating voltage; low system cost; and easy code modification for customizing to
different models.
This reference design includes both the transmitter and the receiver unit. A feature of this reference
design is a 16-pin MON08 programming interface header for in-circuit Flash programming and debugging
in the remote control transmitter and receiver units.
1.2 Freescale’s MC68HC908LT8 Low-Cost MCU
The MC68HC08LT8 is a member of the low-cost, high-performance M68HC08 family of 8-bit
microcontroller units (MCUs). All MCUs in the family use the enhanced M68HC08 central processor unit
(CPU08) and are available with a variety of modules, memory sizes and types, and package types.
Features include:
• High-performance M68HC08 architecture
• Fully upward-compatible object code with M6805, M146805, and M68HC05 families
• Low-power design; fully static with stop and wait modes
• Maximum internal bus frequency:
– 4-MHz at 5-V operating voltage
– 2-MHz at 3-V operating voltage
• Dual oscillator module
– 32.768-kHz crystal oscillator
– 1- to 16-MHz crystal oscillator
• 8,192 bytes user Flash memory
• 128 bytes of on-chip random-access memory (RAM)
• Two 16-bit, 2-channel timer interface modules (TIM1 and TIM2) with selectable input capture,
output compare, pulse-width modulation (PWM) capability on each channel
• Programmable periodic interrupt (PPI)
• 4/3 backplanes and static with maximum 24/25 frontplanes liquid crystal display (LCD) driver
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
7
Introduction
•
•
•
•
Up to 38 general-purpose input/output (I/O) ports:
– 4 keyboard interrupts with internal pull up
– 2 × 15 mA high-current sink pins
System protection features:
– Optional computer operating properly (COP) reset
– Optional low-voltage detection with reset and selectable trip points for 3-V and 5-V operation
– Illegal opcode detection with reset
– Illegal address detection with reset
Master reset pin with internal pull-up and power-on reset
IRQ with schmitt-trigger input and programmable pull up
1.3 Reference Demo Board
The remote control reference design has the following features:
• Transmitter unit: MC68HC908LT8 controlled 9-button with LCD
• Receiver unit: MC68HC908LT8 controlled 2-button with LCD and LED indicators
• 38-kHz carrier frequency generated by software delay
• Easy re-programming and debugging by 16-pin MON08 interface
• Low operating voltage down to 1.8 V
• Low power consumption in standby mode, typically 20 μA(1)
Figure 1-1 shows the transmitter and receiver unit of the IR remote control reference design.
1. The power consumption is dependant on application and system requirements. The 20 μA assumes that all modules are turned
off except PPI, LED, KBI modules, and subsystem clock (32.768 kHz crystal).
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
8
Freescale Semiconductor
Reference Demo Board
(a) MC68HC908LT8 IR RC Receiver
(b) MC68HC908LT8 IR RC Transmitter
Figure 1-1. Infrared Remote Control Reference Design
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
9
Introduction
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
10
Freescale Semiconductor
Chapter 2
Fundamentals of IR Remote Control Communication
2.1 Configuration of the IR Remote Control Unit
An IR remote control transmitter generates infrared rays to a receiver by way of a digital control frame
pattern. The infrared transmitting diode and the infrared receiving module are important components for
an efficient IR transmission through air. The carrier frequency for home appliance applications is typically
around 38kHz.
A typical configuration of IR remote control is shown in Figure 2-1.
Digital Control Frame
with 38-kHz Carrier
REMOTE
CONTROL
TX MCU
IR TX DIODE
IR RX MODULE
Demodulated Digital
Control Signal
KEYPAD
Infrared Rays
Figure 2-1. Configuration of IR Remote Control Unit
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
11
Fundamentals of IR Remote Control Communication
2.2 Control Frame Format
The IR control frame pattern is specific for different transmitter-receiver designs. It depends on application
requirements such as controller purpose and features. Figure 2-2 shows the typical example of the control
frame waveform that is used in this IR remote control reference design.
In Figure 2-2, the carrier is the 38 kHz with a 1/3 duty cycle. Having IR transmitting diode using 38-kHz
carrier and 1/3 duty cycle allows a low power design for the IR transmission. If the carrier was 1/2 duty,
the transmitting diode will be on for 13 μs and off for 13 μs. But for 1/3 duty, the diode is on for 8μs and
off for 18μs. A reduction in turn-on time means a reduction in power consumption.
The data bit for 0 or 1 is based on the duration of the carrier on/off. For data 0, both carrier on and off
times are 0.5 ms. For data 1, the carrier on time is 0.5 ms and the carrier off time is 1.5 ms.
Typically, the data frame consists of the header code, several bytes of data code, one byte of customer
code, and one stop bit. The header code is used to indicate to the IR receiver that following transmissions
will be the data code and customer code. The data code is used for control purposes, such as on/off,
increase/decrease, modes, etc. The customer code is used for identifying different customers. And, the
stop bit is to indicate it is the last bit of the current transmission.
In this reference design, the above frame format is used for an air conditioner remote control unit.
8 μs
Carrier Frequency (38kHz) with 1/3 Duty Cycle
26 μs
Carrier
Data “1”
Data “0”
Bit Data Format
0.5ms
2ms
0.5ms
1ms
Stop bit (1bit)
Frame Format
Header Data Code
(8 bits)
Data Code
(8 bits)
Data Code
(8 bits)
Customer Code
(8 bits)
9ms
13.5ms
Figure 2-2. Control Frame Waveform
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
12
Freescale Semiconductor
Chapter 3
System Concept
3.1 System Specification
This reference design demonstrates a remote controller for air conditioner/small appliance applications
with re-programming and debugging features. The design meets the following performance
specifications:
• Low power consumption in standby mode (transmitter unit)
• Low operating voltage (transmitter unit)
• 16-pin MON08 interface for software development (transmitter and receiver units)
• MC68HC908LT8 controlled transmitter and receiver for system evaluation in real time
• Transmitter and receiver uses standard type AAA batteries as power source
Figure 3-1(a) shows the front of the transmitter unit with the 9-key keypad. Figure 3-1(b) shows the back
of the transmitter unit with the BDM interface header and battery cover.
Figure 3-2(a) shows the front of the receiver unit with the key switch, LCD and LED display, and the IR
receiver module. Figure 3-2(b) shows the back of the receiver unit with the MON08 interface header,
battery holder, and ON/OFF switch.
3.2 Application Description
The design uses a MC68HC908LT8 in both the transmitter and the receiver unit.
In the transmitter unit, the MC68HC908LT8 performs the following tasks:
• Keyboard scanning
• Frame encoding
• Carrier generating
• Transmitting the encoded frame to IR with carrier
• LCD driving
In the receiver unit, the MC68HC908LT8 performs the following tasks:
• Keyboard scanning
• Frame decoding
• LCD and LED displaying
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
13
System Concept
(a) Front of IR RC Transmitter
(b) Back of IR RC Transmitter
Figure 3-1. MC9RS08KA2 IR Remote Control Transmitter Unit
(a) Front of IR RC Receiver
(b) Back of IR RC Receiver
Figure 3-2. MC68HC908LT8 IR Remote Control Receiver Unit
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
14
Freescale Semiconductor
Control Process
3.3 Control Process
Since the design is targeted for an air conditioner remote controller application, some general control
parameters must be included. For example, power ON/OFF, temperature data, and mode selection.
Table 3-1 summarizes the control data frame definition for this reference design.
NOTE
Since each customer has their own requirements and definitions, Table 3-1
only includes the general and common control parameters. Additional
parameters can be added, thus increasing the frame length by the
additional control bytes.
Table 3-1. Remote Control Frame Definition
Data
Code
Name
Bit Definition
7
C1
0
A/C OFF
1
A/C ON
6
5
4
3
2
1
0
Function
Remarks
0
0
0
AUTO mode(1)
no temp.
0
0
1
COOL mode(2)
custom temp.
custom wind
0
1
0
HUMIDITY mode(2)
0
1
1
0
1
custom wind
custom temp.
custom wind
(3)
custom temp.
custom wind
HEAT mode
0
0
°C
0
1
Reserved
1
0
°F (Lower range)
1
1
no sleep
°F (Higher range)
0
Light ON
1
Light OFF
X
C2
custom temp.
(2)
WIND mode
0
no sleep
Reserved
0
Sleep OFF
1
Sleep ON
0
Swing OFF
1
Swing ON
0
0
AUTO Wind Speed
0
1
LOW Wind Speed
1
0
MIDDLE Wind Speed
1
1
HIGH Wind Speed
Continued on next page
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
15
System Concept
Table 3-1. Remote Control Frame Definition (Continued)
Data
Code
Name
Bit Definition
7
6
5
4
3
2
1
0
Function
Temperature
Remarks
°C
°F
°F
C1[3:2] = 0:0
C1[3:2] = 1:0
C1[3:2] = 1:1
0
0
0
0
15°C
59°F
75°F
0
0
0
1
16°C
60°F
76°F
0
0
1
0
17°C
61°F
77°F
0
0
1
1
18°C
62°F
78°F
0
1
0
0
19°C
63°F
79°F
0
1
0
1
20°C
64°F
80°F
0
1
1
0
21°C
65°F
81°F
0
1
1
1
22°C
66°F
82°F
1
0
0
0
23°C
67°F
83°F
1
0
0
1
24°C
68°F
84°F
1
0
1
0
25°C
69°F
85°F
1
0
1
1
26°C
70°F
86°F
1
1
0
0
27°C
71°F
1
1
0
1
28°C
72°F
1
1
1
0
29°C
73°F
1
1
1
1
30°C
74°F
(4)
Model
C3
0
0
0
0
0
0
0
0
1
1
0
0
1
0
2
0
0
1
1
3
0
1
0
0
4
0
1
0
1
5
0
1
1
0
6
0
1
1
1
7
1
0
0
0
8
1
0
0
1
9
0
Model Set ON
1
C4
1
0
1
0
1
Model Set OFF
x
x
x
Reserve
0
0
1
Customer Code(4)
Same model number between transmitter
and receiver
NOTES:
1. Default mode for the reference design after a power-on-reset.
2. Default value of temperature is 25°C and needs to store temperature and wind speed individually.
3. Default value of temperature is 28°C and needs to store its temperature and wind speed individually.
4. Same model and customer code for transmitter and receiver.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
16
Freescale Semiconductor
Chapter 4
Hardware
4.1 Hardware Implementation
This chapter will focus on the hardware implementation of transmitter and receiver units.
The IR remote control transmitter and receiver units can be divided into the following parts:
• Oscillator circuit
• Keypad scan
• IR transmitter diode drive (TX only)
• IR receiver (RX only)
• LCD and LED display
• MON08 interface
4.2 MC68HC908LT8 IR Remote Control Transmitter
The MC68HC908LT8 IR remote control transmitter unit is mounted on an optimized PCB and fits in an
actual remote controller casing, with keypad, LCD, battery holder, and a MON08 interface header for
firmware development and system evaluation.
This reference design uses the 52-pin packaged MC68HC908LT8 to implement the basic functions of the
IR remote control transmitter unit.
4.2.1 Oscillator Circuit
Since the MC68HC(9)08LT8 MCU is designed for remote control applications, it has two independent
clock drives. Both transmitter and receiver units have the same oscillator circuit, as shown in Figure 4-1.
The reason for the two clock sources is due to the low power requirements in standby mode of remote
control applications. For a remote control transmitter unit, the unit is in standby mode for the majority of
the time. The unit wakes up only when it detects a key press. Therefore, in this standby mode, the main
bus clock in the MC68HC(9)08LT8 can be stopped and the slower subsystem clock is used to drive the
LCD display and the programmable periodic interrupt (PPI) module.
Figure 4-1 shows the common crystal oscillator circuit for HC08 family MCUs. The component values
shown are optimized for the MC68HC(9)08LT8, which is the same for both the transmitter and receiver
units. The 4-MHz clock is divided by four for a MCU bus of 1-MHz. A slower bus speed will further lower
MCU power consumption in run mode.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
17
Hardware
OSC1
System Clock
(for MCU Bus)
R1
4.7 MΩ
C1
18 pF
X1
4 MHz
OSC2
C2
18 pF
LT8
XTAL1
Sub-System Clock
(for LCD and PPI Modules)
R2
10 MΩ
X2
32.768 kHz
C3
10 pF
XTAL2
R3
10 kΩ
C4
10 pF
Figure 4-1. Oscillator Circuit for MC68HC908LT8
4.2.2 Keypad Scanning
The transmitter unit has a 9-button keypad, while the receiver unit has only two.
4.2.2.1 Transmitter Unit
The MC68HC(9)08LT8 has four I/O pins with keyboard interrupt (KBI) capability. Having these KBI pins
means the MC68HC(9)08LT8 can be put into stop mode for power saving when no buttons are being
pressed.
The nine buttons on the transmitter unit are configured in a 3-by-3 matrix for key scanning. Shown in
Figure 4-2, pins KBI0–KBI2 and PTA4–PTA6 are used to form a key matrix. Before entering standby
mode, PTA4–PTA6 are set to output low and KBI0–KBI2 enabled for keyboard interrupts. Pressing any
button from SW1–SW9 will wakeup the MC68HC(9)08LT8 from standby mode. Once out of standby
mode, the button is debounced and decoded.
A detailed description of keyboard scanning is discussed in the 5.3 Transmitter Software Implementation.
S7
S8
S9
S4
S5
S6
S1
S2
S3
PTA6
PTA5
PTA4
LT8
S1: SLEEP
S2: SWING
S3: MODEL
S4: +
S5: LIGHT
S6: ON/OFF
S7: –
S8: WIND
S9: MODE
KBI0
KBI1
KBI2
Figure 4-2. Transmitter 3-by-3 Keyboard Matrix
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
18
Freescale Semiconductor
MC68HC908LT8 IR Remote Control Transmitter
Table 4-1 summaries the function or meaning of each button on the transmitter unit:
Table 4-1. Buttons on the IR Remote Control Transmitter Unit
Button
Function
S1
This is the sleep mode button. Pressing S1 activates the sleep timer and turn off the receiver LCD. The air
conditioner switches off when the sleep timer expires. The actual sleep timer is not implemented on this
reference design.
S2
This is the air swing selection button. Pressing S2 toggles the air conditioner louver air swing on and off. The
corresponding icon on the transmitter/receiver LCD is activated accordingly (see 4.3 Transmitter LCD and LED
Display).
S3
This is the model selection button. With the first power on the transmitter, the model iron will flash to let the user
select the model number. If the user wants to change the model number, he/she can press S4 “+” or S7 “–” key
to increase or decrease the model number while the model iron is flashing. Or, the user can press the S3
“model” key to choose the desired model number that is shown on the LCD display. If the transmitter is powered
on a second or later time, the model number can only be changed if the user presses the model key. Then, the
model iron will flash again to let the customer change the model number by pressing the “+” or “–” key.
Button S4: This is the “+” or increase button for temperature or model number depending on the condition.
S4
• If the model key is not pressed (i.e., model icon is not flashing), pressing the “+” key will increase the
temperature by 1. Or, pressing the “+” key for more than 5 seconds will increase the temperature faster and
continuously until the “+” key is released. Additionally, during the temperature change, the control data frame
will transmit out after the “+” key is released.
• If the model key is pressed (i.e., model icon is flashing), pressing the “+” key will increase the model number
by 1. Or, pressing the “+” key more than 5 seconds will increase the model number faster and continuously until
the “+” key is released. In this case, no control data frames will be transmitted after the “+” key is released.
S5
This is the LCD backlight ON/OFF button. Pressing S5 toggles the backlight on the transmitter/receiver LCD on
and off. In this reference design, this button actually toggles one of the receiver LCD icons on and off.
S6
This is the ON/OFF button. Pressing S1 toggles the air conditioner power on and off. When the receiver is in the
OFF mode, the OFF LED will be on (ON LED is off) and the LCD will be off. When the receiver is in the ON mode
(ON LED is on) OFF LED is off and the LCD will be on.
Button S7: This is the “–” or decrease button for temperature or model number depending on the condition.
S7
• If the model key is not pressed (i.e., model icon is not flashing), pressing the “–” key will decrease the
temperature by 1. Or, pressing the “–” key for more than 5 seconds will decrease the temperature faster and
continuously until the “–” key is released. Additionally, during the temperature change, the control data frame
will transmit out after the “–” key is released.
• If the model key is pressed (i.e., model icon is flashing), pressing the “–” key will decrease the model number
by 1. Or, pressing the “–” key more than 5 seconds will decrease the model number faster and continuously
until the “–” key is released. In this case, no control data frames will be transmitted after the “–” key is released.
S8
This is the WIND speed selection button. Pressing S3 toggles through the wind speeds of the air conditioner:
AUTO → LOW → MIDDLE → HIGH and back again to AUTO (see Table 3-1. Remote Control Frame Definition).
The default setting is AUTO when the air conditioner is switched from off to on. The corresponding icon on the
receiver LCD is activated accordingly (see 4.3 Transmitter LCD and LED Display).
S9
This is the mode selection button. Pressing S9 toggles through the operating modes of the air conditioner:
AUTO → COOL → HUMIDITY → WIND → HEAT and back again to AUTO (see Table 3-1. Remote Control
Frame Definition). The corresponding icon on the receiver LCD is activated accordingly (see 4.3 Transmitter
LCD and LED Display).
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
19
Hardware
4.2.2.2 Receiver Unit
There is no need for power saving in the receiver, because the power in the air conditioner is coming from
the AC main. Therefore, there is also no need to force the system (receiver) into standby mode. For this
reference design, we used key polling instead of the keyboard interrupt. Figure 4-3 shows the connection
of two keys. The keys are connected to PTA0, PTA1, and ground and use the polling technique to check
which key has been pressed. In addition, both PTA0 and PTA1 are needed to enable the internal pullup
to maintain the logic high when no key has been pressed. If any key is pressed, PTA0 or PTA1 will sense
the logic low. There are different methods found between the transmitter and receiver due to their system
requirements.
There are two keys in the receiver:
• S1 is the air conditioner ON/OFF control button. The receiver will turn ON or OFF depending on
the ON/OFF control bit coming from the transmitter, or if S1 is in the receiver itself.
• S2 is the MODEL selection in the receiver. The model number will be increased by one for each
S2 pressed. And, it will be changed from 0 to 9 and then changed back to model 0 again. The model
number between transmitter and receiver must be the same for valid communication. If there are
different model numbers between them, the receiver will neglect the command from the
transmitter.
NOTE
After powering on the receiver, the model number in the receiver should
be 0 by default. And, the transmitter must be set as model 0 for valid
communication.
S1
S2
S1: ON/OFF
S2: MODEL
LT8
PTA0
PTA1
Figure 4-3. Receiver Key (Polling)
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
20
Freescale Semiconductor
Transmitter LCD and LED Displays
4.3 Transmitter LCD and LED Displays
In the transmitter, the LCD display only shows the air conditioner status after the last control command
from the transmitter. In the receiver, the LCD display shows either the command from the transmitter
control data frame or the key command from the receiver itself. So, two additional LEDs are needed to
show the status of the receiver (air conditioner), such as power on and power off.
Figure 4-4 shows the LED and LCD display on the MC68HC908LT8 IR remote control receiver unit.
Operating Modes
AUTO
COOL
HUMIDITY
WIND
HEAT
Fan Wind Speed
Air Conditioner OFF
AUTO
Air Conditioner ON
LOW
(1 Bar On)
Temperature
MIDDLE
(3 Bars On)
HIGH
(5 Bars On)
Model Number
Air Swing
Light
Transmit Icon (Middle 3 Bars)
Sleep Function Enable Icon (Outer 2 Bars)
ON TRANSMITTER UNIT ONLY
Figure 4-4. Typical Air Conditioner Receiver LCD Display
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
21
Hardware
4.4 IR Transmitter Diode Drive
Taking system cost into consideration, the MC68HC(9)08LT8 MCU drives the IR transmitting diode
directly. Figure 4-5 shows a typical drive circuit for an IR transmitting diode.
VDD
R7
2.2 Ω
D1
IR-333A
LT8
R5
220 Ω
T2CH0
Q1
MMBT4401
R6
100 kΩ
Figure 4-5. Circuit for IR Transmitting Diode
In the above circuit, the timer channel T2CH0 is used to drive the IR transmitting diode. The timer channel
will generate the 1/3 duty cycle 38-kHz waveform. Using the timer to generate the PWM waveform has
several advantages such as:
• Simply control flow
• Small code size
• Easier re-configuration of duty cycle and frequency of the carrier
The resistor R6 is used to force the transistor Q1 to an OFF state during the system power up stage.
And, the resistor R7 is used to limit the current of the IR transmitting diode. The value of R7 is dependent
upon the requirement of output power in the IR transmitting diode. Lower value on R7 will increase the
output power of the IR transmitting diode. On the other hand, the duty cycle of PWM can also change
the output power of the IR transmitting diode.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
22
Freescale Semiconductor
Infrared Receiving Module
4.5 Infrared Receiving Module
Since the IR receiver board is used only to demonstrate the ability of the MC68HC(9)08LT8 IR remote
control transmitter, the operating voltage of the receiver board is 3 V. The common operating voltage of
a receiving board in an air conditioner is 5 V. So, we selected a IR receiving module that will also work
with an operating voltage of 3 V. Therefore. the sensitivity of the receiving module may be somewhat
different if used in a 5-V IR receiving module.
VDD
R8
47 Ω
LT8
U2
IRM-3638N3
VCC
R5
100 Ω
T2CH0
Out
C10
0.001 μF
C9
0.1 μF
C8
47 μF
+
GND
Figure 4-6. Circuit for IR Receiving Module
Figure 4-6 shows a typical IR receiving module circuit with MCU. In the above circuit, both the MCU and
the IR receiving module work at 3-V VDD. When U2 senses a 38-kHz waveform, it will demodulate it back
to the base-band signal and drive it to the output pin “Out”. C8 and C9 are the bypass and decoupling
capacitors for the U2 used to filter out any noise that coupled from the power supply source. R5 and C10
form the low-pass filter that filters out any unwanted high-frequency noise from U2. We used one of the
MC68HC(9)08LT8 MCU timer channels, it configures as an input capture to decode the incoming
base-band signal from the IR receiving module. Using timer channel T2CH0’s input capture can simplify
the code, making it easier to decode the incoming signal.
In addition, there are some hints to help choose the IR transmitting diode and IR receiving module, such
as the same center freakiness and same peak wavelength. The half angle is depended on the
requirements of the transmitter and receiver. In normal cases, we may choose the same half angle in both
the IR transmitting diode and the IR receiving module. On the other hand, the reception distance also
needs to be considered.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
23
Hardware
4.6 MON08 Interface Header
For easier reprogramming of Flash and evaluating purposes, a 16-pin MON08 header is included in this
reference design. The MON08 interface provides in-circuit programming and debugging features.
To help the user more easily re-program and evaluate the pair of demo(s) (IR remote control transmitter
and IR remote control receiver), both of them have added the 16-pin standard MON08 interface. This
interface provides the in-circuit programming feature for the user. The user can re-program the code into
both the transmitter and the receiver to test their implementation. In addition, some hardware interface
board is needed to connect between the PC and the MON08 header, such as P&E CyclonePro or HC08
low-cost tool (M68UICS08).
GND
U1
P1
VSS
2
1
RST
4
3
IRQ
6
5
PTA0
8
7
10
9
PTA1
12
11
PTA2
14
13
PTC3
16
15
LT8
VDD
VDD
OSC1
Figure 4-7. MON08 Interface Circuit
Figure 4-7 shows the connection between MON08 header with MC68HC(9)08LT8 MCU in both
transmitter and receiver boards. When the user wants to re-program their code to the demo, they will need
to connect the hardware interface board between the PC and the MON08 header. Then, program their
code to the demo in order to check the code.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
24
Freescale Semiconductor
Chapter 5
Software Design
5.1 Introduction
This section describes the design of the drive’s software blocks. The software description comprises
these topics:
• General Flowchart
• Transmitter Software Implementation
• Receiver Software Implementation
5.2 General Flowchart
The control algorithm of a remote control transmitter and receiver are shown in Figure 5-1 and Figure 5-2,
respectively. The individual detail processes are described in the software implementation sections.
5.2.1 Transmitter Flowchart
Figure 5-1 shows the overall transmitter flowchart.
After the remote control transmitter has been powered on:
• The MC68HC908LT8 registers will be initialized (such as I/O ports, timer, keyboard interrupt, and
LCD driver module)
• After the register initialization phase, the keyboard interrupt is enabled and waits for any key
command
• If there are no key commands, the MCU will enter stop mode for power saving
• In stop mode, all MCU modules will be off except for:
– The sub-system clock that drives from a 32.768 kHz crystal
– The LCD display module
– The programmable periodic interrupt module
• If any key command is received:
– The MCU will wakeup from stop mode
– Decode which key command was received
– Update the control frame data accordingly
– The control frame will be transmitted by the IR transmitting diode
• The code will then jump back to the beginning and wait for another key command.
If there are no key presses for more than 10 seconds, the transmitter will revert back to stop mode for
power saving.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
25
Software Design
START
Mask Interrupts
Is
Tx Flag
Set?
Yes
Initialization
Transmit
Control Frame
Enable Interrupts
No
Enable Interrupts
Wait Mode
Is 125 ms
Timer Interrupt
Present?
Yes
No
No Key
Pressed within
10 sec ?
No
Yes
No
Is Any
Key
Pressed?
Yes
Run Mode
Is Sleep
Function
Enable?
No
Yes
Stop Mode
Decode Keys
Is Any
Key
Pressed?
Update
Control Frame
Yes
Update LCD Display
Is Key
Released?
Yes
No
Partial
Stop Mode
No
Flashing Sleep Ion
Is Any
Key
Pressed?
No
Yes
Figure 5-1. General Flowchart of Transmitter
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
26
Freescale Semiconductor
General Flowchart
There are two cases for standby mode, full stop mode and partial stop mode depending on the sleep
function. If the sleep function is enabled, the LCD display needs to be flashing. Therefore, the LCD data
register also needs to be changed by 1 second. The 1 second periodic wakeup can be implemented by
the PPI module. It will wakeup the MCU periodically and change the LCD data register to flash the
corresponding sleep icon(s). If the sleep function is disabled, the remote control transmitter will enter full
stop mode for more power saving.
In this remote control transmitter demo, there are:
• About 20 μA for full stop mode (32.678 kHz subsystem clock, KBI enable, LCD module on)
• About 30 μA for 1 second periodic wakeup of the MCU for LCD flashing
There is a 125 ms periodic interrupt that generates from the timer. If the remote unit is in run mode, the
125 ms periodic interrupt will be generated and the control flow will be determined by a different software
counter. Figure 5-1 shows one of the software counters that is used to determine the period of the key
press. If no key is pressed longer that 10 seconds, the remote control transmitter unit will enter stop mode
for power saving. Any key press will generate a keyboard interrupt to wakeup the MCU from stop mode
and continue the operation of the remote control transmitter unit.
5.2.2 Receiver Flowchart
Figure 5-2 shows the overall receiver flowchart.
After the remote control receiver has been powered on:
• The MC68HC908LT8 MCU will initialize the internal register configuration (such as I/O ports, timer,
keyboard interrupt, and LCD driver module)
• After the initialization phase, the keyboard interrupt is enabled and waits for any key command
• Since the receiver side normally does not need power saving, when no key has been pressed the
receiver will enter wait mode instead of stop mode
• Next, the receiver waits for either a key press or any IR control frame signal from the transmitter
• If any key is pressed:
– The MCU will wakeup from wait mode
– Decode which key has been pressed
– Update the control frame and corresponding LED and LCD display.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
27
Software Design
START
Initialization
Enable Interrupts
Wait Mode
Is Any
Key
Pressed?
Yes
Mask Interrupts
No
Is Infrared
Control Frame
Correct?
No
Yes
Decode Keys
Un-Mask Interrupts
Update
Control Frame
Update LCD & LED
Figure 5-2. General Flowchart of Receiver
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
28
Freescale Semiconductor
Transmitter Software Implementation
5.3 Transmitter Software Implementation
This section discusses the transmitter software implementation in detail.
5.3.1 Initialization
After transmitter power on, the MC68HC(9)08LT8 MCU will initialize the following settings:
•
Initializes stack pointer
•
•
Mask all interrupt
Clear COP counter
•
Initializes GPIO A, B, C, D, and E modules
– GPIO A0–A2 as high outputs and A4–A6 as low outputs for the KBI matrix
– All others of GPIO as output low
•
Initializes the configuration registers
– Disables COP and LVI
– Disables system clock in stop mode
– Enables subsystem clock in stop mode
– Sets port D and E as LCD output pins
•
•
•
•
Disables IRQ
Sets PPI clock source to 32.768 kHz
Enables the KBI pins and interrupts in ports A0–A3
Initializes the LCD module
– Sets bias voltage to 0.65% of VLCD
– Sets bias resistors to 146 Kohm
– Enables the LCD frame rate to 32 Hz
– Sets 1/4 duty cycle
•
Initializes the timer1 module
– Sets clock source to bus frequency / 8
– Sets timer overflow period to 125 ms
•
Initializes the timer2 module
– Sets clock source to bus frequency
– Sets 38 kHz 30% duty cycle PWM in timer2
– Sets channel 2 as a PWM output
•
•
•
•
Initializes system variables
Initializes control frame data
Turns on all LCD ions for 3 seconds
Unmasks the interrupt
After initialization, the timer1 interrupt and the 125 ms timer overflow interrupt will be enabled. They will
provide the timing for the keyboard scan, LCD data update, and control frame data transmission.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
29
Software Design
5.3.2 Key Decoding
The basic configuration and general description of the transmitter keyboard scan was discussed in 4.2.2.1
Transmitter Unit. This section will focus on the software implementation of the keyboard scan.
In Figure 5-1, the key decoding subroutine is shown as “Decode Keys”. The detailed operation is shown
in Figure 5-3. When any key is pressed, the keyboard interrupt service routine will be serviced and some
system flag will be set. Then, key debounce will filter out any noise that was generated by key pressing.
After key debounce, the key will be located by matrix scanning which is the process of scanning the row
first and then the column to locate which key is pressed. There are two keys (S4 “+” and S7 “–”) that have
an additional feature. If one of these keys is pressed for more than 3 seconds, the transmission control
frame will update rapidly until the key is released and the transmission control frame will be transmitted
out after the key is released.
Key Scan
Key Debounce (3 times)
Is S1–S3
Row 1
Pressed ?
Yes
No
S1–S9
Column
Decode
Is S1-S9
(except S4/S7)
Pressing?
Yes
No
Is S4–S6
Row 2
Pressed ?
Update
Control Frame
Is S4/S7
Pressing
> 3 sec ?
No
Yes
Continuous +/when S4 / S7 pressed
without release
Yes
No
Is S7–S9
Row 3
Pressed ?
Yes
No
Return
Figure 5-3. Keyboard Decoding in Transmitter
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
30
Freescale Semiconductor
Receiver Software Implementation
5.3.3 Transmission Control Frame Update
After locating which key is pressed, the transmission control frame will be updated based on which key is
pressing. The definition of the transmission control frame is shown in Table 3-1 and the definition of the
key functions are described in 4.2.2.1 Transmitter Unit.
5.3.4 LCD Display Update
The LCD display is updated every 125 ms (the timer interrupt). And, the icon on or off (in the LCD display)
is dependent on the transmission control frame. After the transmission control frame is updated, the LCD
display routine will decode the frame and then change the icon(s) of the display accordingly. The definition
of the display is discussed in 4.3 Transmitter LCD and LED Displays.
5.4 Receiver Software Implementation
The general software flow diagram for the remote control receiver is discussed in 5.2 General Flowchart.
This section will focus on a detailed description of the transmitter software implementation.
5.4.1 Initialization
After receiver power on, the MC68HC(9)08LT8 MCU will initialize the following settings:
• Initializes stack pointer
• Masks all interrupts
• Clear COP counter
• Initializes GPIO A, B, C, D, and E modules
– GPIO A0–A1 as outputs for KBI
– GPIO B2–B3 as outputs for the LED drive
– All other GPIO as output low
• Initializes the configuration registers
– Disables COP and LVI
– Disables system clock in stop mode
– Enables subsystem clock in stop mode
– Sets port D and E as LCD output pins
• Disables IRQ
• Sets PPI clock source to 32.768 kHz
• Enables the KBI pins and interrupts in port A0–A1
– Initializes the LCD module
– Sets bias voltage to 0.65% of VLCD
– Sets bias resistors to 146 Kohm
– Enables LCD frame rate to 32 Hz
– Sets 1/4 duty cycle
• Initializes system variables
• Initializes control frame data
• Turns on all LCD ions for 3 seconds
• Initializes the timer2 module
– Sets channel 2 as an input capture
• Unmasks the interrupt
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
31
Software Design
After initialization, the timer2 interrupt will be enabled and any IR control frame will cause an interrupt and
the corresponding action in the receiver. On the other hand, if the KBI (PTA0–PTA1) is also enabled, any
key press will cause an interrupt and the corresponding action in the receiver.
5.4.2 Key Decoding
The basic configuration and general description of the receiver keyboard decoding was discussed in
4.2.2.2 Receiver Unit. In this section, focus will be on the software implementation of the keyboard
decoding.
In Figure 5-2, the key decoding subroutine is shown as “Decode Keys”. In Figure 5-4, the keyboard
interrupt is used for key decoding. Similarly to transmitter key decoding, when any key is pressed it will
generate a keyboard interrupt. In the case of the receiver, only two keys need to be decoded. So, there
is no need to scan the key location by row and column. All that is required to poll either the S1 or S2 key
to determine which key is pressed. The corresponding control frame will be updated. And, the LCD and
LED display will be updated accordingly.
5.4.3 Transmission Control Frame Update
Either a key being pressed or receipt of an IR transmission control frame signal from the transmitter will
cause the transmission control frame to be updated accordingly. The definition of the transmission control
frame is shown in Table 3-1 And the definition of the key functions are described in 4.2.2.2 Receiver Unit.
5.4.4 LCD and LED Display Update
The LCD display is the same in both the transmitter and receiver. Since there is no flashing feature in the
receiver, it does not need to update the LCD display periodically. And, the receiver requires the addition
of two LEDs to indicate power on and off. Refer to 4.3 Transmitter LCD and LED Displays for more
detailed information regarding the LCD and LED displays.
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
32
Freescale Semiconductor
Receiver Software Implementation
Key Scan
Key Debounce (2 times)
No
Is S1-S2
Pressed ?
Yes
Is S1
Pressed ?
Yes
No
Is S2
Yes
Pressed ?
No
Update
Control Frame
Return
Figure 5-4. Keyboard Decoding in Receiver
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
33
Software Design
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
34
Freescale Semiconductor
Appendix A
Schematic
A.1 Introduction
Schematics for the reference design are shown on the following pages:
MC68HC908LT8 Remote Control Transmitter Reference Demo (M68DEMOLT8RC2)
MC68HC908LT8 Remote Control Receiver Reference Demo (M68DEMO08LT8RX)
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
35
5
3
4
2
1
C1
VDD
1
2
1
D
18pF
1
D
R1
2
2
IR_LED
1
1
DC1
C7
C8
18pF
C3
B1
0.1uF
1
2 10uF/6V
2
32.768KHz
1
R2
GND
Q1
1
2
2
10M
220
10K
1
2
C
2
10pF
GND
100K
LCD
BP0
BP1
BP2
BP3
FP4
FP5
FP6
FP7
1
2
3
4
5
6
7
8
COM0
COM1
COM2
COM3
SEG13
SEG12
SEG11
SEG10
SEG9
SEG8
SEG7
SEG6
SEG5
SEG4
SEG0
SEG1
SEG2
SEG3
FP18
FP17
FP16
FP15
FP14
FP13
FP12
FP10
FP9
FP8
FP4
FP5
FP6
FP7
FP8
FP9
FP10
FP12
FP0/BP3
PTB6/FP1
PTB7/FP2
PTE0/FP3
PTE1/FP4
PTE2/FP5
PTE3/FP6
PTE4/FP7
PTE5/FP8
PTE6/FP9
PTE7/FP10
PTD0/FP11
PTD1/FP12
XTAL2
NC
PTA7
PTA6
PTA5
PTA4
PTA3/KBI3
PTA2/KBI2
PTA1/KBI1
PTA0/KBI0
PTC7
PTC6
PTC5/FP24
U1
52-LQFP
39
38
37
36
35
34
33
32
31
30
29
28
27
PTA6
PTA5
PTA4
S7
PTA2
PTA1
PTA0
1
1
S4
S9
2
1
S5
2
1
2
S6
2
1
2
VDD
B
S1
1
/IRQ
/RST
PTC3
FP13
FP14
FP15
FP16
FP17
FP18
VDD
S8
2
1
14
15
16
17
18
19
20
21
22
23
24
25
26
B
18
17
16
15
14
13
12
11
10
9
1
2
3
4
5
6
7
8
9
10
11
12
13
PTD2/FP13
PTD3/FP14
PTD4/FP15
PTD5/FP16
PTD6/FP17
PTD7/FP18
PTC0/FP19
PTC1/FP20
PTC2/FP21
PTC3/FP22
PTC4/FP23
/IRQ
/RST
BP3
GND
BP2
BP1
BP0
PTB3/T1CH1
PTB2/T1CH0/PPIECK
PTB1/T2CH1
PTB0/T2CH0
OSC2
OSC1
VSS
VDD
VLCD
XTAL1
52
51
50
49
48
47
46
45
44
43
42
41
40
2
BP2
BP1
BP0
R6
C4
1
1
R3
T2CH0
OSC2
OSC1
GND
VDD
VDD
XTAL1
2 MMBT4401
2
R5
1
2
10pF
X2
2 1uF/6V
1
2
3
2
1
1
D1
C2
1
2.2
1
C
4M7
2
R7
2
X1
1
4MHz
VDD
S2
2
1
S3
2
1
2
1
P1
OSC1
2
4
6
8
10
12
14
16
1
3
5
7
9
11
13
15
R4
/RST
/IRQ
PTA0
2
10K
PTA1
PTA2
PTC3
S1: SLEEP
MON08 HEADER
1
S2: SWING
S3: MODEL
1
GND
C5
A
0.1uF
2
S4: +
C6
S5: LIGHT
0.1uF
2
A
S6: ON/OFF
S7: S8: WIND
GND
S9: MODE
FREESCALE SEMICONDUCTOR HK LTD.
DESCRIPTION: MC68HC908LT8 REMOTE CONTROL REFERENCE DEMO(M68DEMOLT8RC2)
5
4
REV: 0.0
3
2
DATE: 30/09/05
SHEET 01 of 01
1
5
3
4
2
1
VDD
C1
R8
1
1
2
1
POWER ON/OFF
1
1
R1
SW1
2
2
C8
1
1
2
R7
C9
C10
0.1uF
47uF/6V
4M7
C2
1
3
0.001uF
2
1
1
18pF
2
R6
DC1
C7
C3
B1
2
GREEN
AC ON
1
GND
PTB2
1
PTB3
2
1
R2
D2
GND
2
AC OFF
2 1uF/6V
2
2
10pF
10M
X2
D1
1
2
1K
RED
10K
C
C4
2
2
1
32.768KHz
1K
2
1
0.1uF
2
D
VDD
100
1
2
18pF
1
R5
4MHz
VDD
47
3
1
2
VCC
OUT
GND
1
X1
D
2
2
1
U2
1
2
10pF
R3
BP2
BP1
BP0
PTB3
PTB2
PTB1
T2CH0
OSC2
OSC1
GND
VDD
VDD
XTAL1
C
2
1
LCD
BP0
BP1
BP2
BP3
1
2
3
4
FP4
FP5
FP6
FP7
5
6
7
8
COM0
COM1
COM2
COM3
SEG13
SEG12
SEG11
SEG10
SEG9
SEG8
SEG7
SEG6
SEG5
SEG4
SEG0
SEG1
SEG2
SEG3
FP18
FP17
FP16
FP15
FP14
FP13
FP12
FP10
FP9
FP8
FP4
FP5
FP6
FP7
FP8
FP9
FP10
FP12
FP0/BP3
PTB6/FP1
PTB7/FP2
PTE0/FP3
PTE1/FP4
PTE2/FP5
PTE3/FP6
PTE4/FP7
PTE5/FP8
PTE6/FP9
PTE7/FP10
PTD0/FP11
PTD1/FP12
XTAL2
NC
PTA7
PTA6
PTA5
PTA4
PTA3/KBI3
PTA2/KBI2
PTA1/KBI1
PTA0/KBI0
PTC7
PTC6
PTC5/FP24
U1
52-LQFP
39
38
37
36
35
34
33
32
31
30
29
28
27
PTA7
PTA6
PTA5
PTA4
PTA3
PTA2
PTA1
PTA0
PTC7
PTC6
P2
PTB1
PTA6
PTA4
PTC7
GND
S1: ON/OFF
4
1
3
P1
OSC1
VDD
1
3
5
7
9
11
13
15
2
4
6
8
10
12
14
16
2
4
6
8
10
PTA7
PTA5
PTA3
PTC6
GND
B
/IRQ
/RST
PTC3
FP13
FP14
FP15
FP16
FP17
FP18
VDD
1
3
5
7
9
VDD
14
15
16
17
18
19
20
21
22
23
24
25
26
B
18
17
16
15
14
13
12
11
10
9
1
2
3
4
5
6
7
8
9
10
11
12
13
PTD2/FP13
PTD3/FP14
PTD4/FP15
PTD5/FP16
PTD6/FP17
PTD7/FP18
PTC0/FP19
PTC1/FP20
PTC2/FP21
PTC3/FP22
PTC4/FP23
/IRQ
/RST
BP3
BP2
BP1
BP0
PTB3/T1CH1
PTB2/T1CH0/PPIECK
PTB1/T2CH1
PTB0/T2CH0
OSC2
OSC1
VSS
VDD
VLCD
XTAL1
52
51
50
49
48
47
46
45
44
43
42
41
40
GND
S1
S2: MODEL
1
4
2
3
1
S2
2
R4
GND
/RST
/IRQ
PTA0
2
10K
GND
PTA1
PTA2
PTC3
MON08 HEADER
1
1
GND
C5
A
C6
0.1uF
2
A
0.1uF
2
GND
FREESCALE SEMICONDUCTOR HK LTD.
DESCRIPTION: MC68HC908LT8 REMOTE CONTROL RECEIVER REFERENCE DEMO(M68DEMO08LT8RX)
5
4
3
REV: 0.1
2
DATE: 15/12/05
SHEET 01 of 01
1
Schematic
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
38
Freescale Semiconductor
Appendix B
Program Listing
B.1 Transmitter Listing
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
----------------------------------------------------------------------------- *
Freescale Semiconductor (H.K.) Ltd.
*
8/16 bit MCU - Application
*
*
FileName
: Main.asm
*
Title
: 08LT8 Remote Control Reference Demo code (Freescale)
*
MCU
: PC68HC908LT8CFB (44-LQFP) 1st Silicon (Mask Set 0M48C) only *
Assembler
: Metrowerks CodeWarrior HC(S)08 (v3.1)
*
Include File : 908LT8v0r0.inc (for LT8 1st silicon only)
*
Author
: T.C. Lun
*
*
DD/MM/YY
Rev.
Modified comments
*
History
: 15/12/05
0.0
Initial release
*
*
Introduction : The H/W setting are show as below:
*
PTA[2:0]
: KBI of Key Matrix, pullup if enable
*
PTA[6:4]
: o/p port of Key Scan (3x3 Matrix)
*
PTA3 & 7
: NC set o/p low
*
PTB0/T2CH0 : Tx Diode (38.46KHz 0.308% ON Duty Cycle)
*
BP0-3
: Connect to LCD Panel Pin4-1
*
FP4-10
: Connect to LCD Panel Pin5-11
*
FP12-18
: Connect to LCD Panel Pin12-18
*
FP3,11 & FP19-22 : NC o/p
*
PTB1-3
: NC set o/p low
*
RST
: 10K pullup + 0.1uF to GND
*
IRQ
: NC connect 0.1uF to GND
*
OSC1 & 2 : 4M7 + 4MHz + 18pF x2 OR (1M + 4MHz Resonator)
*
XTAL1 & 2 : 10M + 10K + 32.768KHz + 10pF x2
*
Vdd & Vss : 0.01uF // 10uF
*
Unused pin : PTB6-7 & PTC4-7 (need to set as o/p low) available in 52-LQFP *
*
Special arrangment : Add 100uF near to Vdd of Tx diode
*
: Add Mon08 interface for programming/ICD
*
*
MON08 Interface:
*
PIN# Net Name
| PIN# Net Name
*
1 NC
| 2
GND
*
3 NC
| 4
/RST
*
5 NC
| 6
/IRQ(+100 ohm)
*
7 NC
| 8
PTA0
*
9 NC
| 10 NC
*
11 NC
| 12 PTA1
*
13 OSC1(+22 ohm) | 14 PTA2
*
15 Vdd
| 16 PTC3
*
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
39
Program Listing
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
*
*
Remark : This code is only for 1st 908LT8 silicon
*
For new silicon, it need to change the PPI interrupt vector
*
and its register & handling !!!!
*
*
*
----------------------------------------------------------------------------- *
Disclaimer of All Warranties & Liabilities :
*
This Program is a freeware to demonstrate the operation of HC08 micro*
controller. In no event will Motorola be liable for any damages, or any
*
incidental or consequential damages arising out of the use of or
*
inability to use this program. User agrees that Motorola does not make
*
any warranties of any kind that the program does not or will not
*
infringe any copyright, patent, trade secret or other intellectual
*
property right of any third party in any country.
*
----------------------------------------------------------------------------- *
XDEF Entry, IRQ_ISR, main, LVI_ISR, T1M0_ISR, T2M0_ISR, T1M1_ISR,
T2M1_ISR, T1OF_ISR, T2OF_ISR, KBI_ISR, DMY_ISR
Include ’908LT8v0r0.inc’
;********************************************************************************
;* Title: 908LV8.inc
(c) Freescale Semiconductor, Inc. 2004 All rights reserved
;********************************************************************************
;* Author: T.C. Lun - Freescale TSPG
;*
;* Description: Register and bit name definitions for MC68HC908LT8
;*
;* Documentation: MC68HC908LT8/D
;*
;* Include Files: none
;*
;* Assembler: Metrowerks Code Warrior 3.0
;*
or P&E Microcomputer Systems - CASM08Z (v. 3.16)
;*
;* Revision History:
;* Rev #
Date
Who
Comments
;* ----- ----------- ------ -------------------------------------------------;* 0.0
10/14/04
TC.Lun
(Rev.0.3 Preliminary Draft is used)
;*
;********************************************************************************
;**** Memory Map and Interrupt Vectors ****************************************
;*
RamStart:
equ
$0080
;start of RAM
RamLast:
equ
$00FF
;last RAM location
RomStart:
equ
$DE00
;start of Flash
RomLast:
equ
$FFFF
;last Flash location
MonStart:
equ
$0B97
;start of monitor ROM
Vkbd:
Vtim2ov:
Vtim2ch1:
Vtim2ch0:
equ
equ
equ
equ
$FFDC
$FFEA
$FFEC
$FFEE
;keyboard vector
;timer 2 overflow
;timer 2 channel 1 vector
;timer 2 channel 0 vector
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
40
Freescale Semiconductor
Transmitter Listing
Vtimov:
Vtimch1:
Vtimch0:
Vlvi:
Virq:
Vswi:
Vreset:
equ
equ
equ
equ
equ
equ
equ
$FFF0
$FFF2
$FFF4
$FFF8
$FFFA
$FFFC
$FFFE
;timer 1 overflow vector
;timer 1 channel 1 vector
;timer 1 channel 0 vector
;LVI interrupt vector
;IRQ vector
;SWI vector
;reset vector
;**** Input/Output (I/O) Ports ************************************************
;*
PTA:
equ
$00
;port A data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTA7:
equ
7
;port A data bit 7
PTA6:
equ
6
;port A data bit 6
PTA5:
equ
5
;port A data bit 5
PTA4:
equ
4
;port A data bit 4
PTA3:
equ
3
;port A data bit 3
PTA2:
equ
2
;port A data bit 2
PTA1:
equ
1
;port A data bit 1
PTA0:
equ
0
;port A data bit 0
; bit position masks
mPTA7:
equ
%10000000
;port A data bit 7
mPTA6:
equ
%01000000
;port A data bit 6
mPTA5:
equ
%00100000
;port A data bit 5
mPTA4:
equ
%00010000
;port A data bit 4
mPTA3:
equ
%00001000
;port A data bit 3
mPTA2:
equ
%00000100
;port A data bit 2
mPTA1:
equ
%00000010
;port A data bit 1
mPTA0:
equ
%00000001
;port A data bit 0
PTB:
equ
$01
;port B data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTB7:
equ
7
;port B data bit 7
PTB6:
equ
6
;port B data bit 6
PTB3:
equ
3
;port B data bit 3
PTB2:
equ
2
;port B data bit 2
PTB1:
equ
1
;port B data bit 1
PTB0:
equ
0
;port B data bit 0
; bit position masks
mPTB7:
equ
%10000000
;port B data bit 7
mPTB6:
equ
%01000000
;port B data bit 6
mPTB3:
equ
%00001000
;port B data bit 3
mPTB2:
equ
%00000100
;port B data bit 2
mPTB1:
equ
%00000010
;port B data bit 1
mPTB0:
equ
%00000001
;port B data bit 0
PTC:
equ
; bit numbers for
PTC7:
equ
PTC6:
equ
PTC5:
equ
PTC4:
equ
PTC3:
equ
PTC2:
equ
$02
;port C data register
use in BLCR, BSET, BRCLR, and BRSET
7
;port C data bit 7
6
;port C data bit 6
5
;port C data bit 5
4
;port C data bit 4
3
;port C data bit 3
2
;port C data bit 2
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
41
Program Listing
PTC1:
equ
1
PTC0:
equ
0
; bit position masks
mPTC7:
equ
%10000000
mPTC6:
equ
%01000000
mPTC5:
equ
%00100000
mPTC4:
equ
%00010000
mPTC3:
equ
%00001000
mPTC2:
equ
%00000100
mPTC1:
equ
%00000010
mPTC0:
equ
%00000001
;port C data bit 1
;port C data bit 0
;port
;port
;port
;port
;port
;port
;port
;port
C
C
C
C
C
C
C
C
data
data
data
data
data
data
data
data
bit
bit
bit
bit
bit
bit
bit
bit
7
6
5
4
3
2
1
0
PTD:
equ
$03
;port D data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTD7:
equ
7
;port D data bit 7
PTD6:
equ
6
;port D data bit 6
PTD5:
equ
5
;port D data bit 5
PTD4:
equ
4
;port D data bit 4
PTD3:
equ
3
;port D data bit 3
PTD2:
equ
2
;port D data bit 2
PTD1:
equ
1
;port D data bit 1
PTD0:
equ
0
;port D data bit 0
; bit position masks
mPTD7:
equ
%10000000
;port D data bit 7
mPTD6:
equ
%01000000
;port D data bit 6
mPTD5:
equ
%00100000
;port D data bit 5
mPTD4:
equ
%00010000
;port D data bit 4
mPTD3:
equ
%00001000
;port D data bit 3
mPTD2:
equ
%00000100
;port D data bit 2
mPTD1:
equ
%00000010
;port D data bit 1
mPTD0:
equ
%00000001
;port D data bit 0
DDRA:
equ
$04
;port A data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRA7:
equ
7
;port A data direction bit 7
DDRA6:
equ
6
;port A data direction bit 6
DDRA5:
equ
5
;port A data direction bit 5
DDRA4:
equ
4
;port A data direction bit 4
DDRA3:
equ
3
;port A data direction bit 3
DDRA2:
equ
2
;port A data direction bit 2
DDRA1:
equ
1
;port A data direction bit 1
DDRA0:
equ
0
;port A data direction bit 0
; bit position masks
mDDRA7:
equ
%10000000
;port A data direction bit 7
mDDRA6:
equ
%01000000
;port A data direction bit 6
mDDRA5:
equ
%00100000
;port A data direction bit 5
mDDRA4:
equ
%00010000
;port A data direction bit 4
mDDRA3:
equ
%00001000
;port A data direction bit 3
mDDRA2:
equ
%00000100
;port A data direction bit 2
mDDRA1:
equ
%00000010
;port A data direction bit 1
mDDRA0:
equ
%00000001
;port A data direction bit 0
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
42
Freescale Semiconductor
Transmitter Listing
DDRB:
equ
$05
;port B data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRB7:
equ
7
;port B data direction bit 7
DDRB6:
equ
6
;port B data direction bit 6
DDRB3:
equ
3
;port B data direction bit 3
DDRB2:
equ
2
;port B data direction bit 2
DDRB1:
equ
1
;port B data direction bit 1
DDRB0:
equ
0
;port B data direction bit 0
; bit position masks
mDDRB7:
equ
%10000000
;port B data direction bit 7
mDDRB6:
equ
%01000000
;port B data direction bit 6
mDDRB3:
equ
%00001000
;port B data direction bit 3
mDDRB2:
equ
%00000100
;port B data direction bit 2
mDDRB1:
equ
%00000010
;port B data direction bit 1
mDDRB0:
equ
%00000001
;port B data direction bit 0
DDRC:
equ
$06
;port C data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRC7:
equ
7
;port C data direction bit 7
DDRC6:
equ
6
;port C data direction bit 6
DDRC5:
equ
5
;port C data direction bit 5
DDRC4:
equ
4
;port C data direction bit 4
DDRC3:
equ
3
;port C data direction bit 3
DDRC2:
equ
2
;port C data direction bit 2
DDRC1:
equ
1
;port C data direction bit 1
DDRC0:
equ
0
;port C data direction bit 0
; bit position masks
mDDRC7:
equ
%10000000
;port C data direction bit 7
mDDRC6:
equ
%01000000
;port C data direction bit 6
mDDRC5:
equ
%00100000
;port C data direction bit 5
mDDRC4:
equ
%00010000
;port C data direction bit 4
mDDRC3:
equ
%00001000
;port C data direction bit 3
mDDRC2:
equ
%00000100
;port C data direction bit 2
mDDRC1:
equ
%00000010
;port C data direction bit 1
mDDRC0:
equ
%00000001
;port C data direction bit 0
DDRD:
equ
$07
;port D data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRD7:
equ
7
;port D data direction bit 7
DDRD6:
equ
6
;port D data direction bit 6
DDRD5:
equ
5
;port D data direction bit 5
DDRD4:
equ
4
;port D data direction bit 4
DDRD3:
equ
3
;port D data direction bit 3
DDRD2:
equ
2
;port D data direction bit 2
DDRD1:
equ
1
;port D data direction bit 1
DDRD0:
equ
0
;port D data direction bit 0
; bit position masks
mDDRD7:
equ
%10000000
;port D data direction bit 7
mDDRD6:
equ
%01000000
;port D data direction bit 6
mDDRD5:
equ
%00100000
;port D data direction bit 5
mDDRD4:
equ
%00010000
;port D data direction bit 4
mDDRD3:
equ
%00001000
;port D data direction bit 3
mDDRD2:
equ
%00000100
;port D data direction bit 2
mDDRD1:
equ
%00000010
;port D data direction bit 1
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
43
Program Listing
mDDRD0:
equ
%00000001
;port D data direction bit 0
DDRE:
equ
$08
;port E data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRE7:
equ
7
;port E data direction bit 7
DDRE6:
equ
6
;port E data direction bit 6
DDRE5:
equ
5
;port E data direction bit 5
DDRE4:
equ
4
;port E data direction bit 4
DDRE3:
equ
3
;port E data direction bit 3
DDRE2:
equ
2
;port E data direction bit 2
DDRE1:
equ
1
;port E data direction bit 1
DDRE0:
equ
0
;port E data direction bit 0
; bit position masks
mDDRE7:
equ
%10000000
;port E data direction bit 7
mDDRE6:
equ
%01000000
;port E data direction bit 6
mDDRE5:
equ
%00100000
;port E data direction bit 5
mDDRE4:
equ
%00010000
;port E data direction bit 4
mDDRE3:
equ
%00001000
;port E data direction bit 3
mDDRE2:
equ
%00000100
;port E data direction bit 2
mDDRE1:
equ
%00000010
;port E data direction bit 1
mDDRE0:
equ
%00000001
;port E data direction bit 0
PTE:
equ
$09
;port E data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTE7:
equ
7
;port E data bit 7
PTE6:
equ
6
;port E data bit 6
PTE5:
equ
5
;port E data bit 5
PTE4:
equ
4
;port E data bit 4
PTE3:
equ
3
;port E data bit 3
PTE2:
equ
2
;port E data bit 2
PTE1:
equ
1
;port E data bit 1
PTE0:
equ
0
;port E data bit 0
; bit position masks
mPTE7:
equ
%10000000
;port E data bit 7
mPTE6:
equ
%01000000
;port E data bit 6
mPTE5:
equ
%00100000
;port E data bit 5
mPTE4:
equ
%00010000
;port E data bit 4
mPTE3:
equ
%00001000
;port E data bit 3
mPTE2:
equ
%00000100
;port E data bit 2
mPTE1:
equ
%00000010
;port E data bit 1
mPTE0:
equ
%00000001
;port E data bit 0
HDB:
equ
$0C
;port B high current drive control
;register
; bit number for use in BCLR, BSET, BRCLR, BRSET
PPI1L:
equ
6
;PPI1 interrupt request level
HDB3:
equ
3
;port B3 high current drive enable
HDB2:
equ
2
;port B2 high current drive enable
PPI1CLKS1: equ
1
;PPI1 clock select 1
PPI1CLKS0: equ
0
;PPI1 clock select 0
mPPI1L:
mHDB3:
mHDB2:
equ
equ
equ
%01000000
%00001000
%00000100
;PPI1 interrupt request level
;port B3 high current drive enable
;port B2 high current drive enable
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
44
Freescale Semiconductor
Transmitter Listing
mPPI1CLKS1: equ
mPPI1CLKS0: equ
%00000010
%00000001
;PPI1 clock select 1
;PPI1 clock select 0
;**** Keyboard Interrupt Module (KBI) *****************************************
;*
KBSCR:
equ
$1B
;keyboard status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
KEYF:
equ
3
;keyboard flag
ACKK:
equ
2
;keyboard acknowledge
IMASKK:
equ
1
;keyboard interrupt mask
MODEK:
equ
0
;keyboard triggering sesitivity
; bit position masks
mKEYF:
equ
%00001000
;keyboard flag
mACKK:
equ
%00000100
;keyboard acknowledge
mIMASKK:
equ
%00000010
;keyboard interrupt mask
mMODEK:
equ
%00000001
;keyboard triggering sesitivity
KBIER:
equ
$1C
;keyboard interrupt enable
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
PPI1IE2:
equ
6
;PPI1 interrupt enable and
;select bit 2
PPI1IE1:
equ
5
;PPI1 interrupt enable and
;select bit 1
PPI1IE0:
equ
4
;PPI1 interrupt enable and
;select bit 0
KBIE3:
equ
3
;port A keyboard interrupt
KBIE2:
equ
2
;port A keyboard interrupt
KBIE1:
equ
1
;port A keyboard interrupt
KBIE0:
equ
0
;port A keyboard interrupt
; bit position masks
mPPI1IE2:
equ
%01000000
;PPI1 interrupt enable and
;select bit 2
mPPI1IE1:
equ
%00100000
;PPI1 interrupt enable and
;select bit 1
mPPI1IE0:
equ
%00010000
;PPI1 interrupt enable and
;select bit 0
mKBIE3:
equ
%00001000
;port A keyboard interrupt
mKBIE2:
equ
%00000100
;port A keyboard interrupt
mKBIE1:
equ
%00000010
;port A keyboard interrupt
mKBIE0:
equ
%00000001
;port A keyboard interrupt
register
frequency
frequency
frequency
enable
enable
enable
enable
bit
bit
bit
bit
3
2
1
0
frequency
frequency
frequency
enable
enable
enable
enable
bit
bit
bit
bit
3
2
1
0
;**** Configuration Registers 2 (CONFIG2) ***************************************
;*
CONFIG2:
equ
$1D
;configuration register 2
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
STOP_XCLKEN: equ
7
;stop osc1 & osc2 crystal clock enable
STOP_XTALEN: equ
6
;stop xtal1 & xtal2 crystal clock enable
PEE:
equ
5
;port E LCD or GPIO select
PDE:
equ
4
;port D LCD or GPIO select
PCEH:
equ
3
;port C higher nibble lcd or GPIO select
PCEL:
equ
2
;port C lower nibble lcd or GPIO select
LVISEL1:
equ
1
;LVI level select bit 1
LVISEL0:
equ
0
;LVI level select bit 0
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
45
Program Listing
; bit position masks
mSTOP_XCLKEN: equ
%10000000
mSTOP_XTALEN: equ
%01000000
mPEE:
equ
%00100000
mPDE:
equ
%00010000
mPCEH:
equ
%00001000
mPCEL:
equ
%00000100
mLVISEL1:
equ
%00000010
mLVISEL0:
equ
%00000001
;stop osc1 & osc2 crystal clock enable
;stop xtal1 & xtal2 crystal clock enable
;port E LCD or GPIO select
;port D LCD or GPIO select
;port C higher nibble lcd or GPIO select
;port C lower nibble lcd or GPIO select
;LVI level select bit 1
;LVI level select bit 0
;**** External Interrupt (IRQ) ************************************************
;*
INTSCR:
equ
$1E
;IRQ status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
IRQF:
equ
3
;IRQ flag
ACK:
equ
2
;IRQ interrupt request acknowledge
IMASK:
equ
1
;IRQ interrupt mask
MODE:
equ
0
;IRQ edge/level select
; bit position masks
mIRQF:
equ
%00001000
;IRQ flag
mACK:
equ
%00000100
;IRQ interrupt request acknowledge
mIMASK:
equ
%00000010
;IRQ interrupt mask
mMODE:
equ
%00000001
;IRQ edge/level select
;**** Configuration Register 1 (CONFIG1) ****************************************
;*
CONFIG1:
equ
$1F
;configuration register 1
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
COPRS:
equ
7
;COP reset period selection
LVISTOP:
equ
6
;LVI enable in stop mode
LVIRSTD:
equ
5
;LVI reset disable
LVIPWRD:
equ
4
;LVI power disable
SSREC:
equ
2
;short stop recovery
STOP:
equ
1
;STOP instruction enable
COPD:
equ
0
;COP disable
; bit position masks
mCOPRS:
equ
%10000000
;COP reset period selection
mLVISTOP:
equ
%01000000
;LVI enable in stop mode
mLVIRSTD:
equ
%00100000
;LVI reset disable
mLVIPWRD:
equ
%00010000
;LVI power disable
mSSREC:
equ
%00000100
;short stop recovery
mSTOP:
equ
%00000010
;STOP instruction enable
mCOPD:
equ
%00000001
;COP disable
;**** Timer Interface module 1 (TIM1) *****************************************
;*
T1SC:
equ
$20
;timer 1 status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
TOF:
equ
7
;TIM overflow flag
TOIE:
equ
6
;TIM overflow interrupt enable
TSTOP:
equ
5
;TIM stop bit
TRST:
equ
4
;TIM reset bit
PS2:
equ
2
;prescaler select bit 2
PS1:
equ
1
;prescaler select bit 1
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
46
Freescale Semiconductor
Transmitter Listing
PS0:
equ
0
; bit position masks
mTOF:
equ
%10000000
mTOIE:
equ
%01000000
mTSTOP:
equ
%00100000
mTRST:
equ
%00010000
mPS2:
equ
%00000100
mPS1:
equ
%00000010
mPS0:
equ
%00000001
T1SC0:
equ
$25
T1SC1:
equ
$28
T1CNTH:
T1CNTL:
T1MODH:
T1MODL:
equ
equ
equ
equ
$21
$22
$23
$24
;prescaler select bit 0
;TIM overflow flag
;TIM overflow interrupt enable
;TIM stop bit
;TIM reset bit
;prescaler select bit 2
;prescaler select bit 1
;prescaler select bit 0
;timer 1 channel 0 status and control
;register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
CH0F:
equ
7
;channel 0 flag
CH0IE:
equ
6
;channel 0 interrupt enable
MS0B:
equ
5
;mode select bit B
MS0A:
equ
4
;mode select bit A
ELS0B:
equ
3
;edge/level select bit B
ELS0A:
equ
2
;edge/level select bit A
TOV0
equ
1
;toggle on overflow
CH0MAX
equ
0
;channel 0 maximum duty cycle
; bit position masks
mCH0F:
equ
%10000000
;channel 0 flag
mCH0IE:
equ
%01000000
;channel 0 interrupt enable
mMS0B:
equ
%00100000
;mode select bit B
mMS0A:
equ
%00010000
;mode select bit A
mELS0B:
equ
%00001000
;edge/level select bit B
mELS0A:
equ
%00000100
;edge/level select bit A
mTOV0
equ
%00000010
;toggle on overflow
mCH0MAX
equ
%00000001
;channel 0 maximum duty cycle
;timer 1 channel 1 status and control
;register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
CH1F:
equ
7
;channel 1 flag
CH1IE:
equ
6
;channel 1 interrupt enable
MS1A:
equ
4
;mode select bit A
ELS1B:
equ
3
;edge/level select bit B
ELS1A:
equ
2
;edge/level select bit A
TOV1
equ
1
;toggle on overflow
CH1MAX
equ
0
;channel 1 maximum duty cycle
; bit position masks
mCH1F:
equ
%10000000
;channel 1 flag
mCH1IE:
equ
%01000000
;channel 1 interrupt enable
mMS1A:
equ
%00010000
;mode select bit A
mELS1B:
equ
%00001000
;edge/level select bit B
mELS1A:
equ
%00000100
;edge/level select bit A
mTOV1
equ
%00000010
;toggle on overflow
mCH1MAX
equ
%00000001
;channel 1 maximum duty cycle
;timer
;timer
;timer
;timer
1
1
1
1
counter
counter
counter
counter
register high
register Low
modulo register high
modulo register low
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
47
Program Listing
T1CH0H:
T1CH0L:
T1CH1H:
T1CH1L:
equ
equ
equ
equ
$26
$27
$29
$2A
;timer
;timer
;timer
;timer
1
1
1
1
channel
channel
channel
channel
0
0
1
1
register
register
register
register
high
low
high
low
;**** Timer Interface module 2 (TIM2) *****************************************
;*
T2SC:
equ
$2B
;timer 2 status and control register
T2CNTH:
equ
$2C
;timer 2 counter register high
T2CNTL:
equ
$2D
;timer 2 counter register low
T2MODH:
equ
$2E
;timer 2 counter modulo register high
T2MODL:
equ
$2F
;timer 2 counter modulo register low
T2SC0:
equ
$30
;timer 2 channel 0 status and control
;register
T2CH0H:
equ
$31
;timer 2 channel 0 register high
T2CH0L:
equ
$32
;timer 2 channel 0 register low
T2SC1:
equ
$33
;timer 2 channel 1 status and control
;register
T2CH1H:
equ
$34
;timer 2 channel 1 register high
T2CH1L:
equ
$35
;timer 2 channel 1 register low
;**** LCD Driver **************************************************************
;*
LCDCLK:
equ
$4F
;LCD clock register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
FCCTL1:
equ
6
;fast charge duty cycle select 1
FCCTL0:
equ
5
;fast charge duty cycle select 0
DUTY1:
equ
4
;duty cycle select 1
DUTY0:
equ
3
;duty cycle select 0
LCLK2:
equ
2
;LCD clock select bit 2
LCLK1:
equ
1
;LCD clock select bit 1
LCLK0:
equ
0
;LCD clock select bit 0
; bit position masks
mFCCTL1:
equ
%01000000
;fast charge duty cycle select 1
mFCCTL0:
equ
%00100000
;fast charge duty cycle select 0
mDUTY1:
equ
%00010000
;duty cycle select 1
mDUTY0:
equ
%00001000
;duty cycle select 0
mLCLK2:
equ
%00000100
;LCD clock select bit 2
mLCLK1:
equ
%00000010
;LCD clock select bit 1
mLCLK0:
equ
%00000001
;LCD clock select bit 0
LCDCR:
equ
$51
;LCD control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
LCDE:
equ
7
;LCD enable
FC:
equ
5
;fast charge
LC:
equ
4
;Low current
LCCON3:
equ
3
;LCD contrast control bit3
LCCON2:
equ
2
;LCD contrast control bit2
LCCON1:
equ
1
;LCD contrast control bit1
LCCON0:
equ
0
;LCD contrast control bit0
; bit position masks
mLCDE:
equ
%10000000
;LCD enable
mFC:
equ
%00100000
;fast charge
mLC:
equ
%00010000
;Low current
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
48
Freescale Semiconductor
Transmitter Listing
mLCCON3:
mLCCON2:
mLCCON1:
mLCCON0:
equ
equ
equ
equ
%00001000
%00000100
%00000010
%00000001
;LCD
;LCD
;LCD
;LCD
contrast
contrast
contrast
contrast
LDAT1:
LDAT2:
LDAT3:
LDAT4:
LDAT5:
LDAT6:
LDAT7:
LDAT8:
LDAT9:
LDAT10:
LDAT11:
LDAT12:
LDAT13:
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
$52
$53
$54
$55
$56
$57
$58
$59
$5A
$5B
$5C
$5D
$5E
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
display
display
display
display
display
display
display
display
display
display
display
display
display
control
control
control
control
data
data
data
data
data
data
data
data
data
data
data
data
data
bit3
bit2
bit1
bit0
register
register
register
register
register
register
register
register
register
register
register
register
register
1
2
3
4
5
6
7
8
9
10
11
12
13
;**** System Integration Module (SIM) *****************************************
;*
SBSR:
equ
$FE00
;SIM break status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
SBSW
equ
1
;SIM break stop/wait
; bit position masks
mSBSW:
equ
%00000010
;SIM break stop/wait
SRSR:
equ
$FE01
;SIM reset status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
POR:
equ
7
;power-on reset
PIN:
equ
6
;external reset
COP:
equ
5
;COP reset
ILOP:
equ
4
;illegal opcode reset
ILAD:
equ
3
;illegal address reset
MODRST:
equ
2
;monitor mode entry module reset
LVI:
equ
1
;LVI reset
; bit position masks
mPOR:
equ
%10000000
;power-on reset
mPIN:
equ
%01000000
;external reset
mCOP:
equ
%00100000
;COP reset
mILOP:
equ
%00010000
;illegal opcode reset
mILAD:
equ
%00001000
;illegal address reset
mMODRST:
equ
%00000100
;monitor mode entry module reset
mLVI:
equ
%00000010
;LVI reset
SBFCR:
equ
$FE03
;SIM break flag control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
BCFE:
equ
7
;break clear flag enable
; bit position masks
mBCFE:
equ
%10000000
;break clear flag enable
INT1:
equ
$FE04
;interrupt status register 1
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
IF6:
equ
7
;interrupt flag 6
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
49
Program Listing
IF5:
IF4:
IF3:
IF2:
IF1:
equ
equ
equ
equ
equ
6
5
4
3
2
;interrupt
;interrupt
;interrupt
;interrupt
;interrupt
flag
flag
flag
flag
flag
5
4
3
2
1
INT2:
equ
; bit numbers for
IF9:
equ
IF8:
equ
IF7:
equ
$FE05
;interrupt status register 2
use in BCLR, BSET, BRCLR, and BRSET
2
;interrupt flag 9
1
;interrupt flag 8
0
;interrupt flag 7
INT3:
equ
; bit numbers for
IF17:
equ
IF16:
equ
$FE06
;interrupt status register 3
use in BCLR, BSET, BRCLR, and BRSET
2
;interrupt flag 17
1
;interrupt flag 16
;**** Flash Memory ************************************************************
;*
FLCR:
equ
$FE08
;flash control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
HVEN:
equ
3
;high-voltage enable bit mask
MASS:
equ
2
;mass erase control bit mask
ERASE:
equ
1
;erase control bit mask
PGM:
equ
0
;program control bit mask
; bit position masks
mHVEN:
equ
%00001000
;high-voltage enable bit mask
mMASS:
equ
%00000100
;mass erase control bit mask
mERASE:
equ
%00000010
;erase control bit mask
mPGM:
equ
%00000001
;program control bit mask
FLBPR:
equ
$FF7E
;flash block protect register
;**** Break Module (BRK) ******************************************************
;*
BRKSCR:
equ
$FE0E
;break status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
BRKE:
equ
7
;break enable
BRKA:
equ
6
;break active
; bit position masks
mBRKE:
equ
%10000000
;break enable
mBRKA:
equ
%01000000
;break active
BRKH:
BRKL:
equ
equ
$FE0C
$FE0D
;break address register high
;break address register low
;**** Low-Voltage Inhibit (LVI) ***********************************************
;*
LVISR:
equ
$FE0F
;LVI status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
LVIOUT:
equ
7
;LVI output
LVIIE:
equ
6
;LVI interrupt enable bit
LVIIF:
equ
5
;LVI interrupt flag
LVIIAK:
equ
4
;LVI interrupt request acknowledge bit
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
50
Freescale Semiconductor
Transmitter Listing
; bit position masks
mLVIOUT:
equ
%10000000
;LVI
mLVIIE:
equ
%01000000
;LVI
mLVIIF:
equ
%00100000
;LVI
mLVIIAK:
equ
%00010000
;LVI
;**** Computer Operating Properly
;*
COPCTL:
equ
$FFFF
;COP
output
interrupt enable bit
interrupt flag
interrupt request acknowledge bit
(COP) ***************************************
control register
;********************************************************************************
; Registers definition
;********************************************************************************
; PART I: MCU Related values and regsisters
; ----------------------------------------------------------------------------- *
CONFIG1_Init
equ %10110011
; Config 1 initial
;
||||||||
;
|||||||+-- COP=disable(1)
;
||||||+--- Stop=enable(1)
;
|||||+---- Recovery time=long(0)
;
||||+----- NIL=(0)
;
|||+------ LVI power=on(0)
;
||+------- LVI reset=disable(1)
;
|+-------- LVI in stop=disable(0)
;
+--------- COP=long(0)
;
CONFIG2_Init
equ %01111101
; Config 2 initial
;
||||||||
;
|||||||+-- LVI trip point[0] [1:0]= 1:0 = 5.0V
;
||||||+--- LVI trip point[1] [1:0]= 0:1 = 3.0V
;
|||||+---- PTC0-3 = LCD(1)
;
||||+----- PTC4-7 = LCD(1)
;
|||+------ PTD = LCD(1) Need set PTD=$FF (1st 908LT8)
;
||+------- PTE = LCD(1) Need set PTE=$FF (1st 908LT8)
;
|+-------- XTAL enable in stop(1)
;
+--------- OSC enable in stop(1)
;
LVISR_Init
equ %01010000
; LVISR initial
;
||||||||
;
||||++++-- NIL=0 (bit 3-0)
;
|||+------ LVI interrupt acknowledge (1=clear LVI int flag)
;
||+------- LVI interrupt flag (1=pending)
;
|+-------- LVI interrupt enable (1=enable)
;
+--------- LVI o/p flag(=1 if Vdd fall below LVI trip pt)
;
INTSCR_Init
equ %00000110
; INTSCR initial
;
||||||||
;
|||||||+-- IRQ Edge/Level (1=falling/low level, 0=falling)
;
||||||+--- IRQ interrupt mask (1=IRQ interrupt mask)
;
|||||+---- IRQ interrupt acknowledge (1=clear IRQ int flag)
;
||||+----- IRQ interrupt flag (1=pending)
;
++++------ NIL=0 (bit 7-4)
;
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
51
Program Listing
HDB_Init
equ %00000010
; HDB initial
;
||||||||
;
|||||||+-- PPI clock[0] [1:0]= 10 = 32.768KHz Xtal
;
||||||+--- PPI clock[1] [1:0]= 01 = external PPIECLK pin
;
|||||+---- HDB2 (1= PTB2 is high current)
;
||||+----- HDB3 (1= PTB3 is high current)
;
||++------ b4: NIL=0 (bit 4)
;
|+-------- PPI1 interrupt flag (1=pending)
;
+--------- NIL=0 (bit 7)
;
*Remark: PPIECLK mux with PTB2 & T1CH0 !!!!
;
KBSCR_Init
equ %00000100
; KBSCR initial
;
||||||||
;
|||||||+-- KBI Edge/Level (1=falling/low level, 0=falling)
;
||||||+--- KBI/PPI interrupt mask (1=KBI/PPI int mask)
;
|||||+---- KBI/PPI interrupt ack(1=clear KBI/PPI int flag)
;
||||+----- KBI interrupt flag (1=pending)
;
++++------ NIL=0 (bit 7-4)
; * Remark: For KBI int, needs to check KBI interrupt flag in KBSCR !!!
; * Remark: For PPI int, needs to check PPI1 interrupt flag in HDB
;
KBIER_Init
equ %00000111
; KBIER initial (KBI Enable)
;
||||||||
;
|||||||+-- KBIE0 (1= PTA0 KBI interrupt enable)
;
||||||+--- KBIE1 (1= PTA1 KBI interrupt enable)
;
|||||+---- KBIE2 (1= PTA2 KBI interrupt enable)
;
||||+----- KBIE3 (1= PTA3 KBI interrupt enable)
;
|||+------ PPI1E[0] (000)=PPI disable, (001)= 512 count
;
||+------- PPI1E[1] (010)=1024, (011)= 2048, (100)= 4096
;
|+-------- PPI1E[2] (101)=8192, (110)= 16834, (111)= 32768
;
+--------- NIL=0 (bit 7)
; * Remark: When KBIEx = 1, internal pullup enable and PTAx force to i/p
;
LCDCR_Init
equ %10010000
; LCDCR initial (LCD Enable)
;
||||||||
;
|||||||+-- LCCON0 (LCCON3:0 is bias vol control)
;
||||||+--- LCCON1
;
|||||+---- LCCON2
;
||||+----- LCCON3
;
|||+------ LC (LC =1 low current, FC =1 fast charge)
;
||+------- FC (FC:LC) x:0=37K, 0:1=146K, 1:1=Fast Charge
;
|+-------- NIL=0 (bit 6)
;
+--------- LCDE (1= LCD enable)
;
LCDCLK_Init
equ %00010001
; LCDCLK initial
;
||||||||
;
|||||||+-- LCLK0 000=256Hz, 001=128Hz, 010=64Hz, 011=32Hz
;
||||||+--- LCLK1 Frame rate = LCDCLK * Duty cycle
;
|||||+---- LCLK2 with LCDCLK=256Hz => 256*(1/4)=64Hz
;
||||+----- DUTY[0] 00=Static, 01=1/3 duty cycle
;
|||+------ DUTY[1] 10=1/4 duty cycle, 11=Not used
;
||+------- FCCTL[0] 00=LCDCLK/32, 01=/64, 10=/128 w/LC=0
;
|+-------- FCCTL[1] (Fast charge duty cycle)
;
+--------- NIL=0 (bit 7)
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
52
Freescale Semiconductor
Transmitter Listing
;
;
;
;
;
----------------------------------------------------------------------------- *
Define by 4MHz XTAL (1MHz bus) = 1uS bus clock
----------------------------------------------------------------------------- *
Timer 1 Related Constant: 125mS timer overflow interrupt (Replace PPI)
PwmPeriodH1
PwmPeriodL1
;
;
;
;
equ $3D
equ $09
; TOF period = 125mS = 125000uS/8 =15625uS=$3D09
; Timer 1 active after MCU wakeup from KBI & stop
----------------------------------------------------------------------------- *
Timer 2 Related Constant: 8uS duty cycle, 26uS Carrier freq
to provide 38.64Khz carrier with 30.8% duty cycle(ON Tx diode) Logic1=ON state
1MHz = 1uS => PWM period = 26uS = $19, Duty = 8uS = $07 (1uS for compensation)
PwmPeriodH2
equ $00
; Define PWM period = 26uS = $1A-1 = $19
PwmPeriodL2
equ $19
; (i.e. PWM freq = 38.64KHz carrier)
DutyCycleH2
equ $00
; Define 1/3 duty cycle = 8uS = $08-1 = $07
DutyCycleL2
equ $07
; (i.e. 30.8% duty ON cycle)
; ----------------------------------------------------------------------------- *
; PART II: System Related values and variables
; ----------------------------------------------------------------------------- *
Auto_Mode_Init
equ %10100000 ;25oC, Sleep_off, swing_off, auto_wind
Heat_Mode_Init
equ %11010000 ;28oC, Sleep_off, swing_off, auto_wind
Tx_Flag_Init
equ %00100011 ;TX_READY=0, TX_CNT=35 (Count down)
Data10_Init
Data32_Init
Data54_Init
CtmCode_Init
equ
equ
equ
equ
%00000010
%10100000
%00001000
%10101001
;AC_OFF, Auto_mode, oC, Light ON, Model
;25oC, Sleep_off, Swing_off, auto_wind
;Model Set to Model 0 (b0 always equal to 0)
;0.63ms low + 0100101 customer code (Tx LSB first)
;(Value for Tx frame delay call for 0.5mS delay) for FSL
Head_Time_ON
equ $10
; Carrier on time for heading (8mS) 16*0.5ms
Head_Time_OFF
equ $08
; Carrier off time for heading (4mS) 8*0.5ms
; 0us for compensation of time delay by the instruction delay
Data0_Time_ON
equ $32
; Carrier on time for data 0 (500uS) 50*10us
Data0_Time_OFF
equ $32
; Carrier off time for data 0 (500uS) 50*10us
Data1_Time_ON
equ $32
; Carrier on time for data 1 (500uS) 50*10us
Data1_Time_OFF
equ $96
; Carrier off time for data 1 (1500uS) 150*10us
; ----------------------------------------------------------------------------- *
; Key_Flag bit definition
KEY_ON
equ 7
;=1 if KBI occur, =0 if key released
KEY_WRONG
equ 6
;=1 if Key Wrong, =0 if Key O.K.
KEY_FIRST_ON
equ 5
;=1 if first timer setting ON key pressed
KEY_CONFIRM
equ 4
;=1 if Model # confirm key pressed
LCD_READY
equ 3
;=1 go to LCD routine
KEY_REP
equ 2
;=1 if Key Repeat within 250mS
TIM_FLASH
equ 1
;=1 if toggle in 250mS T1OF
S34_KEY_ON
equ 0
;=1 if S3 or S4 pressed
; Tx_Flag bit definition
TX_READY
equ 7
;=1 if Tx ready, =0 if Tx not ready
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
53
Program Listing
; ----------------------------------------------------------------------------- *
T_Flash_Init
equ $30
; Timer_Flash_Cnt initial 125mS*48=6s(48=$30)
S34_Cnt_Init
equ $18
; S3 & S4 cnt initial 125mS*24=3s(24=$18)
Key_Sleep_Max
equ $50
; Key_Sleep_Cnt initial 125mS*80=10s(80=$50)
; ----------------------------------------------------------------------------- *
DEFAULT_RAM
SECTION SHORT
;
org
Key_Flag
Key_Value
RamStart
ds 1
ds 1
1
;
;
;
;
;
;
;
;
$0080 ($80-$8F)
KEY_ON flag (1=key interrupt occur)
Store Key value(ON/OFF, +, -, ...etc)
S1=%11101110,S2=%11101101
Store Key SLEEP_CNT value
Timer setting flash counter(6sec decremental Timer)
125mS * 48 = 6sec (48= $30)
Sleep key flash counter (1s if sleep key press)
Key_Sleep_Cnt
Timer_Flash_Cnt
ds
ds
1
1
Sleep_Flash_Cnt
ds
Auto_Mode
Cool_Mode
Humd_Mode
Wind_Mode
Heat_Mode
ds
ds
ds
ds
ds
1
1
1
1
1
;
;
;
;
;
Store
Store
Store
Store
Store
Tx_Data_Temp
T_Pointer
ds
ds
1
1
; Temp store Tx_Data value
; Index for MODEL# lookup table ($00 - $09)
Tx_Flag
ds
1
; TX_READY Flag (1=ready) &
; TX_CNT (35-bit of data) =%00100011=35
S34_Key_Cnt
Tx_Data54_Tmp
T_Pointer_Tmp
ds
ds
ds
1
1
1
; S3 & S4 key pressed counter
; Temp store Tx_Data54
; Temp store T_Pointer
wind
wind
wind
wind
wind
speed
speed
speed
speed
speed
+
+
+
+
+
Temperature
Temperature
Temperature
Temperature
Temperature
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%11000000
; ------------------------------------------------------------------- *
;
org
$0090
; $90-$9F
Tx_Data10
Tx_Data32
Tx_Data54
Tx_CtmCode
ds
ds
ds
ds
1
1
1
1
;
;
;
;
Nibble
Nibble
Nibble
Nibble
1-0
3-2
5-4
9-8
(first 4-bit will be shift out)=%0000xxxx
=%10010000
=%00000001
(last bit will be shift out)=%x0100101
PPI_Cnt
ds
1
; PPI counter for LCD flash when sleep key pressed
;********************************************************************************
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
54
Freescale Semiconductor
Transmitter Listing
DEFAULT_ROM
SECTION
; ----------------------------------------------------------------------------- *
; Program Area
*
; ----------------------------------------------------------------------------- *
;
org
RomStart ; $DE00
; ----------------------------------------------------------------------------- *
; Subroutine Initialization : Configure register, Port, KBI & Timer
*
; In
: <nil>
*
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
;*******************************************************************************
; Entry Point
;*******************************************************************************
Entry:
main:
rsp
; initialize the stack pointer
SEI
; mask all interrupt
sta $FFFF
; Clear COP counter
; ----------------------------------------------------------------------------- *
; Port Initial
; ----------------------------------------------------------------------------- *
mov #%00000111,PTA ; Avoid false KBI by write PTA0-2 as o/p high
mov #%11111111,DDRA ; Set all port to output low except PTA0-2
; Set PTA4-6 o/p low, KBI will occur if any key
; pressed after KBI interrupt enable
clr
clr
clr
clr
PTB
PTC
PTD
PTE
; Set all port to output low
lda #$FF
; Change port data register before change data
sta DDRB
; direction register (aviod glitch)
sta DDRC
sta DDRD
sta DDRE
sta PTD
; enable LCD output
sta PTE
; enable LCD output
;********************************************************************************
; ----------------------------------------------------------------------------- *
; Configuration Register Initial
; ----------------------------------------------------------------------------- *
mov #CONFIG1_Init,CONFIG1
; CONFIG1 Initial
mov #CONFIG2_Init,CONFIG2
; CONFIG2 Initial
lda #LVISR_Init
sta LVISR
; LVI Initial
mov #INTSCR_Init,INTSCR
; IRQ Initial
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
55
Program Listing
; ----------------------------------------------------------------------------- *
; Keyboard Interrupt & PPI Initial
; ----------------------------------------------------------------------------- *
mov #HDB_Init,HDB
; PTB & PPI Clock Initial
mov #KBSCR_Init,KBSCR
; KBI & PPI Initial
mov #KBIER_Init,KBIER
; KBI & PPI Interrupt Initial
; ----------------------------------------------------------------------------- *
; Timer 1 & 2 Initial
; ----------------------------------------------------------------------------- *
; Set T1CH0 Overflow (125ms) to replace PPI periodic interrupt
;
; Set T1CH0 & T1CH1 as port
;
; T1SC0 & T1SC1 = Default value $00
;
mov #%01110011,T1SC
; TOF int Enable, Timer stop & reset, clock=bus/8
mov #PwmPeriodH1,T1MODH ; write overflow value to modulo reg (PWM freq)
mov #PwmPeriodL1,T1MODL
; ------------------------------------------------------------------- *
; Set T2CH0 as Output compare + Overflow (38K carrier) w/o interrupt
; Set T2CH1 as port, T2SC1=default value =$00
mov #PwmPeriodH2,T2MODH ; write overflow value to modulo reg (PWM freq)
mov #PwmPeriodL2,T2MODL
mov #DutyCycleH2,T2CH0H ; write output compare value (Duty cycle)
mov #DutyCycleL2,T2CH0L
; ----------------------------------------------------------------------------- *
; Keyboard status and Mode & Tx_Data Initial
; ----------------------------------------------------------------------------- *
clr Key_Flag
; Initial Keyboard flag & value and counter
clr Key_Value
; S1=%11101110,S2=%11101101...etc
clr Key_Sleep_Cnt
; Initial Sleep counter
clr T_Pointer
; Initial Timer Setting Pointer
clr Sleep_Flash_Cnt
; Initial Timer flash counter
clr Tx_Flag
; Initial Tx flag
clr PPI_Cnt
lda #Auto_Mode_Init
sta
sta
sta
sta
mov
; Initial difference mode value
; wind speed + Temperature (Tx_Data32)
Auto_Mode
Cool_Mode
Humd_Mode
Wind_Mode
#Heat_Mode_Init,Heat_Mode
clr Tx_Flag
mov
mov
mov
mov
#Data10_Init,Tx_Data10
#Data32_Init,Tx_Data32
#Data54_Init,Tx_Data54
#CtmCode_Init,Tx_CtmCode
mov Tx_Data54,Tx_Data54_Tmp
mov T_Pointer,T_Pointer_Tmp
; Initial Tx Data + Customer code
; Sync Tx_Data54 & Tx_Data54_Tmp
; Sync T_Pointer & T_Pointer_Tmp
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
56
Freescale Semiconductor
Transmitter Listing
; ----------------------------------------------------------------------------- *
; LCD Data & Configuration Register Initial
; ----------------------------------------------------------------------------- *
clrh
clrx
lda #$FF
; default LCD pattern (All ON)
Ld_LCD_FF:
sta LDAT1,x
incx
cpx #$0D
blo Ld_LCD_FF
mov #%10101111,LDAT9
mov #%10000000,LDAT5
bclr 4,LDAT4
; OFF unused LCD segments
mov #LCDCR_Init,LCDCR
; Initial LCD
mov #LCDCLK_Init,LCDCLK
jsr
jsr
jsr
jsr
jsr
jsr
Delay_500ms
Delay_500ms
Delay_500ms
Delay_500ms
Delay_500ms
Delay_500ms
; All segment in LCD panel ON (3 sec)
; ------------------------------------------------------------------- *
clrh
clrx
lda #$00
; default LCD pattern(All OFF except 25oC + Light)
Ld_LCD_00:
sta LDAT1,x
incx
cpx #$0A
; Reach to LDAT11?
bls Ld_LCD_00
mov #%11101011,LDAT4
bset 7,LDAT5
; "MODEL 0" segment ON
lda #%11010111
sta LDAT8
lda #%10101101
sta LDAT7
bset 0,LDAT3
; "25oC", "TEMP" & "Light" segment ON
; ----------------------------------------------------------------------------- *
; Remote Run after power on reset (POR) --- Waiting for Keyboard Interrupt
; ----------------------------------------------------------------------------- *
Main_Loop:
mov #T_Flash_Init,Timer_Flash_Cnt
mov #S34_Cnt_Init,S34_Key_Cnt
; Initial Timer flash counter
; Initial S3 S4 timer counter
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
57
Program Listing
CLI
stop
; Enable all interrupts (i.e. waiting for KBI)
; And PPI disable
jsr TIM1_RUN
; Enable Timer 1 TOF interrupt and timer ON
bra First_Key
Repeat_Key_Scan:
wait
; Waiting for 125ms TOF / KBI
First_Key:
bset LCD_READY,Key_Flag
jsr K_Scan
; Jump to keyboard scan (KEY_ON, KEY_WRONG)
; KEY_ON, KEY_WRONG, Key_Value, & Tx_Data updated
bclr 1,LDAT9
bclr 2,LDAT9
bclr 5,LDAT9
; Tx signal OFF (A2,A3,A4)
Slip_Key_Scan:
jsr LCD_Update
;
;
;
;
Update LCD in each 125ms (T1OF)
Update LCD(Always update even no key, wrong key)
Because it provide flash in sleep key & timer
setting
jsr Key_Release
; Check Key released (KEY_ON, TX_READY)
; PTA=%00001111 All Key standby KBI
jsr Tx_Frame
; Frame Transmission if KEY_ON=0 & TX_READY=1
; --------------------------------------------------------- *
lda Key_Sleep_Cnt
cmp #Key_Sleep_Max
; 80 x 125ms = 10sec
blo Repeat_Key_Scan
; If no key press within 10sec
clr Key_Sleep_Cnt
; Reset Sleep Counter
mov #%00000111,PTA
; Avoid false KBI by write PTA0-2 as o/p high
; Set PTA4-6 o/p low for KBI wakeup
brset 3,Tx_Data32,Sleep_PPI
stop
; Waiting for any key to wakeup from stop mode
bra First_Key
Sleep_PPI:
clr PPI_Cnt
mov #%01110111,KBIER
; Enable PPI before enter STOP mode
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
58
Freescale Semiconductor
Transmitter Listing
Stop_N2_Flash:
bclr 0,LDAT9
; A1 OFF
bset 3,LDAT9
; A5 ON
stop
brset 7,PPI_Cnt,Stop_N2_End ; bit-7 of PPI_Cnt will set if KBI occur
; (i.e. Key pressed)
bset 0,LDAT9
bclr 3,LDAT9
; A1 ON
; A5 OFF
stop
brset 7,PPI_Cnt,Stop_N2_End
bset 0,LDAT9
bset 3,LDAT9
; A1 ON
; A5 ON
stop
brset 7,PPI_Cnt,Stop_N2_End
bra Stop_N2_Flash
Stop_N2_End:
mov #%00000111,KBIER
; Disable PPI before exit STOP mode
clr PPI_Cnt
bra First_Key
; ----------------------------------------------------------------------------- *
; ----------------------------------------------------------------------------; Subroutine <500ms Delay>
; Bus Clock = 1MHz, 1 Cycle=1uS
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------Delay_500ms:
LDX #$C8
; [2]200
Delay_Yms_X
LDA #$FA
; [2]250
Delay_Yms_A
sta $FFFF
; [4] clear COP
nop
; [1]
nop
; [1]
nop
; [1]
dbnza Delay_Yms_A
; [3] 10*{A}=10A
dbnzx Delay_Yms_X
; [3] 10A*{X}+2+3=10AX+2+3
rts
; [3]
*
*
*
*
*
*
*
;Total= {[2]+[2]+10AX+[3]}*Bus Cycle
;Total= [7+(10*200*250)]*1uS = 500mS
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
59
Program Listing
; ----------------------------------------------------------------------------- *
; Timer 1 TOF enable --- 200ms
; ----------------------------------------------------------------------------- *
TIM1_RUN:
; Enable TIM1
bclr 5,T1SC
; clear TSTOP, enable timer counter
bclr CH0F,T1SC0
; clear TIMER1 CH0F flag
bclr CH1F,T1SC1
; clear TIMER1 CH1F flag
bclr TOF,T1SC
; clear TIMER1 TOF flag
rts
; ----------------------------------------------------------------------------- *
; Timer 1 TOF disable --- 200ms
; ----------------------------------------------------------------------------- *
TIM1_STOP:
; Disable TIM1
mov #%01110110,T1SC
; TOF int Enable, Timer stop & reset, clock=bus/64
rts
; ----------------------------------------------------------------------------- *
; Key Release Check
; ----------------------------------------------------------------------------- *
Key_Release:
mov #%00001111,PTA
; PTA4-7=0 (Check All Key in PTA3-0)
nop
lda PTA
and #%00001111
; mask upper nibble
cmp #%00001111
beq K_Released
; Key Released
bset KEY_ON,Key_Flag
; Set key on flag if any key pressed
bset KEY_REP,Key_Flag
; Set repeat key flag
rts
K_Released:
bclr KEY_ON,Key_Flag
; Clear Key pressed flag if no key pressed
bclr KEY_REP,Key_Flag
; Clear repeat key flag
bclr S34_KEY_ON,Key_Flag
mov #S34_Cnt_Init,S34_Key_Cnt ; Initial S3 S4 timer counter
rts
; ----------------------------------------------------------------------------; Subroutine <Hms Delay>
; Bus Clock = 1MHz, 1 Cycle=1uS
; In
: Acc
; Out
: <nil>
; Call
: <nil>
; Remark : (0.5mS * A) Delay
; ----------------------------------------------------------------------------Delay_Hms:
Delay_Hms_A:
LDX #$31
Delay_Hms_X:
sta $FFFF
nop
nop
*
*
*
*
*
*
*
*
; [2]49
; [4] clear COP !!!!!!! Need to re-!!!
; [1]
; [1]
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
60
Freescale Semiconductor
Transmitter Listing
nop
dbnzx Delay_Hms_X
dbnza Delay_Hms_A
rts
;
;
;
;
[1]
[3] 10*{X}=10X
[3] 10X*{A}+2+3=10AX+5
[3] 2+10XA+5+3=10XA+10
;Total= {10AX+[10]}*Bus Cycle
;Total= [10+(10*49*A)]*1uS = 500uS*A =A*0.5mS
; ----------------------------------------------------------------------------; Keyboard Scan Routine
; In
: <Key_Flag>
; Out
: <Key_Value>
; Call
: <nil>
; ----------------------------------------------------------------------------K_Scan:
; Key location and expect KEY_ON=1
lda #$0A
jsr Delay_Hms
*
*
*
*
*
*
; 10*0.5ms
; Delay 5ms for Key Debounce
bclr KEY_WRONG,Key_Flag
; Clear wrong key flag
brset KEY_ON,Key_Flag,KS_S1_S3 ; Key Scan if key pressed
jmp Wrong_Key
; No Key detected in KBI & KEY_ON=0,
; (Key released) may be due form niose
KS_S1_S3:
mov
mov
lda
sta
and
cmp
beq
#%01100111,PTA
#%11111000,DDRA
PTA
Key_Value
#%00000111
#%00000111
KS_S4_S6
; PTA4=0 (Check S1-S3), PTA3 & 7 o/p low
; Store Key Value
; mask bit3-7
; No key if equal
lda #$0A
jsr Delay_Hms
; 10*0.5ms
; Delay 5ms
lda
cmp
bne
clr
bra
; Wrong Key if not equal
; Reset Key Sleep Counter if any key detected
; Go to S1-S3 Key decode
KS_S4_S6:
mov
lda
sta
and
cmp
beq
PTA
Key_Value
Wrong_Key
Key_Sleep_Cnt
K_S1_S3
#%01010111,PTA
PTA
Key_Value
#%00000111
#%00000111
KS_S7_S9
lda #$0A
jsr Delay_Hms
; PTA5=0 (Check S4-S6), PTA3 & 7 o/p low
; Store Key Value
; mask bit3-7
; No key if equal
; 10*0.5ms
; Delay 5ms
lda PTA
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
61
Program Listing
cmp
bne
clr
bra
KS_S7_S9:
mov
lda
sta
and
cmp
beq
Key_Value
Wrong_Key
Key_Sleep_Cnt
K_S4_S6
#%00110111,PTA
PTA
Key_Value
#%00000111
#%00000111
Wrong_Key
; Wrong Key if not equal
; Reset Key Sleep Counter if any key detected
; Go to S4-S6 Key decode
; PTA6=0 (Check S7-S9), PTA3 & 7 o/p low
; Store Key Value
; mask bit3-7
; No key in S1-S9 if equal (all no key=wrong key)
lda #$0A
jsr Delay_Hms
; 10*0.5ms
; Delay 5ms
lda
cmp
bne
clr
bra
; Wrong Key if not equal
; Reset Key Sleep Counter if any key detected
; Go to S7-S9 Key decode
PTA
Key_Value
Wrong_Key
Key_Sleep_Cnt
K_S7_S9
Wrong_Key:
bset KEY_WRONG,Key_Flag ; Assume No key press OR noise
bclr TX_READY,Key_Flag
rts
; ----------------------------------------------------------------------------- *
; Key Decode
; ----------------------------------------------------------------------------- *
K_S1_S3:
brclr 0,Key_Value,S1x
; Perfrom S1 (OK) "Sleep" action
brclr 1,Key_Value,S2x
; Perfrom S2 (A.M.WIND) action
brclr 2,Key_Value,S3x
; Perfrom S3 (SET) "Model select" action
K_S4_S6:
brclr 0,Key_Value,S4x
brclr 1,Key_Value,S5x
brclr 2,Key_Value,S6x
K_S7_S9:
brclr 0,Key_Value,S7x
brclr 1,Key_Value,S8x
brclr 2,Key_Value,S9x
bra Wrong_Key
S1x:
S2x:
; Perfrom S4 (+) action [oC / Model set]
; Perfrom S5 (M.WIND) "Light ON/OFF" action
; Perfrom S6 (ON/OFF) action
;
;
;
;
;
Perfrom S7 (-) action [oC / Model set]
Perfrom S8 (WIND) "Fan Speed select" action
[->Auto->Min->Mid->Max->]Fan Speed
Perfrom S9 (MODE) action
[->Auto->cool->dry->wind->heat->]modes
; If any mistake in key scan
; Jump to Tx Data Update
brset KEY_REP,Key_Flag,Rep_Key
jmp S1
brset KEY_REP,Key_Flag,Rep_Key
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
62
Freescale Semiconductor
Transmitter Listing
S3x:
S4x:
S5x:
S6x:
S7x:
S8x:
S9x:
jmp S2
brset KEY_REP,Key_Flag,Rep_Key
jmp S3
brset KEY_REP,Key_Flag,S4_Rep_Key ; S4 No Repeat Key
jmp S4
brset KEY_REP,Key_Flag,Rep_Key
jmp S5
brset KEY_REP,Key_Flag,Rep_Key
jmp S6
brset KEY_REP,Key_Flag,S7_Rep_Key ; S7 No Repeat Key
jmp S7
brset KEY_REP,Key_Flag,Rep_Key
jmp S8
brset KEY_REP,Key_Flag,Rep_Key
jmp S9
Rep_Key:
rts
; ----------------------------------------------------------------------------- *
S4_Rep_Key:
lda S34_Key_Cnt
beq S4y
bra Rep_Key
; Go to S4 decode if S4/S7 pressed > 3sec
S7_Rep_Key:
lda S34_Key_Cnt
beq S7y
bra Rep_Key
S4y:
S7y:
; Go to S7 decode if S4/S7 pressed > 3sec
jmp S4
jmp S7
; ----------------------------------------------------------------------------- *
; Tx Data Update
; ----------------------------------------------------------------------------- *
S1:
; Sleep Key pressed (OK)
brclr 7,Tx_Data10,Slip_S1
; No action if S1=OFF
brset 3,Tx_Data32,Sleep_OFF ; Check ON/OFF? (1=ON)
; Here AC ON
lda
and
cmp
beq
cmp
beq
cmp
beq
bra
Tx_Data10
#%01110000
#%00010000
Sleep_ON_Cool
#%00100000
Sleep_ON_Humd
#%01000000
Sleep_ON_Heat
Slip_S1
; mask all bit except b6-4
; Check Cool mode (001)
; Check Humd mode (010)
; Check Heat mode (100)
; Slip if in others modes
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
63
Program Listing
Sleep_ON_Cool:
bset 3,Cool_Mode
bra Set_Data32
Sleep_ON_Humd
bset 3,Humd_Mode
bra Set_Data32
Sleep_ON_Heat
bset 3,Heat_Mode
Set_Data32:
bset 3,Tx_Data32
bset TX_READY,Tx_Flag
bra End_S1
; OFF -> ON
; Tx ready
Sleep_OFF:
; Here AC OFF
lda
and
cmp
beq
cmp
beq
cmp
beq
bra
Tx_Data10
#%01110000
#%00010000
Sleep_OFF_Cool
#%00100000
Sleep_OFF_Humd
#%01000000
Sleep_OFF_Heat
Slip_S1
; mask all bit except b6-4
; Check Cool mode (001)
; Check Humd mode (010)
; Check Heat mode (100)
Sleep_OFF_Cool:
bclr 3,Cool_Mode
bra Clr_Data32
Sleep_OFF_Humd
bclr 3,Humd_Mode
bra Clr_Data32
Sleep_OFF_Heat
bclr 3,Heat_Mode
Clr_Data32:
bclr 3,Tx_Data32
bset TX_READY,Tx_Flag
bra End_S1
; OFF -> ON
; Tx ready
Slip_S1:
End_S1:
rts
; ----------------------------------------------------------------------------- *
S2:
; Swing Key pressed (A.M.WIND)
brclr 7,Tx_Data10,Slip_S2
; No action if S1=OFF
; Here (S1=ON)
brset 2,Tx_Data32,Swing_OFF ; Check ON/OFF? (1=ON)
bset 2,Tx_Data32
; OFF -> ON
bset 2,Auto_Mode
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
64
Freescale Semiconductor
Transmitter Listing
bset 2,Cool_Mode
bset 2,Humd_Mode
bset 2,Wind_Mode
bset 2,Heat_Mode
bset TX_READY,Tx_Flag
bra End_S2
Swing_OFF:
bclr
bclr
bclr
bclr
bclr
bclr
bset
; Tx ready
2,Tx_Data32
2,Auto_Mode
2,Cool_Mode
2,Humd_Mode
2,Wind_Mode
2,Heat_Mode
TX_READY,Tx_Flag
; ON -> OFF
; Tx ready
Slip_S2:
End_S2:
rts
; ----------------------------------------------------------------------------- *
S3:
; "Model Set" Key pressed (SET)
brclr 3,Tx_Data54,Model_Set
Model_Confirm:
bclr 3,Tx_Data54
bset KEY_CONFIRM,Key_Flag
rts
; Model Confrim (MODEL ON)
Model_Set:
bset 3,Tx_Data54
; Model Set (MODEL flash)
bclr KEY_CONFIRM,Key_Flag
mov #T_Flash_Init,Timer_Flash_Cnt
mov Tx_Data54,Tx_Data54_Tmp
mov T_Pointer,T_Pointer_Tmp
rts
; ----------------------------------------------------------------------------- *
S4:
; + Key pressed for oC / Model Set (^)
brset 3,Tx_Data54,Model_Set_S4 ; Check Timer set status (4.3=1 ?)
S4_Normal:
brclr 7,Tx_Data10,Slip_S4
; No action if S1=OFF
lda Tx_Data10
and #%01110000
beq Slip_S4
; No action if in Auto Mode
lda
nsa
sta
and
cmp
bhs
Tx_Data32
; swrap N3 as lower nibble
Tx_Data_Temp
#%00001111
#%00001111
No_Inc_Data32
; mask N2
; Is reach Max $111, No need Inc
inc Tx_Data_Temp
lda Tx_Data_Temp
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
65
Program Listing
nsa
sta Tx_Data32
; Swrap N3 back to higher nibble
No_Inc_Data32:
jsr Data32_To_Modes
; Check & update Data32 & Modes
bset TX_READY,Tx_Flag
; Tx ready
bset S34_KEY_ON,Key_Flag
Slip_S4:
End_S4:
rts
Model_Set_S4:
; Here Timer setting = ON
brset KEY_CONFIRM,Key_Flag,S4_Normal ; No action if Key Confirm
lda Timer_Flash_Cnt
beq End_S4
mov #T_Flash_Init,Timer_Flash_Cnt
; Reset Timer flash counter
clrh
ldx T_Pointer
; load Timer pointer
cpx #$09
; Reach Max Model 9?
blo Inc_T_P
; Lower than Model 9
clrx
; Reset Timer Pointer to Min(Model 0)
bra Up_Data54
Inc_T_P:
incx
; Increase Timer setting
Up_Data54:
stx T_Pointer
; Update T_Pointer
lda $F030,x
; Load Data54 Table
sta Tx_Data54
; Update Data54 (4.3=1)
bra End_S4
; ----------------------------------------------------------------------------- *
S5:
; Light Key pressed (M.WIND)
brset 1,Tx_Data10,Light_OFF ; Check ON/OFF? (1=ON)
bset 1,Tx_Data10
; OFF -> ON
bset TX_READY,Tx_Flag
; Tx ready
bra End_S5
Light_OFF:
bclr 1,Tx_Data10
bset TX_READY,Tx_Flag
; ON -> OFF
; Tx ready
End_S5:
rts
; ----------------------------------------------------------------------------- *
S6:
; ON/OFF Key pressed
(ON/OFF)
brclr 7,Tx_Data10,S6_ON ; Check ON/OFF status
bclr 7,Tx_Data10
bra Clear_T_S
; Change to OFF state
bset 7,Tx_Data10
; Change to ON state
S6_ON:
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
66
Freescale Semiconductor
Transmitter Listing
Clear_T_S:
bclr
bclr
bclr
bclr
bclr
bclr
bset
3,Tx_Data32
3,Auto_Mode
3,Cool_Mode
3,Humd_Mode
3,Wind_Mode
3,Heat_Mode
TX_READY,Tx_Flag
; Clear Sleep
; Tx ready
rts
; ----------------------------------------------------------------------------- *
S7:
; - Key pressed for oC / Model Set (v)
brset 3,Tx_Data54,Model_Set_S7 ; Check Timer set status (4.3=1 ?)
S7_Normal:
brclr 7,Tx_Data10,Slip_S7
; No action if S1=OFF
lda Tx_Data10
and #%01110000
beq Slip_S7
; No action if in Auto Mode
lda
nsa
sta
and
cmp
beq
Tx_Data32
Tx_Data_Temp
#%00001111
#%00000000
No_Dec_Data32
dec Tx_Data_Temp
lda Tx_Data_Temp
nsa
sta Tx_Data32
; swrap N3 as lower nibble
; mask N2
; Is reach Min $0000, No need Dec
; Swrap N3 back to higher nibble
No_Dec_Data32:
jsr Data32_To_Modes
; Check & update Data32 & Modes
bset TX_READY,Tx_Flag
; Tx ready
bset S34_KEY_ON,Key_Flag
Slip_S7:
End_S7:
rts
Model_Set_S7:
; Here Timer setting = ON
brset KEY_CONFIRM,Key_Flag,S7_Normal ; No action if Key Confirm
lda Timer_Flash_Cnt
beq End_S7
mov #T_Flash_Init,Timer_Flash_Cnt
; Reset Timer flash counter
clrh
ldx T_Pointer
; load Timer pointer
cpx #$00
; Reach Max Model 0?
bhi Dec_T_P
; Lower than Model 24
ldx #$09
; Reset Timer Pointer to Max(Model 9)
bra Down_Data54
Dec_T_P:
decx
; Decrease Timer setting
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
67
Program Listing
Down_Data54:
stx T_Pointer
; Update T_Pointer
lda $F030,x
; Load Data54 Table
sta Tx_Data54
; Update Data54 (4.3=1)
bra End_S7
; ----------------------------------------------------------------------------- *
S8:
; "Fan Speed" Key pressed (WIND)
;(Auto>low>mid>high)
brclr 7,Tx_Data10,Slip_S8 ; No action if AC OFF
lda
and
cmp
beq
Inc_Wind:
inc
bra
Tx_Data32
#%00000011
#%00000011
Rst_Wind
; Here (AC ON)
; mask other bit except b1-0
; Reach Max. value (high)?
Tx_Data32
End_S8
Rst_Wind:
bclr 0,Tx_Data32
bclr 1,Tx_Data32
; Change to Min. value (Auto)
End_S8:
jsr Data32_To_Modes
bset TX_READY,Tx_Flag
; Check & update Data32 & Modes
; Tx ready
Slip_S8:
rts
; ----------------------------------------------------------------------------- *
S9:
; Modes Key pressed (MODE)
; (Auto>Cool>Humd>Wind>Heat)
brclr 7,Tx_Data10,Slip_S9 ; No action if S1=OFF
bclr 3,Tx_Data32
bclr 3,Auto_Mode
bclr 3,Cool_Mode
bclr 3,Humd_Mode
bclr 3,Wind_Mode
bclr 3,Heat_Mode
lda Tx_Data10
nsa
and #%00001111
cmp #%00001100
blo Inc_Modes
mov #%10000000,Tx_Data10
bset TX_READY,Tx_Flag
bra End_S9
Inc_Modes:
inca
nsa
sta Tx_Data10
bset TX_READY,Tx_Flag
; Clear Sleep
; Here (S1=ON)
; mask other bit except b4-0 (b4==1)
; Reach Max. value (Heat mode)?
; Change to Min. value (Auto mode)
; Tx ready
; Tx ready
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
68
Freescale Semiconductor
Transmitter Listing
Slip_S9:
End_S9:
rts
; ----------------------------------------------------------------------------- *
; Update Data32 to Difference Modes (Auto mode check can be remove)
; ----------------------------------------------------------------------------- *
Data32_To_Modes:
lda Tx_Data10
and #%01110000
cmp #%00000000
; Check Auto mode?
beq D32_2_Auto
cmp #%00010000
; Check Cool mode?
beq D32_2_Cool
cmp #%00100000
; Check Humd mode?
beq D32_2_Humd
cmp #%00110000
; Check Wind mode?
beq D32_2_Wind
mov Tx_Data32,Heat_Mode ; It is Heat mode
rts
D32_2_Auto:
mov Tx_Data32,Auto_Mode
rts
D32_2_Cool:
mov Tx_Data32,Cool_Mode
rts
D32_2_Humd:
mov Tx_Data32,Humd_Mode
rts
D32_2_Wind:
mov Tx_Data32,Wind_Mode
rts
; ----------------------------------------------------------------------------- *
; LCD Data Update Subroutine (Depend on key value and then Tx Data)
; ----------------------------------------------------------------------------- *
LCD_Update:
brclr LCD_READY,Key_Flag,Slip_LCD
; Update LCD in each 250ms (T1OF)
bclr LCD_READY,Key_Flag ; Clear LCD_READY Flag
jsr
jsr
jsr
jsr
jsr
LCD_N1_Chk
LCD_N2_Chk
LCD_N3_Chk
LCD_N45_Chk
LCD_N67_Chk
;
;
;
;
;
LCD
LCD
LCD
LCD
LCD
based
based
based
based
based
on
on
on
on
on
N1
N2
N3
N4 & N5
N6 & N7
Slip_LCD:
rts
; ----------------------------------------------------------------------------- *
LCD_N1_Chk:
brclr 7,Tx_Data10,L_AC_OFF
; Here AC ON
lda Tx_Data10
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
69
Program Listing
and #%01110000
cmp #%00000000
beq LCD_Auto_Mode
cmp #%00010000
beq LCD_Cool_Mode
cmp #%00100000
beq LCD_Humd_Mode
cmp #%00110000
beq LCD_Wind_Mode
LCD_Heat_Mode:
mov Heat_Mode,Tx_Data32
bclr 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bclr 7,LDAT9
bset 2,LDAT10
rts
LCD_Auto_Mode:
mov Auto_Mode,Tx_Data32
bset 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Cool_Mode:
mov Cool_Mode,Tx_Data32
bclr 3,LDAT10
bset 1,LDAT10
bclr 0,LDAT10
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Humd_Mode:
mov Humd_Mode,Tx_Data32
bclr 3,LDAT10
bclr 1,LDAT10
bset 0,LDAT10
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Wind_Mode:
mov Wind_Mode,Tx_Data32
bclr 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bset 7,LDAT9
bclr 2,LDAT10
rts
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Mask all bit except bit4-6
Is bit4-6 = %000
Go to Auto mode if true
Is bit4-6 = %001
Go to Cool mode if true
Is bit4-6 = %010
Go to Humd mode if true
Is bit4-6 = %011
Go to Wind mode if true
Otherwise go to Heat mode (%100 - %111)
Here in Heat Mode
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
;
;
;
;
;
;
Here in Auto Mode
AUTO ON
COOL OFF
DRY OFF
WIND OFF
HEAT OFF
;
;
;
;
;
;
Here in Cool Mode
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
;
;
;
;
;
;
Here in Humd Mode
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
;
;
;
;
;
;
Here in Wind Mode
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
70
Freescale Semiconductor
Transmitter Listing
L_AC_OFF:
clr LDAT3
; Clear all except XXoC & Model No.
clr LDAT6
clr LDAT9
clr LDAT10
rts
; ----------------------------------------------------------------------------- *
LCD_N2_Chk:
; --------------------------- *
LCD_N2_Sleep:
brclr 3,Tx_Data32,L_Sleep_OFF
bset 7,LDAT5
lda Sleep_Flash_Cnt
cmp #$03
bls A1_ON_A5_OFF
cmp #$07
bls A1_ON_A5_ON
cmp #$0B
bls A1_OFF_A5_ON
bra LCD_N2_Swing
; S6 always ON
; S8 ON & S7 OFF if ($00-$03)
[125ms*4=0.5s]
; S8 ON & S7 ON if ($04-$07)
[0.5s]
; S8 OFF & S7 ON if ($08-$0B)
[0.5s]
A1_OFF_A5_ON:
bclr 0,LDAT9
bset 3,LDAT9
bra LCD_N2_Swing
; A1 OFF
; A5 ON
A1_ON_A5_OFF:
bset 0,LDAT9
bclr 3,LDAT9
bra LCD_N2_Swing
; A1 ON
; A5 OFF
A1_ON_A5_ON:
bset 0,LDAT9
bset 3,LDAT9
bra LCD_N2_Swing
; A1 ON
; A5 ON
L_Sleep_OFF:
bclr 0,LDAT9
; A1 OFF
bclr 3,LDAT9
; A5 OFF
; --------------------------- *
LCD_N2_Swing:
brclr 2,Tx_Data32,L_Swing_OFF
brclr 7,Tx_Data10,L_Swing_OFF ; Swing OFF if AC OFF
; Here AC ON
bset 3,LDAT3
bra LCD_N2_Wind_Speed
; A.M.WIND ON
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
71
Program Listing
L_Swing_OFF:
bclr 3,LDAT3
; A.M.WIND OFF
; --------------------------- *
LCD_N2_Wind_Speed:
brclr 7,Tx_Data10,L_Wind_OFF ; Wind Speed OFF if AC
; Here AC ON
lda Tx_Data32
and #%00000011
; Mask all except bit0-1
cmp #%00000000
; Is Bit0-1 = %00
beq L_Wind_Auto
; Go to Wind Auto if true
cmp #%00000001
; Is Bit0-1 = %01
beq L_Wind_Low
; Go to Wind Low if true
cmp #%00000010
; Is Bit0-1 = %10
beq L_Wind_Mid
; Go to Wind Mid if true
L_Wind_High:
; Otherwise go to Wind High
bset 4,LDAT3
; Max Wind ON
mov #%00000111,LDAT6
; AUTO OFF, FAN, Min Wind &
rts
L_Wind_Low:
bclr 4,LDAT3
; Max Wind OFF
mov #%00000110,LDAT6
; FAN & Min Wind ON, AUTO &
rts
L_Wind_Mid:
bclr 4,LDAT3
; Max Wind OFF
mov #%00000111,LDAT6
; FAN & Min Wind & Mid Wind
rts
L_Wind_Auto:
bclr 4,LDAT3
; Max Wind OFF
mov #%00001100,LDAT6
; FAN & AUTO ON, Min Wind &
rts
OFF
(%11)
Mid Wind ON
Mid Wind OFF
ON, AUTO OFF
Mid Wind OFF
L_Wind_OFF:
bclr 4,LDAT3
clr LDAT6
; All OFF if AC OFF
rts
; ----------------------------------------------------------------------------- *
LCD_N3_Chk:
brclr 7,Tx_Data10,L_N3_AC_OFF
L_N3_AC_ON:
lda Tx_Data10
and #%01110000
cmp #%00000000
beq L_N3_Auto_oC
bra L_N3_oC_ON
L_N3_Auto_oC:
clr LDAT7
clr LDAT8
rts
L_N3_AC_OFF:
L_N3_oC_ON:
; Here AC ON
; Mask all bit except bit4-6
; Is bit4-6 = %000
; Go to Auto mode if true
; XXoC OFF in AUTO mode
; Here AC OFF
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
72
Freescale Semiconductor
Transmitter Listing
clrh
lda Tx_Data32
and #%11110000
nsa
tax
; Store N3 as Index
lda $F000,x
sta LDAT8
aix #$10
lda $F000,x
sta LDAT7
rts
; ----------------------------------------------------------------------------- *
LCD_N45_Chk:
brset 3,Tx_Data54,L_MODEL_FLASH
bra L_MODEL_ON
; Flash if Model Set
L_MODEL_FLASH:
lda Sleep_Flash_Cnt
cmp #$02
bls L_MODEL_ON
; MODEL OFF if ($00-$02)
cmp #$05
bls L_MODEL_OFF
; MODEL ON if ($03-$05)
cmp #$08
bls L_MODEL_ON
; MODEL ON if ($06-$08)
cmp #$0B
bls L_MODEL_OFF
; MODEL ON if ($09-$0B)
bra L_7SEG_CHK
L_MODEL_ON:
bset 7,LDAT5
bra L_7SEG_CHK
[125ms*3=0.375s]
[0.375s]
[0.375s]
[0.375s]
; MODEL flash ON
L_MODEL_OFF:
bclr 7,LDAT5
; MODEL flash OFF
bra L_7SEG_CHK
; --------------------------- *
L_7SEG_CHK:
clrh
; Update 5.3-5.0 7-Segment
lda Tx_Data54
nsa
; swrap N5 to lower nibble
and #%00001111
; mask N4 (Force bit 4-7 =0)
tax
lda $F020,x
; Load 7-segment data
sta LDAT4
; Display x(0-9)
; --------------------------- *
lda Timer_Flash_Cnt
beq L_Timer_OFF
rts
; ------------------------------------------------------------------- *
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
73
Program Listing
L_Timer_OFF:
bset 7,LDAT5
; MODEL ON
rts
; ----------------------------------------------------------------------------- *
LCD_N67_Chk:
; Only 6.1 need to check
brclr 1,Tx_Data10,L_Light_OFF
bset 0,LDAT3
; "light" ON (M.WIND)
bra L_Light_END
L_Light_OFF:
bclr 0,LDAT3
; "light" OFF (M.WIND)
L_Light_END:
brclr 7,Tx_Data10,L_N7_AC_OFF
L_N7_AC_ON:
lda Tx_Data10
and #%01110000
beq L_C_OFF
; Check AC ON/OFF?
; mask off except 1.2, 1.1, 1.0
bra L_N7_AC_OFF
L_C_OFF:
bclr 4,LDAT8
bra L_N67_END
; oC OFF if in AC ON & Auto mode
L_N7_AC_OFF:
bset 4,LDAT8
; oC ON if AC OFF
L_N67_END:
rts
; ----------------------------------------------------------------------------- *
; Frame Tx (need to check Tx_Ready flag)
;
; <Need to fine turn the timming of bit transmission>
; ----------------------------------------------------------------------------- *
Tx_Frame:
brclr TX_READY,Tx_Flag,No_Tx
Tx_S34_Chk:
brclr S34_KEY_ON,Key_Flag,Tx_Header
No_Tx:
rts
; --------------------------------------------------------- *
Tx_Header:
; Header Code Tx
SEI
bset 1,LDAT9
bset 2,LDAT9
bset 5,LDAT9
; Disable all interrupts before Tx
; Tx signal ON (A2,A3,A4)
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
74
Freescale Semiconductor
Transmitter Listing
bsr T2_ON
lda #Head_Time_ON
jsr Delay_Hms
; Send Header High [16us]
; 18*0.5ms
; Delay 9ms
bsr T2_OFF
; [16us]
lda #Head_Time_OFF
; 9*0.5ms
jsr Delay_Hms
; Delay 4.5ms
; ----------------------------------------------------------------------------- *
; Tx Data from 2.0 - 9.3
; ----------------------------------------------------------------------------- *
lda Tx_Data10
bsr Tx_N3_N9
lda Tx_Data32
bsr Tx_N3_N9
lda Tx_Data54
bsr Tx_N3_N9
lda Tx_CtmCode
bsr Tx_N3_N9
bra Tx_Stop
; --------------------------------------------------------- *
Tx_N3_N9:
; Nibble2-3 Tx
clrh
; [1us]
clrx
; [1us]
sta Tx_Data_Temp
Tx_N3_Loop:
lsr Tx_Data_Temp
blo Data_N3_1
bsr Data_0
bra Tx_N3_Next
Data_N3_1:
bsr Da
Tx_N3_Next:
incx
cpx #$07
bls Tx_N3_Loop
; [1us]
; [3us] jump if C=1
; Send Data 0 [4us] if C=0
; Send Data 1 [4us] if C=1
; [1us] b0>x=1 .. b3>x=4
; Is 1.0 - 1.3 complete? Total 4 bits [2us]
; [3us]
rts
; --------------------------------------------------------- *
Tx_Stop:
; Stop bit Tx
bsr
Data_1
; Send Data_1 as stop bit !!!
bsr T2_OFF
; Stop Timer 2 after STOP bit was sent
bclr TX_READY,Tx_Flag
; clear TX_READY to avoid next Tx until other key
; pressed
clr Tx_Flag
CLI
rts
; --------------------------------------------------------- *
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
75
Program Listing
; ----------------------------------------------------------------------------- *
; Tx Data "0" OR Data "1"
; ----------------------------------------------------------------------------- *
Data_0:
bsr T2_ON
; Send Carrier [16us]
lda #Data0_Time_ON
; 61*10us + 4us
jsr Delay_Us
; Delay 630us - 20us [4us]
bsr T2_OFF
lda #Data0_Time_OFF
jsr Delay_Us
rts
;
;
;
;
Send Low [16us]
54*10us {-2 for compensation}
Delay 560us - 20us
[4us]
bsr T2_ON
lda #Data1_Time_ON
jsr Delay_Us
; Send Carrier [16us]
; 61*10us
; Delay 630us - 20us
bsr T2_OFF
lda #Data1_Time_OFF
jsr Delay_Us
rts
;
;
;
;
Data_1:
Send Low [16us]
164*10us {-4 for compensation}
Delay 1660us - 20us [4us]
[4us]
; ----------------------------------------------------------------------------- *
; T2CH0 ON/OFF Control
; ----------------------------------------------------------------------------- *
T2_ON:
; Enable TIM2 Now [16us]
mov #%00110000,T2SC
; TOF int disable, Timer stop & reset, clock=bus/1
mov #%00011010,T2SC0
; Clear int flag, Int disable,
; clear o/p on compare, toggle o/p on overflow
bclr 5,T2SC
; clear TSTOP, enable timer counter
rts
T2_OFF:
mov #%00110000,T2SC
mov #%00010010,T2SC0
bclr 0,PTB
; Disable TIM2 Now
[16us]
; TOF int disable, Timer stop & reset, clock=bus/1
; Clear int flag, Int disable,T2CH0 = port o/p low
rts
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
76
Freescale Semiconductor
Transmitter Listing
; ----------------------------------------------------------------------------; Subroutine <Us Delay>
; Bus Clock = 1MHz, 1 Cycle=1uS
; In
: Acc
; Out
: <nil>
; Call
: <nil>
; Remark : (10uS * A) Delay
; ----------------------------------------------------------------------------Delay_Us:
Delay_Us_A:
sta $FFFF
nop
nop
nop
dbnza Delay_Us_A
rts
;
;
;
;
;
*
*
*
*
*
*
*
*
[4] clear COP
[1]
[1]
[1]
[3] 10*{A}
; [4]
;Total= {10AX+[10]}*Bus Cycle
;Total= [4+(10A)]*1uS = 10uS*A + 4uS
; ----------------------------------------------------------------------------; Program Interrupt Service Routine Area
; ----------------------------------------------------------------------------;
org
$EE00
; ----------------------------------------------------------------------------; DMY_ISR - dummy Interrupt Service Routine (with no operation)
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------DMY_ISR:
nop
rti
; ----------------------------------------------------------------------------; Timer Interrupt Service Routine
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------T1M0_ISR:
; Unused
bclr CH0F,T1SC0
; clear CH0F flag in TIM1
rti
; ----------------------------------------------------------------------------T2M0_ISR:
; As TIM2 OCMP
bclr CH0F,T2SC0
; clear CH0F flag in TIM2
rti
; ----------------------------------------------------------------------------T1M1_ISR:
; Unused
bclr CH1F,T1SC1
; clear CH1F flag in TIM1
rti
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
77
Program Listing
; ----------------------------------------------------------------------------- *
T2M1_ISR:
; Unused
bclr CH1F,T2SC1
; clear CH1F flag in TIM2
rti
; ----------------------------------------------------------------------------- *
T1OF_ISR:
; TIM1 Overflow (125ms interrupt period)
bclr TOF,T1SC
; clear TIM1 TOF flag in TIM1
bset LCD_READY,Key_Flag ; Each interrupt to set LCD READY Flag
; @125ms jsr for LCD
brset KEY_CONFIRM,Key_Flag,No_T_Flash_Dec
lda Timer_Flash_Cnt
; Decrement Timer_Flash_Cnt
beq T_Time_Out
deca
sta Timer_Flash_Cnt
bra No_T_Flash_Dec
T_Time_Out:
mov T_Pointer_Tmp,T_Pointer
mov Tx_Data54_Tmp,Tx_Data54
bclr 3,Tx_Data54
No_T_Flash_Dec:
lda Sleep_Flash_Cnt
cmp #$0B
bhs K_Sleep_Clr_Cnt
inca
sta Sleep_Flash_Cnt
bra End_T1OF
; Increment Sleep Flash Counter by each 125ms
K_Sleep_Clr_Cnt:
clr Sleep_Flash_Cnt
End_T1OF:
inc Key_Sleep_Cnt
lda S34_Key_Cnt
beq No_S34_Cnt_Dec
deca
sta S34_Key_Cnt
; Increment sleep counter by each 125ms
; Dec S3 S4 Key pressed timer counter until =0
No_S34_Cnt_Dec:
rti
; ----------------------------------------------------------------------------- *
T2OF_ISR:
; TIM2 Overflow
bclr TOF,T2SC
; clear TIM2 TOF flag in TIM2
rti
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
78
Freescale Semiconductor
Transmitter Listing
; ----------------------------------------------------------------------------; KBI_ISR - Keyboard & PPI Interrupt Service Routine
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; Remark : Either PPI or KBI enable at the same time
; ----------------------------------------------------------------------------KBI_ISR:
lda PTB
eor #%00000010
sta PTB
*
*
*
*
*
*
*
; Toggles PTB1 when KBI interrupt present
; For Debug
PPI_CHK:
brset PPI1L,HDB,PPI_ACK
bra KBI_ACK
; check PPI interrupt flag
; If not a PPI interrupt, jump to KBI_ACK
PPI_ACK:
bset ACKK,KBSCR
brset PPI1L,HDB,PPI_ACK
; clear PPI1L flag by set ACKK bit
; check PPI int flag clear
bset 6,PPI_Cnt
rti
KBI_ACK:
brclr 6,PPI_Cnt,KBI_Normal
bset 7,PPI_Cnt
KBI_Normal:
bset KEY_ON,Key_Flag
; Set KEY_ON flag
bset ACKK,KBSCR
; clear PPI1L flag by set ACKK bit
brset KEYF,KBSCR,KBI_Normal
rti
; ----------------------------------------------------------------------------- *
; LVI_ISR - LVI Interrupt Service Routine
*
; In
: <nil>
*
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
LVI_ISR:
lda #%01010000
sta LVISR
; clear LVI int. flag (Cannot use bset 4,LVISR)
rti
; Cannot use "bset 4,LVISR" due to LVISR = $FE0F)
; ----------------------------------------------------------------------------- *
; IRQ_ISR - IRQ Interrupt Service Routine
*
; In
: <nil>
*
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
IRQ_ISR:
bset 2,INTSCR
; CLEAR IRQF
rti
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
79
Program Listing
; ----------------------------------------------------------------------------- *
; Program Look Up Table Area (For LCD #1)
*
; ----------------------------------------------------------------------------- *
org
$F000
;$F000-$F01F
; ----------------------------------------------------------------------------- *
; LCD oC Display Lookup Table
;
FCB
FCB
FCB
FCB
FCB
ABC%XGED
%01110000
%01110000
%01110000
%01110000
%01110000
;
;
;
;
;
;
10th digit of oC (%=oC & TEMP always ON, X always OFF)
Digit 1 (B,C)
[X=$00]
Digit 1 (B,C)
[X=$01]
Digit 1 (B,C)
[X=$02]
Digit 1 (B,C)
[X=$03]
Digit 1 (B,C)
[X=$04]
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
2
2
2
2
2
2
2
2
2
2
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
[X=$0A]
[X=$0B]
[X=$0C]
[X=$0D]
[X=$0E]
FCB %11110101
; Digit 3 (A,B,C,D,G)
[X=$0F]
; ------------------------------------------------------------------- *
;
ABCXFGED
; 1st digit of oC (X always OFF)
FCB %10101101
; Digit 5 (A,C,D,F,G)
[X=$00+$10]
FCB %10101111
; Digit 6 (A,C,D,E,F,G)
[X=$01+$10]
FCB %11100000
; Digit 7 (A,B,C)
[X=$02+$10]
FCB %11101111
; Digit 8 (A,B,C,D,E,F,G) [X=$03+$10]
FCB %11101101
; Digit 9 (A,B,C,D,F,G)
[X=$04+$10]
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%11101011
%01100000
%11000111
%11100101
%01101100
%10101101
%10101111
%11100000
%11101111
%11101101
FCB %11101011
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
0
1
2
3
4
5
6
7
8
9
(A,B,C,D,E,F)
(B,C)
(A,B,D,E,G)
(A,B,C,D,G)
(B,C,F,G)
(A,C,D,F,G)
(A,C,D,E,F,G)
(A,B,C)
(A,B,C,D,E,F,G)
(A,B,C,D,F,G)
; Digit 0 (A,B,C,D,E,F)
[X=$05+$10]
[X=$06+$10]
[X=$07+$10]
[X=$08+$10]
[X=$09+$10]
[X=$0A+$10]
[X=$0B+$10]
[X=$0C+$10]
[X=$0D+$10]
[X=$0E+$10]
[X=$0F+$10]
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
80
Freescale Semiconductor
Transmitter Listing
; ----------------------------------------------------------------------------- *
org
$F020
;$F020-$F029
; ----------------------------------------------------------------------------- *
; LCD Model Setting Display Lookup Table
;
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
ABCXFGED
%11101011
%01100000
%11000111
%11100101
%01101100
%10101101
%10101111
%11100000
%11101111
%11101101
;
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
0
1
2
3
4
5
6
7
8
9
(A,B,C,D,E,F)
(B,C)
(A,B,D,E,G)
(A,B,C,D,G)
(B,C,F,G)
(A,C,D,F,G)
(A,C,D,E,F,G)
(A,B,C)
(A,B,C,D,E,F,G)
(A,B,C,D,F,G)
[X=$00]
[X=$01]
[X=$02]
[X=$03]
[X=$04]
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
; ----------------------------------------------------------------------------- *
org
$F030
;$F030-$F039
; ----------------------------------------------------------------------------- *
; Key Press Model Setting Lookup Table
; from Model 0(x=00) to Model 9 (X=09);
; ----------------------------------------------- *
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%00001000
%00011000
%00101000
%00111000
%01001000
%01011000
%01101000
%01111000
%10001000
%10011000
;
;
;
;
;
;
;
;
;
;
0
1
2
3
4
5
6
7
8
9
Model
Model
Model
Model
Model
Model
Model
Model
Model
Model
[X=$00]
[X=$01]
[X=$02]
[X=$03]
[X=$04]
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
; ----------------------------------------------------------------------------- *
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
81
Program Listing
B.2 Receiver Listing
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
----------------------------------------------------------------------------- *
Freescale Semiconductor (H.K.) Ltd.
*
8/16 bit MCU - Application
*
*
FileName
: Main.asm (Receiver)
*
Title
: 08LT8 Remote Control Reference Demo code (Freescale)
*
MCU
: PC68HC908LT8CFB (44-LQFP) 1st Silicon (Mask Set 0M48C) only *
Assembler
: Metrowerks CodeWarrior HC(S)08 (v3.1)
*
Include File : 908LT8v0r0.inc (for LT8 1st silicon only)
*
Author
: T.C. Lun
*
*
DD/MM/YY
Rev.
Modified comments
*
History
: 15/12/05
0.0
Initial release
*
*
Introduction : The H/W setting are show as below:
*
PTA[1:0]
: KBI of Keys, pullup if enable
*
PTA[2-7]
: NC set o/p low
*
PTB0/T2CH0 : IR Tx Module (38.46KHz Demodulator)
*
PTB[1]
: NC set o/p low
*
PTB[2]
: Red LED for AC power OFF (high current pin)
*
PTB[3]
: Green LED for AC power ON (high current pin)
*
BP0-3
: Connect to LCD Panel Pin4-1
*
FP4-10
: Connect to LCD Panel Pin5-11
*
FP12-18
: Connect to LCD Panel Pin12-18
*
FP3,11 & FP19-22 : NC o/p
*
RST
: 10K pullup + 0.1uF to GND
*
IRQ
: NC connect 0.1uF to GND
*
OSC1 & 2
: 4M7 + 4MHz + 18pF x2 OR (1M + 4MHz Resonator)
*
XTAL1 & 2 : 10M + 10K + 32.768KHz + 10pF x2
*
Vdd & Vss : 0.01uF // 10uF
*
Unused pin : PTB6-7 & PTC4-7 (need to set as o/p low) available in 52-LQFP *
*
Special arrangment : Add 100uF near to Vdd of Tx diode
*
: Add Mon08 interface for programming/ICD
*
*
MON08 Interface:
*
PIN# Net Name
| PIN# Net Name
*
1 NC
| 2
GND
*
3 NC
| 4
/RST
*
5 NC
| 6
/IRQ(+100 ohm)
*
7 NC
| 8
PTA0
*
9 NC
| 10 NC
*
11 NC
| 12 PTA1
*
13 OSC1(+22 Ohm) | 14 PTA2
*
15 Vdd
| 16 PTC3
*
*
*
Remark : This code is only for 1st 908LT8 silicon
*
For new silicon, it need to change the PPI interrupt vector
*
and its register & handling !!!!
*
*
*
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
82
Freescale Semiconductor
Receiver Listing
; ----------------------------------------------------------------------------- *
; Disclaimer of All Warranties & Liabilities :
*
; This Program is a freeware to demonstrate the operation of HC08 micro*
; controller. In no event will Motorola be liable for any damages, or any
*
; incidental or consequential damages arising out of the use of or
*
; inability to use this program. User agrees that Motorola does not make
*
; any warranties of any kind that the program does not or will not
*
; infringe any copyright, patent, trade secret or other intellectual
*
; property right of any third party in any country.
*
; ----------------------------------------------------------------------------- *
XDEF Entry, IRQ_ISR, main, LVI_ISR, T1M0_ISR, T2M0_ISR, T1M1_ISR,
T2M1_ISR, T1OF_ISR, T2OF_ISR, KBI_ISR, DMY_ISR
Include ’908LT8v0r0.inc’
;********************************************************************************
;* Title: 908LV8.inc
(c) Freescale Semiconductor, Inc. 2004 All rights reserved
;********************************************************************************
;* Author: T.C. Lun - Freescale TSPG
;*
;* Description: Register and bit name definitions for MC68HC908LT8
;*
;* Documentation: MC68HC908LT8/D
;*
;* Include Files: none
;*
;* Assembler: Metrowerks Code Warrior 3.0
;*
or P&E Microcomputer Systems - CASM08Z (v. 3.16)
;*
;* Revision History:
;* Rev #
Date
Who
Comments
;* ----- ----------- ------ -------------------------------------------------;* 0.0
10/14/04
TC.Lun
(Rev.0.3 Preliminary Draft is used)
;*
;********************************************************************************
;**** Memory Map and Interrupt Vectors ****************************************
;*
RamStart:
equ
$0080
;start of RAM
RamLast:
equ
$00FF
;last RAM location
RomStart:
equ
$DE00
;start of Flash
RomLast:
equ
$FFFF
;last Flash location
MonStart:
equ
$0B97
;start of monitor ROM
Vkbd:
Vtim2ov:
Vtim2ch1:
Vtim2ch0:
Vtimov:
Vtimch1:
Vtimch0:
Vlvi:
Virq:
Vswi:
Vreset:
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
$FFDC
$FFEA
$FFEC
$FFEE
$FFF0
$FFF2
$FFF4
$FFF8
$FFFA
$FFFC
$FFFE
;keyboard vector
;timer 2 overflow
;timer 2 channel 1 vector
;timer 2 channel 0 vector
;timer 1 overflow vector
;timer 1 channel 1 vector
;timer 1 channel 0 vector
;LVI interrupt vector
;IRQ vector
;SWI vector
;reset vector
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
83
Program Listing
;**** Input/Output (I/O) Ports ************************************************
;*
PTA:
equ
$00
;port A data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTA7:
equ
7
;port A data bit 7
PTA6:
equ
6
;port A data bit 6
PTA5:
equ
5
;port A data bit 5
PTA4:
equ
4
;port A data bit 4
PTA3:
equ
3
;port A data bit 3
PTA2:
equ
2
;port A data bit 2
PTA1:
equ
1
;port A data bit 1
PTA0:
equ
0
;port A data bit 0
; bit position masks
mPTA7:
equ
%10000000
;port A data bit 7
mPTA6:
equ
%01000000
;port A data bit 6
mPTA5:
equ
%00100000
;port A data bit 5
mPTA4:
equ
%00010000
;port A data bit 4
mPTA3:
equ
%00001000
;port A data bit 3
mPTA2:
equ
%00000100
;port A data bit 2
mPTA1:
equ
%00000010
;port A data bit 1
mPTA0:
equ
%00000001
;port A data bit 0
PTB:
equ
$01
;port B data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTB7:
equ
7
;port B data bit 7
PTB6:
equ
6
;port B data bit 6
PTB3:
equ
3
;port B data bit 3
PTB2:
equ
2
;port B data bit 2
PTB1:
equ
1
;port B data bit 1
PTB0:
equ
0
;port B data bit 0
; bit position masks
mPTB7:
equ
%10000000
;port B data bit 7
mPTB6:
equ
%01000000
;port B data bit 6
mPTB3:
equ
%00001000
;port B data bit 3
mPTB2:
equ
%00000100
;port B data bit 2
mPTB1:
equ
%00000010
;port B data bit 1
mPTB0:
equ
%00000001
;port B data bit 0
PTC:
equ
$02
;port C data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTC7:
equ
7
;port C data bit 7
PTC6:
equ
6
;port C data bit 6
PTC5:
equ
5
;port C data bit 5
PTC4:
equ
4
;port C data bit 4
PTC3:
equ
3
;port C data bit 3
PTC2:
equ
2
;port C data bit 2
PTC1:
equ
1
;port C data bit 1
PTC0:
equ
0
;port C data bit 0
; bit position masks
mPTC7:
equ
%10000000
;port C data bit 7
mPTC6:
equ
%01000000
;port C data bit 6
mPTC5:
equ
%00100000
;port C data bit 5
mPTC4:
equ
%00010000
;port C data bit 4
mPTC3:
equ
%00001000
;port C data bit 3
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
84
Freescale Semiconductor
Receiver Listing
mPTC2:
mPTC1:
mPTC0:
equ
equ
equ
%00000100
%00000010
%00000001
;port C data bit 2
;port C data bit 1
;port C data bit 0
PTD:
equ
$03
;port D data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTD7:
equ
7
;port D data bit 7
PTD6:
equ
6
;port D data bit 6
PTD5:
equ
5
;port D data bit 5
PTD4:
equ
4
;port D data bit 4
PTD3:
equ
3
;port D data bit 3
PTD2:
equ
2
;port D data bit 2
PTD1:
equ
1
;port D data bit 1
PTD0:
equ
0
;port D data bit 0
; bit position masks
mPTD7:
equ
%10000000
;port D data bit 7
mPTD6:
equ
%01000000
;port D data bit 6
mPTD5:
equ
%00100000
;port D data bit 5
mPTD4:
equ
%00010000
;port D data bit 4
mPTD3:
equ
%00001000
;port D data bit 3
mPTD2:
equ
%00000100
;port D data bit 2
mPTD1:
equ
%00000010
;port D data bit 1
mPTD0:
equ
%00000001
;port D data bit 0
DDRA:
equ
; bit numbers for
DDRA7:
equ
DDRA6:
equ
DDRA5:
equ
DDRA4:
equ
DDRA3:
equ
DDRA2:
equ
$04
;port A data direction register
use in BLCR, BSET, BRCLR, and BRSET
7
;port A data direction bit 7
6
;port A data direction bit 6
5
;port A data direction bit 5
4
;port A data direction bit 4
3
;port A data direction bit 3
2
;port A data direction bit 2
DDRA1:
equ
1
DDRA0:
equ
0
; bit position masks
mDDRA7:
equ
%10000000
mDDRA6:
equ
%01000000
mDDRA5:
equ
%00100000
mDDRA4:
equ
%00010000
mDDRA3:
equ
%00001000
mDDRA2:
equ
%00000100
mDDRA1:
equ
%00000010
mDDRA0:
equ
%00000001
DDRB:
equ
; bit numbers for
DDRB7:
equ
DDRB6:
equ
DDRB3:
equ
DDRB2:
equ
DDRB1:
equ
DDRB0:
equ
;port A data direction bit 1
;port A data direction bit 0
;port
;port
;port
;port
;port
;port
;port
;port
A
A
A
A
A
A
A
A
data
data
data
data
data
data
data
data
direction
direction
direction
direction
direction
direction
direction
direction
bit
bit
bit
bit
bit
bit
bit
bit
7
6
5
4
3
2
1
0
$05
;port B data direction register
use in BLCR, BSET, BRCLR, and BRSET
7
;port B data direction bit 7
6
;port B data direction bit 6
3
;port B data direction bit 3
2
;port B data direction bit 2
1
;port B data direction bit 1
0
;port B data direction bit 0
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
85
Program Listing
; bit position masks
mDDRB7:
equ
%10000000
mDDRB6:
equ
%01000000
mDDRB3:
equ
%00001000
mDDRB2:
equ
%00000100
mDDRB1:
equ
%00000010
mDDRB0:
equ
%00000001
;port
;port
;port
;port
;port
;port
B
B
B
B
B
B
data
data
data
data
data
data
direction
direction
direction
direction
direction
direction
bit
bit
bit
bit
bit
bit
7
6
3
2
1
0
DDRC:
equ
$06
;port C data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRC7:
equ
7
;port C data direction bit 7
DDRC6:
equ
6
;port C data direction bit 6
DDRC5:
equ
5
;port C data direction bit 5
DDRC4:
equ
4
;port C data direction bit 4
DDRC3:
equ
3
;port C data direction bit 3
DDRC2:
equ
2
;port C data direction bit 2
DDRC1:
equ
1
;port C data direction bit 1
DDRC0:
equ
0
;port C data direction bit 0
; bit position masks
mDDRC7:
equ
%10000000
;port C data direction bit 7
mDDRC6:
equ
%01000000
;port C data direction bit 6
mDDRC5:
equ
%00100000
;port C data direction bit 5
mDDRC4:
equ
%00010000
;port C data direction bit 4
mDDRC3:
equ
%00001000
;port C data direction bit 3
mDDRC2:
equ
%00000100
;port C data direction bit 2
mDDRC1:
equ
%00000010
;port C data direction bit 1
mDDRC0:
equ
%00000001
;port C data direction bit 0
DDRD:
equ
$07
;port D data direction register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
DDRD7:
equ
7
;port D data direction bit 7
DDRD6:
equ
6
;port D data direction bit 6
DDRD5:
equ
5
;port D data direction bit 5
DDRD4:
equ
4
;port D data direction bit 4
DDRD3:
equ
3
;port D data direction bit 3
DDRD2:
equ
2
;port D data direction bit 2
DDRD1:
equ
1
;port D data direction bit 1
DDRD0:
equ
0
;port D data direction bit 0
; bit position masks
mDDRD7:
equ
%10000000
;port D data direction bit 7
mDDRD6:
equ
%01000000
;port D data direction bit 6
mDDRD5:
equ
%00100000
;port D data direction bit 5
mDDRD4:
equ
%00010000
;port D data direction bit 4
mDDRD3:
equ
%00001000
;port D data direction bit 3
mDDRD2:
equ
%00000100
;port D data direction bit 2
mDDRD1:
equ
%00000010
;port D data direction bit 1
mDDRD0:
equ
%00000001
;port D data direction bit 0
DDRE:
equ
; bit numbers for
DDRE7:
equ
DDRE6:
equ
DDRE5:
equ
DDRE4:
equ
$08
;port E data direction register
use in BLCR, BSET, BRCLR, and BRSET
7
;port E data direction bit 7
6
;port E data direction bit 6
5
;port E data direction bit 5
4
;port E data direction bit 4
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
86
Freescale Semiconductor
Receiver Listing
DDRE3:
equ
3
DDRE2:
equ
2
DDRE1:
equ
1
DDRE0:
equ
0
; bit position masks
mDDRE7:
equ
%10000000
mDDRE6:
equ
%01000000
mDDRE5:
equ
%00100000
mDDRE4:
equ
%00010000
mDDRE3:
equ
%00001000
mDDRE2:
equ
%00000100
mDDRE1:
equ
%00000010
mDDRE0:
equ
%00000001
;port
;port
;port
;port
E
E
E
E
data
data
data
data
direction
direction
direction
direction
bit
bit
bit
bit
3
2
1
0
;port
;port
;port
;port
;port
;port
;port
;port
E
E
E
E
E
E
E
E
data
data
data
data
data
data
data
data
direction
direction
direction
direction
direction
direction
direction
direction
bit
bit
bit
bit
bit
bit
bit
bit
7
6
5
4
3
2
1
0
PTE:
equ
$09
;port E data register
; bit numbers for use in BLCR, BSET, BRCLR, and BRSET
PTE7:
equ
7
;port E data bit 7
PTE6:
equ
6
;port E data bit 6
PTE5:
equ
5
;port E data bit 5
PTE4:
equ
4
;port E data bit 4
PTE3:
equ
3
;port E data bit 3
PTE2:
equ
2
;port E data bit 2
PTE1:
equ
1
;port E data bit 1
PTE0:
equ
0
;port E data bit 0
; bit position masks
mPTE7:
equ
%10000000
;port E data bit 7
mPTE6:
equ
%01000000
;port E data bit 6
mPTE5:
equ
%00100000
;port E data bit 5
mPTE4:
equ
%00010000
;port E data bit 4
mPTE3:
equ
%00001000
;port E data bit 3
mPTE2:
equ
%00000100
;port E data bit 2
mPTE1:
equ
%00000010
;port E data bit 1
mPTE0:
equ
%00000001
;port E data bit 0
HDB:
equ
$0C
;port B high current drive control
;register
; bit number for use in BCLR, BSET, BRCLR, BRSET
PPI1L:
equ
6
;PPI1 interrupt request level
HDB3:
equ
3
;port B3 high current drive enable
HDB2:
equ
2
;port B2 high current drive enable
PPI1CLKS1: equ
1
;PPI1 clock select 1
PPI1CLKS0: equ
0
;PPI1 clock select 0
mPPI1L:
mHDB3:
mHDB2:
mPPI1CLKS1:
mPPI1CLKS0:
equ
equ
equ
equ
equ
%01000000
%00001000
%00000100
%00000010
%00000001
;PPI1
;port
;port
;PPI1
;PPI1
interrupt request level
B3 high current drive enable
B2 high current drive enable
clock select 1
clock select 0
;**** Keyboard Interrupt Module (KBI) *****************************************
;*
KBSCR:
equ
$1B
;keyboard status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
KEYF:
equ
3
;keyboard flag
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
87
Program Listing
ACKK:
equ
2
IMASKK:
equ
1
MODEK:
equ
0
; bit position masks
mKEYF:
equ
%00001000
mACKK:
equ
%00000100
mIMASKK:
equ
%00000010
mMODEK:
equ
%00000001
;keyboard acknowledge
;keyboard interrupt mask
;keyboard triggering sesitivity
;keyboard
;keyboard
;keyboard
;keyboard
flag
acknowledge
interrupt mask
triggering sesitivity
KBIER:
equ
$1C
;keyboard interrupt enable
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
PPI1IE2:
equ
6
;PPI1 interrupt enable and
;select bit 2
PPI1IE1:
equ
5
;PPI1 interrupt enable and
;select bit 1
PPI1IE0:
equ
4
;PPI1 interrupt enable and
;select bit 0
KBIE3:
equ
3
;port A keyboard interrupt
KBIE2:
equ
2
;port A keyboard interrupt
KBIE1:
equ
1
;port A keyboard interrupt
KBIE0:
equ
0
;port A keyboard interrupt
; bit position masks
mPPI1IE2:
equ
%01000000
;PPI1 interrupt enable and
;select bit 2
mPPI1IE1:
equ
%00100000
;PPI1 interrupt enable and
;select bit 1
mPPI1IE0:
equ
%00010000
;PPI1 interrupt enable and
;select bit 0
mKBIE3:
equ
%00001000
;port A keyboard interrupt
mKBIE2:
equ
%00000100
;port A keyboard interrupt
mKBIE1:
equ
%00000010
;port A keyboard interrupt
mKBIE0:
equ
%00000001
;port A keyboard interrupt
register
frequency
frequency
frequency
enable
enable
enable
enable
bit
bit
bit
bit
3
2
1
0
frequency
frequency
frequency
enable
enable
enable
enable
bit
bit
bit
bit
3
2
1
0
;**** Configuration Registers 2 (CONFIG2) ***************************************
;*
CONFIG2:
equ
$1D
;configuration register 2
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
STOP_XCLKEN: equ
7
;stop osc1 & osc2 crystal clock enable
STOP_XTALEN: equ
6
;stop xtal1 & xtal2 crystal clock enable
PEE:
equ
5
;port E LCD or GPIO select
PDE:
equ
4
;port D LCD or GPIO select
PCEH:
equ
3
;port C higher nibble lcd or GPIO select
PCEL:
equ
2
;port C lower nibble lcd or GPIO select
LVISEL1:
equ
1
;LVI level select bit 1
LVISEL0:
equ
0
;LVI level select bit 0
; bit position masks
mSTOP_XCLKEN: equ
%10000000 ;stop osc1 & osc2 crystal clock enable
mSTOP_XTALEN: equ
%01000000 ;stop xtal1 & xtal2 crystal clock enable
mPEE:
equ
%00100000
;port E LCD or GPIO select
mPDE:
equ
%00010000
;port D LCD or GPIO select
mPCEH:
equ
%00001000
;port C higher nibble lcd or GPIO select
mPCEL:
equ
%00000100
;port C lower nibble lcd or GPIO select
mLVISEL1:
equ
%00000010
;LVI level select bit 1
mLVISEL0:
equ
%00000001
;LVI level select bit 0
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
88
Freescale Semiconductor
Receiver Listing
;**** External Interrupt (IRQ) ************************************************
;*
INTSCR:
equ
$1E
;IRQ status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
IRQF:
equ
3
;IRQ flag
ACK:
equ
2
;IRQ interrupt request acknowledge
IMASK:
equ
1
;IRQ interrupt mask
MODE:
equ
0
;IRQ edge/level select
; bit position masks
mIRQF:
equ
%00001000
;IRQ flag
mACK:
equ
%00000100
;IRQ interrupt request acknowledge
mIMASK:
equ
%00000010
;IRQ interrupt mask
mMODE:
equ
%00000001
;IRQ edge/level select
;**** Configuration Register 1 (CONFIG1) ****************************************
;*
CONFIG1:
equ
$1F
;configuration register 1
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
COPRS:
equ
7
;COP reset period selection
LVISTOP:
equ
6
;LVI enable in stop mode
LVIRSTD:
equ
5
;LVI reset disable
LVIPWRD:
equ
4
;LVI power disable
SSREC:
equ
2
;short stop recovery
STOP:
equ
1
;STOP instruction enable
COPD:
equ
0
;COP disable
; bit position masks
mCOPRS:
equ
%10000000
;COP reset period selection
mLVISTOP:
equ
%01000000
;LVI enable in stop mode
mLVIRSTD:
equ
%00100000
;LVI reset disable
mLVIPWRD:
equ
%00010000
;LVI power disable
mSSREC:
equ
%00000100
;short stop recovery
mSTOP:
equ
%00000010
;STOP instruction enable
mCOPD:
equ
%00000001
;COP disable
;**** Timer Interface module 1 (TIM1) *****************************************
T1SC:
equ
$20
;timer 1 status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
TOF:
equ
7
;TIM overflow flag
TOIE:
equ
6
;TIM overflow interrupt enable
TSTOP:
equ
5
;TIM stop bit
TRST:
equ
4
;TIM reset bit
PS2:
equ
2
;prescaler select bit 2
PS1:
equ
1
;prescaler select bit 1
PS0:
equ
0
;prescaler select bit 0
; bit position masks
mTOF:
equ
%10000000
;TIM overflow flag
mTOIE:
equ
%01000000
;TIM overflow interrupt enable
mTSTOP:
equ
%00100000
;TIM stop bit
mTRST:
equ
%00010000
;TIM reset bit
mPS2:
equ
%00000100
;prescaler select bit 2
mPS1:
equ
%00000010
;prescaler select bit 1
mPS0:
equ
%00000001
;prescaler select bit 0
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
89
Program Listing
T1SC0:
equ
$25
;timer 1 channel 0 status and control
;register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
CH0F:
equ
7
;channel 0 flag
CH0IE:
equ
6
;channel 0 interrupt enable
MS0B:
equ
5
;mode select bit B
MS0A:
equ
4
;mode select bit A
ELS0B:
equ
3
;edge/level select bit B
ELS0A:
equ
2
;edge/level select bit A
TOV0
equ
1
;toggle on overflow
CH0MAX
equ
0
;channel 0 maximum duty cycle
; bit position masks
mCH0F:
equ
%10000000
;channel 0 flag
mCH0IE:
equ
%01000000
;channel 0 interrupt enable
mMS0B:
equ
%00100000
;mode select bit B
mMS0A:
equ
%00010000
;mode select bit A
mELS0B:
equ
%00001000
;edge/level select bit B
mELS0A:
equ
%00000100
;edge/level select bit A
mTOV0
equ
%00000010
;toggle on overflow
mCH0MAX
equ
%00000001
;channel 0 maximum duty cycle
T1SC1:
equ
$28
T1CNTH:
T1CNTL:
T1MODH:
T1MODL:
T1CH0H:
T1CH0L:
T1CH1H:
T1CH1L:
equ
equ
equ
equ
equ
equ
equ
equ
$21
$22
$23
$24
$26
$27
$29
$2A
;timer 1 channel 1 status and control
;register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
CH1F:
equ
7
;channel 1 flag
CH1IE:
equ
6
;channel 1 interrupt enable
MS1A:
equ
4
;mode select bit A
ELS1B:
equ
3
;edge/level select bit B
ELS1A:
equ
2
;edge/level select bit A
TOV1
equ
1
;toggle on overflow
CH1MAX
equ
0
;channel 1 maximum duty cycle
; bit position masks
mCH1F:
equ
%10000000
;channel 1 flag
mCH1IE:
equ
%01000000
;channel 1 interrupt enable
mMS1A:
equ
%00010000
;mode select bit A
mELS1B:
equ
%00001000
;edge/level select bit B
mELS1A:
equ
%00000100
;edge/level select bit A
mTOV1
equ
%00000010
;toggle on overflow
mCH1MAX
equ
%00000001
;channel 1 maximum duty cycle
;timer
;timer
;timer
;timer
;timer
;timer
;timer
;timer
1
1
1
1
1
1
1
1
counter
counter
counter
counter
channel
channel
channel
channel
register high
register Low
modulo register high
modulo register low
0 register high
0 register low
1 register high
1 register low
;**** Timer Interface module 2 (TIM2) *****************************************
T2SC:
equ
$2B
;timer 2 status and control register
T2CNTH:
equ
$2C
;timer 2 counter register high
T2CNTL:
equ
$2D
;timer 2 counter register low
T2MODH:
equ
$2E
;timer 2 counter modulo register high
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
90
Freescale Semiconductor
Receiver Listing
T2MODL:
T2SC0:
equ
equ
$2F
$30
T2CH0H:
T2CH0L:
T2SC1:
equ
equ
equ
$31
$32
$33
T2CH1H:
T2CH1L:
equ
equ
$34
$35
;timer 2 counter
;timer 2 channel
;register
;timer 2 channel
;timer 2 channel
;timer 2 channel
;register
;timer 2 channel
;timer 2 channel
modulo register low
0 status and control
0 register high
0 register low
1 status and control
1 register high
1 register low
;**** LCD Driver **************************************************************
LCDCLK:
equ
$4F
;LCD clock register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
FCCTL1:
equ
6
;fast charge duty cycle select 1
FCCTL0:
equ
5
;fast charge duty cycle select 0
DUTY1:
equ
4
;duty cycle select 1
DUTY0:
equ
3
;duty cycle select 0
LCLK2:
equ
2
;LCD clock select bit 2
LCLK1:
equ
1
;LCD clock select bit 1
LCLK0:
equ
0
;LCD clock select bit 0
; bit position masks
mFCCTL1:
equ
%01000000
;fast charge duty cycle select 1
mFCCTL0:
equ
%00100000
;fast charge duty cycle select 0
mDUTY1:
equ
%00010000
;duty cycle select 1
mDUTY0:
equ
%00001000
;duty cycle select 0
mLCLK2:
equ
%00000100
;LCD clock select bit 2
mLCLK1:
equ
%00000010
;LCD clock select bit 1
mLCLK0:
equ
%00000001
;LCD clock select bit 0
LCDCR:
equ
$51
;LCD control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
LCDE:
equ
7
;LCD enable
FC:
equ
5
;fast charge
LC:
equ
4
;Low current
LCCON3:
equ
3
;LCD contrast control bit3
LCCON2:
equ
2
;LCD contrast control bit2
LCCON1:
equ
1
;LCD contrast control bit1
LCCON0:
equ
0
;LCD contrast control bit0
; bit position masks
mLCDE:
equ
%10000000
;LCD enable
mFC:
equ
%00100000
;fast charge
mLC:
equ
%00010000
;Low current
mLCCON3:
equ
%00001000
;LCD contrast control bit3
mLCCON2:
equ
%00000100
;LCD contrast control bit2
mLCCON1:
equ
%00000010
;LCD contrast control bit1
mLCCON0:
equ
%00000001
;LCD contrast control bit0
LDAT1:
LDAT2:
LDAT3:
LDAT4:
LDAT5:
LDAT6:
LDAT7:
equ
equ
equ
equ
equ
equ
equ
$52
$53
$54
$55
$56
$57
$58
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
display
display
display
display
display
display
display
data
data
data
data
data
data
data
register
register
register
register
register
register
register
1
2
3
4
5
6
7
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
91
Program Listing
LDAT8:
LDAT9:
LDAT10:
LDAT11:
LDAT12:
LDAT13:
equ
equ
equ
equ
equ
equ
$59
$5A
$5B
$5C
$5D
$5E
;LCD
;LCD
;LCD
;LCD
;LCD
;LCD
display
display
display
display
display
display
data
data
data
data
data
data
register
register
register
register
register
register
8
9
10
11
12
13
;**** System Integration Module (SIM) *****************************************
SBSR:
equ
$FE00
;SIM break status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
SBSW
equ
1
;SIM break stop/wait
; bit position masks
mSBSW:
equ
%00000010
;SIM break stop/wait
SRSR:
equ
$FE01
;SIM reset status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
POR:
equ
7
;power-on reset
PIN:
equ
6
;external reset
COP:
equ
5
;COP reset
ILOP:
equ
4
;illegal opcode reset
ILAD:
equ
3
;illegal address reset
MODRST:
equ
2
;monitor mode entry module reset
LVI:
equ
1
;LVI reset
; bit position masks
mPOR:
equ
%10000000
;power-on reset
mPIN:
equ
%01000000
;external reset
mCOP:
equ
%00100000
;COP reset
mILOP:
equ
%00010000
;illegal opcode reset
mILAD:
equ
%00001000
;illegal address reset
mMODRST:
equ
%00000100
;monitor mode entry module reset
mLVI:
equ
%00000010
;LVI reset
SBFCR:
equ
$FE03
;SIM break flag control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
BCFE:
equ
7
;break clear flag enable
; bit position masks
mBCFE:
equ
%10000000
;break clear flag enable
INT1:
equ
; bit numbers for
IF6:
equ
IF5:
equ
IF4:
equ
IF3:
equ
IF2:
equ
IF1:
equ
$FE04
;interrupt status register 1
use in BCLR, BSET, BRCLR, and BRSET
7
;interrupt flag 6
6
;interrupt flag 5
5
;interrupt flag 4
4
;interrupt flag 3
3
;interrupt flag 2
2
;interrupt flag 1
INT2:
equ
; bit numbers for
IF9:
equ
IF8:
equ
IF7:
equ
$FE05
;interrupt status register 2
use in BCLR, BSET, BRCLR, and BRSET
2
;interrupt flag 9
1
;interrupt flag 8
0
;interrupt flag 7
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
92
Freescale Semiconductor
Receiver Listing
INT3:
equ
; bit numbers for
IF17:
equ
IF16:
equ
$FE06
;interrupt status register 3
use in BCLR, BSET, BRCLR, and BRSET
2
;interrupt flag 17
1
;interrupt flag 16
;**** Flash Memory ************************************************************
FLCR:
equ
$FE08
;flash control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
HVEN:
equ
3
;high-voltage enable bit mask
MASS:
equ
2
;mass erase control bit mask
ERASE:
equ
1
;erase control bit mask
PGM:
equ
0
;program control bit mask
; bit position masks
mHVEN:
equ
%00001000
;high-voltage enable bit mask
mMASS:
equ
%00000100
;mass erase control bit mask
mERASE:
equ
%00000010
;erase control bit mask
mPGM:
equ
%00000001
;program control bit mask
FLBPR:
equ
$FF7E
;flash block protect register
;**** Break Module (BRK) ******************************************************
BRKSCR:
equ
$FE0E
;break status and control register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
BRKE:
equ
7
;break enable
BRKA:
equ
6
;break active
; bit position masks
mBRKE:
equ
%10000000
;break enable
mBRKA:
equ
%01000000
;break active
BRKH:
BRKL:
equ
equ
$FE0C
$FE0D
;break address register high
;break address register low
;**** Low-Voltage Inhibit (LVI) ***********************************************
LVISR:
equ
$FE0F
;LVI status register
; bit numbers for use in BCLR, BSET, BRCLR, and BRSET
LVIOUT:
equ
7
;LVI output
LVIIE:
equ
6
;LVI interrupt enable bit
LVIIF:
equ
5
;LVI interrupt flag
LVIIAK:
equ
4
;LVI interrupt request acknowledge bit
; bit position masks
mLVIOUT:
equ
%10000000
;LVI output
mLVIIE:
equ
%01000000
;LVI interrupt enable bit
mLVIIF:
equ
%00100000
;LVI interrupt flag
mLVIIAK:
equ
%00010000
;LVI interrupt request acknowledge bit
;**** Computer Operating Properly (COP) ***************************************
COPCTL:
equ
$FFFF
;COP control register
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
93
Program Listing
;********************************************************************************
; Registers definition
;********************************************************************************
; PART I: MCU Related values and regsisters
; ----------------------------------------------------------------------------- *
;
CONFIG1_Init
equ %00100011
; Config 1 initial (LVI enable not in stop)
;
||||||||
;
|||||||+-- COP=disable(1)
;
||||||+--- Stop=enable(1)
;
|||||+---- Recovery time=long(0)
;
||||+----- NIL=(0)
;
|||+------ LVI power=on(0)
;
||+------- LVI reset=disable(1)
;
|+-------- LVI in stop=disable(0)
;
+--------- COP=long(0)
;
CONFIG2_Init
equ %01111101
; Config 2 initial
;
||||||||
;
|||||||+-- LVI trip point[0] [1:0]= 1:0 = 5.0V
;
||||||+--- LVI trip point[1] [1:0]= 0:1 = 3.0V
;
|||||+---- PTC0-3 = LCD(1)
;
||||+----- PTC4-7 = LCD(1)
;
|||+------ PTD = LCD(1) Need set PTD=$FF (1st 908LT8)
;
||+------- PTE = LCD(1) Need set PTE=$FF (1st 908LT8)
;
|+-------- XTAL enable in stop(1)
;
+--------- OSC enable in stop(1)
;
LVISR_Init
equ %01010000
; LVISR initial
;
||||||||
;
||||++++-- NIL=0 (bit 3-0)
;
|||+------ LVI interrupt acknowledge (1=clear LVI int flag)
;
||+------- LVI interrupt flag (1=pending)
;
|+-------- LVI interrupt enable (1=enable)
;
+--------- LVI o/p flag(=1 if Vdd fall below LVI trip pt)
;
INTSCR_Init
equ %00000110
; INTSCR initial
;
||||||||
;
|||||||+-- IRQ Edge/Level (1=falling/low level, 0=falling)
;
||||||+--- IRQ interrupt mask (1=IRQ interrupt mask)
;
|||||+---- IRQ interrupt acknowledge (1=clear IRQ int flag)
;
||||+----- IRQ interrupt flag (1=pending)
;
++++------ NIL=0 (bit 7-4)
;
HDB_Init
equ %00001110
; HDB initial
;
||||||||
;
|||||||+-- PPI clock[0] [1:0]= 10 = 32.768KHz Xtal
;
||||||+--- PPI clock[1] [1:0]= 01 = external PPIECLK pin
;
|||||+---- HDB2 (1= PTB2 is high current)
;
||||+----- HDB3 (1= PTB3 is high current)
;
||++------ b4-b5: NIL=0 (bit 4 & 5)
;
|+-------- PPI1 interrupt flag (1=pending)
;
+--------- NIL=0 (bit 7)
;
*Remark: PPIECLK mux with PTB2 & T1CH0 !!!!
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
94
Freescale Semiconductor
Receiver Listing
;
KBSCR_Init
equ %00000100
; KBSCR initial
;
||||||||
;
|||||||+-- KBI Edge/Level (1=falling/low level, 0=falling)
;
||||||+--- KBI/PPI interrupt mask (1=KBI/PPI int mask)
;
|||||+---- KBI/PPI interrupt ack (1=clear KBI/PPI int flag)
;
||||+----- KBI interrupt flag (1=pending)
;
++++------ NIL=0 (bit 7-4)
; * Remark: For KBI int, needs to check KBI interrupt flag in KBSCR
; * Remark: For PPI int, needs to check PPI1 interrupt flag in HDB
;
KBIER_Init
equ %00000011
; KBIER initial (KBI Enable)
;
||||||||
;
|||||||+-- KBIE0 (1= PTA0 KBI interrupt enable)
;
||||||+--- KBIE1 (1= PTA1 KBI interrupt enable)
;
|||||+---- KBIE2 (1= PTA2 KBI interrupt enable)
;
||||+----- KBIE3 (1= PTA3 KBI interrupt enable)
;
|||+------ PPI1E[0] (000)=PPI disable, (001)= 512 count
;
||+------- PPI1E[1] (010)= 1024, (011)= 2048, (100)= 4096
;
|+-------- PPI1E[2] (101)= 8192, (110)= 16834, (111)= 32768
;
+--------- NIL=0 (bit 7)
; * Remark: When KBIEx = 1, internal pullup enable and PTAx force to i/p
;
LCDCR_Init
equ %10010000
; LCDCR initial (LCD Enable)
;
||||||||
;
|||||||+-- LCCON0 (LCCON3:0 is bias voltage control)
;
||||||+--- LCCON1
;
|||||+---- LCCON2
;
||||+----- LCCON3
;
|||+------ LC (LC =1 means low current, FC =1 fast charge)
;
||+------- FC (FC:LC) x:0= 37K, 0:1= 146K, 1:1= Fast Charge
;
|+-------- NIL=0 (bit 6)
;
+--------- LCDE (1= LCD enable)
;
LCDCLK_Init
equ %00010001
; LCDCLK initial
;
||||||||
;
|||||||+-- LCLK0 000=256Hz, 001=128Hz, 010=64Hz, 011=32Hz
;
||||||+--- LCLK1 Frame rate = LCDCLK * Duty cycle
;
|||||+---- LCLK2 with LCDCLK=256Hz => 256*(1/4)=64Hz
;
||||+----- DUTY[0] 00=Static, 01=1/3 duty cycle
;
|||+------ DUTY[1] 10=1/4 duty cycle, 11=Not used
;
||+------- FCCTL[0] 00=LCDCLK/32, 01=/64, 10=/128 w/LC=0
;
|+-------- FCCTL[1] (Fast charge duty cycle)
;
+--------- NIL=0 (bit 7)
; ----------------------------------------------------------------------------- *
;
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
95
Program Listing
; ----------------------------------------------------------------------------- *
; PART II: System Related values and variables
; ----------------------------------------------------------------------------- *
Auto_Mode_Init
equ %10100000 ;25oC, Sleep_off, swing_off, auto_wind
Heat_Mode_Init
equ %11010000 ;28oC, Sleep_off, swing_off, auto_wind
Data10_Init
equ %00000000 ;AC_OFF, Auto_mode, shift out b0-3
Data32_Init
equ %10100000 ;25oC, Sleep_off, Swing_off, auto_wind
Data54_Init
equ %00001000 ;Model Set to Model 0 (b0 always equal to 0)
Data76_Init
equ %00000010 ;oC, oF low_range,0,health_off,light_on,strong_off
CtmCode_Init
equ %10101001 ;0.63ms low + 0100101 customer code (Tx LSB first)
; Frame range limit for FSL with +/- 200uS
Head_Time_Max
equ $2FA8
; Header Time Max. (8000+4000)+200 ($2FA8)
Head_Time_Min
equ $2E18
; Header Time Min. (8000+4000)-200 ($2E18)
Data0_Time_Max
equ $04B0
; Data0 Time Max. (500+500)+200 ($4B0)
Data0_Time_Min
equ $0320
; Data0 Time Min. (500+500)-200 ($320)
Data1_Time_Max
equ $0898
; Data1 Time Max. (500+1500)+200 ($898)
Data1_Time_Min
equ $0708
; Data1 Time Min. (500+1500)-200 ($708)
; ----------------------------------------------------------------------------- *
; Key_Flag bit definition
KEY_ON
equ 7
;=1 if KBI occur, =0 if key released
AC_OFF_LED
equ 3
;=0 if AC OFF
AC_ON_LED
equ 2
;=0 if AC ON
; ----------------------------------------------------------------------------- *
DEFAULT_RAM
SECTION SHORT
;
org
Key_Flag
RamStart ; $0080 ($80-$8F)
ds 1
; KEY_ON flag (1=key interrupt occur)
Auto_Mode
Cool_Mode
Humd_Mode
Wind_Mode
Heat_Mode
ds
ds
ds
ds
ds
1
1
1
1
1
;
;
;
;
;
Store
Store
Store
Store
Store
Tx_Data10
Tx_Data32
Tx_Data54
Tx_CtmCode
ds
ds
ds
ds
1
1
1
1
;
;
;
;
Nibble
Nibble
Nibble
Nibble
Data_Buffer
ds
5
; Frame Data buffers for Tx_Data10 -- Tx_CtmCode
Byte_Cnt
Bit_Cnt
ds
ds
1
1
; Byte Counter for data buffer
; Bit Counter for data buffer
Model_Tmp
ds
1
; Model Temp
wind
wind
wind
wind
wind
1-0
3-2
5-4
9-8
speed
speed
speed
speed
speed
+
+
+
+
+
Temperature
Temperature
Temperature
Temperature
Temperature
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%10010000
(Tx_Data32)=%11000000
(first 4-bit will be shift out)=%0000xxxx
=%10010000
=%00000001
(last bit will be shift out)=%x0100101
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
96
Freescale Semiconductor
Receiver Listing
;********************************************************************************
DEFAULT_ROM
SECTION
; ----------------------------------------------------------------------------- *
; Program Area
*
; ----------------------------------------------------------------------------- *
;
org
RomStart ; $DE00
; ----------------------------------------------------------------------------- *
; Subroutine Initialization : Configure register, Port, KBI & Timer
*
; In
: <nil>
*
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
;*******************************************************************************
; Entry Point
;*******************************************************************************
Entry:
main:
rsp
; initialize the stack pointer
SEI
; mask all interrupt
sta $FFFF
; Clear COP counter
; ----------------------------------------------------------------------------- *
; Port Initial
; ----------------------------------------------------------------------------- *
mov #%00000011,PTA ; Avoid false KBI by write PTA0-1 as o/p high
mov #%11111111,DDRA ; Set all port to output low except PTA0-1
; Set PTA3-7 o/p low, KBI will occur if any key
; pressed after KBI interrupt enable
clr
clr
clr
clr
PTC
PTD
PTE
PTB
; Set all port to output low
lda #$FF
; Change port data register before change data
sta DDRB
; direction register (aviod glitch)
sta DDRC
sta DDRD
sta DDRE
sta PTD
; enable LCD output
sta PTE
; enable LCD output
;********************************************************************************
; ----------------------------------------------------------------------------- *
; Configuration Register Initial
; ----------------------------------------------------------------------------- *
mov #CONFIG1_Init,CONFIG1
; CONFIG1 Initial
mov #CONFIG2_Init,CONFIG2
; CONFIG2 Initial
lda #LVISR_Init
sta LVISR
; LVI Initial
mov #INTSCR_Init,INTSCR
; IRQ Initial
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
97
Program Listing
; ----------------------------------------------------------------------------- *
; Keyboard Interrupt & PPI Initial
; ----------------------------------------------------------------------------- *
mov #HDB_Init,HDB
; PTB & PPI Clock Initial
mov #KBSCR_Init,KBSCR
; KBI & PPI Initial
mov #KBIER_Init,KBIER
; KBI & PPI Interrupt Initial
; ----------------------------------------------------------------------------- *
; Keyboard status and Mode & Tx_Data Initial
; ----------------------------------------------------------------------------- *
clr Key_Flag
; Initial Keyboard flag & value and counter
clrh
clrx
Clr_Buffer:
clr Data_Buffer,x
incx
cpx #$04
blo Clr_Buffer
lda #Auto_Mode_Init
; Initial Frame data buffer register
; Initial difference mode value
; wind speed + Temperature (Tx_Data32)
sta
sta
sta
sta
mov
Auto_Mode
Cool_Mode
Humd_Mode
Wind_Mode
#Heat_Mode_Init,Heat_Mode
mov
mov
mov
mov
#Data10_Init,Tx_Data10
; Initial Tx Data + Customer code
#Data32_Init,Tx_Data32
#Data54_Init,Tx_Data54
#CtmCode_Init,Tx_CtmCode
; ----------------------------------------------------------------------------- *
; LCD Data & Configuration Register Initial
; ----------------------------------------------------------------------------- *
clrh
clrx
lda #$FF
; default LCD pattern (All ON)
Ld_LCD_FF:
sta LDAT1,x
incx
cpx #$0D
blo Ld_LCD_FF
mov #%10101111,LDAT9
mov #%10000000,LDAT5
bclr 4,LDAT4
; OFF unused LCD segments
mov #LCDCR_Init,LCDCR
; Initial LCD
mov #LCDCLK_Init,LCDCLK
jsr Delay_500ms
jsr Delay_500ms
; All segment in LCD panel ON (1 sec)
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
98
Freescale Semiconductor
Receiver Listing
; ------------------------------------------------------------------- *
clrh
clrx
lda #$00
; default LCD pattern(All OFF except 25oC + Light)
Ld_LCD_00:
sta LDAT1,x
incx
cpx #$0A
; Reach to LDAT11?
bls Ld_LCD_00
bclr AC_OFF_LED,PTB
bset AC_ON_LED,PTB
; Turn ON "AC_OFF" LED
; Turn OFF "AC_ON" LED
; ----------------------------------------------------------------------------- *
; Remote Run after power on reset (POR) --- Waiting for Keyboard Interrupt
; ----------------------------------------------------------------------------- *
Main_Loop:
; Set T2CH0 as input capture to decode the IR receiving signal
mov #%00110000,T2SC
mov #%01001000,T2SC0
; TOF int disable, Timer stop & reset, clock=bus/1
; Int enable, input capture, falling edges
CLI
; Clear interrupt mask bit
bclr TSTOP,T2SC
bclr CH0F,T2SC0
bclr TOF,T2SC
;
;
;
;
Enable TIM2 Now
clear TSTOP, enable timer counter
clear CH0F flag
clear TOF flag
Frame_Restart:
clr Bit_Cnt
clr Byte_Cnt
wait
; waiting for IR signal OR Key pressed
brclr KEY_ON,Key_Flag,No_K_Scan
jmp
K_Scan
; Receive IR frame signal if No key
; Perfrom key scan if KBI occurred
No_K_Scan:
wait
ldhx
cphx
bhi
cphx
blo
; 8ms + 4ms
; wait for second falling edge of header
T2CH0H
; load T2CH0H to H and T2CH0L to X
#Head_Time_Max
Frame_Restart
#Head_Time_Min
Frame_Restart
(+/- 200uS) "Header" is O.K.
Rep_Data:
; Here Header is passed
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
99
Program Listing
wait
; Waiting for 1st data bit
Tst_Data0:
ldhx T2CH0H
; Store Frame counter to H:X
cphx #Data0_Time_Max
bhi
Tst_Data1
cphx #Data0_Time_Min
blo
Frame_Error
bsr
St_Data0
; 500uS + 500us (+/- 200uS) "Data0" is O.K.
bra
Tst_Next_Data
Tst_Data1:
ldhx T2CH0H
; Store Frame counter to H:X
cphx #Data1_Time_Max
bhi
Frame_Error
cphx #Data1_Time_Min
blo
Frame_Error
bsr
St_Data1
; 500uS + 1500us (+/- 200uS) "Data1" is O.K.
Tst_Next_Data:
lda Byte_Cnt
cmp #$04
blo Rep_Data
; Is all Data received ?
bra St_Data_End
Frame_Error:
; Insert any action in here if needed
bra Frame_Restart
; Restart Frame if error occurred
;---------------------------------------------------------------St_Data0:
; Store Data0 to buffer
clrh
ldx
Byte_Cnt
clc
ror
Data_Buffer,x
; X = Byte_Cnt
inc
Bit_Cnt
lda
Bit_Cnt
cmp
#$08
blo
Bit_Cnt_No_Inc0
clr
Bit_Cnt
inc
Byte_Cnt
Bit_Cnt_No_Inc0:
rts
;---------------------------------------------------------------St_Data1:
; Store Data1 to buffer
clrh
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
100
Freescale Semiconductor
Receiver Listing
ldx
Byte_Cnt
sec
ror
Data_Buffer,x
; X = Byte_Cnt
inc
Bit_Cnt
lda
Bit_Cnt
cmp
#$08
blo
Bit_Cnt_No_Inc1
clr
Bit_Cnt
inc
Byte_Cnt
Bit_Cnt_No_Inc1:
rts
;---------------------------------------------------------------St_Data_End:
clrh
ldx
lda
and
sta
#$02
Data_Buffer,x
#%11110000
Model_Tmp
; Load Data_Buffer(Tx_Data54)
; Mask all bit except Model #
lda
and
cmp
Tx_Data54
#%11110000
Model_Tmp
; Mask all bit except Model #
bne
Frame_Error
; Restart Rx frame if model wrong
lda
cmp
bne
ldx
#$03
Data_Buffer,x
#CtmCode_Init
Frame_Error
clrh
clrx
Update_Buffer:
lda
Data_Buffer,x
sta
Tx_Data10,x
incx
cpx
#$04
blo
Update_Buffer
; Load Data_Buffer(Tx_CtmCode)
; Restart Rx frame if cmt code wrong
; Here Model & customer code are O.K.
; Update Frame from Data buffer
Key_Action:
bclr
KEY_ON,Key_Flag
; Clear KEY_ON flag
jsr
LCD_Update
; Update LCD display
jmp
Frame_Restart
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
101
Program Listing
; ----------------------------------------------------------------------------; Keyboard Scan Routine
; In
: <Key_Flag>
; Out
: <Key_Value>
; Call
: <nil>
; ----------------------------------------------------------------------------K_Scan:
; Key location and expect KEY_ON=1
SEI
; Interrupt mask enable
lda #$0A
jsr Delay_Hms
; 10*0.5ms
; Delay 5ms for Key Debounce
mov #%11111100,DDRA
; Set PTA0 & PTA1 as i/p
*
*
*
*
*
*
brset 0,PTA,Chk_PTA1
Chk_PTA0:
lda #$0A
jsr Delay_Hms
; 10*0.5ms
; Delay 5ms for Key Debounce
brset 0,PTA,Bad_Key
brclr 7,Tx_Data10,SW_ON ; A/C OFF
bclr
bra
7,Tx_Data10
; A/C ON => A/C OFF
Key_Action
SW_ON:
bset 7,Tx_Data10
bra
; A/C OFF => A/C ON
Key_Action
Chk_PTA1:
brset 1,PTA,Bad_Key
lda #$0A
jsr Delay_Hms
; 10*0.5ms
; Delay 5ms for Key Debounce
brset 1,PTA,Bad_Key
clrh
lda Tx_Data54
nsa
and #%00001111
tax
cpx #$09
blo Inc_Model
clrx
bra Dec_Model
Inc_Model:
incx
; Reach Max Model 9?
; Lower than Model 9
; Reset Timer Pointer to Min(Model 0)
; Increase Timer setting
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
102
Freescale Semiconductor
Receiver Listing
Dec_Model:
lda $F030,x
sta Tx_Data54
; Load Data54 Table
; Update Data54 (4.3=1)
Bad_Key:
CLI
bra
; Interrupt mask disable
Key_Action
; ----------------------------------------------------------------------------; Subroutine <500ms Delay>
; Bus Clock = 1MHz, 1 Cycle=1uS
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------Delay_500ms:
LDX #$C8
; [2]200
Delay_Yms_X
LDA #$FA
; [2]250
Delay_Yms_A
sta $FFFF
; [4] clear COP
nop
; [1]
nop
; [1]
nop
; [1]
dbnza Delay_Yms_A
; [3] 10*{A}=10A
dbnzx Delay_Yms_X
; [3] 10A*{X}+2+3=10AX+2+3
rts
; [3]
*
*
*
*
*
*
*
;Total= {[2]+[2]+10AX+[3]}*Bus Cycle
;Total= [7+(10*200*250)]*1uS = 500mS
; ----------------------------------------------------------------------------; Subroutine <Hms Delay>
; Bus Clock = 1MHz, 1 Cycle=1uS
; In
: Acc
; Out
: <nil>
; Call
: <nil>
; Remark : (0.5mS * A) Delay
; ----------------------------------------------------------------------------Delay_Hms:
Delay_Hms_A:
LDX #$31
Delay_Hms_X:
sta $FFFF
nop
nop
nop
dbnzx Delay_Hms_X
dbnza Delay_Hms_A
rts
*
*
*
*
*
*
*
*
; [2]49
;
;
;
;
;
;
;
[4]
[1]
[1]
[1]
[3]
[3]
[3]
clear COP
10*{X}=10X
10X*{A}+2+3=10AX+5
2+10XA+5+3=10XA+10
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
103
Program Listing
;Total= {10AX+[10]}*Bus Cycle
;Total= [10+(10*49*A)]*1uS = 500uS*A =A*0.5mS
; ------------------------------------------------------------------------------; ----------------------------------------------------------------------------- *
; LCD Data Update Subroutine (Depend on key value and then Tx Data)
; ----------------------------------------------------------------------------- *
LCD_Update:
jsr
jsr
jsr
jsr
jsr
jsr
LCD_N2_Chk
LCD_N3_Chk
LCD_N45_Chk
LCD_N67_Chk
LCD_N1_Chk
LCD_N2_Sleep
;
;
;
;
;
;
LCD
LCD
LCD
LCD
LCD
ALL
based on N2
based on N3
based on N4 & N5
based on N6 & N7
based on N1
LCD OFF if sleep mode enable
rts
; ----------------------------------------------------------------------------- *
LCD_N1_Chk:
brclr 7,Tx_Data10,L_AC_OFF
; Here AC ON
bclr AC_ON_LED,PTB
bset AC_OFF_LED,PTB
lda Tx_Data10
and #%01110000
cmp #%00000000
beq LCD_Auto_Mode
cmp #%00010000
beq LCD_Cool_Mode
cmp #%00100000
beq LCD_Humd_Mode
cmp #%00110000
beq LCD_Wind_Mode
LCD_Heat_Mode:
bclr 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bclr 7,LDAT9
bset 2,LDAT10
rts
LCD_Auto_Mode:
bset 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Cool_Mode:
bclr 3,LDAT10
bset 1,LDAT10
bclr 0,LDAT10
; Turn on "AC_ON" LED
; Turn off "AC_OFF" LED
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Mask all bit except bit4-6
Is bit4-6 = %000
Go to Auto mode if true
Is bit4-6 = %001
Go to Cool mode if true
Is bit4-6 = %010
Go to Humd mode if true
Is bit4-6 = %011
Go to Wind mode if true
Otherwise go to Heat mode (%100 - %111)
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
;
;
;
;
;
AUTO ON
COOL OFF
DRY OFF
WIND OFF
HEAT OFF
; AUTO OFF
; COOL OFF
; DRY OFF
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
104
Freescale Semiconductor
Receiver Listing
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Humd_Mode:
bclr 3,LDAT10
bclr 1,LDAT10
bset 0,LDAT10
bclr 7,LDAT9
bclr 2,LDAT10
rts
LCD_Wind_Mode:
bclr 3,LDAT10
bclr 1,LDAT10
bclr 0,LDAT10
bset 7,LDAT9
bclr 2,LDAT10
rts
; WIND OFF
; HEAT ON
;
;
;
;
;
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
;
;
;
;
;
AUTO OFF
COOL OFF
DRY OFF
WIND OFF
HEAT ON
L_AC_OFF:
bsr
LCD_All_OFF
bset AC_ON_LED,PTB
bclr AC_OFF_LED,PTB
; Turn off "AC_ON" LED
; Turn on "AC_OFF" LED
rts
; --------------------------- *
LCD_N2_Sleep:
brclr 3,Tx_Data32,L_Sleep_OFF
LCD_All_OFF:
clrh
clrx
clra
; ALL LCD OFF if sleep mode
Ld_LCD_OFF:
sta LDAT1,x
incx
cpx #$0D
blo Ld_LCD_OFF
L_Sleep_OFF:
rts
; ----------------------------------------------------------------------------- *
LCD_N2_Chk:
; --------------------------- *
LCD_N2_Swing:
brclr 2,Tx_Data32,L_Swing_OFF
brclr 7,Tx_Data10,L_Swing_OFF ; Swing OFF if AC OFF
; Here AC ON
bset 3,LDAT3
bra LCD_N2_Wind_Speed
; A.M.WIND ON
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
105
Program Listing
L_Swing_OFF:
bclr 3,LDAT3
; --------------------------- *
LCD_N2_Wind_Speed:
; A.M.WIND OFF
brclr 7,Tx_Data10,L_Wind_OFF ; Wind Speed OFF if AC
; Here AC ON
lda Tx_Data32
and #%00000011
; Mask all except bit0-1
cmp #%00000000
; Is Bit0-1 = %00
beq L_Wind_Auto
; Go to Wind Auto if true
cmp #%00000001
; Is Bit0-1 = %01
beq L_Wind_Low
; Go to Wind Low if true
cmp #%00000010
; Is Bit0-1 = %10
beq L_Wind_Mid
; Go to Wind Mid if true
L_Wind_High:
; Otherwise go to Wind High
bset 4,LDAT3
; Max Wind ON
mov #%00000111,LDAT6
; AUTO OFF, FAN, Min Wind &
rts
L_Wind_Low:
bclr 4,LDAT3
; Max Wind OFF
mov #%00000110,LDAT6
; FAN & Min Wind ON, AUTO &
rts
L_Wind_Mid:
bclr 4,LDAT3
; Max Wind OFF
mov #%00000111,LDAT6
; FAN & Min Wind & Mid Wind
rts
L_Wind_Auto:
bclr 4,LDAT3
; Max Wind OFF
mov #%00001100,LDAT6
; FAN & AUTO ON, Min Wind &
rts
OFF
(%11)
Mid Wind ON
Mid Wind OFF
ON, AUTO OFF
Mid Wind OFF
L_Wind_OFF:
bclr 4,LDAT3
clr LDAT6
; All OFF if AC OFF
rts
; ----------------------------------------------------------------------------- *
LCD_N3_Chk:
brclr 7,Tx_Data10,L_N3_AC_OFF
L_N3_AC_ON:
lda Tx_Data10
and #%01110000
cmp #%00000000
beq L_N3_Auto_oC
bra L_N3_oC_ON
L_N3_Auto_oC:
clr LDAT7
clr LDAT8
rts
; Here AC ON
; Mask all bit except bit4-6
; Is bit4-6 = %000
; Go to Auto mode if true
; XXoC OFF in AUTO mode
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
106
Freescale Semiconductor
Receiver Listing
L_N3_AC_OFF:
L_N3_oC_ON:
; Here AC OFF
clrh
lda Tx_Data32
and #%11110000
nsa
tax
; Store N3 as Index
lda $F000,x
sta LDAT8
aix #$10
lda $F000,x
sta LDAT7
rts
; ----------------------------------------------------------------------------- *
LCD_N45_Chk:
brset 3,Tx_Data54,L_MODEL_ON
L_MODEL_OFF:
bclr 7,LDAT5
bra L_7SEG_CHK
; MODEL ON to OFF
L_MODEL_ON:
bset 7,LDAT5
bra L_7SEG_CHK
; --------------------------- *
L_7SEG_CHK:
; MODEL ON to OFF
clrh
;
lda Tx_Data54
nsa
;
and #%00001111
;
tax
lda $F020,x
;
sta LDAT4
;
; --------------------------- *
bset 7,LDAT5
; Flash if Model Set
Update 5.3-5.0 7-Segment
swrap N5 to lower nibble
mask N4 (Force bit 4-7 =0)
Load 7-segment data
Display x(0-9)
; MODEL ON
rts
; ----------------------------------------------------------------------------- *
LCD_N67_Chk:
; Only 6.1 need to check
brclr 1,Tx_Data10,L_Light_OFF
bset 0,LDAT3
; "light" ON (M.WIND)
bra L_Light_END
L_Light_OFF:
bclr 0,LDAT3
; "light" OFF (M.WIND)
L_Light_END:
brclr 7,Tx_Data10,L_N7_AC_OFF
; Check AC ON/OFF?
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
107
Program Listing
L_N7_AC_ON:
lda Tx_Data10
and #%01110000
beq L_C_OFF
; mask off except 1.2, 1.1, 1.0
bra L_N7_AC_OFF
L_C_OFF:
bclr 4,LDAT8
bra L_N67_END
L_N7_AC_OFF:
bset 4,LDAT8
L_N67_END:
rts
; oC OFF if in AC ON & Auto mode
; oC ON if AC OFF
; ----------------------------------------------------------------------------; Program Interrupt Service Routine Area
; ----------------------------------------------------------------------------;
org
$EE00
; ----------------------------------------------------------------------------; DMY_ISR - dummy Interrupt Service Routine (with no operation)
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------DMY_ISR:
nop
rti
; ----------------------------------------------------------------------------; Timer Interrupt Service Routine
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; ----------------------------------------------------------------------------T1M0_ISR:
; Unused
bclr CH0F,T1SC0
; clear CH0F flag in TIM1
rti
; ----------------------------------------------------------------------------T2M0_ISR:
; As TIM2 Input capture
mov
bclr
bclr
bclr
#%00110000,T2SC
TSTOP,T2SC
CH0F,T2SC0
TOF,T2SC
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
; TOF int disable, Timer stop & reset, clock=bus/1
; clear TSTOP, enable timer counter
; clear CH0F flag
rti
; ----------------------------------------------------------------------------- *
T1M1_ISR:
; Unused
bclr CH1F,T1SC1
; clear CH1F flag in TIM1
rti
; ----------------------------------------------------------------------------- *
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
108
Freescale Semiconductor
Receiver Listing
T2M1_ISR:
; Unused
bclr CH1F,T2SC1
; clear CH1F flag in TIM2
rti
; ----------------------------------------------------------------------------- *
T1OF_ISR:
; Unused
bclr TOF,T1SC
; clear TIM1 TOF flag in TIM1
rti
; ----------------------------------------------------------------------------- *
T2OF_ISR:
; Unused
bclr TOF,T2SC
; clear TIM2 TOF flag in TIM2
rti
; ----------------------------------------------------------------------------; KBI_ISR - Keyboard & PPI Interrupt Service Routine
; In
: <nil>
; Out
: <nil>
; Call
: <nil>
; Remark : Either PPI or KBI enable at the same time
; ----------------------------------------------------------------------------KBI_ISR:
lda PTA
eor #%00000100
sta PTA
*
*
*
*
*
*
*
; Toggles PTA2 when KBI interrupt present
; For Debug
PPI_CHK:
brset PPI1L,HDB,PPI_ACK
bra KBI_ACK
; check PPI interrupt flag
; If not a PPI interrupt, jump to KBI_ACK
PPI_ACK:
bset ACKK,KBSCR
brset PPI1L,HDB,PPI_ACK
; clear PPI1L flag by set ACKK bit
; check PPI int flag clear
rti
KBI_ACK:
bset KEY_ON,Key_Flag
bset ACKK,KBSCR
; Set KEY_ON flag
; clear PPI1L flag by set ACKK bit
rti
; ----------------------------------------------------------------------------- *
; LVI_ISR - LVI Interrupt Service Routine
*
; In
: <nil>
*
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
LVI_ISR:
lda #%01010000
sta LVISR
; clear LVI int. flag (Cannot use bset 4,LVISR)
rti
; Cannot use "bset 4,LVISR" due to LVISR = $FE0F)
; ----------------------------------------------------------------------------- *
; IRQ_ISR - IRQ Interrupt Service Routine
*
; In
: <nil>
*
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
109
Program Listing
; Out
: <nil>
*
; Call
: <nil>
*
; ----------------------------------------------------------------------------- *
IRQ_ISR:
bset 2,INTSCR
; CLEAR IRQF
rti
; ----------------------------------------------------------------------------- *
; Program Look Up Table Area (For LCD #1)
*
; ----------------------------------------------------------------------------- *
org
$F000
;$F000-$F01F
; ----------------------------------------------------------------------------- *
; LCD oC Display Lookup Table
;
FCB
FCB
FCB
FCB
FCB
ABC%XGED
%01110000
%01110000
%01110000
%01110000
%01110000
;
;
;
;
;
;
10th digit of oC (%=oC & TEMP always ON, X always OFF)
Digit 1 (B,C)
[X=$00]
Digit 1 (B,C)
[X=$01]
Digit 1 (B,C)
[X=$02]
Digit 1 (B,C)
[X=$03]
Digit 1 (B,C)
[X=$04]
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
%11010111
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
2
2
2
2
2
2
2
2
2
2
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
(A,B,D,E,G)
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
[X=$0A]
[X=$0B]
[X=$0C]
[X=$0D]
[X=$0E]
FCB %11110101
; Digit 3 (A,B,C,D,G)
[X=$0F]
; ------------------------------------------------------------------- *
;
ABCXFGED
; 1st digit of oC (X always OFF)
FCB %10101101
; Digit 5 (A,C,D,F,G)
[X=$00+$10]
FCB %10101111
; Digit 6 (A,C,D,E,F,G)
[X=$01+$10]
FCB %11100000
; Digit 7 (A,B,C)
[X=$02+$10]
FCB %11101111
; Digit 8 (A,B,C,D,E,F,G) [X=$03+$10]
FCB %11101101
; Digit 9 (A,B,C,D,F,G)
[X=$04+$10]
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%11101011
%01100000
%11000111
%11100101
%01101100
%10101101
%10101111
%11100000
%11101111
%11101101
FCB %11101011
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
0
1
2
3
4
5
6
7
8
9
(A,B,C,D,E,F)
(B,C)
(A,B,D,E,G)
(A,B,C,D,G)
(B,C,F,G)
(A,C,D,F,G)
(A,C,D,E,F,G)
(A,B,C)
(A,B,C,D,E,F,G)
(A,B,C,D,F,G)
; Digit 0 (A,B,C,D,E,F)
[X=$05+$10]
[X=$06+$10]
[X=$07+$10]
[X=$08+$10]
[X=$09+$10]
[X=$0A+$10]
[X=$0B+$10]
[X=$0C+$10]
[X=$0D+$10]
[X=$0E+$10]
[X=$0F+$10]
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
110
Freescale Semiconductor
Receiver Listing
; ----------------------------------------------------------------------------- *
org
$F020
;$F020-$F029
; ----------------------------------------------------------------------------- *
; Model Number Setting Display Lookup Table
;
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
ABCXFGED
%11101011
%01100000
%11000111
%11100101
%01101100
%10101101
%10101111
%11100000
%11101111
%11101101
;
;
;
;
;
;
;
;
;
;
;
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
Digit
0
1
2
3
4
5
6
7
8
9
(A,B,C,D,E,F)
(B,C)
(A,B,D,E,G)
(A,B,C,D,G)
(B,C,F,G)
(A,C,D,F,G)
(A,C,D,E,F,G)
(A,B,C)
(A,B,C,D,E,F,G)
(A,B,C,D,F,G)
[X=$00]
[X=$01]
[X=$02]
[X=$03]
[X=$04]
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
; ----------------------------------------------------------------------------- *
org
$F030
;$F030-$F039
; ----------------------------------------------------------------------------- *
; Key Press Model Setting Lookup Table
; from Model 0(x=00) to Model 9 (X=09);
; ----------------------------------------------- *
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
FCB
%00001000
%00011000
%00101000
%00111000
%01001000
%01011000
%01101000
%01111000
%10001000
%10011000
;
;
;
;
;
;
;
;
;
;
0
1
2
3
4
5
6
7
8
9
Model
Model
Model
Model
Model
Model
Model
Model
Model
Model
[X=$00]
[X=$01]
[X=$02]
[X=$03]
[X=$04]
[X=$05]
[X=$06]
[X=$07]
[X=$08]
[X=$09]
; ----------------------------------------------------------------------------- *
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
Freescale Semiconductor
111
Program Listing
Multi-Button IR Remote Control using the MC68HC908LT8, Rev. 0
112
Freescale Semiconductor
How to Reach Us:
Home Page:
www.freescale.com
E-mail:
support@freescale.com
USA/Europe or Locations Not Listed:
Freescale Semiconductor
Technical Information Center, CH370
1300 N. Alma School Road
Chandler, Arizona 85224
+1-800-521-6274 or +1-480-768-2130
support@freescale.com
Europe, Middle East, and Africa:
Freescale Halbleiter Deutschland GmbH
Technical Information Center
Schatzbogen 7
81829 Muenchen, Germany
+44 1296 380 456 (English)
+46 8 52200080 (English)
+49 89 92103 559 (German)
+33 1 69 35 48 48 (French)
support@freescale.com
Japan:
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F
1-8-1, Shimo-Meguro, Meguro-ku,
Tokyo 153-0064
Japan
0120 191014 or +81 3 5437 9125
support.japan@freescale.com
Asia/Pacific:
Freescale Semiconductor Hong Kong Ltd.
Technical Information Center
2 Dai King Street
Tai Po Industrial Estate
Tai Po, N.T., Hong Kong
+800 2666 8080
support.asia@freescale.com
For Literature Requests Only:
Freescale Semiconductor Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217
1-800-441-2447 or 303-675-2140
Fax: 303-675-2150
LDCForFreescaleSemiconductor@hibbertgroup.com
DRM082
Rev. 0, 09/2006
RoHS-compliant and/or Pb-free versions of Freescale products have the functionality
and electrical characteristics of their non-RoHS-compliant and/or non-Pb-free
counterparts. For further information, see http://www.freescale.com or contact your
Freescale sales representative.
For information on Freescale’s Environmental Products program, go to
http://www.freescale.com/epp.
Information in this document is provided solely to enable system and software
implementers to use Freescale Semiconductor products. There are no express or
implied copyright licenses granted hereunder to design or fabricate any integrated
circuits or integrated circuits based on the information in this document.
Freescale Semiconductor reserves the right to make changes without further notice to
any products herein. Freescale Semiconductor makes no warranty, representation or
guarantee regarding the suitability of its products for any particular purpose, nor does
Freescale Semiconductor assume any liability arising out of the application or use of any
product or circuit, and specifically disclaims any and all liability, including without
limitation consequential or incidental damages. “Typical” parameters that may be
provided in Freescale Semiconductor data sheets and/or specifications can and do vary
in different applications and actual performance may vary over time. All operating
parameters, including “Typicals”, must be validated for each customer application by
customer’s technical experts. Freescale Semiconductor does not convey any license
under its patent rights nor the rights of others. Freescale Semiconductor products are
not designed, intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or sustain life,
or for any other application in which the failure of the Freescale Semiconductor product
could create a situation where personal injury or death may occur. Should Buyer
purchase or use Freescale Semiconductor products for any such unintended or
unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and
its officers, employees, subsidiaries, affiliates, and distributors harmless against all
claims, costs, damages, and expenses, and reasonable attorney fees arising out of,
directly or indirectly, any claim of personal injury or death associated with such
unintended or unauthorized use, even if such claim alleges that Freescale
Semiconductor was negligent regarding the design or manufacture of the part.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
All other product or service names are the property of their respective owners.
© Freescale Semiconductor, Inc. 2006. All rights reserved.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising