函数原型:int ReadSoftwareVersion(HANDLE comm,char *receive) 
功能说明:读取读写器的软件版本号。
输入参数: 
●——comm:串口句柄 
●——*receive:接收软件版本的数组地址。其中 
receive[0]是软件主版本值,receive[1]
是软件次版本值。
返回结果:调用成功返回 
1,否则返回 
-1。
调用例程: 
int flag; 
char receive_data[2]; 
flag = ReadSoftwareVersion(h_Com,receive_data); 
if(flag==1) 

 CString string; 
string.Format("Software Version is %d.%d",receive_data[0],receive_data[1]); 
AfxMessageBox(string); 

else 

 AfxMessageBox("Read Software Version Failed!"); 
} 函数原型:int TagIdentify(HANDLE comm,unsigned char *receive) 
功能说明:单标签 ID识别
输入参数: 
●——comm:串口句柄 
●——*receive:接收 ID的数组地址
返回结果:调用成功返回 1,否则返回 -1。
调用例程:
 5 
int flag; 
unsigned char receive[20]; 
flag=TagIdentify(h_Com,receive); 
if(flag==1) 

 CString string; string.Format("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x 
%02x",receive[0],receive[1],receive[2],receive[3],receive[4],receive[5],receive[6],receiv 
e[7],receive[8],receive[9],receive[10],receive[11]);  AfxMessageBox(string); 

else 
 AfxMessageBox("Operation Error!"); 

解决方案 »

  1.   

    Delphi        字长/值域                                C++ShortInt    8位有符号整型                        signed char
    SmallInt    16位有符号整型                        short
    LongInt        32位有符号整型                        int
    Byte        8位无符号整型                        unsigned char
    Word        16位无符号整型                        unsigned short
    Integer        32位有符号整型                        int
    Cardinal    32位无符号整型                        unsigned int
    Boolean        真/假                                bool
    ByteBool    真/假 或 8位无符号整型                unsigned char
    WordBool    真/假 或 16位无符号整型                unsigned short
    LongBool    真/假 或 32位无符号整型                BOOL (WinAPI)
    AnsiChar    8位无符号字符                        char
    WideChar    宽字编码字符                        wchar_t
    Char        8位无符号字符                        char
    AnsiString    Delphi的字符串类                    AnsiString 类
    String[n]    老式的Delphi字符串, n = 1..255字节    SmallString<n> 模板类
    ShortString    老式的Delphi字符串, 255字节            SmallString<255>
    String        Delphi的AnsiString类                AnsiString
    Single        32位浮点数                            float
    Double        64位浮点数                            double
    Extended    80位浮点数                            long double
    Real        32位浮点数                            double
    Pointer        32无类型指针                        void *
    PChar        32位字符型指针                        unsigned char *
    PAnsiChar    32位ANSI型字符指针                    unsigned char *
    Comp        64位浮点数                            Comp 类
    OleVariant    OLE可变类型值                        OleVariant 类