Motorola Axiom CMD11E1 Guía de usuario Pagina 98

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 101
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 97
98 CHAPTER 9. ANALOG TO DIGITAL CONVERSION
4. Take a reading (this is easy!)
LDAA ADR1
5. Convert it to decivolts by multiplying by 50 and then dividing by 255
LDAB #50
MUL
LDX #255
IDIV
The quotient as a result of division is in the X register. This is an awkward
destination as most of the functions expect the value on the A register. We
transfer from X to A in two steps.. first from X to D. Now the result is in
the [A—B] pair and since the value is less than 255 (the value is between 0
and 50), the result is in the B register. We transfer the value from B to A.
XGDX * D <-> X
TBA * B -> A
6. Print the value in decimal We can now convert the data to BCD format and
then print the left and the right digit.
JSR HEX2BCD
PSHA *SAVE IT FOR LATER USE
JSR OUTLHLF
LDAA #’.
JSR OUTA
PULA *GET THE SAVED VALUE
JSR OUTRHLF
JSR OUTCRLF
The code to convert to BCD was discussed in an earlier section and is
produced here for reference:
HEX2BCD
PSHB
Vista de pagina 97
1 2 ... 93 94 95 96 97 98 99 100 101

Comentarios a estos manuales

Sin comentarios