Examples of Formdepth Formulas

Example 1

In this example, the Formdepth sequence for the AP1340 printer is as follows:

18w27A9(*4n3)

This sequence consists of the parts shown in the following table.

Part

Function / Description

18

Hex value for CAN, the Cancel character, which resets the printer.

27

Hex for ESC, the Escape character, which precedes many printer control sequences.

A9

Hex for z. ESC z denotes the AP1340 Set Form Length command, which must be followed by 3 bytes containing the decimal number of 1/24th-inch increments in the Formdepth.

(

Starts calculation mode, initializing the current work value to Report Formdepth.

*

Multiplies the current work value by the following one-digit value.

4

Multiplies the current work value by 4. In this example, Formdepth in 1/6th-inch units is now expressed in 1/24th-inch units.

n

Inserts the current work value into the output at this point, as an alphanumeric string whose length is given by the following 1-digit value.

3

Outputs the current work value to the printer as three characters.

)

Finishes calculation mode.

For a 22-line form to be set up, the actual output to a AP1340 printer at the start of the Report is shown in the following table:

Hexadecimal

Characters

18

CAN

27A9F0F8F8

ESC z 0 8 8

Example 2

In this example, instead of using n in the formula (as in Example 1), h (or H) can be used to indicate that a hex string is to be repeatedly output a number of times corresponding to the current work value, as shown in the following Formdepth formula example.

(-1h250D)

When Glb.FormDepth is set to 33 (for a 33-line form) in Report logic, this formula would cause the two-character string 250D (equivalent to CR, LF) to be output 32 times in succession (33 minus 1).