Remote-processing CAMBASIC Manuale Utente Pagina 41

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 208
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 40
Commands - 8
BCD
Numeric Fun ction
SYNTAX: n = BCD(m)
PURPOSE: To return four digits in packed BCD format from a number.
REMARK S: The four BCD digits are stor ed in the variable n. Each BC D digit is 4– bits and the four BCD d igits
are stored in 16– bit form . T hese are known as packed BC D num bers. One com mon use is to
convert a count to BCD to send to displays that have BCD inputs.
RELATED: BIN
EXAMPLE: A = 456
PRINT BCD(A)
1110
At first, the answer above appears to be wrong. This is due to the fact that the 4– digit BCD
number has been packed into 16– bits and the print command is treating it as a binary number.
The following converts a 4– digit number and outputs it to two ports:
10 N = BCD(6789)
20 M = N AND 255
30 OUT 1,M
40 N = N \ 256
50 OUT 2,N
ERROR: < Illegal argument> if m > 9999
< Data negative > for m
Vedere la pagina 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 207 208

Commenti su questo manuale

Nessun commento