Professional Documents
Culture Documents
An HPGL interpreter has been written in the Mint language. This not only demonstrates the power
and flexibility of the Mint programming language, but also allows HPGL to be tailored to your
application.
Accepting Files
The HPGL interpreter will accept raw ASCII data that makes up the HPGL file.
IN;
VS57,1;
VS32,2;
VS32,3;
VS32,4;
VS32,5;
VS32,6;
VS32,7;
VS32,8;
SP7;
PU-1004 2919;
PD-868 3067;
PD-868 3067;
PD-867 3068;
PD-866 3069;
PD-864 3071;
PD-863 3072;
PD-861 3074;
PD-860 3075;
PD-858 3077;
PD-857 3079;
PD-855 3080;
PD-854 3082;
PD-852 3083;
PD-851 3085;
PD-849 3087;
When the commands are received, they are immediately executed. This allows files of unlimited
size to be processed.
The size of the Mint serial buffer has been set at 1024 characters, but this can be increased within
the bounds of the available memory on the controller.
Z Axis Control
The HPGL interpreter can be configured for different applications such as:
• Pen plotter
• Router
• Glue laying
• Laser cutting
Since the HPGL interpreter is written in Mint, it is a case of modifying the source code to suit the
application. Some predefined Mint macros have been created to assist:
The Pen or Z axis is controlled by the use of the PD (Pen Down) and PU (Pen Up) commands. The
HPGL interpreter supplied sets and clears Output 7 in response to the PU/PD commands.
The action taken by the PD/PU commands can be altered by modifying the code in the
subroutines MovePenUP and MovePenDown.
Open the Mint editor in the Mint WorkBench and press Ctrl-F for find. Enter **UC in the search
box to locate all sections of customizable code. Each of the User Code (**UC) sections are
described:
**UC 1
User code section 1 defines which digital output controls the pen. This is defaulted to output 7.
**UC 3
User code section 3 defines the Z position values. This is set in user units and determines the
maximum and minimum position values for the Z axis. These parameters are only used if the Z
axis is a driven axis.
**UC 4
User code section 4 defines the axis numbers for the X, Y and Z axes, as well as the tangential
knife.
**UC 5
User code section 5 defines the Z axis control. Remove the comment for the Z axis control
required.
**UC 6
User code section 6 defines the action taken on a PU (Pen Up) command. This is coded to set an
output (defined in UC 1), or move the Z axis to a defined position (defined in UC 3).
**UC 7
If the Z axis has been defined for tangential knife control, this line of code needs to be
uncommented.
**UC 8
User code section 8 defines the action taken on a PD (Pen Down) command. This is coded to set
an output (defined in UC 1), or move the Z axis to a defined position (defined in UC 3).
**UC 9
If the Z axis has been defined for tangential knife control, this line of code needs to be
uncommented.
**UC 10
User code section 10 is the Knife event. This is called when a knife changes status. In order to
add this code to the MintMT program, remove the /* and */ from the source code.
**UC 11
User code section 11 defines what happens in the event of an error. The OnError handler should
be customized to suit the application.
The axes will also need to be datumed or homed. This will depend upon the configuration of the
X, Y and Z axes. This operation can be performed in the StartUp block, or alternatively executed
in the HPGLInterpreter subroutine.
Debugging
The variable Debug has been defined to allow some simple debugging. If this is set to _TRUE,
various messages will be displayed during the execution of the HPGL file.