6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 4:33 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu Nov 12, 2020 1:44 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2020 1:59 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
Welcome, and thanks for sharing your project - it's certainly on-topic.

There must be several different ways to tackle the problem of speeding a system up: you've already increased the clock speed, and that has to be the most direct way. I might suggest that you try to take that further, although you may have to introduce wait states or clock stretching for slow peripherals. So long as your memories are single-cycle, you'll get most of the win.

You've also already upgraded the algorithms - in your case, multiplication and division - and that's a good way to do it. If you have a way to profile your system you can perhaps find out which routines would be the biggest win.

You probably don't need an '802 - the '816 is sufficiently compatible, although you may need to pay attention to the way the databus is multiplexed with the high address bits. It might be that your system doesn't mind: the databus is always the databus during phi2.

I think I'd recommend you do some hand calculations to estimate how much the block move might benefit you.

There are threads on clock-stretching, on using an 816 as a replacement, and of course on multiplication. (Sorry, can't quite search for them myself right now.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2020 5:04 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
Thanks for the fast reply,

I bought recently the book "Programming the 65816" and there is a lot of info.
In a first step I should use the 816 and modify the arithmetic routines to 16 bit, for the block moves I hope to speed up
about factor 3 (I have not yet decoded all memory moves).
As you said, perhaps I don't need the 3-state buffers and inverters, on my CPU the phi1 is not used (there are tracks for
an IC connected to phi1 but no IC soldered in) and the adapter would be the simplest.

Dieter


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2020 11:12 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Would you like a 65C802? I ordered some a while back and could be persuaded to let one go to a good cause.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 13, 2020 11:36 am 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
Thanks Andrew,

Yes I want the 65c802, if possible 2x, I need one for the development board and the second for the lathe.

But to experiment with 16 bit I can start with only one 802 and switch later to 816 for the lathe, the code would be the same.
Please tell me for price and payment/shipping.

Dieter


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 13, 2020 12:55 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
I forgot to mention that I worked on the video EPROM.
Henri Keinonen (Ketturi electronics) made a reverse engineering on an EMCO CNC Videoboard.
He changed the EMCO specific character set (only capital letters normal/inverse and special characters) to ASCII character set.
He made also a complete circuit diagram for the video board, he did a good work.

I mixed his character set with the EMCO set and now I have the upper-case letters in normal/inverse from EMCO
and the lower-case letters from ASCII for the comments from the CNC file, it's easier to read then capital letters.

Unfortunately the link https://ketturi.kapsi.fi/2017/10/revers ... ontroller/
doesn't work for the moment but I already saved the pages for future use.

Dieter


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 13, 2020 1:13 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Welcome, Dieter, and thanks for telling us about your work. Considering that you never experimented with microprocessors until now, it's quite impressive to hear about the changes to baud rate, address decoding, clock rate, the video, the EPROM complement and so on!

Do you have any photos of your equipment? I and others would be interested to see them -- and let me assure you that the associated hardware such as the stepper motors is not off-topic. If you do share some photos, please remember you can attach them to a post. There's no need to use a third-party site such as Imgur.

cheers,
Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 16, 2020 5:26 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
Hi Jeff,

Yes, there are lots of photos. What's the maximum of pictures in one post in 800x600 format?

For starting some older photos:

Attachment:
File comment: The machine as bought with the cassette deck and the broken start key on the right side.
C5_001.JPG
C5_001.JPG [ 73.87 KiB | Viewed 1900 times ]


Attachment:
File comment: Now with a keyboard instead of the cassette deck and a start key. The keys are from an old PABX operator keyboard
with integrated LED's.

C5_206.JPG
C5_206.JPG [ 71.77 KiB | Viewed 1900 times ]


Attachment:
File comment: The "development board", it's a EMCO F1 milling machine CPU, slightly different than a lathe CPU with the EPROM emulator.
C5_305.JPG
C5_305.JPG [ 88.27 KiB | Viewed 1900 times ]


Attachment:
File comment: The video and RS232 board on the lathe, you can see the "flying wires" for EPROM bank switching".
C5_418.JPG
C5_418.JPG [ 122.48 KiB | Viewed 1900 times ]


Attachment:
File comment: The screen in "HAND MODE" showing a header (workpiece name) and comments imported from the CNC file.
The inverted 1 shows the CNC program bank (1 or 2).
I added this feature and meantime one can also use lower case letters (modified character EPROM ) and I changed also the layout of the first line.

Originally the screen showed only the first line and the X / Z position, what a wasting of screen area. :-)

C5_605.JPG
C5_605.JPG [ 68.51 KiB | Viewed 1900 times ]


Attachment:
File comment: The screen in "CNC MODE" showing now only the header in the second line and the CNC program.
The second line is originally used for alarms and messages, so the header is overwritten and restored when necessary.

C5_606.JPG
C5_606.JPG [ 70.58 KiB | Viewed 1900 times ]



That's for the moment, I will make new photos to show the current status of hard / software.

Dieter


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 26, 2020 5:05 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
Hello,

--Welcome, Dieter, and thanks for telling us about your work. Considering that you never experimented with microprocessors until now, it's quite impressive to hear about the changes to baud rate, address decoding, clock rate, the video, the EPROM complement and so on!

If you consider the time it took it's not very impressive, I made it over years with long pauses.
I got the machine in 2012, the first mod was the baud rate by playing "Battleship" to find the parameters in the EPROM's.
I looked in the datasheet of the 6551 for the 300 Bd rate parameter and replaced step by step the corresponding value.
If I remember correctly it took about 5 EPROM burns, I had only an old Eprommer.
Step by step I learned but I forget so rapidly, I must always "Restart".

Don't expect detailed and professional drawings, I make a sketch when needed an it's good for ever.
Hope it's clear enough, the text is mostly in German.


When I started an Belgian friend gave me the book "Programming the 6502" translated in French he bought in the1980th
and I had to understand the 6502 first. (In Luxembourg we learn French, German and English in school)
I downloaded all 6502 needed information (MOS handbooks, datasheets etc) from the web, a lot from 6502.org.

Attachment:
File comment: Programming the 6502 from 1984 translated in French.
Book_Prog_6502.gif
Book_Prog_6502.gif [ 467.15 KiB | Viewed 1825 times ]


To find the address scheme I build first a 8-bit trap connected to A8 - A15. With a probe I checked all CS's and the LED's
indicate the address of the components when accessed by making resets of the CPU. My idea was that the reset routine
write to all interfaces and RAM's for initializing.

Attachment:
File comment: The 8-bit trap with 74LS373 latch and an 74LS132 as R/S-FF. The orange wire is the probe.
C5_306.JPG
C5_306.JPG [ 61.39 KiB | Viewed 1825 times ]


Here is the result of my "research":

Attachment:
EMCO_C5_Adressen.gif
EMCO_C5_Adressen.gif [ 262.68 KiB | Viewed 1825 times ]


To get the remaining addresses not found by probing I had to retrace on the CPU:

Attachment:
EMCO_C5_Adress_Decode_1_2.gif
EMCO_C5_Adress_Decode_1_2.gif [ 290.05 KiB | Viewed 1825 times ]
Attachment:
EMCO_C5_Adress_Decode_2_2.gif
EMCO_C5_Adress_Decode_2_2.gif [ 179.25 KiB | Viewed 1825 times ]


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 28, 2020 3:23 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Dieter wrote:
To find the address scheme I build first a 8-bit trap connected to A8 - A15. With a probe I checked all CS's and the LED's
indicate the address of the components when accessed by making resets of the CPU. My idea was that the reset routine
write to all interfaces and RAM's for initializing.

Reverse engineering is fun. :P And you've done a very tidy job with the board you built to trap A8 - A15 -- I'm sure it's a pleasure to use.

Myself, I'm a little lazier... or too fond of quick 'n dirty solutions, maybe. Probably I'd just temporarily jumper the component's /CS to the CPU's RDY input. When /CS goes low the machine will lock up, and it should be possible to use a multimeter to read the voltage on each of the address lines, one by one. Of course, that's a lot less convenient. And it assumes RDY is otherwise unused.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 30, 2020 4:12 pm 
Offline

Joined: Tue Nov 03, 2020 10:55 am
Posts: 7
Hi,

- And you've done a very tidy job with the board you built to trap A8 - A15 -- I'm sure it's a pleasure to use.

This was the first version.
I made an extension for 16-bit PC and Data address trapping and reading the data
with HEX-coding switches and added TIL 311 HEX- Displays:

A switch selects either only PC or PC with data address for reading data.
An other switch selects R/W or both when searching for data.
The DIP switches (you see them it in the background) allows finding of PC addresses by
disabling the last 3 latches, finding the highest address with the HEX-coding switches,
then enabling the next latch, finding again address etc to find the complete PC of an event.
It's far from perfect, it lacks of reading 2 Bytes immediately so I must make 2 reads for 16 bit data.

Attachment:
File comment: Extended 16-bit PC / Data address trap and 8-bit data readout with ancient TIL311 HEX displays.
I can switch them off, they get relatively hot, even with reduced voltage for the LED's.
I will make a try by pulsing the blanking input.

IMG_9762.JPG
IMG_9762.JPG [ 106.21 KiB | Viewed 1739 times ]


Some more pictures:

Attachment:
EMCO_C5_EPROM_orig.gif
EMCO_C5_EPROM_orig.gif [ 241.94 KiB | Viewed 1739 times ]

Attachment:
EMCO_C5_EPROM_modif_V1.gif
EMCO_C5_EPROM_modif_V1.gif [ 327.71 KiB | Viewed 1739 times ]

Attachment:
EMCO_C5_EPROM_modif_V2_1_2.gif
EMCO_C5_EPROM_modif_V2_1_2.gif [ 333.61 KiB | Viewed 1739 times ]

Attachment:
EMCO_C5_EPROM_modif_V2_2_2.gif
EMCO_C5_EPROM_modif_V2_2_2.gif [ 180.5 KiB | Viewed 1739 times ]

Attachment:
EMCO_C5_F1_Keyboard_Matrix_1_2.gif
EMCO_C5_F1_Keyboard_Matrix_1_2.gif [ 262.44 KiB | Viewed 1739 times ]

Attachment:
EMCO_C5_F1_Keyboard_Matrix_2_2.gif
EMCO_C5_F1_Keyboard_Matrix_2_2.gif [ 196.65 KiB | Viewed 1739 times ]

Attachment:
File comment: The original EPROM board with 2764 EPROM's and decoder.
EMCO made this board to upgrade from 2732 to 2764 EPROM's with the old CPU avoiding a new PCB layout.

EPROM_Board_C5_Original.JPG
EPROM_Board_C5_Original.JPG [ 68.62 KiB | Viewed 1739 times ]

Attachment:
File comment: Modified Version 1 with 27256 EPROM, 43256 RAM and Goldcap memory backup.
The new components are added in "Tube Radio" fashion.
Limited by the address range of the CPU a large area of the RAM remained unused.

EPROM_Board_C5_V1.JPG
EPROM_Board_C5_V1.JPG [ 69.54 KiB | Viewed 1739 times ]

Attachment:
File comment: Modified Version 2 with additional 2x CNC RAM address decoding board.
Now the whole RAM is used by switching between 2 CNC RAM areas, the ZP, the stack and a variable area remain the same.
The ribbon cable allows changing the EPROM without unmounting the Video board.
It adds however signal delay to the more complex address decoding, perhaps I need to remove it
or change to faster IC's when using 65C816 and higher clock rate,
it works with 1.5 MHz and original UM6502.

EPROM_Board_C5_Component.JPG
EPROM_Board_C5_Component.JPG [ 72.69 KiB | Viewed 1739 times ]

Attachment:
File comment: Version 2 solder side.
EPROM_Board_C5_Solder.JPG
EPROM_Board_C5_Solder.JPG [ 77.68 KiB | Viewed 1739 times ]

Attachment:
File comment: Sketch of modification on the Video board for CNC RAM switching and connection to the memory backup Goldcap on the EPROM board.
The leftmost free input from the DIP switches is used for display of CNC RAM area 1 or 2 on the monitor.
The other originally used switches select language and monitor frequency.

EMCO_C5_Video_RAM.gif
EMCO_C5_Video_RAM.gif [ 257.02 KiB | Viewed 1739 times ]

Attachment:
File comment: Modified Video board
C5_F1_Video_Modified.JPG
C5_F1_Video_Modified.JPG [ 122.48 KiB | Viewed 1739 times ]


The next step is replacing the UM6502 by a 65C802 or 816 to accelerate the math routines and memory moves.
Also constant surface speed with D/A converter and Opto OP IL 300 (the controller board has mains potential)
and some more CNC commands are on the to do list.
I still have not found an 65C802.

I have more sketches and pictures from the electrics/electronics more specific to the machine
(additional keyboard, spindle motor reversing and relay board, endswitch board, the modified DNC board for the
tool revolver with absolute indexing of the tool using free keyboard matrix inputs and a rotary switch).

Tell me if it's of interest on this forum please.

Dieter


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: