Telemetry Adapter for the TNC-2 By Bill Beech, NJ7P P.O. Box 38 Sierra Vista, AZ. 85636-0038 Jack Taylor, N7OO RR-2 Box 1640 Sierra Vista, AZ. 85635 Abstract This paper describes a modification for the TNC-2 to allow 16 bits of digital I/O and 16 channels of analog to digital conversion. 1. Background During the development of the TheNet 2.XX code, the need for control and monitoring of remote sites was a discussion topic between the authors. Kantronics had marketed the Weather Node and we were asked to provide an interface from TheNet to the Weather Node. The idea that there must be a more seamless solution drove the design of this adapter. 2. Design Alternatives The Weather Node is an 8051 microprocessor based device to provide an ASCII interface to read the measured data. This design did not lend itself to interfacing with a node stack because the node stack uses a modified X.25 frame for internode communications on the RS-232 port. It did not provide the control functions necessary to provide remote control of the site. The design discussed in this paper utilizes an 82C55 Parallel Interface Adapter (PIA) and an ADC0817 16-channel Analog Digital Converter (ADC). These IC's provide the necessary functionality to provide 16 bits of digital I/O, which are byte selectable as either input or output, and a 16 channel voltmeter with 20 millivolt resolution on the basic range of 0 to 5 volts. They are used in an adapter which fits in the TNC-2 and adds this functionality to the TNC-2. 3. Circuit Description The adapter (see figure 1) gains its operating power and all but one required signal from its connection to the Z80 microprocessor. The adapter plugs into the Z80 socket, and the Z80 plugs into the adapter. The 74HCT138 provides the address decode for the PIA and the ADC. The 74HCT02 provides the read/write qualification for the ADC and inverts the reset signal for the PIA. The 8 bits of port A and B of the PIA are available for control. The ports can be set independently for input or output. Each bit represent a CMOS load as an input. Each bit can source/sink up to 2 milliamps as an output. The lower 4 bits of port C of the PIA are used to select the ADC channel for conversion. The ADC is clocked from the 614 KHz signal on pin 5 of U4A in the TNC-2. (This is the only signal not present on the Z80). The conversion time is 100 microseconds. Each channel can have the basic range multiplied by insertion of a single resistor in place of the jumpers in the MULT headers, H2 and H3. 4. Software The Telemetry Adapter software was incorporated in the TheNet Version 2.10 release. Since there is no generic AX.25 code for the TNC-2 in the public domain, this was the only software available for testing. As the adapter was to be used in a node stack, and the authors had experience with this code, this was not a problem. The software allows reading the digital ports as hex bytes. The ports are written to in a decimal format. The voltmeter data is displayed as fixedpoint (i.e. 1.23). The software will allow integral multipliers of the basic 0 to 5 volt range (i.e. 0 to 20 volts) to match the multiplier resistors used on each channel. The ADC is switched through each channel continuously measuring the values. The software switches channels every 10 milliseconds. The following exchange with a telemetry adapter equipped TNC-2 demonstrates the telemetry functions (bold are user commands, normal are tnc responses): * c CONN to NJ7P-4 t SVATST:NJ7P-4} A=00 B=00 V0-7 4.99 3.46 2.35 1.62 1.09 0.78 0.50 0.37 V8-15 0.23 0.17 0.11 0.07 0.05 0.01 0.00 0.00 t 255 128 SVATST:NJ7P-4} A=FF B=80 V0-7 4.99 3.44 2.37 1.60 1.09 0.78 0.50 0.35 V8-15 0.25 0.15 0.11 0.07 0.03 0.03 0.01 0.00 t 128 0 SVATST:NJ7P-4} A=80 B=00 V0-7 4.99 3.44 2.35 1.62 1.09 0.74 0.50 0.37 V8-15 0.23 0.17 0.11 0.07 0.03 0.03 0.01 0.00 t 0 0 SVATST:NJ7P-4} A=00 B=00 V0-7 4.99 3.46 2.37 1.62 1.11 0.74 0.52 0.35 V8-15 0.25 0.15 0.11 0.07 0.03 0.01 0.01 0.00 b DISC from NJ7P-4 In this example both digital I/O ports are configured for output. Note that the commands for the bits are in decimal. The conversion routine for input uses decimal notation, and there is not enough room in the ROM for a hexadecimal routine. The voltages read here are from a resistor ladder network consisting of 16 4.7K resistors tying IN0 to IN15 together. IN0 is also connected to VCC and IN15 is connected to ground. 5. Applications The obvious application would be remote monitoring of power supply voltages and transmitter forward and reflected power. Power supply and battery voltages could be measured by putting a 100K resistor in the multiplier, and setting the software multiplier to 4, yielding a voltmeter range of 0 to 20 volts with 80 millivolt steps. RF power output could be measured by setting the multiplier and multiplier resistor for an appropriate range. Applications providing lower voltages could use an operational amplifier to bring the range up to that of the basic 0 to 5 volts. This was done with the homemade anemometer based on a 99 cent Radio Shack permanent magnet motor. This anemometer provided 0.075 volts at 50 miles per hour and was quite linear. 6. Conclusions and Future Directions The adapter has functioned flawlessly for many months. There is a lot of work to be done on interfaces for it to sense and control the real world. The ability to pass the measured values to a remote collection station automatically would be nice. With the code constraints, it might be better to have a control node query data from various remote sites and inform the system operators whenever a problem is detected. 7. References Intel, "Peripherals", 1990 MFJ ENTERPRISES, "Model MFJ-1270B/1274 Packet Radio Terminal Node Controller TNC 2, Rev 3.1", First Edition, 1986 National Semiconductor, "Data Acquisition Handbook", 1978