beautypg.com

Low-power, 8-channel, serial 12-bit adcs – Rainbow Electronics MAX188 User Manual

Page 22

background image

MAX186/MAX188

;set delay between transfers

LDD #$0800
STD SPCR2 ;set ENDQP to $8 for 9 transfers

***** Initialize QSPI Command RAM *****

LDAA #$80 ;CONT=1,BITSE=0,DT=0,DSCK=0,PCS0=ACTIVE
STAA $FD40 ;store first byte in COMMAND RAM
LDAA #$C0 ;CONT=1,BITSE=1,DT=0,DSCK=0,PCS0=ACTIVE
STAA $FD41
STAA $FD42
STAA $FD43
STAA $FD44
STAA $FD45
STAA $FD46
STAA $FD47
LDAA #$40 ;CONT=0,BITSE=1,DT=0,DSCK=0,PCS0=ACTIVE
STAA $FD48

***** Initialize QSPI Transmit RAM *****

LDD #$008F

STD $FD20

LDD #$00CF

STD $FD22

LDD #$009F

STD $FD24

LDD #$00DF

STD $FD26

LDD #$00AF

STD $FD28

LDD #$00EF

STD $FD2A

LDD #$00BF

STD $FD2C

LDD #$00FF

STD $FD2E

LDD #$0000

STD $FD30

PULB
PULA
RTS

READ186:
;This routine triggers the QSPI microsequencer to autonomously
;trigger conversions on all 8 channels of the MAX186. Each
;conversion result is stored in the receive data RAM.

PSHA
LDAA #$80
ORAA SPCR1
STAA SPCR1 ;just set SPE
PULA
RTS

***** Interrupts/Exceptions *****

BDM: BGND

;exception vectors point here

Low-Power, 8-Channel,
Serial 12-Bit ADCs

22

______________________________________________________________________________________

Figure 20. MAX186/MAX188 Assembly-Code Listing (continued)