English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (465/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
E.2.1 SIM Programming Examples
The following programming examples involve using the system integration module
(SIM). The programs include:
• Using ports E and F.
• Setting up U1 and U3 RAM slots with two 32K X 8 RAM chips using chip selects.
• Demonstrating the ability of the M68HC16 to change clock frequencies on the fly.
• Demonstrating the software watchdog, the periodic interrupt, and an autovector.
Refer to SECTION 5 SYSTEM INTEGRATION MODULE for more information on the
SIM.
E.2.1.1 Example 1 - Using Ports E and F
* Description : This program demonstrates a simple I/O usage of
*
Ports E and F with a loop that will load Port E
*
with a number, pass that number over to
*
Port F through a hardwire of the M68HC16Z1EVB, and then
read
*
that number from the Port F data register.
*
Port E will be incremented each loop.
*
The hardwire of the M68HC16Z1EVB is from DSACK0 to MODCLK,
*
from DSACK1 to IRQ1, and from AVEC to IRQ2.
*
The numbers start at #$00 and go to #$07.
*
*************************************************************************
INCLUDE 'EQUATES.ASM'
INCLUDE 'ORG00000.ASM'
INCLUDE 'ORG00008.ASM'
;table of EQUates for common register
;addresses
;initialize reset vector
;initialize exception vectors
ORG $00200
;start program right after exception
;vectors
***** Initialize *****
INCLUDE 'INITSYS.ASM'
INCLUDE 'INITRAM.ASM'
;initially set EK=F, XK=0, YK=0, ZK=0
;set sys clock at 16.78MHz, disable COP
;turn on internal SRAM at $10000
;set stack in bank 1 (SK=1, SP=03FE)
LDAB #$00
STAB PEPAR
STAB PFPAR
;define the Port E pins as I/O pins
;define the Port F pins as I/O pins
LDAB #$00
STAB PORTE0
STAB PORTF0
;clear the Port E data register
;clear the Port F data register
LDAB #$FF
STAB DDRE
LDAB #$FF
;initialize Port E pins as outputs
;note that Port E pin 3 does not exist!
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-13