3. Example with API DLL
3.1 Example with single FPA
The code example described below uses one programming adapter. The Multi-FPA API-DLL
selector should be select for FPA-1 only. The fpa_index should be set to 1 or should be unmodified.
The default value of the fpa_index when one adapter is detected only is 1.
Initialization opening procedure for the USB-FPA can be as follows:
response = F_OpenInstancesAndFPAs( “*# *” );
// DLL and FPA (one only) initialization
if( response == 0 )
{
//The FPA has not been found. Exit from the program.
}
F_Set_FPA_index( 1 ); // select FPA 1 for
F_Initialization( ); // init FPA
Below is an example of the simplified (without error handling procedures) application
program written in C++ that allows to initialize one FPA, and run an autoprogram with the same
features like an autoprogram in the standard FlashPro430 (GUI) software.
1. Download data to target device
F_OpenInstancesAndFPAs( “*# *” ); // DLL and FPA (one only) initialization
if( response == 0 )
{
//The FPA has not been found. Exit from the program.
}
F_Set_FPA_index( 1 ); // select FPA 1 only
F_Initialization( ); // init FPA
//– functions above initialized at the startup only ----
F_ReadConfigFile( filename ); // read configuration data and save
// to API-DLLs
F_ReadCodeFile( format, filename ); // read code data and save to DLL
do
{
status = F_AutoProgram( 1 ); //start autoprogram
if ( status != TRUE )
{
..............................
}
else
29