Xicor Application Note
AN33
AN33-2
******************************************************************************
* THIS CODE WAS DESIGNED TO DEMONSTRATE HOW THE XICOR X24C01 COULD *
* BE INTERFACED TO THE 68HC11 MICROCONTROLLER. THE INTERFACE USES 2 LINES *
* FROM PORT D (PD0 AND PD1) TO COMMUNICATE. *
* *
* THE CODE SHOWN DEMONSTRATES A 'RANDOM READ' AND 'BYTE WRITE'. THE OTHER *
* MODES OF OPERATION CAN BE CREATED BY EXPANDING UPON THESE ROUTINES. *
* ACKNOWLEDGE POLLING IS USED TO DETERMINE WHEN THE WRITE CYCLE FINISHES. *
* *
* THE MAINLINE OF THIS PROGRAM READS THE DATA LOCATED AT ADDRESS 002DH AND *
* THEN WRITES THAT DATA BACK TO ADDRESS 0041H. THIS PROGRAM HAS BEEN TESTED *
* USING THE X24C01.
* REVISED: JANUARY 1997 *
******************************************************************************
*
SCLBIT
SDABIT
SDAOUT
SDAIN
DMASK
PORTD
DDRD
ADDR
DATA
COUNT
PDDATA
COUNT2
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
$02
$01
$03
$02
$80
$08
$09
$80
$82
$83
$84
$85
MASK INDICATING PORTD SCL POSITION
MASK INDICATING PORTD SDA POSITION
MAKES SDA AN OUTPUT IF STORED IN DDRD
MAKES SDA AN INPUT IF STORED IN DDRD
USED TO MASK BIT TO SEND TO DUT
PORT D OFFSET IN 'PAGE' $1000
PORT D DIRECTION REGISTER OFFSET
LOCATION FOR X24C01 ADDRESS TO ACCESS
LOCATION FOR X24C01 DATA TRANSFERED
COUNTER LOCATION FOR LOOPING
TEMP REGISTER FOR DATA STORAGE
COUNTER FOR ACK POLLING
****************************
* RESET VECTOR ENTRY POINT *
****************************
ORG
FDB
$FFFE
$E000
RESET VECTOR ADDRESS TO PROGRAM ENTRY
JUMP TO BEGINNING OF EXECUTABLE CODE
***********************
* PROGRAM ENTRY POINT *
***********************
ORG
$E000
BEGINNING OF EXECUTABLE CODE
BEGIN:
LDS
LDX
LDAA
STAA
LDAA
STAA
LDAA
STAA
JSR
LDAA
STAA
JSR
#$00FF
#$1000
#$FF
PORTD,X
#$03
DDRD,X
#$2D
ADDR
RDBYT
#$41
ADDR
WRBYT
INITIALIZE STACK POINTER
INITIALIZE PAGE OFFSET LOCATION
MAKE PORTD ALL ONES
MAKE SDA AND SCL OUTPUTS
READ DATA FROM ADDRESS 002DH
WRITE DATA BACK TO ADDRESS 0041H