*12456789012345678901245678901234567890124567890123456789 #INCLUDE 'A:\VAR_DEF.ASM' * Define program variables ORG DATA VAL1 RMB 1 ; 1st capture VAL2 RMB 1 ; 2nd capture VAL3 RMB 1 ; 3rd capture VAL4 RMB 1 ; 4th capture * Main program ORG PROGRAM START LDX #REGBAS * switch on A/D converter BSET OPTION,X,%10000000 * Perform a single A/D conversion on PE1 LABEL0 LDAA #%00000001 ; SCAN=0, MULT=0, CA=1 STAA ADCTL,X ; LABEL1 LDAA ADCTL,X ; check-CCF loop ANDA #%10000000 BEQ LABEL1 * Store the four consecutive conversion values LDAA ADR1,X STAA VAL1 LDAA ADR2,X STAA VAL2 LDAA ADR3,X STAA VAL3 LDAA ADR4,X STAA VAL4 BRA LABEL0 ; back to the top SWI ORG RESET ; reset vector FDB START ; set to start of program