44 RabbitCore RCM3365/RCM33755.2 Dynamic C Functions5.2.1 Digital I/OThe RCM3365/RCM3375 was designed to interface with other systems, and so there areno drivers written specifically for the I/O. The general Dynamic C read and write func-tions allow you to customize the parallel I/O to meet your specific needs. For example, useWrPortI(PEDDR, &PEDDRShadow, 0x00);to set all the Port E bits as inputs, or useWrPortI(PEDDR, &PEDDRShadow, 0xFF);to set all the Port E bits as outputs.When using the external I/O bus on the Rabbit 3000 chip, add the line#define PORTA_AUX_IO // required to enable external I/O busto the beginning of any programs using the external I/O bus.The sample programs in the Dynamic C SAMPLES/RCM3360 folder provide furtherexamples.5.2.2 SRAM UseThe RCM3365/RCM3375 have a battery-backed data SRAM and a program-executionSRAM. Dynamic C provides the protected keyword to identify variables that are to beplaced into the battery-backed SRAM. The compiler generates code that maintains twocopies of each protected variable in the battery-backed SRAM. The compiler also generatesa flag to indicate which copy of the protected variable is valid at the current time. This flagis also stored in the battery-backed SRAM. When a protected variable is updated, the“inactive” copy is modified, and is made “active” only when the update is 100% complete.This assures the integrity of the data in case a reset or a power failure occurs during theupdate process. At power-on the application program uses the active copy of the variablepointed to by its associated flag.The sample code below shows how a protected variable is defined and how its value canbe restored.protected nf_device nandFlash;int main() {..._sysIsSoftReset(); // restore any protected variablesThe bbram keyword may also be used instead if there is a need to store a variable in bat-tery-backed SRAM without affecting the performance of the application program. Dataintegrity is not assured when a reset or power failure occurs during the update process.Additional information on bbram and protected variables is available in the Dynamic CUser’s Manual.