zoukankan      html  css  js  c++  java
  • 东芝 B-EV4 打印机 串口打印命令

      最近在做项目时候使用了东芝的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”. 

  • 相关阅读:
    KnockoutJS(2)-监控属性
    KnockoutJS(1)-数据模型
    Stimulsoft Reports报表工具
    Knockout.js 初探
    web网页的表单排版利器--960css
    用一个div模拟textarea的实现
    正则表达式笔记4-封装class
    正则表达式笔记3
    正则表达式笔记2
    正则表达式笔记1
  • 原文地址:https://www.cnblogs.com/z45281625/p/10619873.html
Copyright © 2011-2022 走看看