![](http://datasheet.mmic.net.cn/30000/MC68HC16Z3VFC16_datasheet_2369798/MC68HC16Z3VFC16_465.png)
M68HC16 Z SERIES
INITIALIZATION AND PROGRAMMING EXAMPLES
MOTOROLA
USER’S MANUAL
E-13
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.
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'
;table of EQUates for common register
;addresses
INCLUDE
'ORG00000.ASM'
;initialize reset vector
INCLUDE
'ORG00008.ASM'
;initialize exception vectors
ORG
$00200
;start program right after exception
;vectors
*****
Initialize
*****
INCLUDE
'INITSYS.ASM'
;initially set
EK=F, XK=0, YK=0, ZK=0
;set sys clock at 16.78MHz, disable COP
INCLUDE
'INITRAM.ASM'
;turn on internal SRAM at $10000
;set stack in bank 1 (SK=1, SP=03FE)
LDAB #$00
STAB PEPAR
;define the Port E pins as I/O pins
STAB PFPAR
;define the Port F pins as I/O pins
LDAB #$00
STAB PORTE0
;clear the Port E data register
STAB PORTF0
;clear the Port F data register
LDAB #$FF
STAB DDRE
;initialize Port E pins as outputs
;note that Port E pin 3 does not exist!
LDAB #$FF