Help required on VBA Serial Virtual Port Communication on Access 2016

  • Hi


    I have been following your quality answers on the serial virtual port for some time now, though based in excel I though that may be one can assist me also sorting out a similar serial virtual port based in Ms Access 2016.

    The interface follows the same Module created by Mr David H.M, but the only difference is the requirement of using the checksum (CRC) in the send string. That is where I got complete stuck, below are the two VBA code to be used. For example, if I want to send the text called “Christopher” I will do it like below:



    The above VBA Code is fine, no issues, the main challenges are on the device which we are now required to use. It has the following mandatory requirements:

    Details of the device

    The contents of the interface protocol include three commands (request/response), such as Get

    Status, Invoice signing and error message. All the data will be organized in JSON format starting with package header and ending with checksum. It consists of Header, Command ID, Length of data, Content and Verification Code (CRC):

    Detailed description of the device:

    Field

    Header1 = 1 Length Byte (The first byte of package header 0x1A

    Header2 = 1 Length Byte (The first byte of package header 0x5D

    CmdID = 1 Command IDs : (0x01 acquire the status of the device, 0x02 invoice signing, 0x03 Error code)

    Length = 4 The length of the content, big-endian

    Content = ? Data to be sent

    CRC = 2 (Two-Byte verification (CRC), it will be generated by bytes start from Header to Content

    Final String to be sent to this device

    <Header1><Header2><CmdID><Length><Content><CRC>


    Any idea on this people?