1. 程式人生 > >東芝 B-EV4 打印機 串口打印命令

東芝 B-EV4 打印機 串口打印命令

測量 關於 sin comm char tree erro ann -s

  最近在做項目時候使用了東芝的B-EV4打印機,在打印Excel時候由於字體太小,導致打印非常模糊。只能通過串口名稱發送打印指令進行打印。在做項目的時候查了很多關於B-EV4打印機的資料,和打印命令。資料都很少坑也很多,通過這個項目跟大家分享一下,也避免每個人都踩坑。

  我先把官方命令資料給大家,實際命令要以文檔為主 下載地址:http://www.printmark.de/downloads/prog_manuals/Prog_handb_B-EV4.pdf

  1.打印測試頁

  在連接串口之前需要知道串口的信息,在機器的測試頁面會顯示。具體步驟如下

  “自動打印測試和傾印模式”

  1. 關閉打印機電源,把介質卷裝入打印機。
  2. 開啟打印機的同時按下【FEED】按鈕。指示燈將按照以下順序持續亮起:

    綠色(閃爍)→ 紅色(閃爍)→ 橙色(閃爍)→

    橙色 → 紅色 → 綠色

  3. 當指示燈持續亮起且為綠色時,釋放【FEED】按鈕。

  4. 打印機將自動實現自動打印測試,然後進入傾印模式。

  5. 要開始聯機操作,先關閉打印機,然後再次開啟。

  在打印完畢之後會顯示類似模板

技術分享圖片

  PARAMETER 下顯示了機器目前的串口信息,串口的連接信息在以後的命令中也可以自己進行修改。 命令:{Z2; 1, abcdefghijklmnopqqrst(uvw) |}

  2.打印流程

  下圖是官方給出的打印流程模板,每個指令都有自己的參數類型、參數數量。因為參數很多,具體指令還需要看官方文檔。在此只能說下指令的目的和註意事項。

  指令是以大括號和豎線為識別符號,例如{XX;xx|},也就是說在大括號之外的指令是不被打印機識別和運行的,也不會報錯。

  {D;aaa,bbb|} D是指令的名稱,告訴打印機執行什麽動作,aaa和bbb是參數告訴打印機執行具體執行的數據。需要註意參數是有位數限制。文檔上給出的位數在調用的時候一定要位數一致,數值不夠的需要在前方補0 ,例如 {PV00;0050,0030,0030,0030,J,00,B|}。在機器報錯首先檢查是否指令的位數和文檔不符合。

  具體註意事項在文章最下方有詳細說明

技術分享圖片

  {D;|} 指定打印大小、紙張大小。這項一定要按照打印標簽的參數進行設置,否則在以後切紙的時候就會有偏移,就會有可能切到下一張標簽上。如果沒有標簽紙的資料也可以用遊標卡尺進行測量。(要求精度)

  {AX;} 制定切紙大小、切紙偏移位置等。我在使用中沒用這條指令,打印紙張大小確定好後,機器有識別功能的話,會自動識別標簽的切割位置。

  {AY;} 設置打印濃度。

  {T;} 進紙命令,執行完命令後會傳出一份。

  命令註意事項

  1. If a command is not recognized as a command, it is ignored. e.g.) [ESC] H, [ESC]AA, and so on.

  2. If the number of digits of the parameter is specified, when the number of in put digits does not match the specified number of digits, a command error occurs.

  3. When a parameter is set to any character/value other than specified characters/values, a command error occurs.

    e.g.) In the case that a value should be set for parameter, “0001” is acceptable, however, “000A” results in an error.

    In the case that a character should be set for parameter, “A” is acceptable, however, “1” results in an error.

  4. If the value range of the parameter is specified, when any value beyond the range is entered, a command error occurs. (Except for the D command)

  5. When a parameter is missing, which cannot be omitted, a command error occurs.

  6. The parameter should be set to either a value or a character, even if the parameter is defined as “Ignore”.

    e.g.) a : Ignore
    If it is omitted, a command error occurs, except when the parameter is omissible.

    If the number of digits of the parameter is specified, when the number of input digits does not match the specified number of digits, a command error occurs.

   7.When any value/character other than available values/characters for the parameter function is set, a command error occurs.

    1. e.g.) Parameter “e” for the LC command. e: Type of line

      0: Line
      1: Rectangle
        If “2” is set to parameter “e”, a command error occurs.

  1. About D command

    1) Parameter “aaaa”, “bbbb” and “cccc”

    When any value lager than maximum value is entered for these three parameters, the entered value is internally changed to the maximum value.
    When any value smaller than minimum value is entered for these tree parameters, the entered value is internally changed to the minimum value.

    2) When “aaaa” is smaller than “cccc”, a command error occurs.
    3) When “aaaa – cccc < 2mm”, it is internally changed to “cccc = aaaa – 2mm”.

東芝 B-EV4 打印機 串口打印命令