This code example reads metadata about the selected MCU from the library. The condition for this example to work properly is that F_OpenInstancesAndFPAs, and F_Initialization has correctly initialized the given fpa index (1 to 64). If testing adapter 1, the user should call F_Set_FPA_index(1) before this code executes. In addition the user should load the intended configuration file so that the metadata read by this code will pertain to the selected MCU.
#define MCU_DATA_SIZE 20 typedef struct { char name[DEVICE_NAME_SIZE+1]; union { long data[MCU_DATA_SIZE]; struct { long FamilyIndex; long GroupIndex; long NameIndex; long GroupID; long FlashStartAddr; long FlashEndAddr; long OTPStartAddr; long OTPEndAddr; long RAMStartAddr; long RAMEndAddr; long VendorIndex; long EEPROMStartAddr; long EEPROMEndAddr; long CommInterface; long ExtFlashStartAddr; long ExtFlashEndAddr; }x; }u; }_MCU_INFO; _MCU_INFO MCU_Info; void Get_MCU_Info( void ) { int k; // get device info for( k=0; k<DEVICE_NAME_SIZE; k++) { //---------------------------------------------------- MCU_Info.name[k] = (char)F_Get_Device_Info( k ); //---------------------------------------------------- } MCU_Info.name[k] = '\0'; for( k=0; k<MCU_DATA_SIZE; k++) {//when going beyond valid indices, the function will return -1 //---------------------------------------------------- MCU_Info.u.data[k] = F_Get_Device_Info( DEVICE_NAME_SIZE + k ); //---------------------------------------------------- } }