2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues. 2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)

Undercolor/850103/The Data Gatherer Pt 1

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search

Home Articles Companies Publications Hardware People Software Timeline ... Emulators Internet Resources
(Don't see something listed? Click "edit" and add it! Together we can build this database. When making a new info page, refer to this InfoBox Template for guidelines.)

UnderColor, Volume 1, Number 3, January 11, 1985

  • Title: The Data Gatherer Pt 1
  • Author: Dennis Kitsz
  • Synopsis: A welcome interruption.
  • Page Scans: Link


Things develop in odd ways: in the past two issues I’ve been working up to a talking real-time clock/calendar, but (how can I say this?) I got distracted. The implications of its battery-back·up real-time clock were powerful for an experimenter like myself, and soon another project drew me away.

So for the next few issues you’ll be reading about the Data Gatherer, a complete data acquisition system for the Color Computer. (Yes, I will get back to the other talking clock! calendar!)

A data acquisition system is techie jargon for a reasonably accurate, flexible method of interfacing "real worId" events to a computer—real signals, real voltages, real time. The Date Gatherer can convert a digital value into a voltage with an accuracy of .025 percent, and can convert a voltage into a digital value with the same accuracy. It can keep the real time, with a battery to keep the time accurate when the computer is turned off, read and set the time, and use the time to trigger computer program segments. It can send or receive digital signals, (in the specific example used here, as a parallel printer port). And, when you turn the power on, its operating system can automatically install and execute a Basic program from read-only-memory (ROM). And finally, it can be used together with other ROM packs or with a disk system.

The Data Gatherer, like the speech synthesizer, makes use of the interfacing principles and hardware of the CoCoPort (The Color Computer Magazine, April—May 1983). The Data Gatherer is also completely modular—you can construct one, two, three or all four of its major sections and use those sections independently.

Analog-to-Digital Conversion

Essential to computer analysis of any non-digital (real world or analog) information is a way to convert that analog information into digital form.

In some cases you've already got digital-like events to analyze, and those demand no special conversion. The number of customers passing through a door, for example, can be counted one at a time (on-off-on-off-on-off). That counting is inherently digital or binary. To record the weight of those customers, however, you would have to measure and convert the weight into computer numbers. A simple electronic alarm system is already digital because you need to detect only whether a window is open (window switch on or off) or if a light beam has been interrupted (beam on or off). On the other hand, in order to determine an intruder‘s exact position in a building, you must measure and convert a value into computer terms.

What if you wanted to keep track of the electricity coming into your home? Knowing if the electricity is on or off is a digital event; but measuring the actual voltage is more difficult, and that's a similar problem to how joysticks are used.

Atari-style joysticks are four simple on-off switches. Each switch determines one direction or none—up, down, left, right, off—and any two neighbors can both be clicked on—up-left, up-right, down-left, down-right. Radio Shack joysticks are more sophisticated, permitting not just the nine positions Atari allows, but 64 unique positions in each direction, a total of 4,096 distinct locations. (Refer to Issue 1 for more details about the Color Computer joysticks.)

To measure an actual voltage, then, you’ve got to come up with an analog-to-digital conversion process that's accurate enough for whatever you need to measure.

There are two major ways of performing the conversion-hardware-intensive or software-intensive. (Sound familiar? Computer applications always involve trade-offs between hardware and software solutions.) The hardware-intensive solution uses a complete analog—to-digital integrated circuit which, when kicked by the computer, measures voltage, and a few microseconds later reports the result to the computer. This is fast, effective—and costly. Complete 12-bit (.025 percent accurate, or one part in 4096) analog-to-digital converters cost $150 or more each.

With the exception of its greater attention to detail, the software-intensive solution for accurately measuring an analog value is identical to the joystick input process. The computer software calculates and outputs a value to a digital-to-analog converter (much cheaper—about $20). The value is altered and compared via software until the computer finds a match. The Data Gatherer uses this solution, called successive approximation.

Digital-to-AnaIog Conversion

At the heart of the Data Gatherer is a digital-to-analog converter. The governing principle of such converters is binary "weighting"; that is, each binary digit of a binary word has a value, or weight, twice that of its neighbor. Here‘s a simple example:

In decimal terms, the binary word 000001 is 1, 000010 is 2, 000100 is 4, 0010000 is 8, 010000 is 16, and 100000 is 32. Each position is twice that of the previous. Complex binary words can be converted to decimal form by summing each of the individual bit values: 101110 is 32+0+8+4+2+0, or 46.

This same mathematical conversion can be applied to converting binary numbers into voltage. Hook the computer to a "black box." The black box assigns values to each bit, based on its "weight" within the binary word. That is, if the right-most binary digit is worth one, then the black box outputs 1/64th of a volt; the next binary digit is worth two, and the black box assigns it 2/64ths of a volt; all the way up the left—most binary digit, worth 32, and assigned 32/64ths of a volt. The binary example above (101110) then becomes the sum of the individual binary digits (46), and the black box outputs 46/64ths of a volt.

The original gray-case Color Computer had the simplest kind of digital-to-analog (D/A) converter, known as a resistor ladder. See how, in the sketch below, each resistor is twice the value of the next, meaning the voltage getting through each resistor is only half the value of its neighbor. The far ends of all six resistors are wired together, resulting in a sum of all the weighted voltages. In the Color Computer, not one volt, but rather five volts are sent to the top of the resistor ladder, meaning the output voltage is divided (scaled) into 5/64ths of a volt (.078 volts) per binary digit of measurement.

In summary, then, a six-bit digital-to-analog converter has a scale running from 0 volts (binary 000000) to 4.92 volts (binary 111111) in steps of .078 volts (1 bit). Take a look at Figure 1.

To get good precision (even at six bits), the resistors must be accurate to within one bit or less (better than one part in 64). This means that for reasonable precision the resistors used in the ladder should be 1 percent types (one part in 100 accuracy). A check of the Color Service Manual reveals that, yes indeed, Radio Shack used 1 percent resistors—10K, 20K, 40.2K, 80.6K, 162K and 324K.

The Color Computer has only a 6-bit D/A converter, but the Data Gatherer uses a 12-bit D/A converter. What does this mean? lt means that the least significant bit of the Data Gatherer's converter is 1/4096th of a division—an accuracy

of .0244 percent. On the same scale of the Radio Shack machine, this means the scale runs from 0 volts (0000 0000 0000) to 4.9987 volts (1111 1111 1111), with each division worth just .0012 volts.

Inside the Data Gather's converter (an Analog Devices type AD667) is a simple resistor ladder. But since Analog Devices states that the AD667 is accurate to within 1/2 bit, it means they have produced resistors with an accuracy of at least .012 percent -- 100 times more accurate than the 1 percent precision resistors in the Radio Shack machine. This is done by "laser trimming" each resistor until it meets the manufacturer's specifications, a process that drives the cost up quickly.

Just for comparison, the total cost of the parts in the Radio Shack computer's D/A converter (seven resistors, one CMOS butter) is about 20 cents in quantities of 100. The Analog Devices AD667s cost $20 or more each in quantities of 100 -- 100 times the accuracy, 100 times the cost.

A block diagram of the AD667 is presented in Figure 2. I'll discuss later the details of the 4-bit latches shown; beyond that, notice the complete simplicity of the device . . . a latch to hold the digital data accurately in place during conversion, level translator and resistor ladder (marked 12-bit high speed DAC), and a scaling amplifier. The amplifier allows the user to select the full voltage scale across which the D/A converter can be used: 0 to 5 volts or 0 to 10 volts. Later I'll

give you a few application ideas for using the two scales.

Real-Time Clock/Calendar

I am planning to save this one for the talking clock/calendar project, and so you'll get very little of the theory and ideas behind the clock/calendar itself right now. Instead, I'll present an interesting hardware trick for fitting a lot of trinkets into a little box. (If you're interested and absolutely must know about the clock/calendar, take a look at Figure 3 for an idea of how thoughtfully designed this $15 microprocessor-compatible clock/calendar is.)

To implement the clock in a full-blown Color Computer system you need some background about its unique arrangement. The Color Computer uses a 6809E microprocessor, its brain, which can address 64K (65,536 bytes) of memory. When this microprocessor is paired with a special memory management circuit known as the Synchronous Address Multiplexer (SAM), that map of 64K bytes is organized and expanded. That expansion includes the ability to address 96K (98,304 bytes) of memory—and possibly more than that in newer versions of the SAM.

Of particular interest is how the SAM organizes the top page (highest 256 bytes) of memory. This small section of memory has been cordoned off for control purposes. Briefly, that involves signals for choosing graphics modes, using the, keyboard peripheral interface adapter (PIA), using the cassette

motor and joystick PIA, etc. One signal from the SAM (Iabeled SCS*, or not-spare-chip-select) is reserved to distinguish a block of 32 addresses in memory from location $FF40 to $FF5F (decimal 65344 to 65375).

It is this block of 32 bytes that the Radio Shack disk pack uses to read and write, select, and run the motor of your disk drives.

It also turns out that a standard disk drive doesn’t actually need all 32 of these addresses, although (for unknown reasons) Radio Shack chose to identify the 16 addresses

from $FF40 through $FF4F are reserved in its software. Nevertheless, by cleverly demultiplexing (decoding) the block $FF40 to $FFSF, the large 32-byte block can be split into one 16-byte section for the disk and one 16-byte section for your own use. These latter 16 bytes can be further multiplexed into four groups of four. Such is the principle of the CoCoPort.

The Data Gatherer is going to need some of those spare

16 addresses for the digital-to-analog converter for the analog-to-digital converter and its channel-selection process (more on that next time), as well as for a printer port.

But a problem arises. According to the manufacturer's data, the real-time clock/calendar alone requires all 16 addresses; in Table 2, you can see that 14 addresses (1-14) are used for reading from tenths of seconds of tens of years, and the two remaining addresses (0 and 16) are used for controlling the clock/calendar's operation and for setting the clock.

How can the D/A converter, A/D converter and printer have their 16 addresses if the clock/calendar wants to hog them all? Or conversely, if we don't put the clock there, how can the disk drive have its 16 addresses? Examine the Data Gatherer block diagram (Figure 1). The "decode" area is the $FF40—$FF5F demultiplexer, and it selects respectively: a PIA for the D/A converter; a PIA for the A/D converter input

and printer; the real-time clock; and (immediately below the block marked "R/W* logic") the disk drive selector.

Look at the "R/W' logic" part of the diagram. This section directs a block of 16 addresses either to the disk drive or to the clock/calendar. It isn't done with mirrors, but it's close.

Fortunately, all the rest of the Data Gatherer's contraptions won't require 16 addresses (actually only eight) so there are a few free. One of these free addresses is a kind of "which-one" selector. By storing a zero at $FF58 (decimal 65368), you permit the disk to be used; by storing a one at $FF58, you permit the clock to be used. The circuit is a simple flip-flop, triggered by the data written to $FF58: flip, it's the disk, flop, it's the clock.

Generalize this process. It is the heart of "bank selection," a term which you will hear applied to many things, from choosing among various peripherals (Radio Shack’s Multipak is a kind of heavy-handed hardware bank selector) to turning on one among several large blocks of memory (RGS Micro’s 128K adaptor for the CoCo requires bank selection to give you that much RAM).

Your "32K/64K" Color Computer is a bank-selected machine, too. When you are using Basic, you have 32K RAM, 8K ROM (Color Basic), 8K ROM (Extended Basic), 8K ROM (Disk Basic), and 8K unused . . . a total of 64K. When you are using a special 64K RAM program such as a word processor (VIP Writer, TeleWriter, etc.), the three Basic ROMs

are turned off and the upper 32K RAM is turned on in their place. That's bank selection.

So to fit all these electronic contraptions into one little block of available memory, you have to resort to the type of fancy footwork called bank selection. As I said, there will be more about the clock itself when I pick up the talking clock/calendar project in a few weeks. (end)