Other Parts Discussed in Thread: FDC1004
Hello, I am learning about I2C "fdc1004q" communication in Arduino. This datasheet suggest Device Usage :
1. Configure measurements (for details, refer to Measurement Configuration).
2. Trigger a measurement set (for details, refer to Triggering Measurements).
3. Wait for measurement completion (for details, refer to Wait for Measurement Completion).
4. Read measurement data (for details, refer to Read of Measurement Result).
So, I think the program in Arduino like that as below.
#include <Wire.h>
#define FDC1004 (0xA0)
#define MSB_Register (0x00)
#define LSB_Register (0x01)
byte values [4];
char output [512];
long MSB;
long LSB;
void setup() {
Wire.begin ();
Serial.begin(9600);
//MEASUREMENT CONFIGURATION
Wire.beginTransmission(FDC1004);
Wire.begin (0x08); //CONF_MEAS1 Register
Wire.write(0x1C00);//Reset
Wire.endTransmission();
Wire.beginTransmission(FDC1004);
Wire.write(0x08);
Wire.write(0x1000); // CHA; CAPDAC Offset Minimum
Wire.endTransmission();
//TRIGGERING MEASUREMENT
Wire.beginTransmission(FDC1004);
Wire.write(0x0C);//FDC Registers Description
Wire.write(0x0000);//Reset
Wire.endTransmission();
Wire.beginTransmission(FDC1004);
Wire.write(0x0C);
Wire.write(0x0580);//Rate 100S/s; Meas_1;
Wire.endTransmission();
//Wait for Measurement Completion
delay (500);
//Menulis MSB dan LSB
Wire.beginTransmission(FDC1004);
Wire.write(MSB_Register);
Wire.endTransmission();
Wire.beginTransmission(FDC1004);
Wire.write(LSB_Register);
Wire.endTransmission();
}
void loop() {
Wire.beginTransmission(FDC1004);
Wire.write (MSB_Register);
Wire.endTransmission();
Wire.write (LSB_Register);
Wire.endTransmission();
Wire.beginTransmission(FDC1004);
Wire.write(0xA1);
Wire.endTransmission();
Wire.requestFrom(FDC1004, 2);
Wire.endTransmission();
if (Wire.available()<=2){
MSB= Wire.read();
LSB= Wire.read();
}
Serial.print("MSB= ");
Serial.println(MSB,BIN);
Serial.print("LSB= ");
Serial.println(LSB,BIN);
delay (100);
}
But the output of MSB and LSB are 11111111.... (24 bits). I want to know that the program is correct or not. And I want more detail steps using example like that my program.