Omron D6F-PH User Manual page 30

Mems differential pressure sensor
Table of Contents

Advertisement

i++;
}
I2C1_Stop();
adc_wait(5); /* 5msec wait */
I2C1_Start();
I2C1_MastrSel(add, 0);
I2C1_senddata(dbuf[n-1]);
I2C1_Start();
I2C1_MastrSel(add, 1);
I2C1_AckEn();
rd_fifo[0] = I2C1_rcvdata(); /* Read Data */
I2C1_AckDis();
I2C1_Stop();
rd_fifo[1] = I2C1_rcvdata(); /* Read Data */
RD_FIFO = ((rd_fifo[0] << 8) | rd_fifo[1]);
return RD_FIFO;
}
/*=================================================*/
/* I2C Read command
/* Usage
: I2C_RD_u16()
/* Argument
: char add (7bit Slave Address)
/*
char *dbuf (Write data)
/*
unsigned char n (Number of bytes)*/
/* Return value : 16bit Read result
/*=================================================*/
unsigned short I2C_RD_u16 (unsigned char add, char *dbuf, unsigned char n) {
int i= 0;
char n_w;
uint8_t rd_fifo[2] = {0, 0};
n_w = n - 1;
/* I2C Pre-WR Access */
I2C1_Start();
I2C1_MastrSel(add, 0);
while (n_w--) {
I2C1_senddata(dbuf[i]);
i++;
}
I2C1_Stop();
adc_wait(5); /* 5msec wait */
I2C1_Start();
I2C1_MastrSel(add, 0);
I2C1_senddata(dbuf[n-1]);
29
/* Stop condition */
/* Start condition */
/* Slave Address 7bit => 8bit */
/* Word Address
/* Re-Start condition */
/* Slave 7bit => 8bit for RD */
/* ack enable send after MSB 1 byte read */
/* ack diable send after LSB 1 byte read */
/* Stop condition send */
/* Start condition */
/* Slave Address 7bit => 8bit */
/* Send Data
/* Stop condition */
/* Start condition */
/* Slave Address 7bit => 8bit */
/* Word Address
D6F-PH MEMS Differential pressure Sensor User's Manual (A288)
*/
*/
*/
*/
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents