[Color Computer] [coco] Learning MW C

Andrew keeper63 at cox.net
Mon Aug 14 11:41:04 EDT 2006


I think Joel has it spot-on with his "step 4" - if you aren't able to 
get the speed out the CoCo, you might have to drive everything with 
custom hardware. However, depending on what you are planning to do, a 
full Linux box may be overkill.

If this were my project (and yes, I do have a far back-burner CNC 
project in mind, but with everything else I am doing, I probably won't 
get to play with it for a while), and I was going to use a CoCo, I would 
interface it with either the bit-banger serial port or the RS-232 pak. 
If I wanted to hit the widest audience (if I were to release the code 
and such), I would go with the bit-banger port. I would interface this 
to a Basic Stamp or similare microcontroller (actually, the new Parallax 
Propeller might be perfect - one core per stepper). The uC would run the 
steppers and such, so that I could send simple positioning commands in a 
serial fashion. The uC would buffer the commands as fast as they came 
in, and then feed the output to the steppers via driver circuitry just 
as Joel suggested.

On the software side, I would either stick with OS-9/BASIC-09, or just 
use regular DECB. Regardless, the code to do this would just send the 
output down the bit-banger port, using the regular methods for either OS.

The tricky part, and the far more interesting and useful part in my 
opinion (from a community perspective), is in the ability of the CoCo to 
read GCODE from a text file and output the proper positioning commands. 
I am sure there are some simple DOS or Linux code (or you could crib 
from the EMC code if it is open source) to read and translate the GCODE. 
In this case, it might be simpler to stick with MW C to translate the 
code needed. Once you got that working (using whatever GCODE test cases 
there are for testing), then you could start on building a simple CAD 
program for the CoCo (I would stick with a CoCo 3 using the 640x200 
mode) that could save to DXF and GCODE. For the CAD code, I would either 
"roll my own" or base it off of Lee Adams'  CADD-1.BAS program presented 
in his book "Supercharged Graphics" (ISBN  0-8306-2959-9) - which is a 
simple CAD program done in BASIC for the IBM-PC (he also shows a simple 
3D CAD program in the same book). The book, though, is likely out of 
print, unfortunately. I translated a few of his 3D graphics programs 
from a different book in the same "series", from the IBM-PC BASIC he 
uses (I think it is GWBASIC) to DECB (long time ago, not recently - I 
was in high school at the time), and they worked well. In fact, 
somewhere I still have the code. Lee Adams also had a similar series 
where all the code is C as well.

I don't know if the CoCo could drive a CNC machine directly at a fast 
enough rate to be useful (doing everything in software). I know it can 
drive the hardware in some manner (hence the old CoCo ROS project), but 
  speed is the issue when doing everything in software. If you were 
doing a custom interface via the cartridge slot and optimized the driver 
in assembly, it might be possible (I say this from seeing a very old CNC 
machine in storage at a surplus place here in Phoenix that was driven by 
an old 5120 IBM-PC - so in theory, it should be possible). I just don't 
think it would be worth it unless this was only going to be something 
for you and you alone to use. If you planned on giving this to the 
community, it would be far more useful to have a GCODE interpreter than 
a custom hardware interface, IMHO...

-- Andrew L. Ayers
    Glendale (Phoenix), Arizona



More information about the Coco mailing list