GO TOP
E-mail

Freescale HC08 training: Target MC68HC908AP64 microcontroller

The MC68HC908AP64 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.

Basic features:

MC68HC908AP64 MCU:

  • High-performance M68HC08 architecture
  • 8-MHz maximum internal bus frequency (3V or 5V operating voltage)
  • User program FLASH memory with security feature
  • 2,048 bytes of on-chip RAM
  • Two 16-bit, 2-channel timer interface modules (TIM1 and TIM2) with selectable input capture, output compare, and PWM capability on each channel
  • Timebase module
  • Two SCI modules (one of them with IR decoder/encoder)
  • SPI module
  • 8-channel, 10-bit analog-to-digital converter (ADC)
  • 8-bit keyboard wakeup port with integrated pullup
  • IRQ1 external interrupt pin with integrated pullup
  • IRQ2 external interrupt pin with programmable pullup
  • 48-pin low quad flat pack (LQFP), 44-pin quad flat pack (QFP), and 42-pin shrink dual in-line package (SDIP)

Additional features:

  • 32 general-purpose input/output (I/O) pins:
    • 31 shared-function I/O pins
    • 8 LED drivers (sink)
    • 6x25mA open-drain I/O with pullup
  • Low-power design (fully static with stop and wait modes)
  • System protection features:
    • Optional computer operating properly (COP) reset, driven by internal RC oscillator
    • Low-voltage detection with optional reset or interrupt
    • Illegal opcode/address detection with reset
  • Enhanced programming model
  • 16 addressing modes (eight more than the HC05)
  • 16-bit Index register and stack pointer
  • Memory-to-memory data transfers

For more information see this datasheet: MC68HC908AP64


Figure 1. DEMO908AP64 board, Top Side

Figure 2. DEMO908AP64 board, Bottom Side




Figure 3. DEMO908AP64 board features

On figure 3 you see users components available on the board:

  • Serial Port w/ RS232 DB9-S Connector
  • IrDA Serial port
  • 3 LED s Indicators
  • 3 push buttons (1 reset and 2 users switches)
  • MON08 port for debugging/programming needs
  • Photocell circuit (provides a output voltage to ADC5)
  • Potentiometer a 5KOhm provides a 0 to VDD (+5V) to ADC4
  • MCU Port connector provides all digital I/O
  • Analog Port connector provides analog inputs or PTB outputs
  • Selectable clock source 9.8304Mhz or 32.768kHz

Let's start practical example...

Start the CodeWarrior Development Studio. The startup window will guide you.
Click the button "Create New Project":



Figure 4. CodeWarrior IDE Startup window

Select target microcontroller from the list: MC9S08AP64 and select the communication tool MON08 Interface:



Figure 5. CodeWarrior IDE New Project window

Choose programming language C for example and click Finish:



Figure 6. CodeWarrior IDE Project Parameters tab


Figure 7. CodeWarrior IDE Workspace

Add "DEMO908AP64.h" header to the Includes folder:



Figure 8. Adding the header file

Then compile the project (Ctrl + F7). The Compiler supports target processor instructions inside C functions. Following example will show how to do that:

for (;;)
{
    {
#asm
bclr 4,PTB /*LED1 = ON*/
#endasm
    }
}
Mydelay();

Start the debugger (F5) to be sure that our program execute properly. Configure connection manager before first one session:



Figure 9. P&E Connection Manager

Class 4 - Custom board with MON08 serial port must be selected for DEMO908AP64 board. Click "Contact Target with These Settings..." button. Pass power dialog, just turn the power source off and on, then you'll see message on the screen:



Figure 10.

Click yes. From now you can start the program:



Figure 11. Running the real-time debugger

As result LED1 and LED2 must be blinking: LED1 ON/OFF -> LED2 ON/OFF

Download sources.zip

For more information please see these documents: