Specifications

Program Examples
B-13
Program Examples
;===========================================================================
* File Name: SCI.asm
* Description: PROGRAM TO PERFORM A LOOPBACK IN THE SCI MODULE IN ’240x
* An 8 bit value is transmitted through the SCITXD pin at a baud rate of
* 9600 bits/sec. SCITXD–SCIRXD pins are connected together, if external
* loopback is desired i.e. if it is desired to echo the bit–stream back. The SCI
* receives the bit–stream and stores the received data in memory for verification.
* This program is capable of doing internal loopback AND external loopback,
* depending on the value written in SCICCR.
;===========================================================================
.include 240x.h
KICK_DOG .macro ;Watchdog reset macro
LDP #00E0h
SPLK #05555h, WDKEY
SPLK #0AAAAh, WDKEY
LDP #0h
.endm
;===========================================================================
; M A I N C O D E – starts here
;===========================================================================
.text
START:
LDP #0
SETC INTM ;Disable interrupts
CLRC SXM ;Clear Sign Extension Mode
CLRC OVM ;Reset Overflow Mode
SETC CNF ;Config Block B0 to Data mem.
LDP #00E0h
SPLK #006Fh,WDCR ;Disable WD
KICK_DOG
SPLK #0h,GPR0 ;Set wait state generator for:
OUT GPR0,WSGR ;Program Space, 0–7 wait states
LDP #00E0h
SPLK #0040h,SCSR1 ;Enable clock for SCI module