Touchscreen Telescope Controller

Note Update Below (With Code+Source)



This computer is an early 1990's Citadel Infostation 386SX-25 with 4M of RAM, VGA resolution, and a flash disk.

Features:

VGA Plasma Display (I think)
Room for one ISA board (see below)
2 serial, 1 parallel port (one serial used by touchscreen)
Touchscreen
Machined Cast (?) Aluminum Case
External switching P/S


I picked this up on Ebay for only $51.00, pretty good, because I suspect that it once cost more than $3000. It has one column of pixels bad, was a little physically beat up, and a little screen burn from its original application, but for $51.00, it was a good deal anyway and I suppose that I have no business complaining. A little paint had it looking great. It had virtually no documentation, but this was expected, and, of course, this sort of problem never actually stops me from doing anything.

The unit had some sort of weird network (possibly Arcnet or x.25) board installed, which I removed from the single ISA slot.

Then, I checked that Mel Bartels' stepper controller board would fit in the unit. I installed it and modified the rear panel to accommodate it. I had trouble with the RJ connector for the handpaddle, so I used some magic repair epoxy to mount it. I made brackets and needed to remove the ISA slot to make what I felt to be a "safe" amount of room within the unit. It MIGHT be possible to fit another serial/parallel port board there - I just didn't need it. I also shortened the mounting standoffs. A bulk capacitor RTV'd to the back of the CPU board was removed, and I felt that it was not needed, considering that the unit would be powered by a very stiff "linear" power supply (the battery).




The next project was to make the unit operate off of +12V instead of the original external 120V switcher. I was not able to get another DC-DC converter that I had previously used, so I wound up with a very inefficient, but reliable and idiotproof, LM323K in a steel TO-3 package. The 323 is mounted on the steel rear panel which acts as a heatsink, which is definitely needed. The good news is that it keeps the unit warm in cold weather (although the plasma display is not affected by cold as badly as LCD displays can be). Good thing I bought the "big" marine battery from Wal-Mart!! The 323 also powers the stepper controller board because I didn't have enough room for the heatsink on the 7805 designed to fit on the board and I wanted to keep as much heat as possible out of the case anyway. The rear panel of the unit already had cutouts for COM1,COM2, and "Network" (DB-9) so I changed these to accommodate the steppers and a spare COM port, COM1, for possible use by an autoguider later. Because the LPT1 port is looped into the stepper controller board, I installed a "dummy" DB-25 on the external panel. I added a switch for Mel's board (12 volts only) an LED, and a +5 jack for the floppy disk drive to the rear panel also. The LED should have been mounted on the front but I just didn't want to risk drilling anywhere near the screen, and I didn't want to remove the screen itself either. Note that to avoid a screwup, the sex of the RA and DEC motors is different.

Mel's board is not designed for any particular mounting or case, meaning, its layout will not make everyone, or anyone, happy(...). I wanted to mount the component side down in order to avoid any mechanical damage while assembling/disassembling the unit. Unless you mount the board as shown (well, straighter, I hope), this will be a very tight fit. I couldn't find the LED test devices alluded to by Mel anywhere on his pages, but I made what I think to be equivalents (shown below). When the unit is tracking, the 4 LED's on each connector brighten and dim in sequence. It is strange to see LED's (usually thought of a digital devices) dim and brighten instead of simply flashing on and off, due to the pulse width modulation used in the stepper motor control software.


The computer was originally designed to mount to or in something via 1/4-20 screws. I fashioned a simple, but fairly nice looking and sturdy mount with 1/4-20 screws and an oak board as shown. The viewing angle turned out very well not by planning, but by darned luck. The rear panel of the unit was flipped upside down from its original position because this allowed more room for the stepper controller board and wiring. I did not need or stuff the field derotator option on the board.

I cannot stress enough how important it is not to leave any loose solder blobs, washers, wire remnants, etc, inside the machine. I suspect that something falling on the exposed PCB of the plasma screen would be fairly fatal to it. Additionally, I liberally used superglue and loctite on all of the screws I installed.

The screen is yellow and there is no way to control brightness - in fact, it is advertised as daylight-readable, which is very nice if you are in daylight! I know someone had red plastic filter material for laptops some time ago; I wish I had some. With a camera red filter, I determined that the screen has enough of a red component so that a red filter will work while dimming it quite a bit.

I wanted the unit to operate without a keyboard if possible, using only the touchscreen. The Dale infrared touchscreen uses 32 (X) by 20 (Y) infrared emitter/detector pairs around the screen, which are multiplexed. This yields a resolution of something like 64X40Y. Dale hasn't made this model in years, and Citadel did not respond to my email. So, after a lot of teeth-gnashing, I did get the mode I wanted the touchscreen to operate in work (see code). It is connected at 9600 baud to COM2. Apparently, there is no speaker driver hardware on the board, which was a little disappointing.

The unit was designed to boot from flash, but has a floppy (externally available) port and a laptop (mini 44-pin type connector) hard disk port available inside. Because Mel's code is designed to read and write files that you update while matching the software to your mount characteristics, I taped a floppy to the unit and powered it during my "learning" phase. Once I was comfortable with the code and data, I flashed it. Upon boot, a ramdisk is created, scope.exe and dat files are copied to it (the .DAT files are uncompressed to ramdisk), and the scope.exe code executes from and writes to it (which is lost upon power off). You might rather install a mini 2.5" laptop type hard disk into the unit (they can be had for less than $30.00), and a cable, while not easy to find, is not expensive either. If you are willing to do some cutting in the case, there is enough room for a floppy. My first goal was to make the unit rugged, and hard disks, even 2.5" ones, just aren't quite as rugged as silicon.

Because of limited space available on the flash, a batch file and program uncompress the .DAT files to ramdisk. I did manage to get every one of Mel's files in flash and expanded to the 4M ramdisk.


Telescope Control Software Touchscreen Modifications

Firstly, let's establish that I am not a very good C programmer, although I'm better in other languages (well, that's my opinion, anyway). So, although this code works, it is more representative of a architectural model for someone to do better coding for later.

I needed to link in the TRIP.CHR font, and this caused >64K segment problems, so I had to use the _far functions for registerbgidriver and registerbgifont, registerfarbgidriver and registerfarbgifont. I also had to make a small modification involving daylight to support compiling in 5.02, whose time.h and associated library differs slightly.

I didn't want to have to "reflash" my computer twice every year to switch between daylight and regular time. So, there is a new prompt for this, which is turned on with autoDST 1 in the config.dat. AutoDST 2 does not ask, but instead looks up the date and figures out if it is DST according to the laws that cover >99% of the US (and probably North America). So, even if you aren't in North America, you can still use (1).

There are two new settings in config.dat to support the touchscreen:

1. touchscreenport (0-4 valid)
2. touchtype - only 0 (none) or 1 - Dale/Citadel are valid at present.

If the touchscreen port conflicts with the LX200 port, the LX port overrides the touch port and touch support is disabled.

If the touchscreen port conflicts with the encoder port, the encoder port overrides the touch port and touch support is disabled.

The touchscreen is "woken up" and tested before use. If it does not respond properly, an error is displayed and the touchscreen functions are disabled.

There are several ways that this particular touchscreen can operate, including a polled or interrupt-driven mode. I chose to use the polled method. The reason I did this is that not all devices of this type can operate in a purely interrupt driven manner, although the coding could have been much cleaner had I used the interrupt only. Using code similar to Mel's interrupt handler, the mode of the touchscreen is determined, and keys are stuffed in the keyboard buffer appropriately. Then, the his use of the getch() function can work normally. This method permits the keyboard to be used instead of or in conjunction with the touchscreen. I identified 8 fundamental input modes for the scope software.


Because of the limited resolution available on the Dale touchscreen, I chose to use graphics mode for bigger characters, which, of course, takes time to switch to, draw, and switch back from. This might be kind of slow on any computer less powerful than this one (but where can you find one less powerful nowadays...). I believe now that I might have just barely reliably made 40x24 text mode work, but then, Mel's prompts can be lengthy and these will take up too much room at 40x24 - you can't have 40x24 and 80x24 characters at the same time without some real serious tricks. I may rethink this sometime in the future.


You may wonder how I came up with the data points for the touchscreen. I wrote a program to generate it. I made several modifications to it to accommodate the "parallax" effect when looking down on the screen at the angle I sit at.

Future Plans

If you don't have a touchscreen, I believe that it is possible to modify this code to support a mouse, so that you could use a computer with no keyboard at all. Most computer BIOS's have settings to ignore the lack of a keyboard.

UPDATE: How to Put a Hard Disk in the Citadel Unit

UPDATE: (Badly Written C) Sample Executable of Touchscreen Communication

Now complete w/source

This can be use to test if your touchscreen works.