了解简单串行接口编程协议 - 条形码扫描仪

时间:2014-08-02 23:30:52

标签: python c serial-port barcode barcode-scanner

问题陈述:

我正在尝试构建一个简单的应用程序来读取QR /条形码信息并向用户显示显示(首选C /或Python)。

  1. 用户将按系统中的某个键。
  2. 点击后,应启用条形码触发并准备扫描请求的条形码(QR / Code 39)
  3. 成功进行用户扫描后,他/她的数据应显示在屏幕上。
  4. 读取/写入串行数据不是问题。我可以管理它。

    对于我正在使用的扫描仪型号,文档位于:https://drive.google.com/folderview?id=0B60pejPe6yiSQXAwWVFxZjRlR2s&usp=sharing

    我唯一的困惑是形成框架SSI命令。

    我看到很多这方面的例子。但是,我仍然无法明确遵循逻辑。

    unsigned char ledOn[] = {0x05, 0xE7, 0x04, 0x00, 0x0D, 0x00};
    unsigned char SSIBuffer[] = {0x00, 0xC6, 0x04, 0x08, 0x11, 0xEE, 0x01};
    

    以上是我从Stackoverflow(Send data to a barcode scanner over RS232 serial port)得到的一些例子:

    通过与上面的扫描仪参考文档进行比较,我解读了这条消息以便进一步理解。

    问题-1

    在文件中,STATUS字段讨论了4个BIT数据:

        Bit 0: Retransmit
        0 = First transmission
        1 = Subsequent transmission
        Bit 1: Continuation
        0 = Last packet of a multipacket message
        1 = Intermediate packet
    

    我不清楚何时会设置上述位及其含义。

    问题-2

    ledOn[] = {0x05, 0xE7, 0x04, 0x00, 0x0D, 0x00};
    Length(Byte-1)
    Command(Byte-2)( LED_ON)
    Decoder(Byte-3)
    Status(Byte-4)
    LED Selection(Byte-5) //**Don’t know where to get this info**
    
    
    SSIBuffer[] = {0x00, 0xC6, 0x04, 0x08, 0x11, 0xEE, 0x01};
    Length(Byte-1) (Will change the buffer later from 0)
    Command(Byte-2) (PARAM_SEND)
    Decoder(Byte-3)
    Status(Byte-4) – Making barcode to set this config permenanent
    BEEP_CODE(Byte-5)
    Param_data (Byte-6) (Decode Data Packet Format – ref-pl3307)
    Param_value(Byte-7)
    

    再次参考我看到的数据表(SE3300型号)的许多操作模式。我想我应该使用具有电平触发模式的正常解码模式。我对使用“快照模式”有什么好处感到困惑。

    Normal Decode Mode
            Level Trigger Mode Procedure
            Picklist in Level Trigger Mode Procedure
            Presentation Mode Procedure
            Auto-AIM Mode Procedure
    

    最后,如何加入多个命令?

    例如,如果我需要使用级别触发模式程序,根据数据表,这些是涉及的步骤:

    The system is initialized as follows:
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The host sends the Acquisition Stop command.
        • The host sends the Barcode Decode mode command.
        • The SE3300 optimizes the image output for bar code decoding.
        • The SE3300 enters standby mode (or low power mode if enabled).
    Upon a trigger pull:
        • The host sends the Illumination On command.
        • The SE3300 exits standby mode (or low power mode if enabled).
        • The host sends the Aim On command.
        • The host sends the Acquisition Start command.
        • The SE3300 begins outputting images.
        • The host attempts to decode the images.
    Upon a good decode or trigger release:
        • The host sends the Acquisition Stop command.
        • The SE3300 stops outputting images.
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The SE3300 enters standby mode (or low power mode if enabled).
    

    有人可以指导我使用SSI命令为此形成一个简单的流程吗?

0 个答案:

没有答案