Freescale Semiconductor MCS08QG8 Manual Download Page 1

Freescale Semiconductor Confidential and Proprietary Information. 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. 2005.

TM

8-bit Low Pin Count MCU
Hands On Seminar

CodeWarrior Hands On Lab
October 25, 2005

Summary of Contents for MCS08QG8

Page 1: ...cale 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 2005 TM 8 bit Low P...

Page 2: ...le Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 1 Agenda MC9S08QG8 Demo Kit CodeWarrior Installation Lab 1 Co...

Page 3: ...vice names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 2 MCS08QG8 Demo Kit DEMO9S08QG8 DEMO9S08QG8 Demo Board DEMO9S08QG8 User Guide DEMO9S08QG8 Quick Start Guid...

Page 4: ...iconductor Inc 2005 Slide 3 MCS08QG8 Demo Kit Features Integrated USB BDM RS 232 Serial Port w DB9 Connector SPI IIC ports available on Connector J1 External 32 768 kHz Clock Oscillator not installed...

Page 5: ...re the property of their respective owners Freescale Semiconductor Inc 2005 Slide 4 MCS08QG8 Demo Kit Jumpers USER_EN PWR_SEL COM_SEL VX_EN OSC_EN not installed Connectors 32 pin MCU I O Connector 2 0...

Page 6: ...application to execute when power is applied to the board or the RESET button is pressed Use the following settings to configure the DEMO908QG8 board for RUN Mode using the USB bus to power the board...

Page 7: ...d Proprietary Information 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 Semico...

Page 8: ...etary Information 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...

Page 9: ...ietary Information 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...

Page 10: ...y Information 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...

Page 11: ...ary Information 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 In...

Page 12: ...ry Information 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...

Page 13: ...etary Information 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...

Page 14: ...o input ports PTA2 and PTA3 respectively LED Indicators MCU ports PTB6 and PTB7 drive LED1 and LED2 respectively Potentiometer The potentiometer is connected between VDD and GND with the center tap pr...

Page 15: ...ietary Information 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...

Page 16: ...ary Information 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 In...

Page 17: ...Information 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 2...

Page 18: ...nd make sure they are in the default position Use Figure 1 as a guide 2 Connect the USB cable to the PC and then to the board If you are using this board for the first time please follow the instructi...

Page 19: ...heir respective owners Freescale Semiconductor Inc 2005 Slide 18 CodeWarrior Installation 1 Install CodeWarrior HC S 08 CD Reference CodeWarrior Quick Start Section A 2 Install CodeWarrior Service Pac...

Page 20: ...rks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 19 Lab 1 CodeWarrior Project 1 Create a new pro...

Page 21: ...on 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 2005 Slide...

Page 22: ...e trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 21 Lab 1 CodeWarrior Project 3 Select...

Page 23: ...oduct or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 22 Lab 1 CodeWarrior Project 4 Once the root directory for the project has been located enter...

Page 24: ...Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 23 Lab 1 CodeWarrior Project 6 In the Project name field you ma...

Page 25: ...e 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 2005 Slide 24 Lab 1 Co...

Page 26: ...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 2005 Slide 25 Lab 1 Cod...

Page 27: ...ks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 26 Lab 1 CodeWarrior Project 10 Processor expert...

Page 28: ...ale 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 2005 Slide 27 Lab 1...

Page 29: ...e Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 28 Lab 1 CodeWarrio...

Page 30: ...Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 29 Lab 1 CodeWarrior...

Page 31: ...d 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 2005 Slide 30 Lab 1 CodeWa...

Page 32: ...demarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 31 Lab 1 CodeWarrior Project 15 Connection...

Page 33: ...Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 32 Lab 1 CodeWarrior Project 16 Once the project wizar...

Page 34: ...reescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 33 Lab 1 CodeWarrior P...

Page 35: ...rks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 34 Lab 1 CodeWarrior Project 18 This project co...

Page 36: ...reescale 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 2005 Slide 35 L...

Page 37: ...mes are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 36 Lab 1 CodeWarrior Project 2 We will use the Demo_S08_Test application code to demonstrate debugging Software i...

Page 38: ...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 2005 Slide 37 Lab 1 CodeWar...

Page 39: ...he Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 38 Lab 1 CodeWarri...

Page 40: ...ir respective owners Freescale Semiconductor Inc 2005 Slide 39 Lab 1 CodeWarrior Debugging 5 Select Debug GREEN ARROW This compiles and links the code and invokes the True Time simulator and Real Time...

Page 41: ...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 2005 Slide 40 Lab 1 Cod...

Page 42: ...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 2005 Slide 41 Lab 1 CodeWarr...

Page 43: ...Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 42 Lab 1 CodeWarrior...

Page 44: ...e Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 43 Lab 1 CodeWarrior Debugging 9 Once BDM communication has be...

Page 45: ...ale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 44 Lab 1 CodeWarrior Debugg...

Page 46: ...reescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 45 Lab 1 CodeWarrior D...

Page 47: ...ners Freescale Semiconductor Inc 2005 Slide 46 Lab 2 Example Application This lab code is intended to introduce the DEMO9S08QG8 demo board Connecting a serial cable from the DEMO9S08QG8 to a PC with a...

Page 48: ...rty of their respective owners Freescale Semiconductor Inc 2005 Slide 47 Lab 2 Example Application Requirements DEMO9S08QG8 demo board with an MC9S08QG8 in the 16 DIP socket DB9 serial cable CodeWarri...

Page 49: ...05 Slide 48 Lab 2 Example Application Setting up the Demo 1 Connect the DEMO9S08QG8 to the PC as described in the Quick Start Guide The jumper configuration for this application is COM_EN jumper remov...

Page 50: ...Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 49 Lab 2 Example Application Setting up the Demo 4 Co...

Page 51: ...ale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 50 Lab 2 Example Applicatio...

Page 52: ...f their respective owners Freescale Semiconductor Inc 2005 Slide 51 Lab 2 Example Application Running the Demo If everything is configured correctly the terminal window will display the following as s...

Page 53: ...go are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 52 Lab 3 Internal Clock Source 16...

Page 54: ...nternal 32 kHz reference Internal or external reference clocks up to 5 MHz can be used to control the FLL 3 bit select for reference divider is provided Internal reference clock has 9 trim bits availa...

Page 55: ...ale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 54 Lab 3 Internal Clock Sou...

Page 56: ...supplies a clock derived from the FLL which is controlled by the internal reference clock FLL Bypassed Internal FBI In this mode the FLL is enabled and controlled by the internal reference clock but i...

Page 57: ...FBE In this mode the FLL is enabled and controlled by an external reference clock but it is bypassed The ICS supplies a clock derived from the external reference clock FLL Bypassed External Low Power...

Page 58: ...Lab 3 Internal Clock Source ICS Control Register 1 CLKS bits select the clock source that controls the bus frequency RDIV bits select the amount to divide down the FLL reference clock IREFS selects be...

Page 59: ...source selected by the CLKS bits RANGE selects high frequency 1 or low frequency 0 range for the external oscillator HGO configures the external oscillator for high gain 1 or low power 0 operation LP...

Page 60: ...are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 59 Lab 3 Internal Clock Source ICS Status and Control Register CLKST bits indicate the current clock mode OSCINIT thi...

Page 61: ...ctive owners Freescale Semiconductor Inc 2005 Slide 60 Lab 3 Internal Clock Source ICS Trim Register TRIM bits control the internal reference clock frequency by controlling the internal reference cloc...

Page 62: ...le Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 61 Lab 3 Internal Clock Source Select Option 1 ICS setup Main...

Page 63: ...3 Internal Clock Source Select Option 2 ICS in FEI BDIV 2 ICS Setup Menu 1 ICS in FEI BDIV 1 set BAUD to 4800 bps 8 MHz bus 2 ICS in FEI BDIV 2 set BAUD to 4800 bps 4 MHz bus 3 ICS in FEI BDIV 4 set...

Page 64: ...2005 Slide 63 Lab 3 Internal Clock Source ICS Application Code load trim value if location not blank if NVICSTRM 0xFF ICSTRM NVICSTRM output of FLL is selected reference divider 1 internal reference c...

Page 65: ...FEE or FBE mode input clock source must be divisible using RDIV to within the range of 31 25 kHz to 39 0625 kHz Check the External and Internal Oscillator Characteristics Appendix for electrical and t...

Page 66: ...prietary Information 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 Semiconduct...

Page 67: ...e Modulo Timer features include 8 bit up counter Free running or 8 bit modulo limit Software controllable interrupt on overflow Counter reset bit TRST Counter stop bit TSTP Four software selectable cl...

Page 68: ...ductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 67 Lab 4 Modulo Timer Module MTIM Status and Control Register MTIMSC co...

Page 69: ...re trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 68 Lab 4 Modulo Timer Module MTIM Clo...

Page 70: ...ale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 69 Lab 4 Modulo Timer Module Select Option 3 MTIM setup Main...

Page 71: ...r service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 70 Lab 4 Modulo Timer Module MTIM Setup Set Prescaler Modulo and Clock Source as shown in MTIM Setup...

Page 72: ...e Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 71 Lab 4 Modulo Timer Module MTIM will toggle LED1 at 32 Hz LE...

Page 73: ...oprietary Information 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 Semiconduc...

Page 74: ...Freescale Semiconductor Inc 2005 Slide 73 Lab 5 Analog Comparator ACMP has the following features Full rail to rail supply operation Less than 40 mV of input offset Less than 15 mV of hysteresis Sele...

Page 75: ...or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 74 Lab 5 Analog Comparator 1 Configure the Analog Comparator Register ACMPSC 2 Declare ACMP interru...

Page 76: ...cale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 75 Lab 5 Analog Comparator Select Option 6 ACMP test Main T...

Page 77: ...Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 76 Lab 5 Analog Comparator Select Option 1 Enable ACMP Analog Comparator Menu...

Page 78: ...e Semiconductor Inc 2005 Slide 77 Lab 5 Analog Comparator When enabled the ACMP Analog Comparator test configures the ACMP to compare the voltage on the photosensor RZ1 to the potentiometer RV1 The ou...

Page 79: ...e owners Freescale Semiconductor Inc 2005 Slide 78 Lab 5 Analog Comparator Use a business card to block light to RZ1 photo sensor Application code will measure number of seconds between toggles The di...

Page 80: ...and Proprietary Information 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 Sem...

Page 81: ...e 80 Lab 6 ADC ADC Features Eight input channels for the QG8 Two options for resolution 8 bit or 10 bit configurable by software Conversion type adaptable to each application allows single or continuo...

Page 82: ...roperty of their respective owners Freescale Semiconductor Inc 2005 Slide 81 Lab 6 ADC ADC Pin Control Registers They are used to disable the I O port control of MCU pins used as analog inputs APCTL1...

Page 83: ...are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 82 Lab 6 ADC ADC Status and Control Registers Writing ADCSC1 aborts the current conversion and initiates a new conve...

Page 84: ...are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 83 Lab 6 ADC ADC Data Result Registers ADCRH contains the upper two bits of the result of a 10 bit conversion When co...

Page 85: ...Freescale Semiconductor Inc 2005 Slide 84 Lab 6 ADC ADC Compare Value Register ADCCVH holds the upper two bits of the 10 bit compare value These bits are compared to the upper two bits of the result f...

Page 86: ...ks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 85 Lab 6 ADC ADC Configuration Register ADCCFG i...

Page 87: ...of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 86 Lab 6 ADC Select Option 7 ADC test Main Test Men...

Page 88: ...oduct or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 87 Lab 6 ADC Select Option 1 Meas RV1 RZ1 ADC Menu 1 Meas RV1 RZ1 2 Meas Internal Bandgap e Ex...

Page 89: ...her product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 88 Lab 6 ADC ADC Measurements Adjust RV1 potentiometer and cover RZ1 with paper photo se...

Page 90: ...property of their respective owners Freescale Semiconductor Inc 2005 Slide 89 Lab 6 ADC Select Option 2 Meas Internal Bandgap ADC Menu 1 Meas RV1 RZ1 2 Meas Internal Bandgap e Exit ADC menu Select tes...

Page 91: ...or Inc 2005 Slide 90 Lab 6 ADC Temperature Sensor Edit Application Code to include Temperature Sensor measurement code Internal temperature sensor is multiplexed on ADC channel 26 0x1A Append code to...

Page 92: ...e Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 91 Lab 6 ADC Temper...

Page 93: ...ir respective owners Freescale Semiconductor Inc 2005 Slide 92 Lab 6 ADC Temperature Sensor 2 Select Debug GREEN ARROW This compiles and links the code and invokes the True Time simulator and Real Tim...

Page 94: ...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 2005 Slide 93 Lab 6 ADC...

Page 95: ...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 2005 Slide 94 Lab 6 ADC Temp...

Page 96: ...e logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 95 Lab 6 ADC Temperature Sens...

Page 97: ...trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 96 Lab 6 ADC Temperature Sensor 5 Once c...

Page 98: ...nd 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 2005 Slide 97 Lab 6 ADC T...

Page 99: ...le Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 98 Lab 6 ADC Temperature Sensor Select Option 7 ADC test Main...

Page 100: ...other product or service names are the property of their respective owners Freescale Semiconductor Inc 2005 Slide 99 Lab 6 ADC Temperature Sensor ADC Options ADC Menu 1 Meas RV1 RZ1 2 Meas Internal B...

Page 101: ...ide 100 Lab 6 ADC Temperature Sensor Temperature Conversion Temp 25 VTEMP VTEMP25 m where VTEMP is the voltage of the temperature sensor channel at the ambient temperature VTEMP25 is the voltage of th...

Page 102: ...ormation 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 2005...

Page 103: ...idential and Proprietary Information Freescale and the Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Frees...

Reviews: