QE128 Quick Reference User Guide, Rev. 1.0
Freescale Semiconductor
14-1
Chapter 14
Using the Rapid General Purpose I/O (RGPIO) for the
MCF51QE128 Microcontrollers
14.1
Overview
This is a quick reference for enabling the Rapid GPIO (RGPIO) module for a MCF51QE128
microcontroller (MCU). Basic information about the functional description and configuration options are
provided. This example may be modified to suit an application. This module is only available in 32-bit
cores (V1).
14.2
Code Example and Explanation
This example code is available from the Freescale Web site www.freescale.com
The project file contains the following functions:
•
main — Endless loop. Turn on and off three LEDs.
•
MCU_Init – MCU initialization, watchdog disable, RESET pin enabled.
•
GPIO_Init – Configure PTE0 and PTE1 pins as outputs.
•
RGPIO_Init – RGPIO module configuration.
The following firmware describes the initialization code for the RGPIO module. This example shows the
difference using normal GPIO and Rapid GPIO. The differences are shown in the True Time Simulator
window and is explained further in this document.
This part of the code is the MCU initialization. These instructions disable the watchdog, enable the Reset
option and backgroud pin. The System Option Register 1 (SOPT1) is used to configure the MCU.
void MCU_Init(void) {
SOPT1 = 0x23; // Watchdog disable. Stop Mode Enable. Background Pin
// enable. RESET pin enable
}
This is the General Purpose Input/Output configuration. These code lines configure the pin directions for
the PTE port. In this example two LEDs are connected to the PTE port, therefore the PTE0 and PTE1 pins
are configured as outputs.
void GPIO_Init(void) {
PTEDD = 0x03; // Configure PTE0 and PTE1 pins as outputs
PTED = 0x00; // Put 0's in PTE port
}
This is the initialization code for RGPIO module used for the MCF51QE128 MCU. These code lines
configure the PTE7 to work as a RGPIO output.