CYCLONE-User-Manual.pdf - 第70页

User Manual For Cyclone LC Programmers 70 The sample applications come with build scripts defined for ease of use. Simply run the scripts and you should be able to build the sample application without any modifications. …

100%1 / 149
User Manual For Cyclone LC Programmers 69
Read Image and target Properties and Status
The GUI application provides the following Advanced features for all Cyclones:
Add/Remove/Update many images in the Cyclone
Remote Display Access and the ability to “touch” the screen
These features require an Advanced license only when using the SDK or Console (see below).
The SDK and Console application provide the following Advanced features for all Cyclone FX units
and any Cyclone upgraded with a resident Cyclone Control Advanced Automation License:
Add/Remove/Update many images in the Cyclone
Simultaneously (Gang) Control multiple Cyclones via the USB, Serial, or Ethernet
connections
Program (and Read) Dynamic Data in addition to fixed image data
Remote Display Access
8.1.3 PEmicro Compatible Hardware
The following lists the PEmicro hardware that is compatible with the Cyclone Control Suite. To
ensure proper operations, PEmicro recommends upgrading all Cyclone units to the latest
firmware.
Cyclone FX Universa
Cyclone LC Universal
Cyclone FX ARM
Cyclone LC ARM
Cyclone PRO (Standard features only)
Cyclone MAX (Standard features only)
Cyclone for ARM (Standard features only)
Cyclone for Renesas (Standard features only)
Cyclone for STMicro (Standard features only)
8.2 Cyclone Control SDK
The Cyclone Control SDK allows the user to interact with the Cyclone via a .DLL.
8.2.1 Introduction
The Cyclone Control SDK is one of the three components that comprise the Cyclone Control Suite.
Its dynamic link library (.DLL) allows you to create an application on the PC that can directly control
one or more PEmicro Cyclone units. These interface routines are designed to be compiled into
visual and non visual applications running on Windows operating systems
The actual interface routines are located in the “CycloneControlSDK.dll” 32 bit DLL file. The DLL
is callable from almost any 32-bit / 64-bit Windows development environment. Since the way the
DLL is called varies depending on the compiler used, you are provided with the DLL interface code
and sample applications for each of the following compilers. Compilers in bold link to a PEmicro
blog post about using that environment with the SDK:
Borland Delphi 2.0+ (Pascal)
GCC
Microsoft Visual C
Microsoft Visual C#
NI LabVIEW 2018
User Manual For Cyclone LC Programmers 70
The sample applications come with build scripts defined for ease of use. Simply run the scripts and
you should be able to build the sample application without any modifications. The callable interface
routines are defined in:
INSTALLDIR\cycloneControl\controlsdk\examples\pascal\cyclone_control_api.pas
INSTALLDIR\cycloneControl\controlsdk\examples\c\cyclone_control_api.h
8.2.2 Backwards Compatibility With Classic Cyclone Control API
The “CycloneControlSDK.dll” is backwards compatible with many of the classic Cyclone Control
API calls. In each header file, there is a constant variable or define (typically DLL_filename) which
is declared as the file name of the DLL. The value of this variable should be changed to new
filename “CycloneControlSDK.dll” instead of the old "CYCLONE_CONTROL.dll". After this
modification, rebuild the project and it should continue working with the new DLL.
8.2.3 Getting Started with the Cyclone Control DLL
This section outlines the steps you need to take to begin developing your own custom application
and offers tips and suggestions to get the Cyclone Control DLL working with your PEmicro
hardware smoothly.
BLOG TIP: Please click here to visit the PEmicro blog for a detailed example of how to set up a
programming image and use the SDK with some advanced options.
8.2.3.1 Example Programs
Located in the installation directory of the package, you will find two example programs that you
can use as a reference for your own application. The examples are located in the following
directories:
INSTALLDIR\cycloneControl\controlsdk\examples\pascal\
INSTALLDIR\cycloneControl\controlsdk\examples\c\
INSTALLDIR\cycloneControl\controlsdk\examples\labview2018
INSTALLDIR\cycloneControl\controlsdk\examples\msvc
INSTALLDIR\cycloneControl\controlsdk\examples\msvcsharp
These example programs are a valuable reference to use when starting your own custom
application.
8.2.3.2 Starting your own project
To gain access to the functions available in the DLL, the following files need to be added to the
new project workspace:
UDelphi 2.0+ Projects
INSTALLDIR\cycloneControl\controlsdk\examples\pascal\cyclone_control_api.pas
All other source files which will call functions from the DLL should include the above file using the
Delphi “uses” command.
UMSVC 5.0+ Projects
INSTALLDIR\cycloneControl\controlsdk\examples\c\cyclone_control_api.h
INSTALLDIR\cycloneControl\controlsdk\examples\c\cyclone_control_api.c
All other source files which will call functions from the DLL should include the above header file
with the C/C++ #include directive.
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