EMCO Compact 5 CNC Lathe equipped with 6502 NMOS
Posted: Thu Nov 12, 2020 1:44 pm
Hello,
My name is Dieter and I live in Luxembourg, Europe.
Since childhood I was interested in electric and electronics, but I never experimented with microprocessors until now.
Often I visited this site without being member and used some code, so it's time to share my project too.
I bought a while ago a used CNC Lathe, the famous EMCO Compact 5 CNC known by lot of model engineers.
This lathe was a dream for me when I saw it the first time about 1985.
Prices where prohibitive in this years, so expensive as a new car but she was mainly a training machine
with an reduced set of commands and functions!
CNC programs where stored on Philips data cassettes.
A monitor, a serial link, a DNC board with I/O's and a tool changer were expensive options.
The original CPU-board is equipped with a 6502 1MHz NMOS CPU, 3x 6821P VIA (Keyboard, Stepper motors, DNC interface),
ICM7218AIJI Display driver for 7-segment LED's, 10x 2114 4-bit RAM (5kB), 3x EPROM 2764,
on a daughter-board we have the CRT video controller 6845 and 6551 serial interface.(the options)
Address decoding is provided by TTL 74LSxx. Clock rate is a "tremendous" 0.819 MHz.
Most people "retrofits" there machines with new controllers/drivers but I like this 1980 charm of electronic
where one don't need a microscope to solder. I worked for a phone company and I repaired sometimes boards,
but with SMD it becamed nearly impossible. Today its buy and throw away.
I use for my project most of the old TTL and CMOS, transistors etc etc stock from my old company, I saved them from the bin.
The machine worked perfectly, but the baud rate of the serial link was a poor 300 Bd, transfert of programs
where really slow and so I made the first steps in modifying the machine.
Downloading datasheets to find the parameters for baud rate with nearly no experience
in microprocessors and periphal devices was the first step.
I had already an old EPROM-Programmer and by trial and error (about 5 EPROM burnings) I found the place in the HEX file
for 1200 Bd (the maximum possible without transmission errors, there is no flow control).
I hadn't yet disassembled any code but I was "catched" by the idea to upgrade the lathe to my ideas.
I got another CPU from a milling machine which is similar to the lathe CPU, this is my "developers kit".
All hardware/software modification is tested and then duplicated for the lathe without detailed schematics.
After I found circuit diagrams for the spinlde motor controller and the stepper controller on EMCO user group
but nothing exist about the CPU.
Fortunataly a friend had an EPROM emulator and this made the next modifications possible.
I replaced the 3 2764 EPROMS with a 27256 to store the whole code in the emulator by wiring OR the
3 CS with shottky diodes.
With 5kB of memory a CNC program was limited to 210 blocks. (it seems that machines existed with 222 blocks)
To extend the memory at 16kB I moved the addresses for the display driver and the keyboard matrix VIA
to a free space and used a 256 kb CMOS RAM I took from an old PABX CPU.
A Gold cap saves now the memory, impossible with the original RAM's (NMOS)
and they are now disabled by wiring CS to VDD.(no need to desolder, they draw only a few mA in standby)
But half of the new RAM and half of the original video RAM where not used so I made a manual "bank switching"
to store two independend CNC programs. The zero page, stack and the area used for variables
don't switch, only the CNC program area, this made the address decoding more complex.
The RAM area is rugged: $0000 - $3FFF used for page zero, stack and storage of CNC programs
and $A400 - $A7FF for variables (originally installed on the CPU but not in use in my software version,
if used it frees the end of CNC-RAM area and one can store 222 blocks with original RAM's, it's funny
that EMCO didn't use it immediately, but RAM was expensive and there are pictures of CPU's without the last 2x 2114)
The new RAM allows 2x 990 blocks of CNC Code.
I also overclocked the system to 1.5 MHz, but of course I needed to adapt the timing loops.
The video RAM now stores comments present in the CNC program files and is also switched.
A lot of "flying wires" where necessary and it doesn't look professional but it works.
A bit off topics for this site:
I also replaced the stepper motors (reluctand steppers 72 steps/rev very odd) with old
200 steps/rev bi-polar hybrid motors with rewired windings for use with the original drivers.
The magnets became week over time (Ferrit magnets), therefore I made new tube rotors, this rebuild motors are now
reluctand steppers to. (They have less torque but no magnets to age)
I added a reversal relay board for the spindle motor and added the CNC command M04 for counter clockwise rotation,
an additional keyboard to emulate important commands which need double keystrokes (STOP and intermediate STOP of
a program, loading/sending programs over serial link), the "bank switch", an X/Z indicator when hitting end stops etc.
All modifications in the code were made directly in the EPROM emulator in machine code.
I already used some routines from 6502.org to improve the multiplication and division and HEX/BCD conversion.
But I'm far an inexperienced programmer and hardware with age became more difficult (eyesight), so progress is slow.
My next step would be replacing the 6502 with a 65c802 to accelerate the multiplication and division routines with 16-bit
and memory block transfer, mainly the transfer to the video RAM for monitor scrolling with the new block move functions.
Compared with a 8237 DMA Controller the 802/816 seems faster.
I know it's hard to find a 65c802 but it would be nearly a plug and play for hardware.
For 85c816 I have to make an adapter with 3-state line drivers for the data bus, inverters, AND's etc etc
but I would have more flexibility; with de BE input it would be simpler to add DMA improoving even more the
block transfert with a 6844 DMA and using the large multiplication/division tables method described on 6502.org
in a second step.
Hope it's not to much off topic for 6502.org, if there is interest I can go into more details.
Dieter
My name is Dieter and I live in Luxembourg, Europe.
Since childhood I was interested in electric and electronics, but I never experimented with microprocessors until now.
Often I visited this site without being member and used some code, so it's time to share my project too.
I bought a while ago a used CNC Lathe, the famous EMCO Compact 5 CNC known by lot of model engineers.
This lathe was a dream for me when I saw it the first time about 1985.
Prices where prohibitive in this years, so expensive as a new car but she was mainly a training machine
with an reduced set of commands and functions!
CNC programs where stored on Philips data cassettes.
A monitor, a serial link, a DNC board with I/O's and a tool changer were expensive options.
The original CPU-board is equipped with a 6502 1MHz NMOS CPU, 3x 6821P VIA (Keyboard, Stepper motors, DNC interface),
ICM7218AIJI Display driver for 7-segment LED's, 10x 2114 4-bit RAM (5kB), 3x EPROM 2764,
on a daughter-board we have the CRT video controller 6845 and 6551 serial interface.(the options)
Address decoding is provided by TTL 74LSxx. Clock rate is a "tremendous" 0.819 MHz.
Most people "retrofits" there machines with new controllers/drivers but I like this 1980 charm of electronic
where one don't need a microscope to solder. I worked for a phone company and I repaired sometimes boards,
but with SMD it becamed nearly impossible. Today its buy and throw away.
I use for my project most of the old TTL and CMOS, transistors etc etc stock from my old company, I saved them from the bin.
The machine worked perfectly, but the baud rate of the serial link was a poor 300 Bd, transfert of programs
where really slow and so I made the first steps in modifying the machine.
Downloading datasheets to find the parameters for baud rate with nearly no experience
in microprocessors and periphal devices was the first step.
I had already an old EPROM-Programmer and by trial and error (about 5 EPROM burnings) I found the place in the HEX file
for 1200 Bd (the maximum possible without transmission errors, there is no flow control).
I hadn't yet disassembled any code but I was "catched" by the idea to upgrade the lathe to my ideas.
I got another CPU from a milling machine which is similar to the lathe CPU, this is my "developers kit".
All hardware/software modification is tested and then duplicated for the lathe without detailed schematics.
After I found circuit diagrams for the spinlde motor controller and the stepper controller on EMCO user group
but nothing exist about the CPU.
Fortunataly a friend had an EPROM emulator and this made the next modifications possible.
I replaced the 3 2764 EPROMS with a 27256 to store the whole code in the emulator by wiring OR the
3 CS with shottky diodes.
With 5kB of memory a CNC program was limited to 210 blocks. (it seems that machines existed with 222 blocks)
To extend the memory at 16kB I moved the addresses for the display driver and the keyboard matrix VIA
to a free space and used a 256 kb CMOS RAM I took from an old PABX CPU.
A Gold cap saves now the memory, impossible with the original RAM's (NMOS)
and they are now disabled by wiring CS to VDD.(no need to desolder, they draw only a few mA in standby)
But half of the new RAM and half of the original video RAM where not used so I made a manual "bank switching"
to store two independend CNC programs. The zero page, stack and the area used for variables
don't switch, only the CNC program area, this made the address decoding more complex.
The RAM area is rugged: $0000 - $3FFF used for page zero, stack and storage of CNC programs
and $A400 - $A7FF for variables (originally installed on the CPU but not in use in my software version,
if used it frees the end of CNC-RAM area and one can store 222 blocks with original RAM's, it's funny
that EMCO didn't use it immediately, but RAM was expensive and there are pictures of CPU's without the last 2x 2114)
The new RAM allows 2x 990 blocks of CNC Code.
I also overclocked the system to 1.5 MHz, but of course I needed to adapt the timing loops.
The video RAM now stores comments present in the CNC program files and is also switched.
A lot of "flying wires" where necessary and it doesn't look professional but it works.
A bit off topics for this site:
I also replaced the stepper motors (reluctand steppers 72 steps/rev very odd) with old
200 steps/rev bi-polar hybrid motors with rewired windings for use with the original drivers.
The magnets became week over time (Ferrit magnets), therefore I made new tube rotors, this rebuild motors are now
reluctand steppers to. (They have less torque but no magnets to age)
I added a reversal relay board for the spindle motor and added the CNC command M04 for counter clockwise rotation,
an additional keyboard to emulate important commands which need double keystrokes (STOP and intermediate STOP of
a program, loading/sending programs over serial link), the "bank switch", an X/Z indicator when hitting end stops etc.
All modifications in the code were made directly in the EPROM emulator in machine code.
I already used some routines from 6502.org to improve the multiplication and division and HEX/BCD conversion.
But I'm far an inexperienced programmer and hardware with age became more difficult (eyesight), so progress is slow.
My next step would be replacing the 6502 with a 65c802 to accelerate the multiplication and division routines with 16-bit
and memory block transfer, mainly the transfer to the video RAM for monitor scrolling with the new block move functions.
Compared with a 8237 DMA Controller the 802/816 seems faster.
I know it's hard to find a 65c802 but it would be nearly a plug and play for hardware.
For 85c816 I have to make an adapter with 3-state line drivers for the data bus, inverters, AND's etc etc
but I would have more flexibility; with de BE input it would be simpler to add DMA improoving even more the
block transfert with a 6844 DMA and using the large multiplication/division tables method described on 6502.org
in a second step.
Hope it's not to much off topic for 6502.org, if there is interest I can go into more details.
Dieter