Section 15.4.18 · Chapter 15: Using Macros
Print Operation
| Format | P1 = PRINT(P2,P3 ) | Data Type | U | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Function | Sends P3 bytes of data stored in byte array P2 to the printer and saves the completion code in P1. | ||||||||||||||
| P1 (I) |
The word to receive the completion code of the
operation. The following table describes the meanings of
the completion codes.
|
||||||||||||||
| P2 (I) | The starting location of the byte array that stores the data to be sent to the printer. | ||||||||||||||
| P3 (I/C) | The length in byte of the data to be sent to the printer. | ||||||||||||||
| Example 1 |
$U10 = "This is a test." $U20 = PRINT($U10, 15) /* Send the string “This is a test.” to the printer. */ $U10 = 10 $U20 = PRINT($U10, 1) /* Send the line-feed character to the printer */ $U10 = 12 $U20 = PRINT($U10, 1) /* Send the form-feed character to the printer */ |
||||||||||||||
| Example 2 |
$U10 = 0x401b /* ESC, '@' */ $U20 = PRINT($U10, 2) /* Send the initialization command to the EPSON printer */ |
||||||||||||||
■ PRINT_SCREEN
| Format | P1 = PRINT_SCREEN(P2,P3 ) | Data Type | U | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Function | Prints screen P2 and saves the result in P1. | ||||||||||||||||||||
| P1 (I) |
The word to receive the completion code of the
operation. The following table describes the meanings of
the completion codes.
|
||||||||||||||||||||
| P2 (I/C) | The number of the screen to be printed. The printed area is specified in the Screen Properties dialog box. | ||||||||||||||||||||
| P3 (I/C) | Reserved for future use. Must be 0. | ||||||||||||||||||||
| Example 1 | $U0 = PRINT_SCREEN(28, 0) /* Print screen #28*/ | ||||||||||||||||||||
■ BLANK
| Format | P1 = BLANK (P2) | Data Type | U |
|---|---|---|---|
| Function | Blanks the print buffer P1, i.e. makes the print buffer P1 contain only blank characters. | ||
| P1 (I) | The print buffer to be blanked. The print buffer is a byte array. You should always blank a print buffer before printing strings to it. | ||
| P2 (I/C) |
The size of the print buffer. The unit is byte (one-byte
character). For example, if the size of a print buffer is 40, it has 20 words and can contain up to 40 one-byte characters. |
||
| Example 1 | BLANK($U100, 80) /* Blank the print buffer starting at $U100 with a length of 40 words. */ | ||
■ P2B
| Format | P1 = P2B (P2,P3 ) | Data Type | U |
|---|---|---|---|
| Function | Prints the null-terminated string P1 to the print buffer P2 at the specified byte position P3. | ||
| P1 (I) | The byte array that holds the string to be printed. | ||
| P2 (I) | The byte array that is used as a print buffer to accept the string P1. | ||
| P3 (I/C) |
The byte position in the print buffer to put the string.
The byte position counts from 0. For example, to print a string at the beginning of the print buffer, set P3 to 0. |
||
| Example 1 |
BLANK($U100, 20) /* Blank the print buffer. */ $U10 = “Weight:” P2B($U100, $U10, 0) /* Print the string “Weight:” at the position of byte 0 of the print buffer. */ $U10 = I2A(1234, 2) /* The byte array $U10 will hold the string “12.34” after this command is executed. */ P2B($U100, $U10, 8) /* Print the string “12.34” at the position of byte 8 of the print buffer. */ $U10 = “kg” P2B($U100, $U10, 14) /* Print the string “kg” at the position of byte 14 of the print buffer. */ PRINT($U100, 20 ) /* Print string “Weight: 12.34 kg” in the print buffer to the real printer. */ |
||
■ P2B_R
| Format | P1 = P2B_R (P2,P3 ) | Data Type | U |
|---|---|---|---|
| Function | Prints the null-terminated string P1 to the print buffer P2. The string is right aligned with the byte position P3. | ||
| P1 (I) | The byte array that holds the string to be printed. | ||
| P2 (I) | The byte array that is used as a print buffer to accept the string P1. | ||
| P3 (I/C) |
The byte position in the print buffer that the last
characters of the string is placed. The byte position
counts from 0. For example, to print a string with 6 characters at the beginning of the print buffer, set P3 to 5 as the last character of the string should be placed at the position of byte 5. |
||
| Example 1 |
BLANK($U100, 20) /* Blank the print buffer. */ $U10 = “Weight:” P2B_R($U100, $U10, 6) /* Print the string “Weight:” to the print buffer and align the string right with the position of byte 6. */ $U10 = I2A(1234, 2) /* The byte array $U10 will hold the string “12.34” after this command is executed. */ P2B_R($U100, $U10, 12) /* Print the string “12.34” to the print buffer and align the string right with the position of byte 12. */ $U10 = “kg” P2B_R($U100, $U10, 15) /* Print the string “kg” to the print buffer and align the string right with the position of byte 15. */ PRINT($U100, 20 ) /* Print string “Weight: 12.34 kg” in the print buffer to the real printer. */ |
||
Need PM Designer itself?
V4 for current PK, PT, ITV and PM panels, V2 for older models. Free, sent by email.
Source.Section 15.4.18 of the PM Designer Software User Manual, Edition 2.0, © Cermate Technologies Inc. (www.cermate.com, service@cermate.com). Reproduced online, with the manual's own figures, by TSL Automation Solutions, authorised Cermate distributor, for users of Cermate HMI panels. PM Designer and PanelMaster are trademarks of Cermate Technologies Inc.
Text and figures are the manufacturer's and may describe features your panel or software version does not have. For a plain-language introduction read the PM Designer guide; for help with a specific panel contact TSL Automation.