AN2688 Freescale Semiconductor / Motorola, AN2688 Datasheet - Page 19

no-image

AN2688

Manufacturer Part Number
AN2688
Description
Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
;*******************************************************************************************
;* Constants and Variables for this file
;*******************************************************************************************
;DEFAULT_ROM
;*******************************************************************************************
;* Code Section
;*******************************************************************************************
Entry:
Reset: ldhx #RamEndAddress+1
MOTOROLA
txs
lda
sta
lda
sta
mov
org
#setSIMOPT
SIMOPT
#setPMCSC1
PMCSC1
#setACMPSC,ACMPSC;configure analog comparator
clr
clr
mov
mov
bset
bset
bclr
bclr
bset
bset
clr
clr
mov
mov
clr
clr
clr
clr
bclr
bclr
bset
include 'SigmaDelta.equ'
FlashStart
TPMCNTH
TPMCNTL
#setTPMMODH,TPMMODH
#stTPMMODLF,TPMMODL
TOIE,TPMSC
CLKSA,TPMSC
PTA1,PTA
PTA2,PTA
DDRA1,DDRA
DDRA2,DDRA
PTB
PTC
#OutPorts,DDRB
#OutPorts,DDRC
CounterL
CounterH
SampleL
SampleH
PTE0,PTE
PTE1,PTE
DDRE0,DDRE
Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter
SECTION
Using the HC9S08Rx MCU Family Analog Comparator
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
; H:X = #RamEndAddress + 1
; Stack Pointer (SP) = #RamEndAddress
;configure SIMOPT register
;configure PMCSC1 register
;reset TPM counter
;a Timer interrupt will be generated every TPMMOD
;BUSCLKs (133 -> ~60kHz)
;Timer Overflow Interrupt Enable = 1
;Clock Source Select = BUSCLK
;clear bit 1 of port PTA
;clear bit 2 of port PTA
;define bit 1 of port PTA as output
;define bit 2 of port PTA as output
;reset port PTB
;reset port PTC
;define port PTB as output
;define port PTC as output
;reset Counter (low order)
;reset Counter (high order)
;reset Sample (low order)
;reset Sample (high order)
;clear bit 0 of port PTE
;clear bit 1 of port PTE
;define bit 0 of port PTE as output
Software Listings
AN2688/D
19

Related parts for AN2688