Freescale Semiconductor Document Number: AN3415 Application Note Rev. 0, 03/2007

OLED Display Driver for the HCS08 Family OLED Driver Demonstration for 4 Bits-per-Pixel Displays by: Wolfgang Bihlmayr Systems Engineering Munich, Germany

This application note describes how to interface an Contents HCS08 device to an OLED display. Organic 1 OLED Display Description ...... 2 light-emitting diode (OLED) displays can provide a 1.1 Basic Operation...... 3 1.2 Command Description...... 5 graphical user interface to various applications. They can 1.3 Power Up / Power Down Sequence ...... 10 be found in television screens, MP3 players, portable 1.4 Display Initialization...... 11 2 Hardware ...... 13 meters (electrical, medical), home automation 2.1 OLED Daughter Card ...... 13 equipment (thermostats, alarm controls), mobile phones, 2.2 Setup with DEMO9S08QG8 Board ...... 14 vending machines, coffee machines, white goods, etc. 2.3 Setup with DEMO9S08AW60 Board ...... 15 3 and CodeWarrior‘ Development Tool ...... 15 The code was written for MCUs with limited RAM and 3.1 OLED Driver Software Description ...... 18 4 Demo Functionality ...... 23 , with a minimum of I/Os used to drive an 4.1 MC9S08QG8 Example Demo ...... 24 OSRAM Pictiva™ 128x64 OLED Display, Elegance 4.2 9S08AW60 Example Demo...... 25 5 Image format and BMP2C.EXE Utility ...... 27 Yellow with 16 gray scales (Part No. 6 Font Format ...... 28 OS128064PK27MY0B00). The code is provided as a zip 7 Conclusion...... 31 file, AN3415SW.zip, and can be downloaded from the 8 References ...... 32 Appendix AOLED Daughter Card ...... 33 Freescale website, www.freescale.com. The example A.1 Schematics ...... 33 code can be easily modified for other OLED displays. A.2 Layout ...... 34 A.3 OLED Daughter Card BOM (Bill of Materials) . . . . 37 A hardware daughter card is also described. The card A.4 DEMO9S08QG8 Board ...... 39 A.5 DEMO9S08AW60 Board...... 40 layout allows either the Freescale DEMO9S08AW60 board or the DEMO9S08QG8 board to to interface the

© Freescale Semiconductor, Inc., 2007. All rights reserved. OLED Display Description

OLED. The OLED daughter card contains the interface, a DC/DC converter to provide the OLED voltage (12 V), and the actual OLED display itself. The OLED displays are a self-emissive technology that typically require less power than LCDs with backlights. Only an “on” pixel consumes power. This feature makes OLED displays suitable for battery-powered devices. Advantages of OLED displays: • Less power than LCDs — Better for portable/handheld applications • Self-emissive technology • Vivid color — High brightness and contrast • Video capability • Wide viewing angle • Thin form factor — No backlight required • Long-lasting lifetime — Up to 55,000 hours • Monochrome (yellow, orange, green, white, blue) with one- or four-bit gray-scale capability • Full color capability

1 OLED Display Description The OLED display used in this application note offers a parallel- or serial-interface-connection option. The BS1 and BS2 pins are used to select the interface to be used. In this example only the serial interface is used (Figure 1).

15 2 D/C VCC

17 21 CS VDD 11 29 SDIN OLED Module VSS

12 SCLK COMH 3 IREFH 4 16 RST BS1 BS2 VSL 30

20 21

Figure 1. OLED Module Interface (Serial Mode) The main advantage of using the serial interface rather than the parallel interface is the number of I/Os required to drive the display. For the serial interface, only 5 I/Os (D/C, CS, SDIN, SCLK, RST) are required, compared with 13 I/Os (D/C, CS, R/W, E/RD, D0:D7, RST) for the parallel interface. Table 1 briefly describes the OLED pin functions for the serial interface.

OLED Display Driver for the HCS08 Family, Rev. 0 2 Freescale Semiconductor OLED Display Description

Table 1. OLED Pin Description

Pin Pin Name Description

15 D/C Data/Command 17 CS Chip-select control 11 SDIN Serial-data input 12 SCLK Serial-clock input 16 RST Reset 20, 21 BS1, BS2 Interface selection BS1 = 0; BS2 = 0 for serial

2VCC OLED power-supply voltage (12 V)

21 VDD Logic-supply voltage (3.3 V)

29 VSS Ground 3 COMH Common (row) high voltage — A capacitor should be connected between this pin and VSS. 4 IREFH Segment (column) current reference — A resistor should be connected between this pin and VSS. 30 VSL Voltage segment low — A capacitor should be connected between this pin and VSS.

1.1 Basic Operation The OLED display contains a chip-on-glass (COG) controller (SSD0323 128 x 80, 16 Gray Scale Dot Matrix OLED/PLED Segment/Common Driver with Controller from Solomon Systech) with display RAM (graphic display data RAM — GDDRAM) that holds the data for the pattern/images to be displayed. Four bits of data are required for each pixel (4 bpp = bits per pixel) allowing 16 possible gray values. One byte is used to store the information for two pixels. In total, 4 Kbytes (4096 bytes) are required to hold the complete display content for the 128_x_64 pixels. The MCU needs to transfer data only if the display content needs updated. Cyclic refresh of the display is not necessary . The data transfer is done byte-wise, first sending the most significant bit (MSB) (Figure 2). The data is applied with the rising edge of the SCLK signal and is sampled at the falling edge of the SCLK signal. The data/command signal D/C is used to distinguish between graphic display data access and control commands sent to the display. Table 3 outlines the available display-control commands.

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 3 OLED Display Description

D/C

CS

SCLK

SDIN B7 B6 B5 B4 B3 B2 B1 B0

Figure 2. Serial Data Transfer (Command) The display data is sent byte-by-byte. Each byte automatically increments the address pointer to the next position. The display supports different GDDRAM to pixel mappings for mounting flexibility (regarding display orientation). You can rotate the display output by 180 degrees. Figure 3 and Table 2 show the default pixel mapping the software uses.

(0,0)

(127,63)

Figure 3. Pixel Mapping

OLED Display Driver for the HCS08 Family, Rev. 0 4 Freescale Semiconductor OLED Display Description

Table 2. GDDRAM Address Mapping (Data-Byte Sequence D0, D1, ..., D5119)

Column

01...63Address

0123...126127Pixel

0 D0[7:4] D0[3:0] D1[7:4] D1[3:0] ... D63[7:4] D63[3:0]

1 D64[7:4] D64[3:0] D65[7:4] D65[3:0] .... D127[7:4] D127[3:0]

Row ......

63 D5056[7:4] D5056[3:0] D5057[7:4] D5057[3:0] ... D5119[7:4] D5119[3:0]

Address

To update a portion of the display partially, you can use the set-column-address and set-row-address commands. They allow defining a portion (canvas) of the display to be updated without updating the whole 128 x 64 pixels. Also, each transferred data byte increases the address pointer to the next (two) pixel within the defined area. Basically, this mechanism allows you to individually update any (two) pixel (respectively, any byte in the GDDRAM). One constraint of using the serial interface is that it supports only unidirectional data transfer (write-only). Basically, in the serial mode you cannot read back the GDDRAM content; you cannot update only a single pixel of two pixel in a byte by using a read-modify-write one byte method.

1.2 Command Description Table 3 briefly explains the available commands (for the serial interface) and their corresponding parameters. For a more detailed description, consult the OSRAM Pictiva or SSD0323 documentation (Section 8, “References,” on page 32). Most commands are used to parametrize the COG for a specific display under specific ambient conditions. Recommendations for setup for various displays are provided by the display manufacturers (for OSRAM OLED see Table 4).

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 5 OLED Display Description

Table 3. Command Table (Sheet 1 of 5)

D/C Hex Command Length Description1

0 0x15 Set Column Address 3 bytes This command specifies column start address and end address of 0 A[5:0] the display data RAM. It also sets the column address pointer to 0 B[5:0] column start address. Second byte A[5:0] sets the column start address from 0–63. POR = 0. Third byte B[5:0] sets the column end address from 0–63, POR = 63 0 0x75 Set Row Address 3 bytes This command specifies row start address and end address of the 0 A[5:0] display data RAM. It also sets the row address pointer to row start 0 B[5:0] address. Second byte A[5:0] sets the row start address from 0–79, POR= 0. Third byte B[5:0] sets the row end address from 0–79, POR = 79 0 0x81 Set Contrast Control Register 2 bytes This command is to set contrast setting of the display. The COG 0 A[6:0] chip has 128 contrast steps from 0x00 to 0x7F. The segment output current increases linearly with the increase of contrast step. Second byte A[6:0] sets the contrast in 128 steps. Contrast increases as level increases. POR = 0x40. 0 0x84–0x86 Set Current Range 1 byte This command is used to select quarter range or half range or full range current mode. With the same contrast level, quarter range mode gives a quarter of the current output of the full range mode. Similar to half-range current mode, it gives a half of the current output of the full-range mode. 0x84 = Quarter-current range (POR) 0x85 = Half-current range 0x86 = Full-current range

OLED Display Driver for the HCS08 Family, Rev. 0 6 Freescale Semiconductor OLED Display Description

Table 3. Command Table (Sheet 2 of 5)

D/C Hex Command Length Description1

0 0xA0 Set Re-map 2 bytes This command changes the mapping between the display data 0 A[6:0] column address and segment driver, row address and common driver. It allows flexibility in layout during OLED module assembly.

Column Address Re-map If column address re-map is set, columns 0–63 map to SEG127–0, regardless of star-column and end-column commands.

Nibble Re-map If nibble re-map is set, the two nibbles of the data bus for RAM access are re-mapped, such that B7, B6, B5, B4, B3, B2, B1, B0 acts like B3, B2, B1, B0, B7, B6, B5, B4. This feature working with column address re-map produces an effect of flipping outputs SEG0–127 to SEG127–SEG0.

Address Increment Mode If horizontal increment mode is set, the column address pointer advances after each RAM access. If vertical increment mode is set, the row-address pointer advances after each RAM access.

COM Re-map If COM re-map is set, ROW 0–79 maps to COM79–0, regardless of start and end row commands.

A[0]=0, Disable Column Address Re-map (POR) A[0]=1, Enable Column Address Re-map A[1]=0, Disable Nibble Re-map (POR) A[1]=1, Enable Nibble Re-map A[2]=0, Horizontal Address Increment (POR) A[2]=1, Vertical Address Increment A[4]=0, Disable COM Re-map disable (POR) A[4]=1, Enable COM Re-map A[5]=0, Reserved (POR) A[5]=1, Reserved A[6]=0, Disable COM Split Odd Even (POR) A[6]=1, Enable COM Split Odd Even 0 0xA1 Set Display Start Line 2 bytes This command sets the display-start-line register, determining the 0 A[6:0] display RAM address that can be shown by selecting a value from 0 to 79. Second byte A[6:0] sets the display RAM start-line register from 0 to 79. POR = 0.

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 7 OLED Display Description

Table 3. Command Table (Sheet 3 of 5)

D/C Hex Command Length Description1

0 0xA2 Set Display Offset 2 bytes This command is to set the display-offset register to determine the 0 A[6:0] mapping of the display start line to one of COM0–79. (It is assumed that COM0 is the display start line, display start line register equals 0.) For example, to move the COMX toward the COM0 direction for L lines, the 7-bit data in the second command should be given by L. In other words, to move the COMX towards the COM79 direction for L lines, the 7-bit data in the second command should be given by 80–L. Second byte A[6:0] sets the vertical scroll by COM from 0–79. POR = 0. 0 0xA4–0xA7 Set Display Mode 1 byte This command is used to set normal display, entire display on, entire display off, and inverse display.

Normal Display turns the data to ON at the corresponding gray levels GS0–GS15 (see Set Gray Scale Table).

Entire Display On forces the entire display to be at gray level GS15, regardless of the contents of the display data RAM. Entire Display Off forces the entire display to be at gray level GS0 regardless of the contents of the display data RAM. Inverse Display uses the gray scale table in reverse order gray level 0–15 uses GS15–GS0, and so on.

0xA4 = Normal Display (POR) 0xA5 = Entire Display On (GS15) 0xA6 = Entire Display Off (GS0) 0xA7 = Inverse Display 0 0xA8 Set Multiplex Ratio 2 bytes This command sets multiplex ratio N from 16 to 80. 0 A[6:0] Second byte A[6:0] determines multiplex ration N. POR = 0x4F (80). 0 0xAD Set Master Configuration 2 bytes This command is used to enable or disable the internal DC–DC 0 A[1:0] voltage converter. This command is executed when display is on. A[0] = 0, Disable DC–DC converter A[0] = 1, Enable DC–DC converter (POR) A[1] = 0, Disable internal VCOMH A[1] = 1, Enable internal VCOMH (POR) 0 0xAE–0xAF Set Display On/Off 1 byte This command turns the display on or off. When the display is off, the segment and common output are in high impedance state. 0xAE = display off (sleep mode) (POR) 0xAF = display on 0 0xB0 Set Pre-charge 2 bytes This command enables the pre-charge voltage. 0 A[5:0] Compensation Enable A[5:0] = 0x08 (POR) A[5:0] = 0x28, enable pre-charge compensation 0 0xB4 Set Pre-charge 2 bytes This command sets the pre-charge voltage level. 0 A[2:0] Compensation Level A[2:0] = 0 (POR) A[2:0] = 3, recommended level

OLED Display Driver for the HCS08 Family, Rev. 0 8 Freescale Semiconductor OLED Display Description

Table 3. Command Table (Sheet 4 of 5)

D/C Hex Command Length Description1

0 0xBF Set Segment Low 2 bytes This command is used to set segment low voltage (VSL). The 0 A[3:0] Voltage (VSL) value of VSL is the same for display all on, display all off pattern with internal or external DC–DC voltage converter. The second byte A[3:0] sets the VSL voltage as follow: 1000–1110 A[3:0] = 0010 connects to VSS A[3:0] = 1110 (POR) (When VDD > 2.5 V) 0 0xBE Set VCOMH Voltage 2 bytes This command is used to set VCOMH voltage level. 0 A[5:0] The second byte A[5:0] specifies the VCOMH voltage level 000000–011111 A[5:0] = 1xxxxx = 1.0*VREF A[5:0] = 010001(POR) 0 0xBC Set Pre-charge Voltage 2 bytes This command is used to set the pre-charge voltage level. 0 A[7:0] The second byte A[7:0] sets the pre-charge voltage level 00000000–00011111 A[7:0] = 1xxxxxxx connects to VCOMH A[7:0] = 001xxxxx equals 1.0*VREF A[7:0] = 00011000(POR) 0 0xB1 Set Phase Length 2 bytes This command sets the phase length. The lower nibble of the 0 A[7:0] second byte selects phase 1 period (no pre-charge and current drive) from 1 to 16 DCLKs. The higher nibble of the second byte is used to select phase 2 period (pre-charge) from 1 to 16 DCLKs. A[3:0] = P1, phase 1 period of 1–15 DCLK clocks, POR = 3DCLKS = 3 A[7:4] = P2, phase 2 period of 1–15 DCLK clocks, POR = 5DCLKS = 5 0 0xB2 Set Row Period 2 bytes This command is used to set the row period. It is defined by 0 A[7:0] multiplying the internal display clock period by the number of DCLKSs per row (value from 2–158). The larger the value, the more precise tuning of each gray scale level. See set gray scale table command for details. Also, it is used to define the frame frequency with the display clock divide ratio command. Row period equal to the sum of phase 1, 2 periods and the pulse width of GS15. Second byte sets the number of DCLKs, K, per row between 2–158DCLKS, POR = 37DCLKS = 0x25 The K value should be set as K = P1+P2+GS15 pulse width (POR: 3+5+29DCLKS)

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 9 OLED Display Description

Table 3. Command Table (Sheet 5 of 5)

D/C Hex Command Length Description1

0 0xB3 Set Display Clock Divide 2 bytes This command is used to set the frequency of the internal display 0 A[7:0] Ratio/Oscillator clocks, DCLKs. It is defined by dividing the oscillator frequency by Frequency the divide ratio (Value from 1 to 16). Frame frequency is determined by divide ratio, number of display clocks per row, MUX ratio and oscillator frequency. The lower nibble of the second byte is used to select the oscillator frequency. The lower nibble of the next byte sets the divide ratio of the display clocks: Divide ratio = 1–16, POR = 2 The higher nibble of the next byte sets the Oscillator Frequency. Oscillator Frequency increases with the value of A[7:4] and vice versa. POR=0 0 B8 Set Gray Scale Table 9 bytes This command is used to set the gray scale table for the display. 0 A[2:0] The next 8 bytes set the gray scale level of GS1–15 as below: 0 B[6:4][2:0] A[2:0] = L1, POR=1 0 C[6:4][2:0] B[2:0] = L2, POR=1 0 D[6:4][2:0] B[6:4] = L3, POR=1 0 E[6:4][2:0] C[2:0] = L4 POR=1 0 F[6:4][2:0] C[6:4] = L5, POR=1 0 G[6:4][2:0] D[2:0] = L6, POR=1 0 H[6:4][2:0] D[6:4] = L7, POR=1 E[2:0] = L8, POR=1 E[6:4] = L9, POR=1 F[2:0] = L10, POR=1 F[6:4] = L11, POR=1 G[2:0] = L12, POR=1 G[6:4] = L13, POR=1 H[2:0] = L14, POR=1 H[6:4] = L15, POR=1 0 0xCF Set Biasing Current for 1 byte F0H = High (POR) 0 A[7:4] DC–DC converter 70H = Low

0 0xE3 NOP 1 byte Command for no operation

1 POR indicates the default value after power on reset

1.3 Power Up / Power Down Sequence To protect the OLED display and to extend the display life time the power up/down sequence should be controlled, specifically, the display voltage VCC (typ. 12–15 V).

1.3.1 Power-Up Sequence To power-up the OLED display follow the steps below:

1. Power-up VDD (3.3 V) and wait until stable 2. OLED display hardware reset 3. Send display-off command

OLED Display Driver for the HCS08 Family, Rev. 0 10 Freescale Semiconductor OLED Display Description

4. Power-up VCC (12 V) and wait until stable 5. Delay 100 ms 6. Send display-on command

1.3.2 Power-Down Sequence To power-down the OLED display follow the steps below: 1. Send display-off command

2. Power down VCC (12 V) 3. Delay 100 ms (when VCC has reached 0 V and panel is completely discharged) 4. Power down VDD (3.3 V)

1.4 Display Initialization Table 4 shows the manufacturers (OSRAM) recommended initialization sequence after power-up for the Pictiva 2.7-inch 128x64 OLED Display, Elegance Yellow with the following parameters:

•VDD = 3.3 V •VCC = 12 V • Frame frequency = 100 Hz CAUTION Consult the manufacturer documentation for the latest information and for different displays (for example, spring green instead of elegance yellow) and/or parameters (for example, different VCC voltages).

Table 4. Initialization Sequence After Power-Up

Initialization Command Code POR Default Value (Dual Voltage Supply)

Set column address 0x15 0x00 0x00 0x3F 0x3F Set row address 0x75 0x00 0x00 0x4F 0x3F Set contrast control 0x81 0x40 0x661 Set current range 0x84–0x86 quarter (0x84) full (0x86) Set re-map 0xA0 0x00 0x41 Set display start line 0xA1 00 default Set display offset 0xA2 0x00 0x44 Set multiplexer ratio 0xA8 0x4F 0x3F Set display ON/OFF 0xAE (OFF) 0xAF (ON) Set display mode 0xA4 default

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 11 OLED Display Description

Table 4. Initialization Sequence After Power-Up (continued)

Initialization Command Code POR Default Value (Dual Voltage Supply)

Set DC-DC converter 0xAD 0x02 0x02 (disabled) Set DC-DC bias current 0xCF 0xF0 default Set row period 0xB2 0x25 0x46 Set pre-charge 0xB0 0x08 0x28 compensation enable Set pre-charge 0xB4 0x00 0x07 compensation level Set clock divide 0xB3 0x02 0xF1 Set phase length 0xB1 P1=3, P2=5 0x22 (P1=2, P2=2) Set VSL 0xBF 0x0E 0x0D Set VCOMH 0xBE 0x11 0x021 Set Vprecharge 0xBC 0x18 0x04 Set gray scale table 0xB8 all 1 see Table 5 1 This setting represents maximum luminance for proper operation of the display. A lower setting can be used for dimming. A higher setting adversely affects the operating lifetime, as defined in this specification.

Table 5 shows the corresponding recommended gray-scale settings. Table 5. Gray-Scale Settings

GS Level Phase 1 Phase 2 S/W Set GS Pulse Total DCLK

L022004 L122115 L222137 L322159 L4222812 L5 2 2 2 11 15 L6 2 2 2 14 18 L7 2 2 3 18 22 L8 2 2 3 22 26 L9 2 2 4 27 31 L10 2 2 4 32 36 L11 2 2 5 38 42 L12 2 2 5 44 48 L13 2 2 6 51 55 L14 2 2 6 58 62 L15 2 2 7 66 70

OLED Display Driver for the HCS08 Family, Rev. 0 12 Freescale Semiconductor Hardware 2Hardware The system is set up using the standard DEMO9S08AW60 and DEMO9S08QG8 boards with a second pcb board called an OLED daughter card (Figure 4).

Power Supply

3.3 V Logic Supply 2 Switches DC/DC GND 3.3 V 12 V Enable to OLED Display Potentiometer 12 V RESET 128x64pixel (Yellow 4bit) Data/Command Light Sensor MOSI SPCLK SS QG8DEMO Board OLED Daughter Card

Figure 4. System Setup Example

2.1 OLED Daughter Card The OLED daughter card allows the OLED display to connect to the DEMO9S08QG8 or DEMO9S08AW60 demo boards. The OLED daughter card contains the socket for the flat flex cable (FFC) of the OLED display, a DC/DC converter (12 V, 120 mA boost converter) to supply the OLED display with the necessary 12 V derived from the 3.3 V supply of the DEMO9S08AW60 and DEMO9S08QG8 boards. It has two separate 0.1-inch pinheader connectors, J1 and J2, that can be directly connected to the DEMO9S08AW60 and DEMO9S08QG8 boards, respectively. Further details of the OLED Daughter Card, like schematics, layout and bill of materials (BOM), can be found in Section Appendix A, “OLED Daughter Card.”

2.1.1 Interface • OLED daughter-card interface — Requires six signals and two power-supply connections (Table 6, Table 7). • MCU serial peripheral interface — Used to transfer data and commands to the OLED display. Three SPI pins—slave select (SS), serial clock (SPSCK), and master-out slave-in (MOSI)—are used for the unidirectional data flow from the MCU to the OLED display. The master-in slave-out (MISO) pin is available for other use. • 12VEN signal — Controls DC/DC converter output voltage. Allows a controlled power up/down of the OLED power voltage VCC.

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 13 Hardware

•RST signal — Connected to an MCU general-purpose input output (GPIO) pin to control the OLED display hardware reset by software.

Table 6. OLED Daughter-Card Connector J1 (DEMO9S08QG8)

Pin Signal Description

1 3.3 V 3.3 V power supply input 3 GND Ground 17 SDIN Serial data input 19 12VEN 12 V enable control input 21 SCLK Serial clock input 23 CS Chip Select input 27 D/C Data/command input 29 RST Reset input all other pins Unused — not connected

Table 7. OLED Daughter-Card Connector J2 (DEMO9S08AW60)

Pin Signal Description

1 3.3 V 3.3 V power supply input 3 GND Ground 13 D/C Data/command input 15 RST Reset input 17 SDIN Serial data input 19 12VEN 12 V enable control input 21 SCLK Serial clock input 23 CS Chip Select input All other pins Unused — not connected

2.2 Setup with DEMO9S08QG8 Board Figure 4 indicates the OLED driver setup using the DEMO9S08QG8 board. To protect the system and for proper operation, set up the DEMO9S08QG8 board before the system powers up. Use the documentation provided with the board for more details about the DEM09S08QG8 board.

2.2.1 Jumpers Jumper VX_EN must be closed to provide the OLED daughter card with power (3.3 V).

OLED Display Driver for the HCS08 Family, Rev. 0 14 Freescale Semiconductor Software and CodeWarrior‘ Development Tool

The Jumper PWR_SEL must be in position VDD. This selects the external power supply as the power source. The Jumper USER_EN should be closed for full demo functionality. Figure 5 summarizes the jumper settings. SW1 SW2 VB VDD LED1 VX_EN PWR_SEL USER_EN LED2 RV1 RZ1 Figure 5. DEMO9S08QG8 Jumper Settings

2.3 Setup with DEMO9S08AW60 Board Figure 13 indicates the OLED Driver setup using the DEMO9S08AW60 board. To protect the system and for proper operation, set up the DEMO9S08AW60 board before the system powers up. WARNING Set up the DEMO9S08AW60 board correctly to avoid system damage or malfunction! The board must be configured for 3 V (see Section 2.3.1, “Jumpers”). Use the documentation provided with the board for more details about the DEM09S08AW60 board.

2.3.1 Jumpers

• Jumper W1 — VDD_SEL must be in position 3 V. This selects the 3 V operation. • Jumper W2 — 5V_SEL must be in position EXT. This selects the external power supply as the power source. • Jumper W3 — P_IO_5V must be closed to provide the OLED daughter card with power (3.3 V). • Jumpers from J3 to J31 — Should be closed for full demo functionality. Figure 6 summarizes jumper settings. J31 P_IO_5V USB EXT 5V 3V 5V_SEL VDD_SEL W3 W2 W1

J3 Figure 6. DEMO9S08AW60 Jumper Settings

3 Software and CodeWarrior™ Development Tool The application software was developed for the DEMO9S08QG8 and the DEMO9S08AW60 boards driving an OSRAM Pictiva OSRAM Pictiva 2.7-inch 128x64 OLED Display, Elegance Yellow with 16 gray

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 15 Software and CodeWarrior‘ Development Tool

scales (Part.No. OS128064PK27MY0B00). It is written in a way which should make it easy to adopt for different MCUs or different OLED displays. The software is also tested to be used with the OSRAM Pictiva 1.6-inch 128x64 OLED display, elegance yellow with 16 gray scales (Part.No. OS128064PK16MY0A01). The driver project was developed with the CodeWarrior for HC08 V5.1 — Special Edition development tool. Application features: • Serial interface to OLED display using SPI module (low number of I/Os used) • Low-level routines: — Send data byte — Send command byte — OLED power voltage ON/OFF — OLED hardware reset • High-level routines: — Display initialization — Set drawing area — Fill drawing area — Draw text using bitmap font — Draw bitmap graphic • Two bitmap type fonts 5x7 and 8x15 pixel size are included • Adaptable for other OLED displays or MCUs To open the OLED driver demo project, open file OLEDDemo.mcp in the CodeWarrior integrated development environment (IDE). Figure 7 shows the project view.

OLED Display Driver for the HCS08 Family, Rev. 0 16 Freescale Semiconductor Software and CodeWarrior‘ Development Tool

Figure 7. OLED Driver Demo Project Tree

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 17 Software and CodeWarrior‘ Development Tool 3.1 OLED Driver Software Description The OLED driver project contains the following files: Table 8. OLED Driver Files

Files Description

OLED.H OLED driver header file — Constants (defines) for OLED commands — Preparation for different OLED displays — Definition of MCU hardware interface OLED.C OLED driver c file — OLED initialization sequence (array) — OLED functions (Table 9) FONT.H Font include file FONT.C Font c file — Definition of two fonts 5x7pixel and 8x16pixel IMAGES.H Image include file IMAGES.C Image c file — Example images DERIVATIVE.H Header file to include the derivative specific header file — This and the MCU derivative-specific files (for example, MC9S08QG8.H and MC9S08QG8.C) are controlled by the CodeWarrior IDE (Section 3.1.1, “Driver Configuration”). MYTYPES.H Type definitions MAIN.C Shows an example implementation of the OLED driver

3.1.1 Driver Configuration The OLED.H header file can adapt the driver for different . Currently, it supports the MC9S08QG8 and the MC9S08AW60 MCUs. To change the , click on the “Change MCU/Connection ...” button and select the MCU derivative and the debugger connection you want to use (Figure 8 and Figure 9). NOTE You must select the correct MCU derivative and debugger interface to download the software into the microcontroller flash memory.

Figure 8. Change MCU

OLED Display Driver for the HCS08 Family, Rev. 0 18 Freescale Semiconductor Software and CodeWarrior‘ Development Tool

Figure 9. Select MCU Derivative and Debugger Connection The CodeWarrior IDE automatically modifies the DERIVATIVE.H file and inclues the right MCU derivative files. For example, after changing to the MC9S08QG8 MCU the DERIVATIVE.H file looks like this:

/* * Note: This file is recreated by the project wizard whenever the MCU is * changed and should not be edited by hand */

/* Include the derivative-specific header file */ #include

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 19 Software and CodeWarrior‘ Development Tool

And now, the project contains the MC9S08QG.C and MC9S08QG8.H files:

Figure 10. IDE Updates MCU Derivative Files The MC9S08QG8.H file defines a macro with the derivative name, for example, _MC9S08QG8_H, which is used to implement the hardware interface-specific code.

OLED Display Driver for the HCS08 Family, Rev. 0 20 Freescale Semiconductor Software and CodeWarrior‘ Development Tool

// ------// macros for hardware interface // ------

// ------// pinout for DEMO9S08QG8 board: #ifdef _MC9S08QG8_H

// use PTB4/MISO pin to enable 12V for OLED display #define _12V_Init() PTBD_PTBD4 = 0; PTBDD_PTBDD4 = 1 #define _12V_Enable() (PTBD_PTBD4 = 1) #define _12V_Disable() (PTBD_PTBD4 = 0)

// use PTB7 pin to drive reset signal OLED display #define _RST_Init() PTBD_PTBD7 = 1; PTBDD_PTBDD7 = 1 #define _RST_Assert() (PTBD_PTBD3 = 0) #define _RST_Release() (PTBD_PTBD3 = 1)

// use PTB6 pin to drive D/#C (Data/Command) signal to OLED display #define _DC_Init() {PTBD_PTBD6 = 1; PTBDD_PTBDD6 = 1;} #define _DC_Set() (PTBD_PTBD6 = 1) #define _DC_Clr() (PTBD_PTBD6 = 0)

// SPI init #define _SPI_Init() { \ SPIC1 = SPIC1_SPE_MASK|SPIC1_MSTR_MASK|SPIC1_SSOE_MASK; \ SPIC2 = SPIC2_MODFEN_MASK|SPIC2_BIDIROE_MASK|SPIC2_SPC0_MASK; \ SPIBR = 0; \ }

#define _SPI_Send(v) {while(!SPIS_SPTEF) {;} SPID = (v);}

#endif

To adapt the driver software for a different OLED display, modify the initialization routine. This is currently limited to only 4 bpp displays. Different color resolutions require further adaptations. In the OLED.H file, a define, based on the manufacturer part number (for example, OS128064PK27MY0B00), is used to select which display is connected. A second definition _UP_SIDE_DOWN allows to select the display orientation.

// ------// macros for display selection and orientation // ------// select which display to use, if necessary add new display and init sequence //#define OS128064PK27MY0B00 #define OS128064PK16MY0A01

// select if display is mounted up side down //#define _UP_SIDE_DOWN // define to rotate output 180 degrees

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 21 Software and CodeWarrior‘ Development Tool

In the OLED.C file, modify the actual initialization sequence.

//------// OLED Init Sequence for Pictiva 128x64 2.7" Yellow OS128064PK27MY0B00 // is used by OLED_Display_Init() //------#if defined(OS128064PK27MY0B00)

const UINT8 _Display_Init_Seq[] = { OLED_SETCONTRAST,0x5D, // for yellow OLED_SETCURRENTRANGE_100,

#if defined (_UP_SIDE_DOWN) OLED_SETREMAP,0x52, OLED_SETDISPLAYOFFSET,0x4C, // mapping of RAM to display #else OLED_SETREMAP,0x41, OLED_SETDISPLAYOFFSET,0x44, // mapping of RAM to display #endif

OLED_SETDISPLAYSTARTLINE,0, // TOP OLED_SETMULTIPLEXRATIO,63, // 64 MUX OLED_SETDISPLAYMODE_NORM, OLED_SETPHASELENGTH,0x22, OLED_SETROWPERIOD,0x46, OLED_SETDISPLAYCLOCKDIVIDE,0x41, OLED_SETSEGMENTLOWVOLT,0x0D, OLED_SETVCOMH,0x00, OLED_SETPRECHAGEVOLT,0x10, OLED_SETGREYSCALETABLE,0x01,0x11,0x22,0x32,0x43,0x54,0x65,0x76, OLED_SETMASTERCONFIG,0x02, // DC-DC 0x02 disabled, 0x03 enabled };

#endif

3.1.2 OLED Driver API Table 9 summarizes the services provides by the OLED driver: Table 9. OLED Driver Services

Function Name Type Parameters Description

OLED_Interface_Init void void Initialization of MCU <> OLED hardware-interface (I/O ports, SPI)

OLED_VCC_On void void Turn ON VCC OLED power voltage (12 V)

OLED_VCC_Off void void Turn OFF VCC OLED power voltage (12 V) OLED_Reset void void Applies hardware reset (RST) to OLED display OLED_WriteCmd void UINT8 cmd Transfers one byte of command data (D/C = 0) OLED_WriteData void UINT8 data Transfers one byte of display data (D/C = 1) OLED_Display_Init void void Initialization sequence for OLED display. The actual command sequence is specified as a const array for easy adaptation, for example, for a different display type.

OLED Display Driver for the HCS08 Family, Rev. 0 22 Freescale Semiconductor Demo Functionality

Table 9. OLED Driver Services (continued)

Function Name Type Parameters Description

OLED_Fill void UINT8 left Fills a specified area with a color: UINT8 top — Left/top are the x/y coordinates of the top/left corner of the area UINT8 width — Width/height of the area UINT8 height — Fill is the pattern=color to fill the area (high/low nibble specifying UINT8 fill the color) (4bpp) Attention: 4bpp is the supported color depth. An even number must be set for left and width. OLED_SetCanvas void UINT8 left Sets a canvas (an sub-set of the display area) to be active UINT8 top — Left/top are the x/y coordinates of the top/left corner UINT8 width — Width/height of the area UINT8 height Attention: 4bpp is the supported color depth. An even number must be set for left and width. OLED_DrawImage void UINT8 left draws a image (bitmap) to the specified position UINT8 top — Left/top are the x/y coordinates of the top/left corner UINT8 mask — Mask allows to modify the color of the image to be modified. UINT8* image Darkens an onscreen button to indicate it has been pressed (see demo). — *Image is a pointer to the image data Attention: for 4bpp left and the width of the image must be an even number. OLED_WriteString5x7 void UINT8 left Writes the text with the Font 5x7 to the specified position UINT8 top — Left/top are the x/y coordinates of the top/left corner UINT8 cc — cc is the color of the font (high/low nibble specifying the color) char* text (4bpp) Attention: for 4bpp left must be an even number. OLED_WriteString8x15 void UINT8 left Writes the text with the Font 8x15 to the specified position UINT8 top — Left/top are the x/y coordinates of the top/left corner UINT8 cc — cc is the color of the font (high/low nibble specifying the color) char* text (4bpp) Attention: On the left side for 4bpp, set an even number.

4 Demo Functionality The demo functionality varies slightly between the DEMO9S08QG8 and the DEMO9S08AW60 setups. Figure 11 depicts the basic program flow and the OLED display outputs for DEMO9S08QG8 example.

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 23 Demo Functionality

Power On (Reset)

MCU initialization (Real Time Interrupt modules RTI used for timing)

OLED_Interface_Init()

OLED Power Up Sequence

Display Welcome Message (for about 1 second)

Display example GUI with real time data (about 10 second)

Display Freescale Logo (scrolls in)

Display Memory Information Message (for about 3 seconds)

Figure 11. Basic Program Flow

4.1 MC9S08QG8 Example Demo The demo software demonstrates the OLED display drive and displays some real-time data (see Figure 4): • Status of two switches • Analog-voltage reading set by potentiometer • Analog-voltage reading of ambient-light sensor

OLED Display Driver for the HCS08 Family, Rev. 0 24 Freescale Semiconductor Demo Functionality

OLED Daughter Card

9S08QG8

BDM Interface

Switches SW1,SW2

Potentiometer Light Sensor

Figure 12. Demo Setup with DEMO9S08QG8 (Photo)

4.2 9S08AW60 Example Demo The demo software demonstrates the drive of the OLED display and displays some real-time data: • Status of four switches • Analog-voltage reading set by potentiometer • Analog-voltage reading of ambient light sensor • Two analog-voltage readings of a X/Y accelerometer

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 25 Demo Functionality

Power Supply

3.3 V Logic Supply 4 Switches GND DC/DC 3.3 V 12 V Enable to OLED Display Potentiometer 12 V RESET 128x64pixel (Yellow 4bit) Data/Command Light Sensor MOSI SPCLK X/Y Accelerometer SS AW60DEMO Board OLED Daughter Card

Figure 13. Demo Setup with DEMO9S08AW60 Board

OLED Display Driver for the HCS08 Family, Rev. 0 26 Freescale Semiconductor Image format and BMP2C.EXE Utility

OLED Daughter Card

9S08AW60

Accelerometer

Potentiometer

BDM Interface (bottom side)

Switches SW1-SW4 Light Sensor

Figure 14. Demo Setup with DEMO9S08AW60 (Photo)

5 Image format and BMP2C.EXE Utility The BMP2C.EXE utility (freeware from Freescale) is a command-line tool to convert a Windows bitmap file (*.bmp) to a C-language structure used with the OLED driver software. To convert a bitmap file, open a command window and run the BMP2C.EXE, as described below:

Usage: BMP2C.exe bmpfile outfile bmpfile bitmap file to be converted outfile output "C" file created

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 27 Font Format

The tool converts bitmap pixel from the RGB format to the 4 bpp format using the following equation: RGB++ Pixel = ------316⋅

R, G, B are the 8bit values representing the red, green, and blue portion of the pixel. All converted pixel are packed into a C-language structure (byte array).

const char Image[] = { 128,40, // first two byte are size in pixel (x * y) 0x00, 0x00, ...... }; // pixel data

Each byte contains the information for two pixels. NOTE The software and the BMP2C.EXE requires that the source bitmap file horizontal resolution is an even number. This structure can be included into the IMAGE.C source file (for example, in the CodeWarrior IDE).

6 Font Format Bitmap type fonts are stored in a format where one bit represents one pixel of information — monochrome font. Each letter can then be displayed in one of 16 gray levels. To explain how the font data is represented, the character 1 is used as an example. For the 5x7 font, five bytes are used to store each character:

const char FONT5X7 [][5] = { ...... { 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1 ...... }

OLED Display Driver for the HCS08 Family, Rev. 0 28 Freescale Semiconductor Font Format

Byte

01234

0

1

2

3 Bit 4

5

6

7

0x00 0x42 0x7F 0x40 0x00

Figure 15. Number “1” in FONT 5x7 Format For the 8x15 font, 8 times 2 = 16 bytes are used to store each character:

const char FONT8X15 [][8][2] = { ...... { {0x00, 0x00}, {0x04, 0x08}, {0x06, 0x08}, {0xFF, 0x0F}, {0xFF, 0x0F}, {0x00, 0x08}, {0x00, 0x08}, {0x00, 0x00} } , // 1 ...... }

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 29 Font Format

Byte

02468101214

0

1

2

3 Bit 4

5

6

7

0x00 0x04 0x06 0xFF 0xFF 0x00 0x00 0x00

Byte

13579111315

0

1

2

3 Bit 4

5

6

7

0x00 0x08 0x08 0x0F 0x0F 0x08 0x08 0x00 Figure 16. Number “1” in FONT8x15 Format

OLED Display Driver for the HCS08 Family, Rev. 0 30 Freescale Semiconductor Conclusion 7Conclusion The provided documentation and software show how to control an OLED display with an HCS08 microcontroller, even with a limited amount of memory or GPIOs. The software can be used as the basis for other projects and further enhancements, such as: • Support for monochrome (1bpp) OLED displays • Support for full-color OLED displays • Support for software SPI or parallel interface • Scalable fonts • Use of power-down sequence (controlled shut down) • Implementation of a screen saver • Power-consumption optimization • Implementation of drawing functions, for example, lines, rectangulars, etc.(requires sufficient amount of RAM memory) • Use of compressed storage of data to enhance memory efficiency • Utility to generate fonts More information on how to use an OLED in a real-world application can be found on the OSRAM Pictiva website (see Section 8, “References”). For more information on CodeWarrior tools, see Section 8, “References”. To get to a small memory footprint, some specific actions were incorporated (the storage of the Freescale Logo image). Only the logo itself was stored and not the surrounding background. Like this the size of the bitmap could be reduced by 37.5% from 4096 bytes (128 x 64 x 4 Bit) to 2560 bytes (128 x 40 x 4 Bit). A second method used for the push buttons (Figure 11) is the ability to “darken” a bitmap during runtime when it is drawn (OLED_DrawImage function — see Table 9). Like this, the storage of two images—button released and button pressed—can be reduced to only one image. This saves 258 bytes (50% reduction). Table 10 summarizes the memory consumption for the example applications. This differences are mainly caused by demonstration functionalities. Table 10. Memory Consumption Overview

MC9S08QG8 MC9S08AW60

Images 3912 bytes 5260 bytes

Fonts 1995 bytes 1995 bytes

Text 187 bytes 134 bytes

Program 1951 bytes 1987 bytes

Flash total 8045 bytes 9376 bytes

RAM <100 bytes <100 bytes

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 31 References 8 References Further details can be found in the following documentation • MC9S08QG8 Data Sheet • MC9S08AW60 Advanced Information Data Sheet • SSD0323 Data sheet (128x80, 16 gray scale dot matrix controller) Useful web sites: • Freescale website http://www.freescale.com • OSRAM Pictiva website http://www.pictiva.com • Wikipedia website http://en.wikipedia.org/wiki/Oled • OLED Information website http://www.oled-info.com

OLED Display Driver for the HCS08 Family, Rev. 0 32 Freescale Semiconductor References Appendix A OLED Daughter Card

A.1 Schematics

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 33 References A.2 Layout

Figure 17. Placement

Figure 18. Solderstop Mask (Top)

OLED Display Driver for the HCS08 Family, Rev. 0 34 Freescale Semiconductor References

Figure 19. Copper (Top)

Figure 20. Copper (Bottom)

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 35 References

Figure 21. Solderstop Mask (Bottom)

OLED Display Driver for the HCS08 Family, Rev. 0 36 Freescale Semiconductor References A.3 OLED Daughter Card BOM (Bill of Materials)

Table 11. OLED Daughter Card Bill of Materials

Quantity Reference Description Supplier PartNo. Supplier

1 U1 TPS7634ID (Texas Instruments) 8458111 Farnell IC, DC/DC 120 mA, 12 V SMD-SOIC8 2 C1, C2 Ceramic Capacitor 9227857 Farnell 4.7 μF 6.3 V 20% SMD–0805 1 C3 Tantal Capacitor 197269 Farnell 4.7 μF 16 V 20% SMC–A 1 C4 Tantal Capacitor 498737 Farnell 10 μF 16 V 20% SMC–B 2 C5, C6 Tantal Capacitor 757858 Farnell 33 μF 16 V 10% SMC–D 1 C7 Ceramic Capacitor 722042 Farnell 47pF 50 V 10% SMD–0603 1 C8 Ceramic Capacitor 721840 Farnell 1 pF 50 V 10% SMD–0603 1 D1 Schottky Diode 3004120 Farnell MBRA130LT3 ONSEMI SMD–SMA (DO–214AC) 1 J1 PinHeader 2x16 9729070 Farnell 0.1 inch pitch 1 J2 PinHeader 2x20 9729070 Farnell 0.1 inch pitch 1 J3 FCB Flex 30 pin socket SFV30R1–ST FCI 0.5 mm pitch 1 L1 Inductor 15 μH, max. 850 mA, 0.15 Ω 3837403 Farnell Panasonic ELL6RH150M

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 37 References

Table 11. OLED Daughter Card Bill of Materials (continued)

Quantity Reference Description Supplier PartNo. Supplier

1 LED1, LED2 LED green 8554609 Farnell low power SMD–ChipLED 0603 1R1Resistor 9334920 Farnell 820 kΩ, 5%, 0.1 W SMD–0805 1R2Resistor 9334319 Farnell 3 kΩ, 5%, 0.1 W SMD–0805 1R3Resistor 9334351 Farnell 330 Ω, 5%, 0.1 W SMD–0805

OLED Display Driver for the HCS08 Family, Rev. 0 38 Freescale Semiconductor References A.4 DEMO9S08QG8 Board

OLED Display Driver for the HCS08 Family, Rev. 0 Freescale Semiconductor 39 References A.5 DEMO9S08AW60 Board D C B A of 35 1 1 RESET_B BKGD DEMO9S08AW60 POWER, CLOCK, AND RESET PDF: SPF-20805 SOURCE: SCH-20805 B Thursday, September 22, 2005 Drawing Title: Size Document NumberDate: Sheet Rev C Page Title: Drawing Title: Size Document NumberDate: Sheet Rev VCC_3V Q50 2

MGSF1N02LT1G

1 3 2 Q51 IRLML6402TRPBF 1 3

R4 10K +/-5%

1 2 VCC

R50 10K +/-5%

1 2

1 3 U50 ZR431 2 JP1 HDR_1X1 NO _POP 1 2 2 VDD R54 510ohm 5%

D7 SML-LXL1206GC

2 1 2 1 C58 100uf 0.1 P_IO_5V

2 1

+ 1 2 P3_3V W3 HDR_2X1

C56 10uF 0.6

2 1 P3_3V VDD_5V 3 2 1 W1 4 LT1086 69190-603 2 VOUT R3 510 OHM +/-5% 1 ADJ VOUT VIN U2 1 2 3

R53 820 +/-5%

1 2 C52 100uf 0.1

+ 1 2 3 3

0.6 10uF C59

1 2

2 1 0.1 C53 0.1uF C57 100uf 0.1

+ 1 2

VDD_5V

VCC_TGT_5V 3

2 1 69190-603 W2 C50 100uf 0.1

+ 2 1 P_EXT_5V P_EXT_5V

C51 10uF 0.6 1

1 2 JP4 NO _POP 4 4 HDR_1X1 VDD

RESET_B 1 2 4 LT1086 0.1 C62 VDD 55 44 54 45 21 59 2 22 0.1uF

VOUT

2 R1 1 VSS VSS VDD 510 OHM +/-5% VREFL VREFH VSSAD VDDAD 1 0.1 VIN VOUT ADJ C63 U1 2 4 6 0.1uF

3 2 1

1 2

R2 1.5K +/-5% 1 OF 2

2 1 NO_POP J18 TSW-103-07-S-D 0.1 C65 1 3 5 0.1uF MC9S08AW60 U3A BKGD/MS RESET PTG5/XTAL PTG6/EXTAL 0.6 10uF C55 BKGD

3

56 57 58 2 1

R59 10.0K +/-1%

2 1 XTAL C54 100uf 0.1 R70 10.0K +/-1%

+ 1 2 2 1 VDD 9 8 14 13 12 11 10 EXTAL RESET_B IO9 IO8 IO14 IO13 IO12 IO11 IO10

VIN_F NO_POP

2 D50 MBRS130L

1 2 IO1 IO2 IO3 IO4 IO5 IO6 IO7 J6 DIP14 R57 0ohm 5% R7 10.0K +/-1%

5 5

1 2 3 4 5 6 7 1

2

2 1 R60 10.0K +/-1%

VDD

2

2 1 F50 0.75A VDD 1 3 4 R61 0ohm 5% 1

EXTAL_R C61 22pF 0.2

1 2 1 3 2 2 2 XTAL_R SW3 SPST PB NO J1 PJ-002A-SMT R56 Y1 4MHz 10M +/-5% C60 22pF 0.2 1 2 1

1

2 7V to 12V CENTER POSITIVE 1 D C B A

OLED Display Driver for the HCS08 Family, Rev. 0 40 Freescale Semiconductor 5 4 3 2 1

PTA[0:7]

PTB[0:7]

PTC[0:6] RESET_B BKGD VDD

PTE[0:7] 2 R83 P3_3V 10.0K PTF[0:7] VDD U3B +/-1% U54

D 1 D 2 OF 2 5 1 PTG[0:4] DIR VCCA VCCB 6 2 IRQ PTC4_SW 3 A B 4 2 GND 33 PTA7 PTA7 PTA6 P_IO_5V VDD 32 SN74LVC1T45 PTA6 PTA5 J50 PTA5 31 PTA4 1 2 IRQ PTA4 30 29 PTA3 PTC4 3 4 RESET_B R82 PTA3 1 2 PTA2 PTE0 5 6 BKGD 1 2 PTA2 28 PTA1 HDR_2X1 PTE1 7 8 PTG4 PTA1 27 R78 26 PTA0 PTG0 9 10 PTB0 47K +/-5% PTA0 2 J20 PTG1 11 12 PTB1 1 2 C76 PTD0 PTD0_SW PTE2 13 14 PTB2 0.1uF PTB7 1 2 PTE3 15 16 PTB3 20K +/-5% 0.1

41 1 PTB7/AD1P7 2 40 PTB6 HDR_2X1 PTE6 17 18 PTB4 PTB6/AD1P6 5 PTB5 C74 PTE5 19 20 PTB5 U57 PTB5/AD1P5 39 PTB4 J8 VDD PTE7 21 22 PTB6 V+ 38 0.1uF 1 PTB4/AD1P4 2 37 PTB3 PTD1 VR1 PTE4 23 24 PTB7 3 PTB3/AD1P3 1 2 0.1 - PTB2 1 3 PTA0 25 26 PTC1 PTD5_SW 4 PTB2/AD1P2 36 PTB1 HDR_2X1 PTA1 27 28 PTC0 1 PTB1/AD1P1 35 + 34 PTB0 10K PTA2 29 30 PTG2 PTB0/AD1P0 2 J7 +/-10% PTA3 31 32 PTG3 V- PTD2 PTA4 33 34 PTF4 R79 2

LMV321DBV 2 PTC6 1 2 PTA5 35 36 PTF5 C75 PTC6 9 10.0K PTC5 HDR_2X1 PTA6 37 38 PTC5 PTC5/RXD2 64 +/-1% 0.1uF 1 1 PTC4 PTA7 39 40 PTC3 1 0.1 PTC4 PTC3 J3 PTC3/TXD2 63 62 PTC2 PTD3 PTC2/MCLK 1 2 CONN_SKT_20X2 61 PTC1 PTC1/SDA1 PTC0 HDR_2X1 PTC0/SCL1 60 J4 VDD 53 PTD7 PTD4 PTD4_SW PTD7/AD1P15/KBI1P7 1 2 52 PTD6 PTD6/AD1P14/TPM1CLK PTD5 HDR_2X1 PTD5/AD1P13 51 C PTD4 VDD R65 C PTD4/AD1P12/TPM2CLK 50 PTD3 J9 1 2 PTD3/AD1P11/KBI1P6 47 46 PTD2 PTD5 PTD2/AD1P10/KBI1P5 1 2 R63 PTD1 47K +/-5% PTD1/AD1P9 43 42 PTD0 HDR_2X1 1 2 PTD0/AD1P8 U59 2 2 J5 PTD1_SW C68 20K +/-5% C66 5 OUT VCC 1 20 PTE7 PTD6 0.1uF 1 0.1uF 1 2 5 PTE7/SPSCK1 PTE6 1 2 U51 PTE6/MOSI1 19 4 NC 0.1 0.1 PTE5 HDR_2X1 R75 V+ PTE5/MISO1 18 17 PTE4 SW8 10.0K 2 3 3 PTE4/SS1 GND1EN_B 1 - 16 PTE3 J2 PTC2_SW 1 3 6 4 PTE3/TPM1CH1 1 2 +/-1% GND2 15 PTE2 PTD7 R91 1 1 PTE2/TPM1CH0 1 2 + 14 PTE1 2 4 1.0K PTE1/RXD1 EL7900ILCZ 2 2 13 PTE0 HDR_2X1 SPST PB NO +/-5% V- PTE0/TXD1 HDR_2X1 R64 C67

2 LMV321DBV 2 PTC2 J19 J32 SW7 10.0K 0.1uF 1 10 PTF7 PTC6 PTC6_SW 1 3

1 2 +/-1% 0.1 PTF7 PTF6 PTF6 12 1 PTF5 2 4 PTF5/TPM2CH1 11 8 PTF4 PTE0 SPST PB NO PTF4/TPM2CH0 PTF3 1 2 HDR_2X1 PTF3/TPM1CH5 7 PTF2 HDR_2X1 J33 SW5 PTD7_SW PTF2/TPM1CH4 6 5 PTF1 PTD2_SW 1 3 PTF1/TPM1CH3 PTF0 J16 2 PTD6_SW PTF0/TPM1CH2 4 PTE1 2 4 C7 1 2 SPST PB NO VDD P3_3V 1 0.1uF HDR_2X1 C69 2 0.1 U58 C77 SW4 0.1uF U4 PTG4 J17 PTD3_SW 1 3 VDD 1 2 0.1 PTG4/KBI1P4 49 27 V+ VCC 26 1 48 PTG3 PTF0 VDD 28 3 PTG3/KBI1P3 1 2 C1+ VDD 25 PTG2 2 4 PTG2/KBI1P2 2 2 0.1uF 24 PTG1 SPST PB NO 12 LT_PTC4_SW PTG1/KBI1P1 PTG0 2 R80 C5 0.1 R89 ST R77 PTG0/KBI1P0 23 HDR_2X1 R8 10.0K 1 2 2 1 0.1uF 1 GND 25 XOUT 15 J11 10.0K 3 +/-1% 0.1 24 C1- V- PTF1 C8 0ohm 5% 1K +/-5%

1 1 14 MC9S08AW60 1 2 +/-1% C2+ YOUT PTE0_SW PTE0 21 J22 1 1 B 2 1 INVALID B SW6 PTF0_SW 22 1 2 R90 M1 1 R69 FORCEOFF NC1 1 20 PTF1_SW C9 1 2 2 2 1 23 FORCEON NC2 2 19 HDR_2X1 0.1uF 1 5 2 0.1uF NC3 3 18 HDR_2X1 J10 0.1 0ohm 5% 6 1K +/-5% C2- 2 NC4 6 4 17 J24 PTF2 PTF2_SW PTE0_TXD 14 9 0.1 2 7 1 2 T1IN T1OUT NC5 5 16 PTE1_SW PTE1 13 10 7 8 2 1 T2IN T2OUT NC6 6 15 11 3 9 12 T3IN T3OUT NC7 7 14 8 NC8 10 8 13 HDR_2X1 4 17 11 20 R2OUTB VSS NC9 9 12 HDR_2X1 J12 PTE1_RXD 4 9 13 19 R1OUT R1IN NC10 10 11 J25 PTF3 PTF3_SW 18 5 5 4 16 1 2 1 R2OUT R2IN VSS NC11 PTE2_SW PTE2 LED1 NO_POP 17 6 2 1 R3OUT R3IN 1 20 R71 510ohm 1 2 5% R81 16 7 M2 76SB10ST R4OUT R4IN MMA6260Q_QFN16 2 19 R72 510ohm 1 2 5% 0 ZERO OHM 8 15 R5OUT R5IN HDR_2X1 3 18 R73 510ohm 1 2 5% +/-5% 788750-1 HDR_2X1 J13 4 17 R74 510ohm 1 2 5% 2 MAX3243 J26 PTF4 PTF4_SW 5 16 R94 510ohm 1 2 5% PTE3_SW PTE3 1 2 6 15 R96 510ohm 1 2 5% 2 1 7 14 R97 510ohm 1 2 5% 8 13 R95 510ohm 1 2 5% HDR_2X1 9 12 HDR_2X1 J34 10 11 2 2 J27 PTF5 PTF5_SW R16 R15 1 2 PTE4_SW PTE4 10.0K 10.0K 2 1 LED_BAR_10 +/-1% +/-1% HDR_2X1 1 1 HDR_2X1 J23 J28 PTF6 PTF6_SW PTE5_SW PTE5 1 2 2 1

HDR_2X1 HDR_2X1 J14 J29 PTF7 PTF7_SW PTE6_SW PTE6 1 2 2 1

A A HDR_2X1 HDR_2X1 J15 J30 PTE7_SW PTE7 2 1

HDR_2X1 J31 DrawingDrawing Title:Title: DEMO9S08AW60 Page Title: USER FUNCTIONS SizeSize Document Document NumberNumber Rev Rev C PDF: SPF-20805 SOURCE: SCH-20805 B

Date:Date:Monday, September 26, 2005 Sheet Sheet 45of 5 4 3 2 1 How to Reach Us: Information in this document is provided solely to enable system and software Home Page: implementers to use Freescale Semiconductor products. There are no express or www.freescale.com implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. E-mail: [email protected] Freescale Semiconductor reserves the right to make changes without further notice to USA/Europe or Locations Not Listed: any products herein. Freescale Semiconductor makes no warranty, representation or Freescale Semiconductor guarantee regarding the suitability of its products for any particular purpose, nor does Technical Information Center, CH370 Freescale Semiconductor assume any liability arising out of the application or use of any 1300 N. Alma School Road product or circuit, and specifically disclaims any and all liability, including without Chandler, Arizona 85224 limitation consequential or incidental damages. “Typical” parameters that may be +1-800-521-6274 or +1-480-768-2130 provided in Freescale Semiconductor data sheets and/or specifications can and do vary [email protected] in different applications and actual performance may vary over time. All operating Europe, Middle East, and Africa: parameters, including “Typicals”, must be validated for each customer application by Freescale Halbleiter Deutschland GmbH customer’s technical experts. Freescale Semiconductor does not convey any license Technical Information Center under its patent rights nor the rights of others. Freescale Semiconductor products are Schatzbogen 7 not designed, intended, or authorized for use as components in systems intended for 81829 Muenchen, Germany surgical implant into the body, or other applications intended to support or sustain life, +44 1296 380 456 (English) or for any other application in which the failure of the Freescale Semiconductor product +46 8 52200080 (English) could create a situation where personal injury or death may occur. Should Buyer +49 89 92103 559 (German) +33 1 69 35 48 48 (French) purchase or use Freescale Semiconductor products for any such unintended or [email protected] unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all Japan: claims, costs, damages, and expenses, and reasonable attorney fees arising out of, Freescale Semiconductor Japan Ltd. directly or indirectly, any claim of personal injury or death associated with such Headquarters unintended or unauthorized use, even if such claim alleges that Freescale ARCO Tower 15F Semiconductor was negligent regarding the design or manufacture of the part. 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. 0120 191014 or +81 3 5437 9125 All other product or service names are the property of their respective owners. [email protected]

Asia/Pacific: © Freescale Semiconductor, Inc. 2007. All rights reserved. Freescale Semiconductor Hong Kong Ltd. Technical Information Center RoHS-compliant and/or Pb-free versions of Freescale products have the functionality 2 Dai King Street Tai Po Industrial Estate and electrical characteristics as their non-RoHS-compliant and/or non-Pb-free Tai Po, N.T., Hong Kong counterparts. For further information, see http://www.freescale.com or contact your +800 2666 8080 Freescale sales representative. [email protected] For information on Freescale’s Environmental Products program, go to http://www.freescale.com/epp. 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 [email protected]

Document Number: AN3415 Rev. 0 03/2007