AT24CXX IC卡无法解释的变量

时间:2018-07-20 13:03:11

标签: c# c++ pinvoke hardware

我正在使用C#上的C ++卡分配器硬件API,我已经完成了简单的部件dll导入等工作,并且文档做得很好。但是,有两个输入变量我无法确定,这里是文档

/**
 *  AT24CXX IC card read data, must power on.
 *
 *  @param [in] ComHandle Port handle(> 0).
 *  @param [in] CardType Card type, see the value below.
 *  @param [in] RLEN Data length of reading.
 *  @param [in] ADDRH High byte of card memory address.
 *  @param [in] ADDRL Low byte of card memory address.
 *  @param [out] ReadData buffer to store return read result. 
 *  @param [out] ERR_Code buffer to store API function error code. please reference to @ref APIErrorCode.
 *  
 *  CardType value:
 * | Type     | Type Value   | Memory Size  |   Address Index Range
 * | ------   |------------- | ------------ |  --------------------
 * | AT24C01  |    0x30      |  128 byte    |   addr = 0x0000-0x007F
 * | AT24C02  |    0x31          |  256 byte    |   addr = 0x0000-0x00FF
 * | AT24C04  |    0x32          |  512 byte    |   addr = 0x0000-0x01FF
 * | AT24C08  |    0x33          |  1K byte     |   addr = 0x0000-0x03FF
 * | AT24C16  |    0x34          |  2K byte     |   addr = 0x0000-0x07FF
 * | AT24C32  |    0x35          |  4K byte     |   addr = 0x0000-0x0FFF
 * | AT24C64  |    0x36          |  8K byte     |   addr = 0x0000-0x1FFF
 *
 *  @return  == 0, success, != 0, failed. please reference to @ref APIReturn.
 *
 *  @note the card memory address meaning is the address = (low byte + hight byte * 256).
 *
 */
int APIENTRY WBCM7200_AT24XXRead(HANDLE ComHandle, BYTE CardType, BYTE RLEN, BYTE ADDRH, BYTE ADDRL, BYTE ReadData[], BYTE *ERR_Code);

我不知道的变量是ADDRH和ADDRL。我已经研究了C ++和C#中的高位和低位,但是没有任何进展,请参阅下面的导入

[DllImport(CardDispenserLibrary, EntryPoint = "WBCM7200_AT24XXRead", CallingConvention = CallingConvention.StdCall)]
        public static extern int ReadCard(int comHandle, byte cardType, byte rlen, byte addrh, byte addrl, byte[] readData, out byte error);

我用所有可能的ADDRH和ADDRL组合调用了该函数,返回值为-1,输出字节为4,这在上述APIErrorCode中很容易丢失。我有一张2K卡。这些值是什么?

0 个答案:

没有答案