Menu

Help with DataBlock method

Help
2008-01-31
2023-03-13
  • Gonzalo Urroz

    Gonzalo Urroz - 2008-01-31

    Im trying to read data from the DS1923 Ibutton throgh the DS9490 USB adapter, and i think is not reading anything beacause all i get is 0xFF.. heres the code, can someone tell me what is wrong in the syntaxis?

    outBuffer = new byte[size];
                    adaptador.Reset();
                    GeneralDelay(100);
                   
                    bool get = adaptador.SelectDevice(DalSemi.OneWire.Utils.Convert.ToByteArray(device)); // Match ROM
                    byte[] dataPacket = new byte[11+size];
                    byte[] pass = DS1923_SendPass(missionParam.ReadAccess_Pass);
                    dataPacket[0] = DS1923_cmdReadmemory; //Comand
                    dataPacket[1] = (byte)addressStart;  //Address from wich I want to Read
                    dataPacket[2] = (byte)(addressStart >> 8);
                    for (int i = 0; i < pass.Length; i++) // filling with the password
                        dataPacket[i + 3] = (byte)pass[i];

                   for (int i = 0; i < size; i++)
                        dataPacket[i + 11] = (byte)0xff; //bytes where from the read command  will be written

                    for( int i = 0; i<3;i++)
                        adaptador.DataBlock(dataPacket, 0, 11+size);

                    for (int i = 0; i < size; i++)
                    {
                        outBuffer[i] = dataPacket[i+11];
                        MessageBox.Show(outBuffer[i] + "");
                    }
                     adaptador.Reset();
                }

     
    • PerMal

      PerMal - 2008-02-10

      Hello,

      Sorry for the late reply. Check that you are following the correct command sequence, you can find it in the Datasheet for the device.

       

Log in to post a comment.