FM6124 Ramtron Corporation, FM6124 Datasheet - Page 46

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
FM6124ReadEventAtRP(struct SEvent *a_poEvent)
{
}
Rev. 4.0 (EOL)
July 2010
// First, we need to indicate the FM6124 that we want to read an Event
FM6124WriteReg(EDR_REG_BUFFER_CTRL, EDR_BC_CMD_GET);
// Make sure I2C is Idle
while(!(I2CSTATUS & 0x08));
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Dummy Read, to clear the I2CRxAv flag.
a_poEvent->uiEventCode = I2CRXTX;
// "Fake" write operation to send the register address we want to read
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 Read Address
I2CRXTX = EDR_REG_EVT_CODE;
// Wait for I2C to be Idle and generate a STOP
while(!(I2CSTATUS & 0x08));
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// READ EVENT
// Dummy Read to clear the I2CRXAVF
a_poEvent->uiEventCode = I2CRXTX;
// Make sure we will ACK the Data we will receive
I2CCONFIG &= 0xFD;
// Now, send the Read command to the Slave ER
I2CRXTX = I2C_ID_EDR | g_uiI2CDevSelect | IC2_READ;
while(!(I2CSTATUS & 0x02));
a_poEvent->uiEventCode
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiSeconds
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiMinutes
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiHours
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiDay
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiDate
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiMonth
while(!(I2CSTATUS & 0x02));
a_poEvent->oBCDDate.uiYear
// Stop the transaction
I2CCONFIG |= 0x02;
// Wait for I2C to be Idle and generate a STOP
while(!(I2CSTATUS & 0x08));
return RTRUE;
return RFALSE;
return RFALSE;
FM6124ReadEventAtRP
Read Event pointed by the current position of RP (Read Pointer)
struct SEvent *a_poEvent: Pointer to a SEvent, which
will receive the Event's values.
rbool: RTRUE = Read Ok.
None
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
= I2CRXTX;
Page 46 of 53

Related parts for FM6124