34 - LDX#900 DELAY DEX BNE DELAY LDAA INDEX DECA STAA INDEX...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
OPTION EQU $1039 ADCTL EQU $1030 ADR2 EQU $1032 INDEX EQU $F0 NOW EQU $1D0 SUM EQU $1E0 PORTB EQU $1004 ANALOG EQU $1 TOTAL EQU $3 INDEX2 EQU $5 B EQU $7 A EQU $8 ORG $10 TABLE FCB $1 ;BCD table FCB $2 FCB $4 FCB $8 FCB $16 FCB $32 FCB $64 ORG $100 LDAA #$90 ;TURN ON ADC STAA OPTION LOOP3 LDD #$0000 STD SUM ;initialize running total to zero LDAA #128 STAA INDEX ;loop index for averaging LOOP1 LDAA #1 STAA ADCTL ;channel selection LOOP2 TST ADCTL ;wait for EOC BPL LOOP2 CLRA CLRB LDAB ADR2 ;Get converted result STD NOW LDD SUM ;Get running total ADDD NOW STD SUM ;SUM = SUM+NOW
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: LDX #900 DELAY DEX BNE DELAY LDAA INDEX DECA STAA INDEX BNE LOOP1 LDD SUM LSRD LSRD LSRD LSRD LSRD LSRD LSRD LDAA #61 MUL LSRD LSRD LSRD LSRD LSRD LSRD LSRD BSR CONV ;convert # to BCD COMB STAB PORTB BRA LOOP3 CONV CLR TOTAL LDAA #8 AB LSRB BCS ADD BRA DEC ADD STAB B STAA INDEX2 LDAB #8 SUBB INDEX2 LDY #TABLE ABY LDAA 0,Y LDAB TOTAL ABA DAA STAA TOTAL LDAA INDEX2 LDAB B DEC DECA BNE AB LDAB TOTAL RTS END...
View Full Document

This note was uploaded on 10/08/2011 for the course ECE 567 taught by Professor Staff during the Spring '08 term at Ohio State.

Page1 / 2

34 - LDX#900 DELAY DEX BNE DELAY LDAA INDEX DECA STAA INDEX...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online