FM6124 Ramtron Corporation, FM6124 Datasheet - Page 39

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:
//
//
//
////////////////////////////////////////////////////////////////////////////////
int
main()
{
Rev. 4.0 (EOL)
July 2010
__idata ruint8
__idata ruint16
__xdata struct SBCDDate l_oRTCValue;
__xdata struct SEvent
__xdata ruint8*
/////////////
// INIT Phase
// Initialize I2C interface, making sure FM6124 is responding.
InitI2C();
// Reset RTC to a defined value
l_oRTCValue.uiSeconds
l_oRTCValue.uiMinutes
l_oRTCValue.uiHours
l_oRTCValue.uiDay
l_oRTCValue.uiDate
l_oRTCValue.uiMonth
l_oRTCValue.uiYear
FM6124WriteRTC(&l_oRTCValue);
// Configure Event Buffer to 1000 Events
FM6124WriteReg(EDR_REG_BUFFER_CTRL, EDR_BC_CMD_EB_SIZE | EDR_BC_VAR_3000_EVENTS);
Delay(1);
FM6124WriteReg(EDR_REG_BUFFER_CTRL, EDR_BC_CMD_EB_SIZE | EDR_BC_VAR_1000_EVENTS);
// Make sure FM6124 has enough time to setup the new Event Buffer (100us required)
Delay(1);
///////////////////
// F-RAM Write/Read
// Write a Byte into the F-RAM at address 0x0000
FM6124WriteFRAM(0x0000, 0xBD);
// Read a Byte of Data in the F-RAM at address 0x0000
l_uiDataByte = FM6124ReadFRAM(0x0000);
////////////////
// Create Events
// Enable Event Recording of Digital Input 4-11 (Rising Edges)
FM6124WriteReg(EDR_REG_PIN_RF_B, 0xFF);
FM6124WriteReg(EDR_REG_PIN_EE_B, 0xFF);
// Make sure FM6124 has enough time to enable Event Recording (100us required)
Delay(1);
// Disable Event Recording
FM6124WriteReg(EDR_REG_PIN_EE_B, 0x00);
//////////////
// Read Events
// Read Number of Events (Number of Events between RP and WP)
FM6124WriteReg(EDR_REG_PIN_SNAP, 0x02);
l_uiNbEvents = FM6124ReadReg(EDR_REG_EVENT_COUNT_MSB);
l_uiNbEvents <<= 8;
l_uiNbEvents |= FM6124ReadReg(EDR_REG_EVENT_COUNT_LSB);
// Read newest event:
// 1- Move RP to the last event
FM6124WriteReg(EDR_REG_BUFFER_CTRL, EDR_BC_CMD_LAST);
// 2- Read Event
FM6124ReadEventAtRP(&l_oEvent);
main
main function of the program
None
int: Error Code
For the purpose of this example, the return values
of functions are not verified. In a real application,
return values should be verified in order to make sure that
any all operations have completed successfully.
l_uiDataByte
l_uiNbEvents
l_oEvent;
l_puiEvents
= 0x00;
= 0x01;
= 0x02;
= 0x03;
= 0x10;
= 0x09;
= 0x07;
= 0x00;
= 0x0000;
= NULL;
Page 39 of 53

Related parts for FM6124