07.10.2016 Views

Brother RJ-4040 - Raster Command Reference

Brother RJ-4040 - Raster Command Reference

Brother RJ-4040 - Raster Command Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Software Developer's Manual<br />

<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

<strong>RJ</strong>-4030/4030Ai/<strong>4040</strong><br />

Version 1.03


The <strong>Brother</strong> logo is a registered trademark of <strong>Brother</strong> Industries, Ltd.<br />

<strong>Brother</strong> is a registered trademark of <strong>Brother</strong> Industries, Ltd.<br />

© 2016 <strong>Brother</strong> Industries, Ltd. All rights reserved.<br />

Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and other<br />

countries.<br />

Each owner whose software title is mentioned in this document has a Software License Agreement specific to<br />

its proprietary programs.<br />

Any trade names and product names of companies appearing on <strong>Brother</strong> products, related documents and<br />

any other materials are all trademarks or registered trademarks of those respective companies.


IMPORTANT - PLEASE READ CAREFULLY<br />

Note<br />

This documentation (“Documentation”) provides information that will assist you in controlling your Printer<br />

<strong>RJ</strong>-XXXX (where “XXXX” is the model name).<br />

You may use the Documentation only if you first agree to the following conditions.<br />

If you do not agree to the following conditions, you may not use the Documentation.<br />

Condition of Use<br />

You may use and reproduce the Documentation to the extent necessary for your own use of your Printer<br />

Model (“Purpose”). Unless expressly permitted in the Documentation, you may not;<br />

(i) copy or reproduce the Documentation for any purpose other than the Purpose,<br />

(ii) modify, translate or adapt the Documentation, and/or redistribute it to any third party,<br />

(iii) rent or lease the Documentation to any third party, or,<br />

(iv) remove or alter any copyright notices or proprietary rights legends included within the Documentation.<br />

No Warranty<br />

a. Any updates, upgrades or alteration of the Documentation or Printer Model will be performed at the sole<br />

discretion of <strong>Brother</strong>. <strong>Brother</strong> may not respond to any request or inquiry about the Documentation.<br />

b. THIS DOCUMENTATION IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY KIND,<br />

WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY<br />

OF FITNESS FOR A PARTICULAR PURPOSE. BROTHER DOES NOT REPRESENT OR WARRANT<br />

THAT THIS DOCUMENTATION IS FREE FROM ERRORS OR DEFECTS.<br />

c. IN NO EVENT SHALL BROTHER BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL,<br />

SPECIAL OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER, ARISING OUT OF<br />

THE USE, INABILITY TO USE, OR THE RESULTS OF USE OF THE DOCUMENTATION OR ANY<br />

SOFTWARE PROGRAM OR APPLICATION YOU DEVELOPED IN ACCORDANCE WITH THE<br />

DOCUMENTATION.


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Contents<br />

Introduction ···································································································· 1<br />

About <strong>Raster</strong> <strong>Command</strong>s ················································································· 2<br />

1. Printing Using <strong>Raster</strong> <strong>Command</strong>s ································································· 3<br />

2. Print Data ···································································································· 5<br />

2.1 Print data overview ······························································································ 5<br />

2.2 Sample (analyzing the print data of the test page) ···················································· 7<br />

2.2.1 Preparation ............................................................................................................. 7<br />

2.2.2 Checking the print data .......................................................................................... 7<br />

2.2.3 Explanation of print data for the test page ........................................................... 10<br />

2.3 Page data details ······························································································· 12<br />

2.3.1 Resolution ............................................................................................................ 12<br />

2.3.2 Page size ............................................................................................................. 12<br />

2.3.3 Feed amount ........................................................................................................ 14<br />

2.3.4 Maximum and minimum lengths .......................................................................... 14<br />

2.3.5 <strong>Raster</strong> line ............................................................................................................ 15<br />

3. Print <strong>Command</strong> List ··················································································· 17<br />

4. Printing <strong>Command</strong> Details ·········································································· 18<br />

NULL Invalidate ..................................................................................................... 18<br />

ESC i S Status information request .......................................................................... 18<br />

ESC @ Initialize ....................................................................................................... 23<br />

ESC i U Additional media information command ...................................................... 23<br />

ESC i d Specify margin amount (feed amount) ........................................................ 25<br />

ESC i a Switch dynamic command mode ................................................................ 26<br />

g <strong>Raster</strong> graphics transfer .............................................................................. 26<br />

ESC i B Specify baud rate ........................................................................................ 27<br />

Z Zero raster graphics .................................................................................... 27<br />

FF Print command ............................................................................................ 27<br />

Control-Z Print command with feeding ........................................................................ 27<br />

ESC i z Print information command ......................................................................... 28<br />

M Select compression mode ........................................................................... 29<br />

5. MCR <strong>Command</strong> Specifications ··································································· 31<br />

5.1. <strong>Command</strong> details······························································································ 31<br />

ESC #1 MCR on command ...................................................................................... 31<br />

ESC #0 MCR off command ...................................................................................... 31<br />

5.2. Response ········································································································ 32<br />

6. Flow Charts ······························································································· 34<br />

6.1 Normal flow for USB connection ·········································································· 34<br />

6.2 Error flow for USB connection (when feeding at the end of the page) ························ 35<br />

6.3 Error flow for USB connection (with a concurrent printing error such as end of tape) ··· 36<br />

6.4 Cooling flow for USB connection ·········································································· 37<br />

6.5 Flow for setting serial connection baud rate ··························································· 38<br />

6.6 Normal flow for serial connection ········································································· 39<br />

6.7 Error flow for serial connection ············································································ 40<br />

6.8 Cleaning flow for serial connection ······································································· 41<br />

Appendix A: USB Specifications ···································································· 42<br />

Appendix B: Introducing the <strong>Brother</strong> Developer Center ··································· 43<br />

- i -


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Introduction<br />

This material provides the necessary information for directly controlling the <strong>Brother</strong> printer <strong>RJ</strong>-XXXX (where<br />

“XXXX” is the model name).<br />

This information is provided assuming that the user has full understanding of the operating system being used<br />

and basic mastery of USB and networks in a developer's environment.<br />

Details concerning the USB interface are not described in this material. If a USB interface is being used, refer<br />

to “Appendix A: USB Specifications” to prepare the interface.<br />

We accept no responsibility for any problems caused by programs that you develop using the information<br />

provided in this material, affecting software, data or hardware, including the <strong>Brother</strong> printer <strong>RJ</strong>-XXXX, and any<br />

problems resulting directly or indirectly from them. These materials are provided in their current condition, and<br />

we assume no responsibility for their content. Use this material only if you accept these terms.<br />

This material shall not be reproduced, in part or in full, without prior approval. In addition, this material shall<br />

not be used as evidence in a lawsuit or dispute in a way that is unfavorable towards our company.<br />

Read the model names that appear in the screens in this manual as the name of your printer.<br />

- 1 -<br />

Introduction


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

About <strong>Raster</strong> <strong>Command</strong>s<br />

Using raster commands an <strong>RJ</strong>-XXXX printer (where “XXXX” is the model name) can be used to print without<br />

using our printer driver.<br />

This operation is useful in the following situations.<br />

• When printing from an operating system other than Windows<br />

(Example: When printing from a Linux computer or mobile terminal)<br />

• When adding print functions to an existing system<br />

In addition, printing can be performed with advanced settings.<br />

In this material, “raster” refers to binary bitmap data (collection of dots).<br />

Refer to this material to print by sending initialization commands and control codes together with raster data to<br />

the <strong>RJ</strong>-XXXX printer (hereafter, referred to as “printer”).<br />

This manual describes the procedure for adding these codes and sending the data.<br />

- 2 -<br />

About <strong>Raster</strong> <strong>Command</strong>s


At your side<br />

<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

1. Printing Using <strong>Raster</strong> <strong>Command</strong>s<br />

The printing procedure is described below. For detailed flow charts, refer to “6. Flow Charts”. For details on<br />

each command, refer to “4. Printing <strong>Command</strong> Details”.<br />

In addition, descriptions of the commands for the MCR (magnetic card reader) are provided. For details, refer<br />

to “5. MCR <strong>Command</strong> Specifications”.<br />

(1) Open the port<br />

Port<br />

(2) Send the status<br />

(Confirm the printer status.)<br />

(プリンタの 状 態 を 確 認 )<br />

(3) Send the print data<br />

(5) Send the status<br />

(Confirm that printing is completed.)<br />

Computer, mobile<br />

terminal, etc.<br />

Your printer<br />

(4) Print<br />

(6) Close the port<br />

- 3 -<br />

1. Printing Using <strong>Raster</strong> <strong>Command</strong>s


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(1) Open the USB/serial/network port<br />

Open the USB/serial/network port in the operating environment. The procedure for opening the<br />

USB/serial/network port is not described in this material.<br />

The network port can only be used with the <strong>RJ</strong>-<strong>4040</strong>.<br />

(2) Confirm the printer status sent from the printer<br />

The “status information request” command is sent to the printer, the status information received from the<br />

printer is analyzed, and then the status of the printer is determined.<br />

For details on the “status information request” command and on the definitions of “status”, refer to “Status<br />

information request” in “4. Printing <strong>Command</strong> Details”.<br />

(3) Send the print data<br />

If the status analysis confirms that media compatible with the print data is loaded into the printer and that<br />

no error has occurred, the print data is sent.<br />

The structure of the print data is explained in the next section, “2. Print Data”.<br />

Note:<br />

No command can be sent to the printer after the print data is transmitted and until the completion<br />

of printing is confirmed.<br />

Even the “status information request” command cannot be sent during printing.<br />

(4) Print the data<br />

(5) Confirm that printing is completed<br />

When printing is completed, the status is received from the printer.<br />

If this status is analyzed to confirm that printing is completed, printing one page is considered finished.<br />

If the print job has multiple pages, (2) through (4) are repeated.<br />

(6) Close the USB/serial/network port<br />

After all printing is finished, close the USB/serial/network port.<br />

Note:<br />

In order to print at high speed when a USB port is used to send uncompressed raster data, the<br />

<strong>Brother</strong> <strong>RJ</strong>-XXXX starts printing when it starts to receive print data, instead of waiting for a print<br />

command (concurrent printing).<br />

For the processing flow, for example when managing errors, refer to “6. Flow Charts”.<br />

- 4 -<br />

1. Printing Using <strong>Raster</strong> <strong>Command</strong>s


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2. Print Data<br />

2.1 Print data overview<br />

The print data is constructed of the following: (1) initialization commands, (2) control codes, (3) raster data,<br />

and (4) print commands. If the print job consists of multiple pages, (2) through (4) are repeated.<br />

(1) Initialization commands<br />

Specified only once at the beginning of the job.<br />

Sequence <strong>Command</strong> Name Description/Example<br />

1 Invalidate<br />

2 Initialize<br />

Sends a 350-byte invalidate command, and then resets the printer<br />

to the receiving state.<br />

Initializes for printing.<br />

1Bh, 40h (Fixed)<br />

(2) Control codes<br />

Added at the beginning of each page and sent for each page.<br />

Sequence <strong>Command</strong> Name Description/Example<br />

1<br />

2<br />

3<br />

4<br />

5<br />

Switch dynamic<br />

command mode<br />

Additional media<br />

information<br />

command<br />

Print information<br />

command<br />

Specify margin<br />

amount<br />

Select compression<br />

mode<br />

1Bh, 69h, 61h, 01h<br />

1Bh, 69h, 55h, 77h, 01h, 127 bytes of media information<br />

Note<br />

If the media information is the same as when printing was<br />

last performed, it is unnecessary to send the additional<br />

media information command.<br />

Sets the print information for the printer.<br />

For 102-mm-wide continuous length tape:<br />

1Bh, 69h, 7Ah, 86h, 0Ah, 66h, 00h, 09h, 07h, 00h, 00h, 00h, 00h<br />

Specifies the amount of the margins.<br />

For 3 mm margins:<br />

1Bh, 69h , 64h, 23h, 00h<br />

Selects the compression mode for raster graphics.<br />

To send the data compressed to TIFF format:<br />

4Dh, 02h<br />

- 5 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(3) <strong>Raster</strong> data<br />

Repeated for each page in the print job.<br />

Sequence <strong>Command</strong> Name Description/Example<br />

-<br />

<strong>Raster</strong> graphics<br />

transfer<br />

Sends a raster line that contains data with pixels set to “ON”.<br />

- Zero raster graphics<br />

Sends a raster line with all pixels set to “0”.<br />

5Ah (Fixed)<br />

(4) Print commands<br />

Specified at the end of the page.<br />

Sequence <strong>Command</strong> Name Description/Example<br />

- Print command<br />

Specifies at the end of a page that is not the last page.<br />

0Ch<br />

-<br />

Print command with<br />

feeding<br />

Specifies at the end of the last page.<br />

1Ah (Fixed)<br />

- 6 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2.2 Sample (analyzing the print data of the test page)<br />

The print data created by the printer driver is described here.<br />

As an example, we will check the print data created when the [Print Test Page] button in the printer<br />

Properties dialog box is clicked to print the test page.<br />

Since the print data differs depending on the print settings of the printer, refer to this procedure and try<br />

creating print data with various print settings.<br />

Furthermore, this procedure is for the Windows ® 7 operating environment. A similar procedure can be<br />

performed if you are using a different operating system.<br />

Printer Properties<br />

Test page<br />

2.2.1 Preparation<br />

Install the two listed below.<br />

・ Printer driver of the <strong>Brother</strong> <strong>RJ</strong>-XXXX<br />

・ Binary file editor<br />

The data that we will analyze in this sample is a binary file.<br />

Therefore, use a binary file editor to display and check the contents of the binary file.<br />

2.2.2 Checking the print data<br />

The procedure for checking the print data is provided below.<br />

Step 1: Change the port of the printer to “FILE:”.<br />

Step 2: Print the desired item (in this case, the test page), and then specify the file name.<br />

Step 3: Open the created file in the binary file editor to check it.<br />

- 7 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Step 1: Change the port of the printer to “FILE:”.<br />

Open the Printers and Faxes folder, and then right-click the printer (in this case, <strong>RJ</strong>-4030) to display<br />

the Properties dialog box. In the Properties dialog box, click the [Ports] tab, select the “FILE:” check<br />

box, and then click the [Apply] button.<br />

[Ports] tab of the printer Properties dialog box<br />

Step 2: Print the item (in this case, the test page), and then specify the file name.<br />

For this sample, print the test page with the default print settings, which were specified immediately<br />

after the printer driver was installed.<br />

Default settings immediately after installation of the printer driver<br />

- 8 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

When the test page is printed with the printer, a dialog box appears so that the file name can be<br />

specified. (Refer to the illustration below.)<br />

After a file name is typed in and the [OK] button is clicked, the printer driver creates the print data and<br />

saves it in a file with the specified name.<br />

Dialog box for specifying the file name<br />

Step 3: Open the print data in the binary file editor.<br />

Open the saved file in the binary file editor. The rows of numbers that appear are the print data. (Refer<br />

to the illustration below.)<br />

The print data is constructed of the following: (1) initialization commands, (2) control codes, (3) raster<br />

data and (4) print commands, which were described in “2.1 Print data overview”. For details on the print<br />

data, refer to “2.2.3 Explanation of print data for the test page”.<br />

(1) Initialization<br />

commands<br />

(2) Control codes<br />

(3) <strong>Raster</strong> data<br />

(4) Print commands<br />

Print data<br />

- 9 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2.2.3 Explanation of print data for the test page<br />

The print data for the test page outputted in the previous section is described below.<br />

The following illustration shows the print data created in section “2.2.1 Preparation” opened in the binary file<br />

editor.<br />

1<br />

3 4<br />

2<br />

6<br />

5<br />

7<br />

8<br />

9<br />

:<br />

:<br />

Print data<br />

- 10 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Descriptions for the numbers in the print data on the previous page are provided in the following table.<br />

For details on each command, refer to “4. Printing <strong>Command</strong> Details”.<br />

No. <strong>Command</strong> Name Description<br />

1 Invalidate A 350-byte invalidate command is sent.<br />

2 Initialize The “initialize” command is sent.<br />

3<br />

4<br />

5<br />

6<br />

Switch dynamic<br />

command mode<br />

Additional media<br />

information command<br />

Print information<br />

command<br />

Various mode settings<br />

(1Bh+69h+4Dh+00H)<br />

The printer is switched to raster mode.<br />

Send this command before sending raster data to the printer.<br />

Additional media information on the media size is sent.<br />

This is the command for “4" × 6" (102 mm × 152 mm)”.<br />

Media size information for the print data is sent.<br />

This is the command for “4" × 6" (102 mm × 152 mm)” die-cut<br />

labels.<br />

This is the command for specifying settings such as cut options.<br />

Since there are no cut options with this model, it is unnecessary<br />

to send this command.<br />

7 Specify margin amount<br />

Since a margin amount cannot be specified with die-cut labels,<br />

this command is sent with a margin amount of 0.<br />

8<br />

Select compression<br />

mode<br />

TIFF compression mode is selected.<br />

9 <strong>Raster</strong> data <strong>Raster</strong> data continues.<br />

10<br />

Print command with<br />

feeding<br />

Since one page will be printed, this is sent at the end of the first<br />

page.<br />

- 11 -<br />

2. Print Data


Feeding direction<br />

<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2.3 Page data details<br />

2.3.1 Resolution<br />

Resolution<br />

Height-to-Width Proportion<br />

203 dpi high, 203 dpi wide 1:1<br />

2.3.2 Page size<br />

(a) Continuous length tape<br />

1<br />

3<br />

5<br />

6<br />

5<br />

6<br />

2<br />

4<br />

Print<br />

area<br />

4<br />

2<br />

1<br />

3<br />

Print area<br />

Feeding direction<br />

Landscape<br />

Portrait<br />

Number 1 Width 2 Length<br />

3 Print area width (maximum printing width) 4 Print area length<br />

5 Width offset 6 Length offset<br />

ID Tape Size Designation 1 2 3 4 5 6<br />

415 102 mm<br />

102 mm<br />

4"<br />

101.6 mm<br />

812 dots<br />

--> 2.3.4.<br />

98.6 mm<br />

764 dots<br />

-->2.3.4.<br />

1.5 mm<br />

12 dots<br />

--> 2.3.3.<br />

- 12 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(b) Die-cut labels<br />

1<br />

5<br />

3<br />

6<br />

2<br />

4<br />

Print area<br />

Number 1 Width 2 Length<br />

3 Print area width (maximum printing width) 4 Print area length<br />

5 Width offset 6 Length offset<br />

ID Label Size 1 2 3 4 5 6<br />

423<br />

RD 102 mm x 26 mm<br />

RD 4" x 1"<br />

101.6 mm<br />

812 dots<br />

25.6 mm<br />

195 dots<br />

98.6 mm<br />

788 dots<br />

20.5 mm<br />

156 dots<br />

1.5 mm<br />

12 dots<br />

3.0 mm<br />

24 dots<br />

419<br />

RD 102 mm x 50 mm<br />

RD 4" x 2"<br />

101.6 mm<br />

812 dots<br />

49.9 mm<br />

399 dots<br />

98.6 mm<br />

788 dots<br />

43.9 mm<br />

351 dots<br />

1.5 mm<br />

12 dots<br />

3.0 mm<br />

24 dots<br />

424<br />

RD 102 mm x 76 mm<br />

RD 4" x 3"<br />

101.6 mm<br />

812 dots<br />

76.2 mm<br />

609 dots<br />

98.6 mm<br />

788 dots<br />

70.2 mm<br />

561 dots<br />

1.5 mm<br />

12 dots<br />

3.0 mm<br />

24 dots<br />

425<br />

RD 102 mm x 102 mm<br />

RD 4" x 4"<br />

101.6 mm<br />

812 dots<br />

101.6 mm<br />

812 dots<br />

98.6 mm<br />

788 dots<br />

95.6 mm<br />

764 dots<br />

1.5 mm<br />

12 dots<br />

3.0 mm<br />

24 dots<br />

420<br />

RD 102 mm x 152 mm<br />

RD 4" x 6"<br />

101.6 mm<br />

812 dots<br />

152.4 mm<br />

1218dots<br />

98.6 mm<br />

788 dots<br />

140.5 mm<br />

1123 dots<br />

1.5 mm<br />

12 dots<br />

6.0 mm<br />

48 dots<br />

- 13 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2.3.3 Feed amount<br />

The feed amount (left and right margins) is defined below.<br />

Type Minimum Margin Setting Maximum Margin Setting<br />

Continuous length tape<br />

3 mm<br />

0.12"<br />

24 dots<br />

127 mm<br />

5"<br />

1020 dots<br />

Die-cut labels<br />

The length offset indicated in “(b) Die-cut labels” of “2.3.2 Page size”<br />

is used.<br />

However, set “0” as the value of the “specify margin amount”<br />

command.<br />

2.3.4 Maximum and minimum lengths<br />

The maximum and minimum lengths are defined below.<br />

Type Minimum Length Maximum Length<br />

Device Capabilities<br />

Value of DC_MINEXTENT<br />

Continuous length tape<br />

25.4 mm<br />

204 dots<br />

25.4 mm<br />

204 dots<br />

3000 mm<br />

24094 dots<br />

3000 mm<br />

24094 dots<br />

Die-cut labels Fixed Fixed<br />

- 14 -<br />

2. Print Data


<strong>Raster</strong>Line 4<br />

Zero <strong>Raster</strong> 1<br />

Zero <strong>Raster</strong> 1<br />

<strong>Raster</strong>Line 3<br />

<strong>Raster</strong>Line 2<br />

<strong>Raster</strong>Line 1<br />

<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

2.3.5 <strong>Raster</strong> line<br />

As shown below, the parts with data to be printed are converted with “raster graphics transfer”, and the<br />

parts with no data are converted with “zero raster graphics”. On the actual tape, margins (feed) are<br />

added specified with “various mode settings” at the beginning and the end.<br />

Feeding direction<br />

Expansion direction<br />

Print area<br />

<strong>Raster</strong>ized<br />

Feeding direction<br />

Print area<br />

Print head<br />

The following shows the relationship between the raster graphics parameters and the pixels.<br />

MSB LSB<br />

1 st B<br />

MSB LSB MSB LSB MSB LSB<br />

2 nd B 3 rd B 4 th B ...<br />

- 15 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Total number of pins: 832 pins<br />

Number of pins<br />

for right margin<br />

<strong>Raster</strong> line<br />

First byte<br />

Left and right margins<br />

Number of<br />

print area<br />

pins<br />

Total number<br />

of pins<br />

Print area<br />

Last byte<br />

0 pin<br />

Number of pins<br />

for left margin<br />

Pins on print head<br />

Feeding direction<br />

Continuous length tape:<br />

Tape Size<br />

Number of Pins<br />

for Left Margin<br />

Number of Print<br />

Area Pins<br />

Number of Pins<br />

for Right Margin<br />

Number of Bytes for<br />

<strong>Raster</strong> Graphics Transfer<br />

102 mm 22 788 22 104<br />

Die-cut labels:<br />

Label Size<br />

Number of Pins<br />

for Left Margin<br />

Number of Print<br />

Area Pins<br />

Number of Pins<br />

for Right Margin<br />

Number of Bytes for<br />

<strong>Raster</strong> Graphics Transfer<br />

102 mm x 25 mm 22 788 22 104<br />

102 mm x 51 mm 22 788 22 104<br />

102 mm x 76 mm 22 788 22 104<br />

102 mm x 102 mm 22 788 22 104<br />

102 mm x 152 mm 22 788 22 104<br />

- 16 -<br />

2. Print Data


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

3. Print <strong>Command</strong> List<br />

ASCII Code Binary Code Description<br />

NULL 00 Invalidate<br />

ESC i S 1B 69 53 Status information request<br />

ESC @ 1B 40 Initialize<br />

ESC i U w 1 1B 69 55 77 01 Additional media information command<br />

ESC i d 1B 69 64 Specify margin amount (feed amount)<br />

ESC i a 1B 69 61 Switch dynamic command mode<br />

g 67 <strong>Raster</strong> graphics transfer<br />

ESC i B 1B 69 42 Specify baud rate<br />

Z 5A Zero raster graphics<br />

FF 0C Print command<br />

Control-Z 1A Print command with feeding<br />

ESC i z 1B 69 7A Print information command<br />

M 4D Select compression mode<br />

- 17 -<br />

3. Print <strong>Command</strong> List


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

4. Printing <strong>Command</strong> Details<br />

NULL<br />

Invalidate<br />

ASCII: NULL<br />

Hexadecimal: 00<br />

Description<br />

• Skipped<br />

• If data transmission is to be stopped midway, send the “initialize” command after sending the “invalidate”<br />

command for the appropriate number of bytes to return to the receiving state, where the print buffer is<br />

cleared.<br />

ESC i S<br />

Status information request<br />

ASCII: ESC i S<br />

Hexadecimal: 1B 69 53<br />

Description<br />

• Send a request to the printer for status information. For details on the status, refer to the previous section.<br />

• The size is fixed at 32 bytes.<br />

Note<br />

Before sending print data to the printer, this command should be sent once. Since error<br />

information is automatically sent by the printer during printing, do not send this command while<br />

printing.<br />

- 18 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Number Offset Size Name Value/<strong>Reference</strong><br />

1 0 1 Print head mark Fixed at 80h<br />

2 1 1 Size Fixed at 20h<br />

3 2 1 Reserved Fixed at “B” (42h)<br />

4 3 1 Series code Fixed at “7” (37h)<br />

5 4 1 Model code<br />

<strong>RJ</strong>-4030: Fixed at “1” (31h)<br />

<strong>RJ</strong>-4030Ai: Fixed at “5” (35h)<br />

<strong>RJ</strong>-<strong>4040</strong>: Fixed at “2” (32h)<br />

6 5 1 Reserved Fixed at “0” (30h)<br />

7 6 1 Battery level Refer to table (8) below.<br />

8 7 1 Reserved Fixed at “00h”<br />

9 8 1 Error information 1 Refer to table (1) below.<br />

10 9 1 Error information 2 Refer to table (2) below.<br />

11 10 1 Media width Refer to table (3) below.<br />

12 11 1 Media type Refer to table (4) below.<br />

13 12 1 Reserved Fixed at 00h<br />

14 13 1 Reserved Fixed at 00h<br />

15 14 1 Reserved Fixed at 3Fh<br />

16 15 1 Mode<br />

Value specified where the “various<br />

mode settings” command<br />

00h if not specified<br />

17 16 1 Reserved Fixed at 00h<br />

18 17 1 Media length Refer to table (3) below.<br />

19 18 1 Status type Refer to table (5) below.<br />

20 19 1 Phase type<br />

21 20 1<br />

22 21 1<br />

Phase number<br />

(higher order bytes)<br />

Phase number<br />

(lower order bytes)<br />

Refer to table (6) below.<br />

23 22 1 Notification number Refer to table (7) below.<br />

24 23 1 Reserved Fixed at 00h<br />

25 24 8 Reserved Fixed at 00h<br />

- 19 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(1) Error information 1<br />

Flag Mask Definition<br />

Bit 0 01h “No media” error<br />

Bit 1 02h “End of media” error (only for die-cut labels)<br />

Bit 2 04h Cutter jam (not used)<br />

Bit 3 08h (Not used)<br />

Bit 4 10h Printer in use<br />

Bit 5 20h Printer turned off<br />

Bit 6 40h High-voltage adapter (not used)<br />

Bit 7 80h Fan motor error (not used)<br />

(2) Error information 2<br />

Flag Mask Definition<br />

Bit 0 01h “Replace media” error (with a serial connecting)<br />

Bit 1 02h “Expansion buffer full” error<br />

Bit 2 04h Communication error<br />

Bit 3 08h “Communication buffer full” error (not used)<br />

Bit 4 10h “Cover open” error<br />

Bit 5 20h Cancel key (not used)<br />

Bit 6<br />

40h<br />

Media cannot be fed<br />

(also when the media end is detected)<br />

Bit 7 80h System error<br />

- 20 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(3) Media width and length<br />

The media width and length is described in millimeters. 0~255 (0 to FFh)<br />

(a) Continuous length tape<br />

* Media Width: The tape width is indicated in millimeters.<br />

* Media Length: Fixed at 00h<br />

Media Media Width Media Length<br />

102 mm 102 00<br />

(b) Die-cut labels<br />

* Media Width: The width of the die-cut section is indicated.<br />

* Media Length: The length of the die-cut section is indicated.<br />

Media Media Width Media Length<br />

102 mm x 26 mm 102 26<br />

102 mm x 50 mm 102 50<br />

102 mm x 76 mm 102 76<br />

102 mm x 102 mm 102 102<br />

102 mm x 152 mm 102 152<br />

(4) Media type<br />

Media Type Value Description<br />

No media<br />

00h<br />

Used as print information when the<br />

media type is not indicated.<br />

Continuous length tape 4Ah Used for both paper and film.<br />

Die-cut labels 4Bh Used for both paper and film.<br />

(5) Status type<br />

Status Type Value Description<br />

Reply to status request<br />

Printing completed<br />

Error occurred<br />

Turned off<br />

Notification<br />

Phase change<br />

(Not used)<br />

(Reserved)<br />

00h<br />

01h<br />

02h<br />

04h<br />

05h<br />

06h<br />

08h to 20h<br />

21h to FFh<br />

If an error occurred during printing, the printer returns the error status.<br />

- 21 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

(6) Phase type and phase number<br />

If the phase number is not used, both are fixed at 00h.<br />

Phase State<br />

Receiving state<br />

Printing state<br />

Phase Type<br />

00h<br />

01h<br />

Receiving state<br />

Phase Value (Dec.) Higher Order Bytes Lower Order Bytes<br />

Waiting to receive 0 00h 00h<br />

Printing state<br />

Phase Value (Dec.) Higher Order Bytes Lower Order Bytes<br />

Printing 0 00h 00h<br />

• When the printer is turned on, it is in the receiving state. When printing begins, it changes to the “printing”<br />

phase (phase type: printing state; phase number: printing), and the printer sends that phase status to the<br />

computer. When printing has finished, the printer sends the “receiving state” phase status (phase type:<br />

receiving state; phase number: waiting to receive) to the computer. Unless an error occurs during printing,<br />

the printer sends the “printing completed” status.<br />

• With concurrent printing, printing starts even if a print command has not been sent from the computer in<br />

order to print at high speed. At this time, care should be taken since the “printing” and “waiting to receive”<br />

phase statuses will be sent. (Refer to “6. Flow Charts”.)<br />

(7) Notification number<br />

Notification<br />

Not available<br />

Cooling (started)<br />

Cooling (finished)<br />

Value<br />

00h<br />

01h<br />

02h<br />

(8) Battery level<br />

Battery Level<br />

Full<br />

Half<br />

Low<br />

Charging required<br />

AC adaptor in use<br />

Value<br />

00h<br />

01h<br />

02h<br />

03h<br />

04h<br />

- 22 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

ESC @<br />

Initialize<br />

ASCII: ESC @<br />

Hexadecimal: 1B 40<br />

Description<br />

• Initializes mode settings.<br />

• Also used to cancel printing.<br />

ESC i U<br />

Additional media information command<br />

ASCII: ESC i U w 1 {d1...d127}<br />

Hexadecimal: 1B 69 55 77 01 {d1...d127}<br />

Description<br />

• Updates the media information for the printer.<br />

• Send to the printer the commands outputted with the “Save Paper Size <strong>Command</strong>s” function of Paper Size<br />

Setup.<br />

Note<br />

If the media information is the same as when printing was last performed, it is unnecessary to<br />

send the additional media information command.<br />

“Save Paper Size <strong>Command</strong>s” function of Paper Size Setup<br />

1. Preparation<br />

Install the two listed below.<br />

・Printer driver of the <strong>Brother</strong> <strong>RJ</strong>-XXXX<br />

・Binary file editor.<br />

The data outputted with the “Save Paper Size <strong>Command</strong>s” function of Paper Size Setup will be a<br />

binary file. Therefore, use a binary file editor to display and check the contents of the binary file.<br />

- 23 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Open the [Devices and Printers] window, right-click the printer, and then display the Printing<br />

Preferences dialog box. Click the [Paper Size Setup] button on the [Basic] tab to display the<br />

Paper Size Setup dialog box. (Refer to the illustration below.)<br />

Click [Save Paper Size <strong>Command</strong>s] button to display a dialog box for creating a file for saving the<br />

paper size commands, and then save them in a file with the specified name.<br />

2. Open the saved file in the binary file editor. The rows of numbers that appear are the command<br />

data.(Refer to the illustration below.)<br />

In the command data that appeared, the part marked with the red box is the additional media<br />

information command.<br />

Of this, the 127 bytes underlined in orange are the media information.<br />

Use this when adding media information.<br />

- 24 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

ESC i d<br />

Specify margin amount (feed amount)<br />

ASCII: ESC i d {n1} {n2}<br />

Hexadecimal: 1B 69 64 {n1} {n2}<br />

Description<br />

• Specifies the amount of the margins.<br />

• Margin amount (dots)=n1+n2*256<br />

• With die-cut labels, the margin amount at the ends of the printed area is 0.<br />

(a) Continuous length tape<br />

Paper<br />

Tape<br />

Print area<br />

Margin amount<br />

Cut line<br />

(b) Die-cut labels<br />

Paper<br />

Label<br />

Print area<br />

Margin amount<br />

(only “0” is available)<br />

Cut line<br />

- 25 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

ESC i a<br />

Switch dynamic command mode<br />

ASCII: ESC i a {n1}<br />

Hexadecimal: 1B 69 61 {n1}<br />

Parameters<br />

Definitions of {n}:<br />

0: ESC/P mode (default)<br />

1: <strong>Raster</strong> mode (Be sure to switch to this mode.)<br />

3: P-touch Template mode<br />

Description<br />

• Dynamically switches between the printer's command modes. A printer that receives this command<br />

operates in the specified command mode until the printer is turned off.<br />

• The printer must be switched to raster mode before raster data is sent to it. Therefore, send this command<br />

to switch the printer to raster mode.<br />

g<br />

<strong>Raster</strong> graphics transfer<br />

ASCII: g {s} {n} {d1} ... {dn}<br />

Hexadecimal: 67 {s} {n} {d1} ... {dn}<br />

Parameters<br />

{s} 00h<br />

{n} Number of bytes of raster data (d1 to dh)<br />

However, use the following value if no compression is specified as the compression mode.<br />

n=104<br />

{d1~dn} <strong>Raster</strong> data.<br />

- 26 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

ESC i B<br />

Specify baud rate<br />

ASCII: ESC i B {n1} {n2}<br />

Hexadecimal: 1B 69 42 {n1} {n2}<br />

Parameters<br />

Setting=n1+n2*256<br />

Setting: 96=9600 bps, 576=57600 bps, 1152=115200 bps<br />

Description<br />

• Changes the communications baud rate for the printer. The manufacturer’s default setting is 9600 bps.<br />

Z<br />

Zero raster graphics<br />

ASCII: Z<br />

Hexadecimal: 5A<br />

Description<br />

• Fills raster line with 0 data.<br />

FF<br />

Print command<br />

ASCII: FF<br />

Hexadecimal: 0C<br />

Description<br />

• Used as a print command at the end of pages other than the last page when multiple pages are printed.<br />

Control-Z<br />

Print command with feeding<br />

ASCII: Control-Z<br />

Hexadecimal: 1A<br />

Description<br />

• Used as a print command at the end of the last page.<br />

- 27 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

ESC i z<br />

Print information command<br />

ASCII: ESC i z {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10}<br />

Hexadecimal: 1B 69 7A {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10}<br />

Description<br />

• Specifies the print information.<br />

• Definitions of {n1} through {n10}<br />

{n1}:<br />

{n2}:<br />

{n3}:<br />

{n4}:<br />

{n5-n8}:<br />

Valid flag; Specifies which values are valid<br />

#define PI_KIND 0x02 // Media type<br />

#define PI_WIDTH 0x04 // Media width<br />

#define PI_LENGTH 0x08 // Media length<br />

#define PI_QUALITY 0x40 // Priority given to print quality<br />

#define PI_RECOVER 0x80 // Printer recovery always on<br />

Media type<br />

Continuous length tape: 0Ah<br />

Die-cut labels: 0Bh<br />

{n3}: Media width (mm)<br />

{n4}: Media length (mm)<br />

For the media of width 102 mm × length 152 mm, specify as n3=66h and n4=98h.<br />

<strong>Raster</strong> number = n8*256*256*256 + n7*256*256 + n6*256 + n5<br />

If the media is not correctly loaded into the printer when the valid flag for PI_KIND,<br />

PI_WIDTH and PI_LENGTH are set to “ON”, an error status is returned (Bit 0 of “(2)<br />

Error information 2” is set to “ON”.)<br />

{n9}: Starting page: 0<br />

Other pages: 1<br />

{n10}: Fixed at 0<br />

- 28 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

M<br />

Select compression mode<br />

Parameters<br />

Description<br />

ASCII: M {n}<br />

Hexadecimal: 4D<br />

Definitions of {n}<br />

{n}<br />

0 No-compression mode (Enabled)<br />

1 Reserved (Disabled)<br />

2 TIFF (Enabled)<br />

• Selects the compression mode. Data compression is available only for data in raster graphic transfer.<br />

[TIFF(Pack Bits)]<br />

• 1-byte units<br />

• If the same data is repeated, the number of data units and that 1 byte of data are specified.<br />

If different data is in a series, the number of data items and all of the different data are specified.<br />

• If the same data is repeated, the number of data units is specified as the actual number minus 1,<br />

expressed as a negative number.<br />

If different data is in a series, the number of data units is specified as the number of bytes minus 1,<br />

expressed as a positive number.<br />

• If the above process results in more than 162 bytes of compressed data, the data is treated as being all<br />

different. As a result, the data will be 163 bytes, including the 1 byte that specifies the data length.<br />

Example<br />

1 raster of raster graphics transfer:<br />

Without compression: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br />

00 00 00 00 00 22 22 23 BA BF A2 22 2B……<br />

With compression:<br />

ED 00 FF 22 05 23 BA BF A2 22 2B …<br />

a b c<br />

a. Since “00h” is repeated for 20 bytes, 20d -> 19d -> 13h changed into a negative number is EDh.<br />

Therefore: ED 00<br />

b. Since “22h” is repeated for 2 bytes, 2d -> 1d -> 1h changed into a negative number is FFh.<br />

Therefore: FF 22<br />

c. The following 6 bytes remain unchanged. 6d -> 5d -> 5h<br />

Therefore: 05 23 BA BF A2 22 2B<br />

Continue for the remaining number of bytes for the uncompressed data. Even if 00h continues until the<br />

end, it cannot be omitted.<br />

- 29 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Explanation of “TIFF compression mode”<br />

With compression, the data for the “raster graphics transfer” command is based on 104 bytes of the total<br />

number of pins (832). As shown below, with no compression, the sum of the number of offset pins and the<br />

number of pins within the print area is the byte data. However, with compression, the number of unused pins<br />

is also added to the data. In other words, with compression, this becomes 104 bytes when it is expanded by<br />

the printer, regardless of the tape width.<br />

<strong>Raster</strong> line with<br />

compression<br />

<strong>Raster</strong> line with<br />

no compression<br />

0 pin<br />

First byte<br />

Number<br />

of offset<br />

pins<br />

Tape margin<br />

Total<br />

number<br />

of pins<br />

Number of<br />

print area<br />

pins<br />

Print area<br />

Number<br />

of unused<br />

pins<br />

Pins on print head<br />

Last byte<br />

Feeding direction<br />

- 30 -<br />

4. Printing <strong>Command</strong> Details


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

5. MCR <strong>Command</strong> Specifications<br />

5.1. <strong>Command</strong> details<br />

ESC #1<br />

MCR on command<br />

ASCII: ESC # 1 {n1} {n2} {n3}<br />

Hexadecimal: 1B 23 31 {n1} {n2} {n3}<br />

Description<br />

• Turns on MCR. Does nothing if it is already on.<br />

• Definitions of {n1} through {n3}<br />

{n1}:<br />

Set read/response mode<br />

00h: Continuous reading mode<br />

01h: Single reading mode (Reading ends even if it failed)<br />

*Does nothing if none of the above<br />

{n2}:<br />

{n3}:<br />

Timeout setting (seconds, 1 (min.) to 255 (max.)); 0 (00h) indicates no timeout.<br />

Read track setting<br />

{n3}<br />

Read track<br />

Track3 Track2 Track1<br />

1 (01h) - - ○<br />

2 (02h) - ○ -<br />

3 (03h) - ○ ○<br />

4 (04h) ○ - -<br />

5 (05h) ○ - ○<br />

6 (06h) ○ ○ -<br />

7 (07h) ○ ○ ○<br />

*7 (07h) if other than 1 through 7<br />

ESC #0<br />

MCR off command<br />

ASCII: ESC # 0<br />

Hexadecimal: 1B 23 30<br />

Description<br />

• Turns off MCR. Does nothing if it is already off.<br />

- 31 -<br />

5. MCR <strong>Command</strong> Specifications


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

5.2. Response<br />

Condition<br />

Response<br />

Description<br />

Successful Reception Response (When there is data)<br />

Hex 54h [track] 3Ah [data] 0Dh 0Ah<br />

ASCII T [track] : [data] CR LF<br />

Response that returns the read card data<br />

[track]: Track number (ASCII, ‘1’ to ‘3’)<br />

Track1: 31h, Track2: 32h, Track3: 33h<br />

Track number Multiple bytes Delimiter<br />

[data]: Read data string (ASCII)<br />

SS start code and FC, AS, ES, SS, etc. symbols are not included.<br />

Condition<br />

Response<br />

Description<br />

Successful Reception Response (When there is no data)<br />

Hex 54h [track] 3Ah [“empty”] 0Dh 0Ah<br />

ASCII T [track] : [“empty”] CR LF<br />

Track number<br />

Character string<br />

“empty”<br />

Delimiter<br />

Response indicating that there was no data on the track specified with the MCR on command<br />

This response is returned if the specified track does not exist on the card.<br />

[track]: Track number (ASCII, ‘1’ to ‘3’)<br />

[“empty”]: The character string “empty” is entered.<br />

Track1: 31h, Track2: 32h, Track3: 33h<br />

Hex 65h 6Dh 70h 74h 79h<br />

ASCII e m p t y<br />

- 32 -<br />

5. MCR <strong>Command</strong> Specifications


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Reading multiple tracks<br />

Data in the above-mentioned format is combined for the specified number of tracks and sent.<br />

Example: Reading Track 1 and Track 2<br />

54h 31h 3Ah [data] 0Dh 0Ah 54h 32h 3Ah [data] 0Dh 0Ah<br />

T 1 : [data] CR LF T 2 : [data] CR LF<br />

Condition<br />

Response<br />

Description<br />

Failed Reception Response (Timeout)<br />

Hex 54h 30h 3Ah [“timeout”] 0Dh 0Ah<br />

ASCII T 0 : [“timeout”] CR LF<br />

Character string<br />

“timeout”<br />

Delimiter<br />

Response indicating that it returned to the MCR off status due to a timeout<br />

[“timeout”]: The character string “timeout” is entered.<br />

Hex 74h 69h 6Dh 65h 6Fh 75h 74h<br />

ASCII t i m e o u t<br />

Condition<br />

Response<br />

Description<br />

Failed Reception Response (Read Error)<br />

Hex 54h 30h 3Ah [“can not read”] 0Dh 0Ah<br />

ASCII T 0 : [“can not read”] CR LF<br />

Character string “can<br />

not read”<br />

Delimiter<br />

Response indicating that an error occurred while reading<br />

[“can not read”]: The character string “can not read” is entered.<br />

Hex 53h 41h 4Eh 20h 4Eh 4Fh 54h 20h 52h 45h 41h 44h<br />

ASCII c a n n o t r e a d<br />

Space<br />

Space<br />

- 33 -<br />

5. MCR <strong>Command</strong> Specifications


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6. Flow Charts<br />

6.1 Normal flow for USB connection<br />

Computer (host)<br />

If there are no<br />

problems with the<br />

printer status (media,<br />

etc.), the data is READ<br />

transmitted. If there<br />

is a problem, an error<br />

appears.<br />

Displaying sending<br />

Initialize<br />

Status information request<br />

Status (response to status information request)<br />

Sending control codes<br />

Sending raster data<br />

Status<br />

(Phase change:<br />

“Printing”)<br />

Printer<br />

The printer is<br />

initialized.<br />

The status of the<br />

printer (media, etc.)<br />

is checked and a<br />

response is sent.<br />

Data received.<br />

Beginning printing<br />

without waiting for<br />

a print command<br />

Printing<br />

Sending raster data<br />

Sending raster data<br />

Sending raster data<br />

Display ing printing<br />

Phase change<br />

“Printing” received.<br />

“Printing completed”<br />

received.<br />

READ<br />

Finishing process for<br />

printing page 1<br />

Sending data for page 2<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other pages)<br />

Status (“Printing completed”)<br />

Status (Phase change:<br />

“Waiting to receive”)<br />

Sending control code/print data<br />

Printing of the 1st<br />

page is actually not<br />

finished, but the<br />

“Printing<br />

completed” status<br />

and “Waiting to<br />

receive” phase are<br />

sent.<br />

Status<br />

(Phase change:<br />

“Printing”)<br />

Printing 1st page<br />

Printing 2nd page<br />

Sending raster data<br />

Sending raster data<br />

Sending raster data<br />

- 34 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.2 Error flow for USB connection (when feeding at the end of the page)<br />

If there are no<br />

problems with the<br />

printer status (media,<br />

etc.), the data is<br />

transmitted. If there is<br />

a problem, an error<br />

appears.<br />

Displaying sending<br />

Computer (host)<br />

READ<br />

Initialize<br />

Status information request<br />

Status (response to status information request)<br />

Sending control codes<br />

Printer<br />

The printer is<br />

initialized.<br />

The status of the<br />

printer (media, etc.)<br />

is checked and a<br />

response is sent.<br />

Data received.<br />

Sending raster data<br />

Status<br />

(Phase change:<br />

“Printing”)<br />

Beginning printing<br />

without waiting for a<br />

print command<br />

Printing<br />

Sending raster data<br />

Displaying printing<br />

READ<br />

Phase change<br />

“Printing” received.<br />

“Printing completed”<br />

received.<br />

Finishing process<br />

for printing page 1<br />

Sending data for page 2<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other page)<br />

Status (“Printing completed”)<br />

Status (Phase change: “Waiting to receive”)<br />

Sending control code/raster data<br />

Status<br />

(“Error occurred”)<br />

Printing of the 1st<br />

page is actually not<br />

finished, but the<br />

“Printing completed”<br />

status and “Waiting<br />

to receive” phase are<br />

sent.<br />

Error occurred<br />

Displaying printing<br />

Sending raster data<br />

Sending raster data<br />

If an error occurs, all<br />

data read from the<br />

computer is cleared.<br />

Displaying printing<br />

“Error Occured” received.<br />

An error appears.<br />

When restarted, data is<br />

resent starting with the<br />

1st page since “Printing”<br />

for the 2nd page is not<br />

received.<br />

Resending process<br />

for data of 1st page<br />

READ<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other pages)<br />

Initialize<br />

Reprinting 1st page<br />

- 35 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.3 Error flow for USB connection (with a concurrent printing error such as end of tape)<br />

If there are no<br />

problems with the<br />

printer status (media,<br />

etc.), the data is<br />

transmitted. If there is<br />

a problem, an error<br />

appears.<br />

Computer (host)<br />

READ<br />

Displaying sending<br />

Initialize<br />

Status information request<br />

Status (response to status information request)<br />

Sending control codes<br />

Printer<br />

Any jobs with errors<br />

remaining in the printer<br />

are cleared.<br />

The printer is initialized.<br />

The status of the printer<br />

(media, etc.) is checked<br />

and a response is sent.<br />

Data received.<br />

Sending raster data<br />

Sending raster data<br />

Status<br />

(Phase change :<br />

“Printing”)<br />

Beginning printing<br />

without waiting for a<br />

print command<br />

Printing<br />

Phase change<br />

“Printing” received.<br />

Displaying printing<br />

“Printing completed” received.<br />

Phase change<br />

“Waiting to receive” received.<br />

Finishing process for<br />

printing page 1<br />

Sending data for page 2<br />

Displaying printing<br />

READ<br />

Phase change<br />

“Printing” received.<br />

“Error Occured” received.<br />

An error appears.<br />

When restarted, data is resent<br />

starting with the 2nd page<br />

since “Printing” for the 2nd<br />

page is received.<br />

Resending process for<br />

data of 2nd page<br />

READ<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other pages)<br />

Status (“Printing completed”)<br />

Status (Phase change: “Waiting to receive”)<br />

Sending control code/raster data<br />

Sending raster data<br />

Sending raster data<br />

Status<br />

(Phase change :<br />

“Printing”)<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other pages)<br />

Initialize<br />

Status<br />

(“Error Occurred”)<br />

Printing of the 1st page<br />

is actually not finished,<br />

but the “Printing<br />

completed” status and<br />

“Waiting to receive”<br />

phase are sent.<br />

Printing 1st page<br />

Printing 2nd page<br />

Error occurred<br />

If an error occurs, all<br />

data read from the<br />

computer is cleared.<br />

Reprinting 2nd page<br />

- 36 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.4 Cooling flow for USB connection<br />

Computer (host)<br />

If there are no<br />

problems with the<br />

printer status<br />

(media, etc.), the READ<br />

data is transmitted.<br />

If there is a<br />

problem, an error<br />

appears.<br />

Displaying sending<br />

Initialize<br />

Status information request<br />

Status (response to status information request)<br />

Sending control codes<br />

Printer<br />

Any jobs with errors<br />

remaining in the printer<br />

are cleared.<br />

The printer is initialized.<br />

The status of the printer<br />

(media, etc.) is checked<br />

and a response is sent.<br />

Data received.<br />

Sending raster data<br />

Status<br />

(Phase change:<br />

“Printing”)<br />

Beginning printing<br />

without waiting for a<br />

print command<br />

Printing<br />

Sending raster data<br />

Sending raster data<br />

Sending raster data<br />

Status<br />

(Notification:<br />

“Cooling (started)”)<br />

Cooling occurred<br />

READ<br />

Sending raster data<br />

Failed<br />

Returned “NAK” from<br />

cooling<br />

Repeating reading of<br />

maximum and<br />

transmission timeout<br />

times. If the<br />

transmission timeout is<br />

exceeded, reading,<br />

and displaying the<br />

cooling status if a hightemperature<br />

error is<br />

returned.<br />

0 packet<br />

0 packet<br />

0 packet<br />

Continuing reading.<br />

0 packets are returned<br />

while cooling.<br />

0 packet<br />

When cooling is finished,<br />

Notification: “Cooling<br />

(finished)” is returned.<br />

Status (Notification: “Cooling (finished)”)<br />

Sending raster data<br />

Resuming printing<br />

Sending raster data<br />

- 37 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.5 Flow for setting serial connection baud rate<br />

Computer (host)<br />

Printer<br />

Printer waiting to<br />

recover from 3000 ms<br />

Sleep<br />

Old baud rate<br />

New baud rate<br />

Specify baud rate<br />

“Specify baud rate completed” status (normal status)<br />

Status information request<br />

Status (response to status information request)<br />

* The request/response at the new baud rate are<br />

simply to verify that communication is possible and<br />

may be omitted.<br />

- 38 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.6 Normal flow for serial connection<br />

Computer (host)<br />

Printer<br />

If there are no<br />

problems with the<br />

printer status (media,<br />

etc.), the data is<br />

transmitted. If there is<br />

a problem, an error<br />

appears.<br />

READ<br />

Displaying sending<br />

Initialize<br />

Status information request<br />

Status (response to status information request)<br />

Sending control codes<br />

The printer is<br />

initialized.<br />

The status of the<br />

printer (media, etc.)<br />

is checked and a<br />

response is sent.<br />

Data received.<br />

Sending raster data<br />

Sending raster data<br />

Sending raster data<br />

Sending raster data<br />

Displaying printing<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other page)<br />

Printing<br />

Phase change<br />

“Printing” received.<br />

READ<br />

Status<br />

(Phase change: “Printing”)<br />

“Printing completed”<br />

received.<br />

Status<br />

(“Printing completed”)<br />

Phase change<br />

“Waiting to receive” received.<br />

Finishing process for<br />

printing 1st page<br />

Sending data for<br />

2nd page<br />

Status<br />

(Phase change: “Waiting to receive”)<br />

Sending control codes<br />

Printing 1st page<br />

Printing 2nd page<br />

Sending raster data<br />

Sending raster data<br />

- 39 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.7 Error flow for serial connection<br />

Computer (host)<br />

Printer<br />

If there are no<br />

problems with the<br />

printer status<br />

READ<br />

(media, etc.), the<br />

data is transmitted.<br />

If there is a problem,<br />

an error appears.<br />

Initialize<br />

Status information request<br />

Status (response to status information<br />

request) or an error is displayed<br />

The printer is<br />

Initialized.<br />

The status of the<br />

printer (media, etc.)<br />

is checked and a<br />

response is sent.<br />

Displaying sending<br />

Sending control codes<br />

Data received.<br />

Sending raster data<br />

Displaying printing<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other page)<br />

Printing<br />

READ<br />

Phase change<br />

“Printing” received.<br />

Status<br />

(Phase change: “Printing”)<br />

Status (“Error Occurred”)<br />

Error occurred<br />

- 40 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

6.8 Cleaning flow for serial connection<br />

Computer (host)<br />

Printer<br />

If there are no<br />

problems with the<br />

printer status<br />

(media, etc.), the<br />

READ<br />

data is transmitted.<br />

If there is a problem,<br />

an error appears.<br />

Initialize<br />

Status information request<br />

Status (response to status<br />

information request)<br />

The printer is<br />

initialized.<br />

Status (response<br />

to status request)<br />

Displaying sending<br />

Sending control codes<br />

Data received.<br />

Sending raster data<br />

Displaying printing<br />

Sending a print command (print command with feeding (1A)<br />

for the last page or print command (0C) for other page)<br />

Printing<br />

Phase change<br />

“Printing” received.<br />

READ<br />

Status<br />

(Phase change :“Printing”)<br />

Status<br />

(Notification: “Cooling (started)”)<br />

Cooling<br />

* “Cooling (standard)”<br />

and “Cooling (finished)”<br />

may be repeated<br />

multiple times during<br />

one printing operation.<br />

Status<br />

(Notification: “Cooling (finished)”)<br />

Printing<br />

“Printing completed”<br />

received.<br />

Status<br />

(Printing completed)<br />

Phase change “Waiting<br />

to receive” received.<br />

End process for<br />

printing 1st page<br />

Sending data for 2nd<br />

page<br />

Status<br />

(Phase change: “Waiting to receive”)<br />

Sending control codes<br />

Printing 1st page<br />

Printing 2nd page<br />

Sending raster data<br />

Sending raster data<br />

- 41 -<br />

6. Flow Charts


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Appendix A: USB Specifications<br />

USB specifications 1.1<br />

Item<br />

Description<br />

Vendor ID<br />

Product ID<br />

Class<br />

Character string for<br />

manufacturer<br />

Character string for<br />

product<br />

Character string for<br />

serial number<br />

Device speed<br />

Number of interfaces<br />

Power supply<br />

End point 1<br />

End point 2<br />

0x04F9<br />

<strong>RJ</strong>-4030:2045<br />

<strong>RJ</strong>-4030Ai:208f<br />

<strong>RJ</strong>-<strong>4040</strong>:2046<br />

Printer<br />

Mass storage<br />

Character string descriptor: 0x01<br />

0x0409: “<strong>Brother</strong>”<br />

Character string descriptor: 0x02<br />

0x0409: “<strong>RJ</strong>-4030”<br />

0x0409: “<strong>RJ</strong>-4030Ai”<br />

0x0409: “<strong>RJ</strong>-<strong>4040</strong>”<br />

Character string descriptor: 0x03<br />

0x0409: “000000001”<br />

Last nine digits of the printer’s serial number<br />

Full speed<br />

1 (No alternate interfaces)<br />

Self-powered (As a printer class, Bus power is also set to “ON”.)<br />

In bulk (Sends the status from the printer to the computer.)<br />

Maximum packet size: 16 bytes<br />

Out bulk (Sends print commands and data from the computer to the printer.)<br />

Maximum packet size: 64 bytes<br />

- 42 -<br />

Appendix A: USB Specifications


<strong>Raster</strong> <strong>Command</strong> <strong>Reference</strong><br />

Appendix B: Introducing the <strong>Brother</strong> Developer Center<br />

Useful information for developers, such as applications, tools, SDKs as well as FAQs, are provided in the<br />

<strong>Brother</strong> Developer Center.<br />

http://www.brother.com/product/dev/index.htm<br />

- 43 -<br />

Appendix B: Introducing the <strong>Brother</strong> Developer Center

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!