Remote Processing Coorporation RPC-320 Dokumentacja Strona 37

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 186
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 36
Commands - 7
BIN
Numeric Function
SYNTAX: n = BIN(m)
PURPOSE: To return a number from a packed BCD number.
REMARKS: This function assumes that the BCD digits are packed. That is, there are four BCD digits per 16–bits.
EXAMPLE: A = BIN(B)
Normally, the only way BCD data can enter the system is through an I/O port like those on the 82C55
(e.g. reading a two digit BCD thumbwheel switch).
Each of the two switches has four outputs. Together, the eight lines are connected to an I/O port
input. Assuming the thumbwheel switches are set to 98 and connected to I/O port &18, the port input
would look as follows (where D0 through D7 are the eight data bits):
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 1 0 0 0
The example below appears wrong at first. However, CAMBASIC assumed that this was a binary
number and gave you the decimal equivalent.
PRINT INP(&18)
152
To get the correct result:
PRINT BIN(INP(&18))
98
ERROR: <Illegal argument> – if any BCD digit > 9
<Data negative > – for m
Przeglądanie stron 36
1 2 ... 32 33 34 35 36 37 38 39 40 41 42 ... 185 186

Komentarze do niniejszej Instrukcji

Brak uwag