Home > Software engineering >  Could you tell me who is defined in the ISO/IEC 14443 standard CRC - B check VB source code
Could you tell me who is defined in the ISO/IEC 14443 standard CRC - B check VB source code

Time:09-20

I want to write a HEX qualcomm chip mobile data, through the "string of monitoring found that PC to write the phone order 27 97, 07 56 34 12 00 00 A1 00 00 CC 9 d 7 e, by contrast," 27 97, 07 56 34 12 00 00 A1 00 00 "CC 9 d" should be the efficacy of the code, "7 e" is fixed, it is defined in the IEC 14443 standard CRC - B check way, could you tell me who have the source code, VB or VB.NET or tell me how to call DLL, VB.NET in VB call I have, but using this call the VB.NET: "crc_16" the call causes a stack asymmetry, reason may be managed PInvoke signature and unmanaged target signature does not match, please check the PInvoke signature and unmanaged calling convention and parameters of target signature match, "
VB call source is
 Option Explicit 
Private Declare Function crc_16 Lib "crc16. DLL" (ByVal mode As Byte, ByRef data As Byte, ByVal length As Long) As an Integer
Dim CRC As Integer
Dim the data () As Byte
Private Sub Command1_Click ()
Dim n As Long As Long, I m As Byte
N=Len (Text1) \ 2
ReDim data (n - 1)
For I=0 To n - 1
Data (I)=Val (" & amp; H "& amp; Mid (Text1, I * 2 + 1, 2))
Next I
CRC=crc_16 (2, data (0), n)
Label1=Right (" 000 "& amp; Hex (CRC), 4)
End Sub

I call on the VB.net?

CodePudding user response:

You in VB.NET is "import function", should give it a "StdCall" indicate?

CodePudding user response:

Post code of VB.Net,
Again, use the edit box on the tool bar code format,

CodePudding user response:

Fyi:
/* * * * * crc16. C * * * * */
#include

# define CRC16_DNP 0 x3d65u//DNP, IEC 870, M - BUS, wM - BUS,...
# define CRC16_CCITT 0 x1021u//x. 25, v. 41, in HDLC FCS, Bluetooth,...

//Other polynoms not *
# define CRC16_IBM 0 x8005u//ModBus, USB, Bisync, CRC - 16, CRC - 16 - ANSI,...
# define CRC16_T10_DIF 0 x8bb7u//SCSI DIF
# define CRC16_DECT 0 x0589u//Cordeless Telephones
# define CRC16_ARINC 0 xa02bu//ACARS Aplications

# define POLYNOM CRC16_DNP//define the informs the POLYNOM from one of the aboves

//Calculates the new crc16 have the newByte. Variable crcValue is the actual or initial value (0).
Unsigned short crc16 (unsigned short crcValue, unsigned char newByte) {
int i;

For (I=0; I & lt; 8; I++) {
If (((crcValue & amp; 0 x8000u) & gt;> 8) ^ (newByte & amp; {0 x80u))
CrcValue=https://bbs.csdn.net/topics/(crcValue <1) ^ POLYNOM;
} else {
CrcValue=https://bbs.csdn.net/topics/(crcValue <1);
}
NewByte & lt; <=1;
}
Return crcValue;
}

Unsigned short exampleOfUseCRC16 (unsigned char * Data, int len) {

Unsigned short CRC;
Int aux=0;

CRC=0 x0000u;//Initialization of CRC to 0 x0000 for DNP
//CRC=0 xffffu;//Initialization of CRC to 0 XFFFF for CCITT

While (aux & lt; Len) {
CRC=crc16 (CRC, Data/aux);
Aux++;
}

Return (CRC) ~;//The CRC value for DNP it is obtained by The NOT operation

//return CRC;//The CRC value for CCITT
}

Int main () {
Unsigned char d [10]=,1,2,3,4,5,6,7,8,9 {0};

Printf (" % 0 x 04 hx \ n ", exampleOfUseCRC16 (d, 10));//0 x1078
return 0;
}

CodePudding user response:

Write the wrong estimation is vb.net/dllimport parameters
  • Related