home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p078 / 7.img / TUTOR.PLB / BINBCD.PLD < prev    next >
Encoding:
Text File  |  1990-12-11  |  1.0 KB  |  31 lines

  1.                             BINARY TO BCD CONVERTER
  2.  
  3. This binary to BCD converter accepts a 7-bit binary number in the range
  4. 0000000b to 1100011b and converts it to a pair of decimal digits.  For
  5. example, the following conversions will be performed.
  6.  
  7.     BINARY[6..0]   UPPER[3..0]  LOWER[3..0]
  8.  
  9.       0000000         0           0
  10.       0000001         0           1
  11.       0010000         1           6
  12.       0111111         6           3
  13.       1000000         6           4
  14.       1100011         9           9
  15.  
  16. No actual devices is assigned, so this corresponds to a trial run to see
  17. how many product terms are required before an actual device is assigned.
  18.  
  19. | in:BINARY[6..0], out:(UPPER[3..0], LOWER[3..0])
  20. |
  21. | Title:  "Binary to BCD converter"
  22. |
  23. | Map:  BINARY[6..0] -> UPPER[3..0], n=0..99  { n -> n/10 }
  24. | Map:  BINARY[6..0] -> LOWER[3..0], n=0..99  { n -> n\10 }
  25. |
  26. | Vectors:
  27. | { Display BINARY[6..0], " -> ", (UPPER[3..0])d, ", ", (LOWER[3..0])d
  28. |   Test    BINARY[6..0]
  29. |   End  }
  30.  
  31.