CYCLONE-User-Manual.pdf - 第72页
User Manual For Cyclone LC Programmers 72 function will be called once for each Cyclone. 8.2.3.4 Finalization Before closing the application, it is recommended that the session with the PEmicro hardware be terminated and…

User Manual For Cyclone LC Programmers 71
MSVC# 2017 Projects
INSTALLDIR\cycloneControl\controlsdk\examples\msvcsharp\visual_sap_control\cyclone_control
_api.cs
NI LabVIEW 2018 Projects
INSTALLDIR\cyclone\cycloneControl\controlsdk\examples\labview2018\user.lib\CycloneControlS
DK\CycloneControlSDK.lvlib
INSTALLDIR\cyclone\cycloneControl\controlsdk\examples\labview2018\user.lib\CycloneControlS
DK\VIs\*.vi
The pre-built VIs that we provide include modifications for error handling using error clusters.
Please visit our blog post “Automated Flash Programming with LabVIEW” for more information on
how to develop your own LabVIEW project.
8.2.3.3 Initialization
ULoading the DLL (C/C++ Projects only)
Before calling any routines from the DLL, the DLL must be loaded into memory. To do this, the
following function has been provided in the included header files. Refer to Chapter 4 of this manual
for a detailed description of this function.
loadLibrary( );
For Delphi (Pascal) and C# users, this process is transparent for the user and no action is
required.
UEnumerate all ports
After loading the DLL, a call to the following function is required in order to properly initialize all
devices. This function should only be called once, typically at the beginning of the application.
enumerateAllPorts( );
UConnect to the PEmicro hardware interface
The next step is to establish communications with the PEmicro Cyclone unit. This is accomplished
with the following function call:
connectToCyclone( );
Refer to Chapter 4 of this manual for a detailed description of this function. This call returns the
handle to the Cyclone unit which is used in all other routines in the DLL to identify the Cyclone.
Note that the special case of a return value of 0 indicates an error contacting the Cyclone. This

User Manual For Cyclone LC Programmers 72
function will be called once for each Cyclone.
8.2.3.4 Finalization
Before closing the application, it is recommended that the session with the PEmicro hardware be
terminated and the DLL unloaded from memory.
These calls should always be made before the application closes:
disconnectFromAllCyclones( );
unloadLibrary();
Note that the “unloadLibrary” call is only required for C/C++ applications. For the Delphi and C#
example projects, the DLL is automatically unloaded when the application closes.
8.2.3.5 Initial Cyclone Setup
The Cyclone Image Creation Utility software, which is included with each Cyclone, is used to
create the standalone images that will be stored in the non-volatile memory of the Cyclone. These
images contain the FLASH / EEPROM programming algorithms, the actual binary data to be
programmed, the sequence of programming operations, and user specified Cyclone settings.
Prior to using the Cyclone Control Suite, these standalone images need to be created. Please
refer to the user’s manual of your Cyclone unit for more information on standalone images and
image creation.
8.2.3.6 Typical Usage
Figure 8-1: Typical programming procedure flow chart
Figure 8-1 describes the most common sequence of calls to the DLL after successfully connecting
to the Cyclone unit.
a. Initiate programming operations. “startImageExecution” carries out the programming
operations defined in the stand-alone image stored on the Cyclone unit.
b. Wait for programming completion. Note that no error checking is provided by the

User Manual For Cyclone LC Programmers 73
“checkCycloneExecutionStatus” call. A result of 0 will be returned even if an error has
occurred or if communication with the Cyclone is lost.
c. Retrieve the error code from the Cyclone unit to determine if the programming was
successful.
8.2.3.7 External Memory Storage Support
Some Cyclones support external memory storage. The Cyclone Control SDK and Cyclone Control
Console both support images residing on external memory cards. The parameter
“selectedMediaType” is used to select between Cyclone internal Flash and external memory.
Image numbers will go in ascending order starting with image number 1. Internal images will be
counted first and external image numbers will start after the last internal image number. Image
number 1 will refer to the first image in the internal memory if there are any images in the Cyclone
internal memory, if there are no internal images, image 1 will refer to the first image in the external
memory.
Modifying images residing in external memory will only be available on Cyclones with the proper
license. Certain Cyclones may require a supplementary license to support external memory.
8.2.4 Application Programming Interface (API)
This chapter describes the API of the “CycloneControlSDK.dll” in detail. A C/C++ function
prototype is given here. Header files are provided for the following languages:
Pascal
C/C++
8.2.4.1 Constants
8.2.4.2 DLL Loading / Unloading Calls
8.2.4.2.1 loadLibrary
bool loadLibrary(char *filepath);
This function loads the CycloneControlSDK.dll into memory and gives the user access to all of the
Name 32-bit Value
CyclonePortType_USB 5
CyclonePortType_Ethernet 6
CyclonePortType_Serial 7
CycloneInformation_IP_Address 1
CycloneInformation_Name 2
CycloneInformation_Generic_Port_Number 3
CycloneInformation_Cyclone_Type_String 4
MEDIA_INTERNAL 1
MEDIA_EXTERNAL 2