27.01.2015 Views

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

state of the unused bits cannot be determined, perhaps they have not<br />

actually been constructed in the input port circuit. You can "elimthese<br />

bits by using appropriate software commands. These<br />

commands "mask" these unused bits, so that they become zeros.<br />

Since a 12-bit value may represent decimal values between 0 and<br />

:4095, some means must be found for converting the individual bytes<br />

;that have been input into a single value. We will assume that the<br />

·· ·ght least-significant bits have been input as a single byte from port<br />

312, and that the four most-significant bits have been input from<br />

put port 49313 at bit positions D3-DO. We will further assume that<br />

e unused bits at input port 49313 have been grounded so that they<br />

e logic zeros.<br />

Now that the configuration of the input ports has been defined,<br />

's see how the information is manipulated so that the original value<br />

reconstructed from the two separate bytes of data from the two inf<br />

ports (Fig. 3-13). Since the least-significant bits can represent<br />

ues between 0 and 255 from the 12-bit interface device, these bits<br />

not require any "conversion," since the Apple will simply input<br />

INPUT DATA<br />

DO ---1<br />

Dl ---1<br />

DATA BUS<br />

RD<br />

ADDR<br />

Fig. 3-13. Two-bit input port.<br />

e eight bits and convert them to a value within the range of 0 to<br />

However, if the four most-significant bits are considered apart<br />

the other bits, converting them to decimal will yield values be-<br />

0 and 15, rather than their original positional values of 0, 256,<br />

and so on. These bits have been "offset" by a factor of 256 due<br />

e. fact that the 12-bit data value had to be "split" into smaller<br />

so that it could be input by the Apple. Remember that any<br />

. value that is input into ·the Apple will be automatically con­<br />

.d into a decimal number with values in the range of 0 to 255.<br />

en the two values have been input into the Apple, it is a simple<br />

to "reconstruct" the data. If the information from the four<br />

jgnificant bits is multiplied by 256 and then added to the value<br />

e eight least-significant bits, a resulting value will represent<br />

between 0 and 4095, inclusive, the value that was originally<br />

t as a 12-bit binary value at the interlace .device. The complete<br />

re routine is shown in Example 3-3.<br />

55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!