beautypg.com

Appendix: 68hc05 microcode to interface, To the cs5521/22/23/24/28, An131 – Cirrus Logic AN131 User Manual

Page 6

background image

AN131

6

AN131REV2

6. APPENDIX: 68HC05 MICROCODE TO INTERFACE TO THE CS5521/22/23/24/28

;*****************************************************************************
;* File:

55226805.ASM

;* Date:

September 23, 1998

;* Revision:0
;* Processor:68HC05
;*
;* Program entry point at routine ’main’. Entry point address is $100
;*
;* This program is an example on how to interface a 68HC05 Microcontroller
;* to a CS5521/22/23/24/28 ADC. The program interfaces via the SPI port (Port D)
;* on the microcontroller, which controls the serial communications,
;* calibration, and conversion cycles.
;*****************************************************************************

;*** Memory Map Equates ***

PORTA

EQU

$00

;General Purpose I/O Port

DDRA

EQU

$04

;Data Direction Control for Port A

PORTD

EQU

$03

;Port D Direct Pin Access (Input)

SPCR

EQU

$0A

;Serial Peripheral Control Register

SPSR

EQU

$0B

;Serial Peripheral Status Register

SPDR

EQU

$0C

;Serial Peripheral Data I/O Register

SPIF

EQU

7

;Serial Peripheral Data Transfer Flag

;*** RAM Values ***

ORG

$50

HIGHBYTE

RMB

1

;Upper 8 bits of Conversion Register

MIDBYTE

RMB

1

;Middle 8 bits of Conversion Register

LOWBYTE

RMB

1

;Lower 8 bits of Conversion Register

COMMAND

RMB

1

;Command Byte storage location

;*****************************************************************************
;* Program Code
;*****************************************************************************

ORG

$100

;*****************************************************************************
;* Routine - main
;* Input

- none

;* Output - none
;* This is the entry point and the main loop of the program.
;*****************************************************************************