SENA HD1200 User Manual

Page 41

Advertising
background image

Starter Kit and User Manual for the HelloDevice 1200

38

setb rw

; Ser as Read Active (pin 30, nWR=HIGH)

clrb dpramcs

; Chip Enable (pin 31, nCE=LOW)

mov Scratch0, datalo

; Read data from Data line and save it to Scratch0 variable (refer to pin 19~26)

setb dpramcs

; Chip Disable (pin 31, nCE=HIGH)

mov w, Scratch0

; Save the value of Scratch0 into w register

retp

Write memory

To write Dual-Port RAM, specify address for DPROffsetLSB and DPROffsetLSB, save appropriate 1 byte

value to w-register, and call

_dpramwrite

subroutine. To save multiple byte values, call

_dpramwrite

several times.

_dpramwrite

mov Scratch0, w

; Save the data to be written to Scratch0 variable

mov

!datalo,#$00

; Set Data Read line as output (refer to pin 19 ~ 26)

mov addlo, DPROffsetLSB

; Set memory address (Address 0 ~ 7) : refer to pin 9 ~ 16

mov addhi, DPROffsetMSB

; Set memory address (Address 8 ~ 10): refer to 17 ~ 18, 33

mov datalo, Scratch0

; Write the value of Scratch0 to Data line (refer to 19~26)

clrb dpramcs

; Chip Enable (pin 31, nCE=LOW)

clrb rw

; Set Write Active (pin 30, nWR=LOW)

setb rw

; Clear Write Active (pin 30, nWR=HIGH)

setb dpramcs

; Chip Disable (pin 31, nCE=HIGH)

retp

Generating interrupt into the HelloDevice

Before you generate an interrupt to the HelloDevice, you should specify the address and length of the data to be

read by the HelloDevice. In this sample, your device will specify the address value at InAddrMSB and

InAddrLSB of interrupt control register location, by writing as such. You will also specify the data length at

InLenMSB, InLenLSB, by writing such. And then, you will have to write data to the specified location. Next,

you will have to generate interrupt by writing 0xAA value to INTR_L register. Then, interrupt is generated into

the HelloDevice, and the HelloDevice will read the data written by user device. The following is a sample code.

InAddrMSB

equ

$7F4

InAddrLSB

equ

$7F5

InLenMSB

equ

$7F6

InLenLSB

equ

$7F7

OutAddrMSB equ

$7F8

Advertising