WuMRC/drive

Can't read multiple byte data by block read function in arduino

Opened this issue · 0 comments

According to the user manual, the AD5933 chip provides "block read" function for reading a block of data. However, directly using this function seems no use in arduino. In AD5933 Files--Deprecated AD5933 Files--AD5933_Single_Temp, it provides a single test towards AD5933. In part 5:
//[5]-- Read the stored temperature data.
Serial.println("Checking temperature data registers...");//Send status message to the serial monitor.
Wire.beginTransmission(0x0D); //Open communications to to AD5933.
Wire.write(B10110000); //Send the "pointer" commmand.
Wire.write(0x92); //Send the address for the pointer (first temperature data register).
Wire.endTransmission(); //Close communications.
Wire.requestFrom(0x0D, 2); //Request the data byte stored in the register the pointer is at.
register_0x92 = Wire.read(); //Store the first byte in a variable.
register_0x93 = Wire.read(); //Store the second byte in a variable.
Serial.print("Temperature register 0x92 set to: "); //Display the data via the serial monitor.
Serial.println(register_0x92, BIN);
Serial.print("Temperature register 0x93 set to: "); //Display the data via the serial monitor.
Serial.println(register_0x93, BIN);
//--[3]
The code directly asked for 2 bytes data from AD5933: Wire.requestFrom(0x0D, 2); Then use the variable register_0x92/register_0x93 to store the data. I found that only the result in register_0x92 was correct, the register_0x93 maintained same (usually 0xCE at around 22℃) instead of change with real temperature.

I think the Wire library in arduino only allows us to read single byte every time.