*** NOTE *** 12/11/84 DEVICE.DOC The December issue of BYTE magazine contains an excellent article by Steve Ciarcia (as usual) on using micros to control the real world. --J.F. *** NOTE *** 11/25/84 I just glanced through the December/January issue of Profiles and saw a "home control system" for your Kaypro in the "New Products" column. While the DEVICE setup described in this file is no where near as complex as the system described in the magazine, it doesn't carry a $1500.00 price tag either. I think that every computer owner, at one time or another, dreams of a "computerized" household. DEVICE is just my way of automating the troublesome task of hooking up various printers and other peripherals while, in a rather small fashion, fulfilling this dream. If you are of the more ambitious sort and plan on a similar, but more extensive system, I hope DEVICE can be of some small help to you, possibly as a starting point. In any case, good luck and happy computing! --J.F. DEVICE.DOC -- Documentation for DEVICE vers 1.1 November 21, 1984 (for use with pre-'84 Kaypro IIs and 4s only) The longer that I own a computer, the more gizmos, gadgets, and do-hickeys I accumulate for it. Of course, every time I want to use one of these assorted goodies, I have to swap a zillion cables and extension cords. I looked at various RS-232 switchers, etc, but none of them seemed to satisfy my (or my wallet's) requirements. Some digging around (my favorite pastime!) showed that my Kaypro 4 had two Z80 PIOs, but only used one side of each. I decided that one of these would satisfy my "switching" needs nicely. HARDWARE -------- I selected the unused B side of the general purpose PIO (the A side is used for the Centronics printer port) as my victim. Bits 0-7 of this spare parallel port are available at solder pads E7-E14 on the main board (next to U54) of older (pre-'84) Kaypros (see the table below), and can be brought to the back of your Kaypro, along with +5 volts D.C. and supply ground, using some ribbon cable and a small "D" type connector. bit # - solder pad ----- ---------- 0 E14 1 E13 2 E12 3 E11 4 E10 5 E9 6 E8 7 E7 Each of these eight lines can be used to control various peripherals, etc. in a variety of ways. The following circuit, for example, allows your Kaypro to control the flow of A.C. current to a given load. inverter +5 ----------+------->120 | ______ | |M2 __>VAC |\ ---1| MOC |6--- | | | \ 200 ohm | 3010 | TRIAC | cntrl line---| >O--/\/\/\----2| | r2* G / | | | / | |4--/\/\/\-/ |M1 | |/ ------ | | * - value depends on triac's -LOAD-- gate current The inverter allows the PIO to drive the LED inside the opto-coupler, which, by the way, provides a very comforting 7500 volts of isolation between your computer and the 120 volts A.C.. You could substitute a relay for the triac or use the circuit to control a lower A.C. voltage (for low voltage lamps, motors, etc.). The following two examples show how to control either an analog or digital signal buss. ----- 8 digital lines in->| |>-8 digital lines out (buffered) | | e2| | |\ ----| | | \ | e1| | 74LS244 cntrl line---| >O----+---| | Digital "Switch" | / ----- |/ inverter ---------- 4 lines analog | | 4 lines analog data in-------->| |>-data out | | |\ ---------- 4066 | \ A| B| C| D| Analog "Switch" cntrl line---| >------+--+--+--+ | / |/ buffer By using variations of the above techniques, I have set up my work station so that I can manipulate or enable various peripherals, including my printers, an EPROM programmer, a modem, and a speech synthesizer without leaving the keyboard. SOFTWARE -------- Using the spare parallel port is quite straight forward. The data address is 0AH. The control address is 0BH. If you are not familiar with programming the Z80 PIO I would suggest that you pick up a copy of the Mostek data book, it seems to be a little easier to decipher than the one available from Zilog. The following partial Z80 listing sets up the PIO in the bidirectional mode and then sets up all 8 bits as outputs. PORT EQU 0AH ;SPARE parallel port CPORT EQU 0BH ;PIO control port CWORD EQU 0CFH ;control word to set spare port to ; bidirectional mode. the PIO expects ; another word after this one to set the ; individual bits to either INPUT or OUTPUT ; 0 in bit pos. = OUTPUT ; 1 in bit pos. = INPUT ; initialization LD A,CWORD ;cntrl word in A OUT (CPORT),A ;output to cntrl port LD A,00H ;ALL outputs OUT (CPORT),A ; ; output info to port LD A,byte 1 ;first byte to output OUT (PORT),A LD A,byte 2 ;second byte to output OUT (PORT),A . . . . . . and so on DEVICE.COM is a simple menu driven program that allows you to toggle "devices" 1 thru 8 ON or OFF (bits 0 thru 7 of the spare port HI or LOW) from the keyboard. Simply enter: DEVICE to enter the program and either ^C or to exit. Any settings that you make using DEVICE will remain in effect until you either change them with DEVICE, press the reset button (Cold Boot), or turn your computer OFF. You can strike any key to cancel the pause after the sign-on message (striking any key also cancels the pause after DEVICE informs you of an improper entry). You can also remove either the sign-on message or the improper entry message (or both) with the patches listed at the end of this file. I have been using the same basic setup for close to eight months now, and have had no problems with it. For me at least, the convenience provided has been well worth the effort it took to get everything "up and running". I would enjoy hearing from you if you set up a similar system or are using your micro in some other type of "real world" control. Just leave me a message on the Downey RCPM (213) 806-2226. ENJOY! Joe Fitzpatrick DEVICE.COM PATCHES ---------- ------- Remove sign-on message: change 0169 from 11H to 18H 016A from CAH to 07H Remove improper entry message: change 020E from 11H to 18H 020F from 07H to 0EH If you simply want to change the pause length (default is approximately 2 seconds on a 5 Mhz Kaypro) change the hex value at 027A (currently 07H) to a lower value to shorten the pause, or a higher value to lengthen it. Note about DEVICE on PRO8 systems: If you are using the PRO8 monitor ROM from Micro Cornucopia (a great magazine!), DEVICE changes your cursor to invisible (SPACE) until you exit the program, at which time your cursor is restored. This operation should have no nasty side effects on non-PRO8 systems. If one should turn up however, you may remove this feature by changing the ten bytes from 015F to 0168 to 00H and the seven bytes from 023B to 0241 to 00H.