Freescale Semiconductor S08 User Manual

S08 Microcontrollers
freescale.com
LED Lighting Control Using the MC9S08AW60
Designer Reference Manual
DRM093 Rev. 1 07/2007
LED Lighting Control using the MC9S08AW60
Designer Reference Manual
by: Dennis Lui, Ernest Chan
Freescale Semiconductor, Inc. Hong Kong
To provide the most up-to-date information, the revision of our documents on the World Wide Web is the most current. Your printed copy may be an earlier revision. To verify 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
03/2006 0 Initial release N/A
07/2007 1 Overall edits for grammar, spelling, structure, and style. N/A
Freescale Semiconductor 3
Revision
Level
Description
LED Lighting Control using the MC9S08AW60, Rev. 1
Page
Number(s)
Revision History
LED Lighting Control using the MC9S08AW60, Rev. 1
4 Freescale Semiconductor

Table of Contents

Chapter 1
Introduction
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 MC9S08AW60 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Chapter 2
Hardware Description
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 DEMO9S08AW60LED Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 DEMO9S08AW60LED Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Development Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Reset Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7 Clock Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.8 RS-232 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9 User Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9.1 Pushbutton Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9.2 LED Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9.3 ADC Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9.4 Other I/O Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.10 LED Driving Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.11 LED Driver Design Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.11.1 RGB LED Chip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.11.2 Current Sense Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.11.3 Boost Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 3
Firmware Description
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 PC Control Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3 Standalone Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.4 Firmware Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 4
Demo Setup
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 Hardware and Software Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.1 Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.2 PC Software Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Demo Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
LED Control using the MC9S08AW60, Rev. 1
Freescale Semiconductor 5
Table of Contents
4.3.1 Demo 1 - Demonstration Display . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3.2 Demo 2 - Preset Colors Display . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3.3 Demo 3 - Auto White Balance Control . . . . . . . . . . . . . . . . . . . . . 32
4.3.4 Demo 4 - PWM Output Frequency Control . . . . . . . . . . . . . . . . . . 32
4.3.5 Demo 5 - Full Manual Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4 Program the MCU Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Appendix A Schematics Appendix B
Bill of Materials
LED Control using the MC9S08AW60, Rev. 1
6 Freescale Semiconductor

Chapter 1 Introduction

1.1 Introduction

This manual describes a reference design of a multi-color LED lighting control solution by using the MC9S08AW60 Microcontroller.
Using a microcontroller (MCU) to control the red/green/blue (RGB) color LEDs increases system flexibility and functionality for the next generation of lighting applications, architectural/entertainment lighting or LCD backlighting, that require a smart and adaptive control methodology to ensure optimized color space rendering for various display contents, excellent color contrast for realistic display scene and a consistent color setting in manufacturing. In many cases, these new applications are controlled by a central control unit that requires a connectivity interface that can be implemented at a low cost using MCU-based lighting controller.
A compact light-box with more than a million display colors is implemented to demonstrate the advantages of using MCU to control RGB color LEDs with different luminosity settings. The average current through each color LED is controlled by an individual PWM signal generated from MCU and the LED luminosity is almost in linear relationship with the pulse width of the driving PWM signal. The final display color is determined on the mix of light emitted by RGB LEDs, so one of the simple methods to set the light source in different color is changing the RGB PWM duty cycles equal to the corresponding mixing ratio required for a particular color. In addition, a serial control protocol with user interface is also developed as a communication link to control and monitor system parameters through a personal computer.
All hardware schematic diagrams and firmware source codes are available as reference materials.

1.2 Features

Apply for architectural/entertainment lighting or LCD backlighting applications
Exceptional color mixing
Pre-set or dynamic RGB colors
High resolution on dimming control
Automatic white balance tracking on dimming
Flexible connectivity interface
User friendly control menu
LED Lighting Control using the MC9S08AW60, Rev. 1
Freescale Semiconductor 7
Introduction
PWM
SCI
KBI
AW60
RGB PWM
ADC
Button Switch Detection
GPIO Port
RS232
Interface
To PC
Power Supply & Regulator
DC/DC
Converter
Blue LEDs
I/O Control
Red LEDs
Green LEDs
PWM
SCI
KBI
AW60
RGB PWM
ADC
Button Switch Detection
GPIO Port
RS232
Interface
To PC
Power Supply & Regulator
DC/DC
Converter
Blue LEDs
I/O Control
Red LEDs
Green LEDs

1.3 System Overview

A block diagram of the system is shown in Figure 1-1.
Figure 1-1 . System Block Diagram

1.4 MC9S08AW60

The MC9S08AW60, MC9S08AW48, MC9S08AW32, and MC9S08AW16 are members of the low-cost, high-performance HCS08 family of 8-bit microcontroller units (MCUs). All MCUs in the family use the enhanced HCS08 core and are available with a variety of modules, memory sizes, memory types, and package types. Refer to Table 1-1 for memory sizes and package types.
Table 1-2 summarizes the peripheral availability per package type for the devices available in the
MC9S08AW60/48/32/16 series.
Table 1-1. Devices in the MC9S08AW60/48/32/16 Series
Device Flash RAM Package
MC9S08AW60 63,280
MC9S08AW48 49,152
MC9S08AW32 32,768
MC9S08AW16 16,384 1024
2048
64 QFP
64 LQFP
48 QFN
44 LQFP
LED Lighting Control using the MC9S08AW60, Rev. 1
8 Freescale Semiconductor
Table 1-2. Peripherals Available per Package Type
Package Options
Feature 64-Pin 48-Pin 44-Pin
ADC 16-CH 8-CH 8-CH
IIC Yes Yes Yes
IRQ Yes Yes Yes
KBI1 8 7 6
S C I 1 Ye s Ye s Ye s
S C I 2 Ye s Ye s Ye s
SPI1 Yes Yes Yes
TPM1 6-CH 4-CH 4-CH
TPM1CLK Yes No No
TPM2 2-CH 2-CH 2-CH
TPM2CLK Yes No No
MC9S08AW60
I/O Pins 54 38 34
LED Lighting Control using the MC9S08AW60, Rev. 1
Freescale Semiconductor 9
Introduction
LED Lighting Control using the MC9S08AW60, Rev. 1
10 Freescale Semiconductor
Chapter 2
AW60 Control Board
RGB LED Driving Board
Hardware Description

2.1 Introduction

The system consists of a MCU control board and a LED driving board. The MCU control board, DEMO9S08AW60LED, is one of the demonstration boards for the Freescale MC9S08AW60. This board allows easier developmet of code for LED control applications, architectural/entertainment lighting or LCD backlighting. The on-board serial interface allows you to control and monitor the system status via the RS232 serial port connection. The separated LED light-box with driving circuitries is also available as a whole demo kit to demonstrate how to do the color mixing and see the visual effects on changing different type of parameter settings.
Figure 2-1. Light-Box Demo
LED Lighting Control using the MC9S08AW60, Rev. 1
Freescale Semiconductor 11
Hardware Description

2.2 DEMO9S08AW60LED Features

MC9S08AW60 CPU – 44 pin LQFP package – 20 MHz Internal Bus Frequency – 60 Kbytes of on-chip in-circuit programmable FLASH – 2 Kbytes of on-chip RAM – 8-channel, 10-bit analog-to-digital converter – Two SCI modules – SPI module
2
–I
C module – 6-pin keyboard interrupt (KBI) module – 34 general-purpose input/output (I/O) pins
External power jack for DC power supply (+12 VDC)
Four pushbutton user switches
Four LEDs connected to I/O port
Master reset switch
RGB PWM output port
Optical sensor input port
On-board RS-232 serial port
100mm x 80mm board size

2.3 DEMO9S08AW60LED Layout

Figure 2-2. DEMO9S08AW60LED Top Side
LED Lighting Control using the MC9S08AW60, Rev. 1
12 Freescale Semiconductor
Development Support

2.4 Development Support

Application development and debug for the MC9S08AW60 is supported through a 6-pin BDM header (CON8). The pinout is as follows:
Table 2-1. BDM Connector (CON8) Pinout
BKGD 1 2 GND
NC 3 4 RESET
NC 5 6 V
DD

2.5 Power

The DEMO9S08AW60LED is powered externally through the barrel connector CON2. This connector is a 2.5 mm, center positive connector. Voltage supplied through this connector should be positive 12 volts DC. This is also the supply voltage for the LED light box.
The DEMO9S08AW60LED can be run with V
set to 5 or 3 volts. To run the board at 3V, move jumper
DD
JP1 to the 1-2, 3V position.
LED D5 turns green to let you know that power has been correctly applied to the board.

2.6 Reset Switch

The reset switch (SW5) provides a way to apply a reset to the MCU. The reset switch is connected directly to the RESET
signal of the MCU. A 10 kΩ pullup resistor to VDD on the RESET signal allows for normal operation. When the reset switch is pressed, the RESET signal is grounded and the MCU recognizes a reset.

2.7 Clock Source

An on-board 16 MHz crystal (X1) is connected between the XTAL and EXTAL pins of the MCU. This offers flexibility on clock source selection. Refer to the MC9S08AW60 data sheet for details on how to use the internal clock generation (ICG) module to generate the system clocks for the MCU.

2.8 RS-232

An RS-232 translator provides RS-232 communication on COM connector P2. This connector is a 9-pin Dsub right angle connector. TXD and RXD signals are routed from the MCU to the RS-232 transceiver.
Table 2-2 . RS-232 Connections
MCU Port COM Signal I/O Port Connector
PTE0/TXD1 TXD OUT P2-2
PTE1/RXD1 RXD IN P2-3
LED Lighting Control using the MC9S08AW60, Rev. 1
Freescale Semiconductor 13
Hardware Description

2.9 User Options

The DEMO9S08AW60LED includes various input and output devices to assist in application development. These devices include four pushbutton switches, four LEDs, and an operational amplifier with RC filter connected at each ADC input channel for signal amplification and filtering.

2.9.1 Pushbutton Switches

Four pushbutton switches provide momentary active low input for user applications. The table below describes the pushbutton switch connections.
Table 2-3. Pushbutton Switches (SW1-SW4) Connections
Switch MCU Port
SW1 PTG0/KBI0
SW2 PTG1/KBI1
SW3 PTG2/KBI2
SW4 PTG3/KBI3

2.9.2 LED Indicators

Four green LED indicators (D1-D4) are provided to assist during code development. The LEDs are active low and illuminated when a logic low signal is driven from the MCU port pin. Two of the LEDs are connected to port A, and the other two are connected to Port C. The connections are described below:
Table 2-4. LEDs (D1-D4) Connections
LED MCU Port
D1 PTA0
D2 PTA1
D3 PTC2
D4 PTC4

2.9.3 ADC Interface

Eight operational amplifiers are provided to assist users in developing applications with feedback control signals. For examples, the signal generated by an optical sensor in LED backlight system should be scaled to a level matched with the ADC input range without any saturation. Each operational amplifier can be configured as an inverting or non-inverting amplifier with variable gain setting by different resistor connections. A RC filter is also connected at each output for noise filtering.
NOTE
The maximum operational amplifier output voltage should be limited to the
V
voltage applied to MCU to prevent any damage on input port.
DD
LED Lighting Control using the MC9S08AW60, Rev. 1
14 Freescale Semiconductor
Loading...
+ 32 hidden pages