Пример #1
0
        public static string WriteDQBH(string str)
        {
            byte[] databuff = new byte[1];
            byte[] buff     = new byte[2];
            string data     = "";

            data  = LConvert.int_hex(str);
            icdev = IC.ic_init(1, 9600);
            buff  = System.Text.Encoding.ASCII.GetBytes(data);
            IC.asc_hex(buff, databuff, 2);
            st = IC4442.swr_4442(icdev, 71, 1, databuff);
            if (st == 0)
            {
                return("写数据成功!" + data);
            }
            else
            {
                return("写数据失败!" + data);
            }
        }
Пример #2
0
        public static string WriteRemainQL(string str)
        {
            byte[] databuff = new byte[3];
            byte[] buff     = new byte[6];
            string f_i      = "";
            string data     = "";

            f_i   = LConvert.float_int(str);
            data  = LConvert.int_hex(f_i);
            icdev = IC.ic_init(1, 9600);
            buff  = System.Text.Encoding.ASCII.GetBytes(data);
            IC.asc_hex(buff, databuff, 6);
            st = IC4442.swr_4442(icdev, 61, 3, databuff);
            if (st == 0)
            {
                return("写数据成功!" + data);
            }
            else
            {
                return("写数据失败!" + data);
            }
        }
Пример #3
0
        //用户编号区 21H—24H(33 – 36)当存储在IC卡上时,8位数从低位到高位,每两位为1组,每组存入1个字节中。
        //例如:若从卡上用户编号区读出的数据为:0CH,22H,38H,4EH,则用户编号为12345678。
        public static string ReadUserId()
        {
            string s = "";

            byte[] data     = new byte[4];
            byte[] databuff = new byte[8];
            string lbResult;

            icdev = IC.ic_init(port, baud);
            st    = IC4442.srd_4442(icdev, 33, 4, data);
            if (st == 0)
            {
                st       = IC.hex_asc(data, databuff, 4);
                lbResult = System.Text.Encoding.ASCII.GetString(databuff);
                s        = LConvert.hex_int(lbResult);
                s       += LConvert.int_hex(s);
                lbResult = s + lbResult;
            }
            else
            {
                lbResult = "读数据失败!";
            }
            return(lbResult);
        }