I need help to convert the below information into VBA , I tried to fit the information into the two codes below but no lucky.

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):

<Header1><Header2><CmdID ><Length ><Content><CRC>
Header 1 1 The first byte of package header 0x1A
Header 2 1 The second byte of package header Ox5D
CmdID 1 Command IDs:
0x01 acquire the status of ESD
0x02 invoice signing
0x03 Error code
Length 4 The length of the content, big-endian
Content ? The Json based business data
CRC 2 Two-Byte verification (CRC), it will be generated by bytes start from
Header 1 up to content

The CRC algorithm used here is follows:
unsigned short int cal_crc(unsigned char *ptr, unsigned int len)
unsigned char i;
unsigned int crc=0;
for(i=0x80; i!=0; i/=2)

I have already converted my data in Json format using the Json serializer and also Deserialized will be used for data that will be received.

Dim intPortID As Integer ' Ex. 1, 2, 3, 4 for COM1 - COM4
    Dim lngStatus As Long
    Dim strError  As String
    Dim strData   As String
    ' Initialize Communications
    lngStatus = CommOpen(intPortID, "COM" & CStr(intPortID), _
        "baud=9600 parity=N data=8 stop=1")
    If lngStatus <> 0 Then
                ' Handle error.
        lngStatus = CommGetError(strError)
                MsgBox "COM Error: " & strError
    End If
    ' Set modem control lines.
    lngStatus = CommSetLine(intPortID, LINE_RTS, True)
    lngStatus = CommSetLine(intPortID, LINE_DTR, True)
    ' Write data to serial port.
    lngSize = Len(strData)
    lngStatus = CommWrite(intPortID, strData)
    If lngStatus <> lngSize Then
                ' Handle error.
    End If
    ' Read maximum of 64 bytes from serial port.
    lngStatus = CommRead(intPortID, strData, 64)
    If lngStatus > 0 Then
        ' Process data.
    ElseIf lngStatus < 0 Then
        ' Handle error.
    End If
    ' Reset modem control lines.
    lngStatus = CommSetLine(intPortID, LINE_RTS, False)
    lngStatus = CommSetLine(intPortID, LINE_DTR, False)
    ' Close communications.
    Call CommClose(intPortID)

The manual is below: