aweome DIY links


Staff member
This talk of computer controlled machines reminds me of a job I did 10 years ago. A company that makes mailing envelopes had a die cutter machine (X,Y axis and rotating head Z axis with a 50 ton hydraulic press). It was controlled by an old microprocessor board and cassette tape recorder that no longer worked reliably, but the mechanics of it were still good. They paid me $12,500 to design a new computer to control it. I used a 40 MHz 386 and bought a blank ISA card to design my own interface to the shaft encoders and axis motors (using 10 bit D/A chips). I actually had to scope out the signals with the old controller board running to really figure out how the encoders worked.

I wrote the new program using (don't laugh now...) GW Basic! This allowed me to save programs on disk and add new features like drift compensation and global program step adjustments (for when the printing on the paper stock was a bit off from one batch to the next). The entire program is written using a huge ladder logic loop. I chose GW Basic because it had the requisite i/o port in and out instructions and was fairly high level enough to do the user interface stuff quite easily. They were very happy with it back in 1994 and they might still be using it as far as I know.

That was a fun project and a good learning experience too. Good memories of that one.
Wow Guy. I know you are talanted, but that project sounded very challenging! Especially when you had to figure out the encoder from its basic signal outputs.
Ten years ago, I was also working with CNC machines - writing the control code. This was for a year or so after I graduated and while I was looking for a "real" job. The machines ranged from a 2-axis machine up to a 6 axis grinder. The 6 axis grinder had encoders rigged to measure positions at a resolution of 1e-6 inches (one millionth of an inch). They were making cutters (small carbide bits) that needed to be made to 1/10000 inch accuracy. Those encoders were a pain.

The programs were written in various languages and running on DOS or Windows machines. The grinder was running DOS and the main control programs were written in C. But the test code that I usually wrote was also written in GWBasic - they made a number of real parts for customers using the test programs while the real code was still being developed.

The 2 axis machine was controlled using a touchscreen computer running windows (if you've seen the kiosk computers that were discussed on the HomeSeer board recently, you know the form factor of the machine). The touchscreen was an "orange-scale" gas plasma. The actual control program was written in Visual BASIC because it was the easiest way to create the user interface - nice fancy interface with big buttons, scrolling lists of parts, etc.

It was pretty cool stuff to work with. It was also one of the few times I've needed to wear safety goggles while programming.
Well smee, that makes two of us nuts... But really, these were fun projects. I agree, getting things from encoders is always an exercise in patience. The encoders on my die cutting machine were 2 phase square wave output (the kind where one signal goes low before the other depending on the direction). These drove a 16 bit counter made from four cascaded 7493 binary counters. I actually replicated this part of the original controller's circuitry and then read the counter values into a 16 bit latch (and made two readings that had to match to avoid any counter ripple errors). The driving motors were 90 vdc drives controlled by a +10 to -10 control voltage (this is what my DACs had to put out). 0v was to stop the motors while the speed and direction was proportional to the voltage. The ladder logic loop would continuously monitor how far each axis was from the final position and when it was within so many pulses away, it would gradually slow down the motors to get a nice smooth stop at the right position. The PID (Proportional, Integral, Derivative) compensation was actually part of the control program, not in the hardware.

Programming this thing and making the ISA board was truely an educational experience. I still have a blank ISA vector board somewhere that will surely end up in a project someday.