In emc2, the PC interprets all the gcode, and then the realtime portion of the software produces a "commanded position", typically every 1ms ("commanded position" includes helical arc interpolation, blending, acceleration & velocity limits, and so on). It compares it to a "feedback position" just as often, issuing a following error if the difference is too great.
You can put whatever you want between "commanded position" and "feedback position" -- for instance, servos controlled with a PID loop and PWM, steppers controlled by "step & direction" signals generated at 50kHz, and so on.
So back to this device you'd like to build. You've said it will use the "PC serial port". emc2 doesn't yet include any hardware drivers that use the serial port and can't use linux own drivers for realtime tasks like motion control, but since you're familiar with programming microcontrollers, you should understand in general what it takes to write a hardware driver for the PC's "16550" serial chip. http://www.beyondlogic.org/serial/serial.htm
Now you need to figure out all the details, like the format of the data to be transmitted between the PC and your device. At 115200 baud (the maximum supported by a standard PC serial port) you get about 10 8-byte characters each way per 1ms under ideal conditions. Conveniently, this fits within the 16-byte FIFO of the 16550. One possible format would be a series of 3 or 4 signed differences in position (one per axis you control) with the rest of the bits left over for misc digital inputs and outputs.
Then all you have to do is write all the software and hook up the HAL driver. Documentation for writing HAL drivers is on the linuxcnc.org website: http://linuxcnc.org/docs/2.1/html/hal/comp/


LinkBack URL
About LinkBacks






