Epson POS

From Leo's Notes
Last edited on 14 June 2020, at 23:56.

The ESC/POS is a set of instructions for thermal paper printers communicated over serial, parallel, or USB.

Instructions

See the command reference list below for a detailed list of instructions.

Epson's command list shows the command with ASCII names rather than the hex values, so sending 1B 40 to initialize a printer is equivalent to ESC @.

Here are some common instructions:

  • 1B 40 Initialize the ESC/POS printer
  • 1C 70 01 00 = Print first bit image stored in NVRam
  • 1B 64 05 1D 56 01 = Epson cutter command
  • 0A = Line feed

Sending Bit Image

To store a bit image to NVRam, use the 1C 71 01 command, followed by 5 arguments:

  1. xl - image width in bytes (ie. Ceiling of Image Width in Pixels / 8). Must be between 0 - 255
  2. xh - image width as multiples of 256. Must be between 0 - 3.
  3. yl - image height in bytes (ie. Ceiling of Image Height in Pixels / 8). Must be between 0 - 255
  4. yh - image height in multiples of 256. Must be between 0 - 1.
  5. bit image data. Length must be (xl + yl + ((xh + yh) * 256)) * 8.

The image bitmap data is sent to the printer ordered from top to bottom, left to right. 8 pixels per byte.

For example, sending a 4x4 black bitmap image would result in 8 bytes of data:

  1. 1111 0000 - 1st column, 4 black, plus 4 blank pixels
  2. 1111 0000 - 2nd column
  3. 1111 0000 - 3rd column
  4. 1111 0400 - 4th column. Last byte at the end of the image ends with 04. see below.
  5. 0000 0000 - 5th column, outside of the original 4x4 image
  6. 0000 0000 - 6th column
  7. 0000 0000
  8. 0000 0000

It also seems like the end of the image is terminated with a 04 code... but i'm not sure if this is true as it isn't documented. It is sent by the logo utility though.

See Also

PHP Library:

Epson's 'official' documents:

Epson's Logo Utility:

Command References: