When using PE (in the default relative mode), the application program does not know the current pen location after printing a label (normally, the current pen location is updated to the end of the label.) If this presents a problem in your program, follow these steps.

1Create a flag called "lost" in your program.

2After labeling (or any command which updates the current pen location), set lost to true.

3If lost = true at the beginning of the PE command, use an absolute flag for the first coordinate pair only (subsequent coordinates are interpreted as relative).

4Set lost to false.

Note

At the beginning of your application program, set lost to true. Then,

 

specify the next coordinate in absolute mode (PA or PE=).

 

 

When converting and encoding data, note the following.

zn DIV 64 = n.shift right.6 bits. You can optimize your application by shifting 6 bits to the right since shifting is faster than division.

zn MOD 64 = n.AND.63. The number is logically AND'd with 63.

Example: Using the PE Command

The following BASIC program converts three relative real coordinates to base 64.

``10 LPRINT CHR$(27);"E"; 'Reset the Printer.''

``20 LPRINT CHR$(27);"%0B"; 'Enter HP-GL/2 Mode.''

``30 LPRINT "IN;SC1,20,1,20,1;SP1;PU5,5;";''

``40 PRINT "Input number of fractional decimal places in data" '' ``50 INPUT F 'In this example, 2 decimal places (line 290).'' ``60 'Calculate Number of Fractional Binary Bits ''

``70 F = F * 3.33 ''

``80 F = INT(F) '' ``90 A = F ''

``100 IF F >= 0 THEN F = 2*ABS(F) ELSE F = 2*ABS(F)+1 '' ``110 F = 191+F ''

``120 LPRINT #1, "PE>"+CHR$(F) ''

EN

PE, Polyline Encoded 20-41

Page 501
Image 501
HP 5961-0509 manual Example Using the PE Command, Specify the next coordinate in absolute mode PA or PE=