33 - ADR2 ;Get converted result STD NOW LDD SUM ;Get...

Info iconThis preview shows page 1. 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 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
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ADR2 ;Get converted result STD NOW LDD SUM ;Get running total ADDD NOW STD SUM ;SUM = SUM+NOW 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 COMB STAB PORTB BRA LOOP3 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.

Ask a homework question - tutors are online