FM6124 Ramtron Corporation, FM6124 Datasheet - Page 42

no-image

FM6124

Manufacturer Part Number
FM6124
Description
Event Data Recorder With F-ram
Manufacturer
Ramtron Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
FM6124
Manufacturer:
FM/富满电子
Quantity:
20 000
Part Number:
FM6124-QG
Manufacturer:
ABOV
Quantity:
3 000
}
////////////////////////////////////////////////////////////////////////////////
// Function:
// Description:
// Parameters:
//
// Return value:
// Remarks:
////////////////////////////////////////////////////////////////////////////////
rbool
FM6124WriteReg(ruint8 a_uiRegAddr, ruint8 a_uiRegValue)
{
}
Rev. 4.0 (EOL)
July 2010
// READ OPERATION
// Dummy Read to clear the I2CRXAVF
l_uiValue = I2CRXTX;
// Make sure we will ACK the Data we will receive
I2CCONFIG &= 0xFD;
// Now, send the Read command to the FM6124
I2CRXTX = I2C_ID_EDR | g_uiI2CDevSelect | IC2_READ;
// Wait for Data to comeback
while(!(I2CSTATUS & 0x02));
l_uiValue = I2CRXTX;
// Stop the transaction
I2CCONFIG |= 0x02;
// Wait for I2C to be Idle and generate a STOP
while(!(I2CSTATUS & 0x08));
return l_uiValue;
// Make sure I2C is Idle
while(!(I2CSTATUS & 0x08));
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Send Write command
I2CRXTX = I2C_ID_EDR | g_uiI2CDevSelect | IC2_WRITE;
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Send Write Address
I2CRXTX = a_uiRegAddr;
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Send Write Data
I2CRXTX = a_uiRegValue;
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Wait for I2C to be Idle, this will generate a STOP
while(!(I2CSTATUS & 0x08));
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
return RTRUE;
return RFALSE;
return RFALSE;
return RFALSE;
return RFALSE;
FM6124WriteReg
Write a Register of the FM6124
ruint8 a_uiRegAddr
ruint8 a_uiRegValue
rbool: RTRUE = Operation Ok.
None
Page 42 of 53

Related parts for FM6124