Using HP-GL/2 With Programming Languages

The HP-GL/2 examples included in this manual are given in a “generic” format (they show the commands required to perform a specific function but usually do not use a specific programming language). In most cases, the commands are accompanied by a brief description of the command being used.

To see how HP-GL/2 commands are used in BASIC and the C programming language, see the following examples.

Example:BASIC

This example uses BASIC to print three lines forming a simple triangle (shown below).

10 LPRINT CHR$(27);“E”; :REM Reset the printer

20 LPRINT CHR$(27);“%0B”; :REM Enter HP-GL/2 Mode 30 LPRINT “IN”; :REM Initialize HP-GL/2 Mode

40 LPRINT “SP1PA10,10”; :REM Select Pen & move to 10,10

50 LPRINT “PD2500,10,10,1500,10,10;”; :REM Pen down & draw

60 LPRINT CHR$(27);“%0A”; :REM Enter PCL Mode

70 LPRINT CHR$(27);“E”; :REM Reset to end job/eject page

Figure 17-3

EN

Using HP-GL/2 With Programming Languages 17-13

Page 383
Image 383
HP 5961-0509 manual Using HP-GL/2 With Programming Languages, ExampleBASIC