
\chapter{MINI}


\section{Introduction%
\footnote{Much of this chapter quotes from a chapater of the Sherline CNC operators
manual.%
}}

%
\begin{figure}[H]
\caption{\label{fig:startmini}The Mini Graphical Interface}


\centering{}\includegraphics[scale=0.7]{gui/mini01}
\end{figure}


Mini\index{mini} was designed to be a full screen graphical interface.
It was first written for the Sherline\index{Sherline} CNC\index{CNC}
but is available for anyone to use, copy, and distribute under the
terms of the GPL copyright.

Rather than popup new windows for each thing that an operator might
want to do, Mini allows you to display these within the regular screen.
Parts of this chapter are copied from the instructions that were written
for that mill by Joe Martin and Ray Henry.


\section{Screen layout}

%
\begin{figure}[H]
\caption{\label{fig:runmini}Mini Display for a Running EMC}


\centering{}\includegraphics[scale=0.7]{gui/mini02}
\end{figure}
The Mini screen is laid out in several sections. (See Figure\ref{fig:startmini}
) These include a menu across the top, a set of main control buttons
just below the menu and two rather large columns of information that
show the state of your machine and allow you to enter commands or
programs.

When you compare figure\ref{fig:startmini} with figure \ref{fig:runmini}
you will see many differences. In the second figure
\begin{itemize}
\item each axis has been homed -- the display numbers are dark green
\item the EMC mode is auto\index{Auto} -- the auto button has a light green
background
\item the backplotter has been turned on -- backplot\index{backplot} is
visible in the pop-in window
\item the tool path from the program is showing in the display. 
\end{itemize}
Once you start working with Mini you will quickly discover how easily
it shows the conditions of the EMC and allows you to make changes
to it.


\section{Menu Bar}

The first row is the menu bar across the top. Here you can configure
the screen to display additional information. Some of the items in
this menu are very different from what you may be acustomed to with
other programs. You should take a few minutes and look under each
menu item in order to familiarize yourself with the features that
are there. 

The menu includes each of the following sections and subsections. 
\begin{description}
\item [{Program}] This menu includes both reset and exit functions. Reset
will return the EMC to the condition that it was in when it started.
Some startup configuration items like the normal program units can
be specified in the ini file. 
\item [{View}] This menu includes several screen elements that can be added
so that you can see additional information during a run. These include

\begin{description}
\item [{Position\_Type}] This menu item adds a line above the main position
displays that shows whether the displays are in inches or metric and
whether they are Machine or Relative location and if they are Actual
positions or Commanded positions. These can be changed using the Settings
menu described below.
\item [{Tool\_Info}] This adds a line immediately below the main position
displays that shows which tool has been selected and the length of
offset applied.
\item [{Offset\_Info}] adds a line immediately below the tool info that
shows what offsets have been applied. This is a total distance for
each axis from machine zero.
\item [{Show\_Restart}] adds a block of buttons to the right of the program
display in auto mode. These allow the operator to restart a program
after an abort or estop. These will pop in whenever estop or abort
is pressed but can be shows by the operator anytime auto mode is active
by selecting this menu item.
\item [{Hide\_Restart}] removes the block of buttons that control the restart
of a program that has been aborted or estopped.
\item [{Show\_Split\_Right}] changes the nature of the right hand column
so that it shows both mode and pop-in information.
\item [{Show\_Mode\_Full}] changes the right hand column so that the mode
buttons or displays fill the entire right side of the screen. In manual
mode, running with mode full you will see spindle and lube control
buttons as well as the motion buttons.
\item [{Show\_Popin\_Full}] changes the right hand column so that the popin
fills the entire right side of the screen.
\end{description}
\item [{Settings}] These menu items allow the operator to control certain
parameters during a run.

\begin{description}
\item [{Actual\_Position}] sets the main position displays to actual(machine
based) values.
\item [{Commanded\_Position}] sets the main position displays to the values
that they were commanded to.
\item [{Machine\_Position}] sets the main position displays to the absolute
distance from where the machine was homed.
\item [{Relative\_Position}] sets the main position displays to show the
current position including any offsets like part zeros that are active.
For more information on offsets see the chapter on coordinate systems.
\end{description}
\item [{Info}] lets you see a number of active things by writing their
values into the MESSAGE pad.

\begin{description}
\item [{Program\_File}] will write the currently active program file name.
\item [{Editor\_File}] will write the currently active file if the editor
pop in is active and a file has been selected for editing.
\item [{Parameter\_File}] will write the name of the file being used for
program parameters. You can find more on this in the chapters on offsets
and using variables for programming.
\item [{Tool\_File}] will write the name of the tool file that is being
used during this run.
\item [{Active\_G-Codes}] will write a list of all of the modal program
codes that are active whenever this item is selected. For more information
about modal codes see the introductory part programming chapter.
\end{description}
\item [{Help}] opens a text window pop in that displays the contents of
the help file.
\end{description}
You will notice between the info menu and the help menu there are
a set of four buttons. These are called check buttons because they
have a small box that shows red if they have been selected. These
four buttons, Editor, Backplot, Tools, and Offsets pop in each of
these screens. If more than one pop-in is active (button shown as
red) you can toggle between these pop-ins by right clicking your mouse. 


\section{Control Button Bar}

Below the menu line is a horizontal line of control buttons. These
are the primary control buttons for the interface. Using these buttons
you can change mode from {[}MANUAL{]} to {[}AUTO{]} to {[}MDI{]} (Manual
Data Input). These buttons show a light green background whenever
that mode is active. 

You can also use the {[}FEEDHOLD{]}, {[}ABORT{]}, and {[}ESTOP{]}
buttons to control a programmed move. 


\subsection{MANUAL\index{Manual}}

This button or pressing <F3> sets the EMC to Manual mode and displays
an abreviated set of buttons the operator can use to issue manual
motion commands. The labels of the jog buttons change to match the
active axis. Whenever Show\_Mode\_Full is active in in manual mode,
you will see spindle and lube control buttons as well as the motion
buttons. A keyboard <i> or <I> will switch from continuous jog to
incremental jog. Pressing that key again will toggle the increment
size through the available sizes. 

%
\begin{figure}[H]
\caption{Manual Mode Buttons\label{cap:Manual-Mode-Buttons}}


\centering{}\includegraphics[scale=0.8]{gui/miniman}
\end{figure}

\begin{quotation}
A button has been added to designate the present position as the home
position. We felt that a machine of this type (Sherline 5400) would
be simpler to operate if it didn't use a machine home position. This
button will zero out any offsets and will home all axes right where
they are.

Axis focus is important here. Notice (in figure \ref{fig:startmini})
that in manual mode you see a line or \emph{groove} around the X axis
to highlight its position display. This groove says that X is the
active axis. It will be the target for jog moves made with the \emph{plus}
and \emph{minus} jog buttons. You can change axis focus by clicking
on any other axis display. You can also change axis focus in manual
mode if you press its name key on your keyboard. Case is not important
here. {[}Y{]} or {[}y{]} will shift the focus to the Y axis. {[}A{]}
or {[}a{]} will shift the focus to the A axis. To help you remember
which axis will jog when you press the jog buttons, the active axis
name is displayed on them. 

The EMC can jog (move a particular axis) as long as you hold the button
down when it is set for \emph{continuous}, or it can jog for a preset
distance when it is set for \emph{incremental}. You can also jog the
active axis by pressing the plus {[}+{]} or minus {[}-{]} keys on
the keyboard. Again, case is not important for keyboard jogs. The
two small buttons between the large jog buttons let you set which
kind of jog you want. When you are in incremental mode, the distance
buttons come alive. You can set a distance by pressing it with the
mouse. You can toggle between distances by pressing {[}i{]} or {[}I{]}
on the keyboard. Incremental jog has an interesting and often unexpected
effect. If you press the jog button while a jog is in progress, it
will add the distance to the position it was at when the second jog
command was issued. Two one-inch jog presses in close succession will
not get you two inches of movement. You have to wait until the first
one is complete before jogging again. 

Jog speed is displayed above the slider. It can be set using the slider
by clicking in the slider's open slot on the side you want it to move
toward, or by clicking on the {[}Default{]} or {[}Rapid{]} buttons.
This setting only affects the jog move while in manual mode. Once
a jog move is initiated, jog speed has no effect on the jog. As an
example of this, say you set jog mode to \emph{incremental} and the
increment to 1 inch. Once you press the {[}Jog{]} button it will travel
that inch at the rate at which it started. 
\end{quotation}

\subsection{AUTO\index{Auto}}

When the Auto button is pressed, or <F4> on the keyboard, the EMC
is changed into that mode, a set of the traditional auto operation
buttons is displayed, and a small text window opens to show a part
program. During run the active line will be displayed as white lettering
on a red background. 

In the auto mode, many of the keyboard keys are bound to controls.
For example the numbers above the querty keys are bound to feed rate
override. The 0 sets 100\%, 9 sets 90\% and such. Other keys work
much the same as they do with the tkemc graphical interface. 

%
\begin{figure}[H]
\caption{Auto Mode\label{cap:Auto-Mode}}


\centering{}\includegraphics[scale=0.8]{gui/miniauto}
\end{figure}


Auto mode does not normally display the active or modal codes. If
the operator wishes to check these, use menu Info -> Active\_G-Codes.
This will write all modal codes onto the message scratch pad. 

If abort or estop is pressed during a run a set of buttons displays
to the right of the text that allows the operator to shift the restart
line forward or backwards. If the restart line is not the last active
line, it will be highlighted as white letters on a blue background.
Caution, a very slow feed rate, and a finger poised over the pause
button is advised during any program restart.
\begin{quotation}
The real heart of CNC machine tool work is the auto mode. Sherline's
auto mode displays the typical functions that people have come to
expect from the EMC. Along the top are a set of buttons which control
what is happening in auto mode. Below them is the window that shows
the part of the program currently being executed. As the program runs,
the active line shows in white letters on a red background. The first
three buttons, {[}Open{]}, {[}Run{]}, and {[}Pause{]} do about what
you'd expect. {[}Pause{]} will stop the run right where it is. The
next button, {[}Resume{]}, will restart motion. They are like feedhold
if used this way. Once {[}Pause{]} is pressed and motion has stopped,
{[}Step{]} will resume motion and continue it to the end of the current
block. Press {[}Step{]} again to get the motion of the next block.
Press {[}Resume{]} and the interpreter goes back to reading ahead
and running the program. The combination of {[}Pause{]} and {[}Step{]}
work a lot like single block mode on many controllers. The difference
is that {[}Pause{]} does not let motion continue to the end of the
current block. Feed rate Override ... can be very handy as you approach
a first cut. Move in quickly at 100 percent, throttle back to 10\%
and toggle between {[}Feedhold{]} and 10\% using the pause button.
When you are satisfied that you've got it right, hit the zero to the
right of nine and go. 

The {[}Verify{]} button runs the interpreter through the code without
initiating any motion. If Verify finds a problem it will stop the
read near the problem block and put up some sort of message. Most
of the time you will be able to figure out the problem with your program
by reading the message and looking in the program window at the highlighted
line. Some of the messages are not very helpful. Sometimes you will
need to read a line or two ahead of the highlight to see the problem.
Occasionally the message will refer to something well ahead of the
highlight line. This often happens if you forget to end your program
with an acceptable code like \%, m2, m30, or m60. 
\end{quotation}

\subsection{MDI\index{MDI}}

The MDI button or <F5> sets the Manual Data Input mode. This mode
displays a single line of text for block entry and shows the currently
active modal codes for the interpreter.
\begin{quotation}
MDI mode allows you to enter single blocks and have the interpreter
execute them as if they were part of a program (kind of like a one-line
program). You can execute circles, arcs, lines and such. You can even
test sets of program lines by entering one block, waiting for that
motion to end, and then enter the next block. Below the entry window,
there is a listing of all of the current modal codes. This listing
can be very handy. I often forget to enter a g00 before I command
a motion. If nothing happens I look down there to see if g80 is in
effect. G80 stops any motion. If it's there I remember to issue a
block like g00 x0 y0 z0. In MDI you are entering text from the keyboard
so none of the main keys work for commands to the running machine.
{[}F1{]} will Estop the control. 
\end{quotation}
Since many of the keyboard keys are needed for entry, most of the
bindings that were available in auto mode are not available here.


\subsection{{[}FEEDHOLD{]} -- {[}CONTINUE{]}}

Feedhold is a toggle. When the EMC is ready to handle or is handling
a motion command this button shows the feedhold label on a red backgrouund.
If feedhold has been pressed then it will show the continue label.
Using it to pause motion has the advantage of being able to restart
the program from where you stopped it. Feedhold will toggle between
zero speed and whatever feed rate override was active before it was
pressed. This button and the function that it activates is also bound
to the pause button on most keyboards.


\subsection{{[}ABORT{]}}

The abort button stops any motion when it is pressed. It also removes
the motion command from the EMC. No further motions are cued up after
this button is pressed. If you are in auto mode, this button removes
the rest of the program from the motion cue. It also records the number
of the line that was executing when it was pressed. You can use this
line number to restart the program after you have cleared up the reasons
for pressing it.


\subsection{{[}ESTOP\index{ESTOP}{]}}

The estop button is also a toggle but it works in three possible settings. 
\begin{itemize}
\item When Mini starts up it will show a raised button with red background
with black letters that say {}``ESTOP PUSH.'' This is the correct
state of the machine when you want to run a program or jog an axis.
Estop is ready to work for you when it looks like this.
\item If you push the estop button while a motion is being executed, you
will see a recessed gray button that says {}``ESTOPPED.'' You will
not be able to move an axis or do any work from the Mini gui when
the estop button displays this way. Pressing it with your mouse will
return Mini to normal ready condition.
\item A third view is possible here. A recessed green button means that
estop has been take off but the machine has not been turned on. Normally
this only happens when <F1> estop has been pressed but <F2> has not
been pressed.
\end{itemize}
Joe Martin says, {}``When all else fails press a software {[}ESTOP{]}.''
This does everything that abort does but adds in a reset so that the
EMC returns to the standard settings that it wakes up on. If you have
an external estop circuit that watches the relevant parallel port
or DIO pin, a software estop can turn off power to the motors.
\begin{quotation}
Most of the time, when we abort or E-Stop it's because something went
wrong. Perhaps we broke a tool and want to change it. We switch to
manual mode and raise the spindle, change tools, and assuming that
we got the length the same, get ready to go on. If we return the tool
to the same place where the abort was issued, the EMC will work perfectly.
It is possible to move the restart line back or ahead of where the
abort happened. If you press the {[}Back{]} or {[}Ahead{]} buttons
you will see a blue highlight that shows the relationship between
the abort line and the one on which the EMC will start up again. By
thinking through what is happening at the time of the restart you
can place the tool tip where it will resume work in an acceptable
manner. You will need to think through things like tool offsets barriers
to motion along a diagonal line and such before you press the {[}Restart{]}
button. 
\end{quotation}

\section{Left Column}

There are two columns below the control line. The left side of the
screen displays information of interest to the operator. There are
very few buttons to press here.


\subsection{Axis Position Displays}

The axis position displays work exactly like they do with tkemc. The
color of the letters is important.
\begin{itemize}
\item Red indicates that the machine is sitting on a limit switch or the
polarity of a min or max limit is set wrong in the ini file.
\item Yellow indicates that the machine is ready to be homed.
\item Green indicates that the machine has been homed.
\end{itemize}
The position can be changed to display any one of several values by
using the menu settings. The startup or default settings can be changed
in the ini file so these displays wake up just the way that you want
them.


\subsection{Feed rate Override\index{feed override}}

Immediately below the axis position displays is the feed rate override
slider. You can operate feed rate override and feedhold in any mode
of operation. Override will change the speed of jogs or feed rate
in manual or MDI modes. You can adjust feed rate override by grabbing
the slider with your mouse and dragging it along the groove. You can
also change feed rate a percent at a time by clicking in the slider's
groove. In auto mode you can also set feed override in 10\% increments
by pressing the top row of numbers. This slider is a handy visual
reference to how much override is being applied to programmed feed
rate.


\subsection{Messages }

The message display located under the axis positions is a sort of
scratch pad for the EMC. If there are problems it will report them
there. If you try to home or move an axis when the {[}ESTOP{]} button
is pressed, you'll get a message that says something about commanding
motion when the EMC is not ready. If an axis faults out for something
like falling behind, the message pad will show what happened. If you
want to remind an operator to change a tool, for example, you can
add a line of code to your program that will display in the message
box. An example might be (msg, change to tool \#3 and press resume).
This line of code, included in a program, will display {}``change
to tool \#3 and press resume'' in the message box. The word msg,
(with comma included) is the command to make this happen; without
\emph{msg,} the message wouldn't be displayed. It will still show
in the auto modes' display of the program file. 

To erase messages simply click the message button at the top of the
pad or on the keyboard hold down the {[}Alt{]} key and press the {[}m{]}
key. 


\section{Right Column}

The right column is a general purpose place to display and work. Here
you can see the modal buttons and text entry or displays. Here you
can view a plot of the tool path that will be commanded by your program.
You can also write programs and control tools and offsets here. The
modal screens have been described above. Each of the popin displays
are described in detail below.


\subsection{Program Editor}

%
\begin{figure}[H]
\caption{Mini Text Editor\label{cap:Mini-Text-Editor}}


\centering{}\includegraphics[scale=0.8]{gui/miniedit}
\end{figure}


The editor is rather limited compared to many modern text editors.
It does not have \emph{undo} nor \emph{paste} between windows with
the clipboard.These were eliminated because of interaction with a
running program. Future releases will replace these functions so that
it will work the way you've come to expect from a text editor. It
is included because it has the rather nice feature of being able to
number and renumber lines in the way that the interpreter expects
of a file. It will also allow you to cut and paste from one part of
a file to another. In addition, it will allow you to save your changes
and submit them to the EMC interpreter with the same menu click. You
can work on a file in here for a while and then save and load if the
EMC is in Auto mode. If you have been running a file and find that
you need to edit it, that file will be placed in the editor when you
click on the editor button on the top menu. 


\subsection{Backplot\index{backplot} Display}

%
\begin{figure}[H]
\caption{Mini's Backplotter\label{cap:Mini's-Backplotter}}


\centering{}\includegraphics[scale=0.8]{gui/minibkplot}
\end{figure}
Backplot {[}Backplot{]} will show the tool path that can be viewed
from a chosen direction. '3-D' is the default. Other choices and controls
are displayed along the top and right side of the pop-in. If you are
in the middle of a cut when you press one of these control buttons
the machine will pause long enough to re-compute the view.

Along the right side of the pop-in there is a small pyramid shaped
graphic that tries to show the angle you are viewing the tool path
from. Below it are a series of sliders that allow you to change the
angle of view and the size of the plot. You can rotate the little
position angle display with these. They take effect when you press
the {[}Refresh{]} button. The {[}Reset{]} button removes all of the
paths from the display and readies it for a new run of the program
but retains your settings for that session. 

If backplot is started before a program is started, it will try to
use some color lines to indicate the kind of motion that was used
to make it. A green line is a rapid move. A black line is a feed rate
move. Blue and red indicate arcs in counterclockwise and clockwise
directions.

The backplotter with Mini allows you to zoom and rotate views after
you have run your program but it is not intended to store a tool path
for a long period of time. 


\subsection{Tool Page}

The tool page is pretty much like the others. You can set length and
diameter values here and they become effective when you press the
{[}Enter{]} key. You will need to set up your tool information before
you begin to run a program. You can't change tool offsets while the
program is running or when the program is paused. 

%
\begin{figure}[H]
\caption{Mini Tool Display\label{cap:Mini-Tool-Display}}


\centering{}\includegraphics[scale=0.8]{gui/minitool}
\end{figure}


The {[}Add Tools{]} and {[}Remove Tools{]} buttons work on the bottom
of the tool list so you will want to fill in tool information in decending
order. Once a new tool has been added, you can use it in a program
with the usual G-code commands. There is a 32 tool limit in the current
EMC configuration files but you will run out of display space in Mini
long before you get there. (Hint You can use menu -> view -> show
popin full to see more tools if you need.) 


\subsection{Offset Page}

The offset page can be used to display and setup work offsets. The
coordinate system is selected along the left hand side of the window.
Once you have selected a coordinate system you can enter values or
move an axis to a teach position. %
\begin{figure}[H]
\caption{Mini Offset Display\label{cap:Mini-Offset-Display}}


\centering{}\includegraphics[scale=0.8]{gui/minioffsets}
\end{figure}
You can also teach using an edgefinder by adding the radius and length
to the offset\_by widgets. When you do this you may need to add or
subtract the radius depending upon which surface you choose to touch
from. This is selected with the add or subtract radiobuttons below
the offset windows.

The zero all for the active coordinate system button will remove any
offsets that you have showing but they are not set to zero in the
variable file until you press the write and load file button as well.
This write and load file button is the one to use when you have set
all of the axis values that you want for a coordinate system.


\section{Keyboard Bindings}

A number of the bindings used with tkemc have been preserved with
mini. A few of the bindings have been changed to extend that set or
to ease the operation of a machine using this interface. Some keys
operate the same regradless of the mode. Others change with the mode
that EMC is operating in. 


\subsection{Common Keys}
\begin{description}
\item [{Pause}] Toggle feedhold
\item [{Escape}] abort motion 
\item [{F1}] toggle estop/estop reset state 
\item [{F2}] toggle machine off/machine on state 
\item [{F3}] manual mode 
\item [{F4}] auto mode 
\item [{F5}] MDI mode 
\item [{F6}] reset interpreter
\end{description}
The following only work for machines using auxiliary I/O
\begin{description}
\item [{F7}] toggle mist on/mist off
\item [{F8}] toggle flood on/flood off
\item [{F9}] toggle spindle forward/off
\item [{F10}] toggle spindle reverse/off
\item [{F11}] decrease spindle speed
\item [{F12}] increase spindle speed
\end{description}

\subsection{Manual Mode\index{Manual}}
\begin{description}
\item [{1-9~0}] set feed override to 10\%-90\%, 0 is 100\%
\item [{\textasciitilde{}}] set feed override to 0 or feedhold
\item [{x}] select X axis
\item [{y}] select Y axis
\item [{z}] select Z axis
\item [{a}] select A axis
\item [{b}] select B axis
\item [{c}] select C axis
\item [{Left~Right~Arrow}] jog X axis
\item [{Up~Down~Arrow}] jog Y axis
\item [{Page~Up~Down}] jog Z axis 
\item [{-~\_}] jog the active axis in the minus direction 
\item [{+~=}] jog the active axis in the plus direction.
\item [{Home}] home selected axis
\item [{i~I}] toggle through jog increments 
\end{description}
The following only work with a machine using auxiliary I/O
\begin{description}
\item [{b}] take spindle brake off
\item [{Alt-b}] put spindle brake on
\end{description}

\subsection{Auto Mode \index{Auto}}
\begin{description}
\item [{1-9,0}] set feed override to 10\%-90\%, 0 is 100\%
\item [{\textasciitilde{}}] set feed override to 0 or feedhold
\item [{o/O}] open a program
\item [{r/R}] run an opened program
\item [{p/P}] pause an executing program
\item [{s/S}] resume a paused program
\item [{a/A}] step one line in a paused program
\end{description}

\section{Misc}

One of the features of Mini is that it displays any axis above number
2 as a rotary and will display degree units for it. It also converts
to degree units for incremental jogs when a rotary axis has the focus. 
