CAD CAM EDM DRO - Yahoo Group Archive

RE: [CAD_CAM_EDM_DRO] DOS/EMC aka DeskNCrt (LONG)

Posted by Tim Goldstein
on 2001-03-30 10:50:16 UTC
When I played with it previously it was a stand alone program that ran from
DOS (not a DOS window). I just down loaded it and looked at the readme file.
Nothing there would indicate that it is not still a stand alone DOS program
link CNC Pro.

Below is the readme contents.

Tim
[Denver, CO]



>
> Doug, et al,
> Is this a stand alone DOS program that I can d/l, install and run?
> Or does this fit into additional user supplied programming?
> Not so sure, Rich D.

>
> FAQ: http://www.ktmarketing.com/faq.html

DeskNCRT is a RS274 G-Code interpreter and stepper motor driver running
under
a Real Time DOS Microkernel. It is currently for 3 Axis milling machines
only.
DeskNCRT has a 150 continuous move look ahead buffer and can run in closed
loop
mode using a simple DRO board from Camtronics.

DeskNCRT supports the following G and M Codes:
G0 rapid positioning
G1 linear interpolation
G2 circular/helical interpolation (clockwise)
G3 circular/helical interpolation (counterclockwise)
G10 coordinate system origin setting
G17 xy plane selection
G18 xz plane selection
G19 yz plane selection
G20 inch system selection
G21 millimeter system selection
G40 cancel cutter diameter compensation
G41 start cutter diameter compensation left
G42 start cutter diameter compensation right
G43 tool length offset (plus)
G49 cancel tool length offset
G53 motion in machine coordinate system
G54 use preset work coordinate system 1
G55 use preset work coordinate system 2
G56 use preset work coordinate system 3
G57 use preset work coordinate system 4
G80 cancel motion mode (including any canned cycle)
G81 drilling canned cycle
G83 chip-breaking drilling canned cycle
G84 right hand tapping canned cycle
G85 boring, no dwell, feed out canned cycle
G86 boring, spindle stop, rapid out canned cycle
G87 back boring canned cycle
G88 boring, spindle stop, manual out canned cycle
G90 absolute distance mode
G91 incremental distance mode
G92 offset coordinate systems
G92.2 cancel offset coordinate systems
G93 inverse time feed mode
G94 feed per minute mode
G98 initial level return in canned cycles
G99 R-point level return in canned cycles

M0 program stop
M1 optional program stop
M2 program end
M6 tool change
M48 enable speed and feed overrides
M49 disable speed and feed overrides

Pricipal of Operation:

There are six seperate tasks running at the same time under a DOS
Real Time MicroKernel. The first task is the g-code interpreter.
DeskNCrt interprets a g-code file and appends a 150 move buffer with
linear and circular moves at the proper feedrate. The feedrate will
be
clamped to a maximum of the MAX_VELOCITY of the [TRAJ] section when
performing an interpolated move. The feedrate will be clamped to the
MAX_VELOCITY of each individual axis' when in a rapid positioning
(G00)
move. This task has a low priority and is always running when
processing
a file or MDI command.

The second task is the motion control task. It processes the 150
move
buffer and determines the position of the spindle based on feedrate
and acceleration values. This is the Commanded position and is
calculated
at the Servo Cycle time. If the Servo Cycle time is set to its
default
0.001 seconds then the Commanded position is calculated 1,000 times
a second. Increasing the Servo Cycle time can reduce the Following
Error
at high rapid speeds at the expense of using more CPU power. The
Following Error is the difference between the Commanded and Actual
positions. If you are running in closed loop mode the Actual
position
will be read from the encoders on each axis. If you are running in
Open Loop mode, the output from the Stepper Driver task is taken
as the Actual Position. Note that there is ALWAYS a following error
when the machine is in motion even when running in Open Loop mode.
The minimum Following Error encountered during a move can be at
least
the distance traveled in one Servo Cycle. If you are running an
axis
at a 50 IPM feedrate the axis can move 50 / 60 * 0.001 = 0.00083
Inch
in one Servo Cycle (assuming 0.001 second cycle).

The Commanded position is fed to the third task. This is the
Stepper
Motor driver task and has the highest priority. This task has a
constant
frequency output as set by the PERIOD variable. The maximum steps
per
second that your setup can output is determined by twice the PERIOD.
Increasing the PERIOD will increase performance at the expense of
using
more CPU power. If the PERIOD is set to 10 (microseconds) then the
max SPS of your system is 1,000,000 / (10 * 2) = 50,000 SPS. For
best
performance, you should run your motors at a max of 1/5 this value
or
the maximum your hardware can reliably run. Output frequency is
clamped
to a max SPS by setting the MIN and MAX_OUTPUTS. MIN and
MAX_OUTPUTS
set the maximum SPS your system can run at any time. The
MAX_VELOCITY
settings set the max feedrate. It is possible for the motors
to move faster than the MAX_VELOCITY to 'catch up' to the commanded
position
but they can never go faster than the MIN and MAX_OUTPUT.

The fourth task is the Command interface. Here you can enter
commands
to run a file or jog the table.

The fifth task is the Message task and is responsible for delivering
messages from all other tasks to the screen.

The sixth task is the Display task and outputs information such as
current axis position and following error at eight times a second.

DeskNCRT Setup:

PIN Assignments for the parallel port:

X Direction - PIN 2
X Step - PIN 3
Y Direction - PIN 4
Y Step - PIN 5
Z Direction - PIN 6
Z Step - PIN 7

Positive Limit Switches - PIN 15
Negative Limit Switches - PIN 13
Home Switches - PIN 12

Switches are connected in parallel so that all 3 axis'
connect into one PIN.

DeskNC.Ini File Setup Parameters:

The following Setup Parameters are defined in the
DeskNC.Ini file and can be changed with any Text Editor.

SECTION [EMCMOT] :Sets general parameters.
PERIOD : Real Time Switching Period in
Microseconds.
This sets the resolution of the clock and
the maximum
frequency of the step signals. Lowering the
Period
will increase CPU usage and increase
performance.
Set the PERIOD so that CPU usage is 80 - 90%
at idle.
PARPORT_IO_ADDRESS : Base Port Address of the parallel port
(usually 888).
DRO_ADDRESS : Base Port Address of the Camtronics DRO
Board.
Set to 0 when not using the DRO board or set
it to the
base address of the board if running in
closed loop mode.
CYCLE_TIME :Servo Cycle Time. Sets the time period
used to calculate the
next Commanded position.
AXES : Number of Axis (3).
COORDINATES : Axis designations (X Y Z)

SECTION [TRAJ] :Sets trajectory parameters.
CYCLE_TIME [TRAJ] : Trajectory Cycle time. The time
trajectory
calculations are calculated. Course traj
planner
calculations are interpolated at the Servo
Cycle Time.
MAX_VELOCITY [TRAJ] : Maximum feedrate. Do not enter a feedrate
beyond
the capabilities of your hardware or a
Following Error
will occur. This feedrate can be 150%
greater than
the individual axis' MAX_VELOCITY.
LINEAR_UNITS : Units per Millimeter (Inches =
0.03937007874016).
HOME : Home Position coordinates.
DEFAULT_VELOCITY : Initial startup feedrate.
DEFAULT_ACCELERATION : Initial startup acceleration.
MAX_ACCELERATION : Maximum Acceleration.
USELIMITS : Set to 1 to detect switches, 0 to disable
switch sensing.

SECTION [AXES] :Sets parameters for each axis
MAX_VELOCITY : Maximum feedrate of each axis.
The individual axis' MAX_VELOCITY. This is
the
absolut maximum velocity a single axis can
reliably
run at.

PID: : The PID is used to calculate the proper
velocity
of the motors based on each axis' commanded
and actual
positions. The larger the error (commanded
- actual), the
faster the motors should turn. The
calculated speed of the
motors will be based on the PID algorythm.
P : Proportional Gain of the compensation
algorithm. This
is a constant used to multiply the Error.
The Error is the
commanded position minus the actual
position. Increasing this
value will help track the commanded position
better at higher
velocities but may reduce the smoothness at
lower velocities.
Increase the 'P' until there is very little
'overshoot' at higher
feedrates. This is the most important value
of the PID.
FF1 : The 1st order feed foreward gain. Usually
set to 1.0.
FF2 : The 2nd order feed foreward gain. Not
normally used.
BIAS : Bias. Currently unimplemented.
BACKLASH : Backlash in user units.
DEADBAND : Deadband in user units. This is the
maximum distance with which
the Error is effectively zero. Set this to
the distance of at least
one half step so that the motor will not
'hunt' for its
final position.
MAX_FERROR : Maximum cumulative following error. The
cumulative error
is multiplied by the Integral Gain of the
compensation algorithm.
The MAX_FERROR and 'I' are not usually
required when running steppers.
If the following error is larger than the
MAX_FERROR the the Integral
gain of the PID will be added in. This
results in a speed increase
of the motors at this threshold.

FERROR : Maximum scaled Following error. This is
the maximum
following error based on the velocity of the
axis. Set it to the same
value as the MIN_FERROR to start.
MIN_FERROR : Minimum following error. If the current
following error
exceeds the MIN_FERROR value, motion will
disable and a 'following
error' error will be displayed.
INPUT_SCALE : Number of encoder counts per unit followed
by the input offset(0).
This value can be negative if the encoder is
'running backwards'.
OUTPUT_SCALE : Number of steps per unit followed by the
output offset (0).
MIN_LIMIT : Minimum Soft Limit coordinate. Motion will
not go past this value.
MAX_LIMIT : Maximum Soft Limit coordinate.
MIN_OUTPUT : Max Steps per Second scale in negative
direction
MIN_OUTPUT * OUTPUT_SCALE = -(Max
Steps/Second). This sets the
maximum frequency of the step signal output.
MAX_OUTPUT : Max Steps per Second scale in positive
direction
MAX_OUTPUT * OUTPUT_SCALE = Max
Steps/Second. This sets the
maximum frequency of the step signal output.
HOMING_VEL : Feedrate used for homing.
HOME_OFFSET : Home Offset. This is the position the
spindle will
move to after a Homing sequence.
MIN_LIMIT_SWITCH_POLARITY : Logic high or low detection of Min
Limit switches.
MAX_LIMIT_SWITCH_POLARITY : Logic high or low detection of Max
Limit switches.
HOME_SWITCH_POLARITY : Logic high or low detection of
Home switches.
HOMING_POLARITY : Homing direction. Either 0 or 1.
Sets the direction
for the homing sequence.

Tuning Your System:

For best results, your computer should be tuned to your hardware.
DeskNCRT
runs under a Real-Time DOS Microkernel that uses your computers
clock to
switch between simultaneously running 'Tasks'. The resolution of
this clock
is read from the DeskNC.Ini file under 'PERIOD'. Care should be
taken
in setting the time period. The higher the resolution (shorter time
period)
the more CPU time is used and can cause your computer to lock up if
set
too small. To tune your system, first set your input scale to the
number of encoder steps per unit for each axis. If you are not using
the DRO board
for closed loop operation, enter the number of steps per unit for
the output scale.
Enter the number of steps per unit for the output scale. Start
DeskNCrt and
watch the CPU usage percent indicator. If it is less than 80% then
slowly
reduce the PERIOD by using the Period command below. Once the CPU
indicator is about
80% - 90%, set this Period value in the DeskNC.Ini file.

Set MIN and MAX_OUTPUT to the maximum step rate of your system such
that
MAX_OUTPUT * OUTPUT_SCALE = Max Steps/Second.
MIN_OUTPUT * OUTPUT_SCALE = -(Max Steps/Second).
The step signal frequency will never exceed this scaled value. The
MAX_VELOCITY
values should be set so that when moving at maximum velocity, your
drivers are running
at slightly less than the Max step rate clamped by the MIN and
MAX_OUTPUT.

eg. A system running at 8000 steps/inch at a max step rate of 4000
steps/second.
MAX_OUTPUT = 4000 / 8000 = .5
MIN_OUTPUT = -.5
MAX_VELOCITY [AXIS] = 4000 * 60 / 8000 = 30 IPM (Use a value
slightly less - 27 IPM)

Tune the PID. You will most likely only use the 'P' and 'FF1'
parameters.
If your system 'overshoots' its commanded position, increase the
proportional
gain ('P' for each axis) until movement is satisfactory. Watch the
Following Error
display and look for unwanted 'oscillations'.



Commands:

The following commands can be entered directly in the Main window.
Pressing the Enter key will display the latest Status. Axis
designation
is 0 - 2 for X - Z.

?, ??, ???, help : Display the following Help commands.
> : toggle prompt on or off.
; : comment follows.
quit : Quit DeskNCRT.
show : Show current Status in Main window.
show {pids} : Show Pid settings in the Main window.
show {flags} : Show Flags in the Main window.
show {limits} : Show limits and Maximum Following Error
detected in Main window.
show {scales} : Show velocity scales Main Window.
free : Set mode to free.
coord : Set mode to coordinated 3 axis motion.
Coord mode is required for running a file
and any MDI command.
pause : Pause motion.
resume : Resume motion after a pause.
a : ABORT all motion.
c : Continue processing a NC file after a Stop
or Tool Change.
enable : Enable motion calculations and output.
disable : Disable output.
jog : Enter jog mode.

When in Jog Mode, the following key press commands are available.

? : Display these commands in the Main window.
U : Jog Up.
D : Jog Down.
R : Jog Right.
L : Jog Left.
B : Jog Back.
F : Jog Forward.
X : Jog Set X axis to 0.
Y : Jog Set Y axis to 0.
Z : Jog Set Z axis to 0.
A : Jog Set All axis' to 0.
> : Increase jog distance by 10x.
< : Decrease jog distance by 10x.
Q : Quit Jog Mode.

jogspeed <feedrate> : Set jog speed.
jogdist <distance> : Set jog increment distance.
set <t>, <s>, <v>, : Set the <trajectory time>, <servo time>,
<l>, <a> <value> <feedrate>, <max feedrate>, or
<acceleration>.
oscale <axis> <a> <b> : Set Output scale and offset of the axis.
Equels the number
of steps per unit.
iscale <axis> <a> <b> : Set the Input scale and offset of the
axis. Equels the number
of encoder counts per unit when running in
closed loop mode or
the number of steps per unit when running in
open loop mode.
pol <axis> <nhl phl> : Set the Polarity of the Negative or
Positive Limit switch for axis.
pol <axis> <homedir> : Set the Polarity of the Homing direction
for axis.
pol <axis> <homesw> : Set the Polarity of the Home Switches for
axis.
Polarity is either 0 or 1 depending on
whether the switch
is sensed as a low or high signal.
minlimit <axis> <min> : Set min soft position limits for axis.
maxlimit <axis> <max> : Set max soft position limits. for axis.
minclamp <axis> <min> : Set minimum OUTPUT_SCALE for axis.
maxclamp <axis> <max> : Set maximum OUTPUT_SCALE for axis.
ferror <axis> <value> : Set max following error for axis.
home <axis> : Home an axis.
limits off : Disable hardware limits.
limits on : Enable hardware limits.;
mdi <nc code> : Execute nc code directly.
run <file> <line no> : Run nc file starting at line <line no>.
Line no. is the actual text lin number and
not
the block number.

Windows

Main:

The Main window displays the current Status.

Mode : Either Coordinated 3 axis or Free single axis.
Time : Compute time in seconds. Should be less than the
Servo Cycle time.
Traj Step Time : Trajectory and Step frequency times in seconds.
Jog Speed : Current jog speed;
Jog Distance : Current jog increment distance.
Enabled : Displays which axis' are currently enabled.


Position:

The position window displays the current position of the spindle:

X, Y, and Z : Current coordinates updated 8 times a second.
X, Y, and Z : Current following error updated 8 times a second.
This is the difference between the Commanded and
Actual positions.
Id : Id of the motion currently being executed.
Depth : Depth of the look ahead queue. Up to 140 moves
can be queued.
Act : Actual Active depth of the queue.
Feed : Current feedrate.
Heart : Heartbeat of the motion controller.
CPU : Percent of CPU usage.

Messages:

The Message window displays all messages from DeskNCRT.

DeskNC.tbl:
This is the tool table offset file. Enter values for length and
diameter tool offsets. The Pocket, FMS, Length, and Diameter fields
should come after a blank line;

DeskNC.var:
This is the work coordinate/offset file for DeskNCrt. Parameters
for
Codes G92, and G54-G59 are entered in this file. Do not change the
first
ID values, only change the coordinates.

GCode.Exe:
GCode.Exe contains the same RS274 interpreter as DeskNCrt and is
used
to check files for errors. To check your GCode file for errors
simply
enter GCode <filename.ext>. The program will stop on the first
error
encountered.

Discussion Thread

Tim Goldstein 2001-03-30 10:50:16 UTC RE: [CAD_CAM_EDM_DRO] DOS/EMC aka DeskNCrt (LONG)