Example Scripts
The Samples folder (C:\Program Files (x86)\Atomic Programming\Infinity II APEL\Samples) contains example scripts that demonstrate how to use some of the features within APEL and to help you with your own scripts.
Using Parameters
Script : logtest.apel
Parameters can be passed to console to all APEL applications as command line parameters and these exist as string array called param
For example:
APEL params.apel c:\temp\temp.bin
This gives the follows output
For the ActiveX object two functions exist. Use ClearCommandLineVariables() to remove existing parameters and use AddCommandLineVariable(<StringValue>) to add parameters before calling Start().
In APEL Studio the command line parameters can be simulated in the options Window. See below
Controlling Buses
Script : bustest.apel
Buses are controlled using Pinstrings. These are string which contain H, L, Z, 0 and 1. Each character of the string refers to a pin on the bus
Examples of using the following functions:
- HEXS - Converts a Pinstring value into a HEX value
- HEXV - Converts an integer value into a HEX value
- STRH - Converts a HEX string into a Pinstring
- STRV - Converts a integer value into a Pinstring
- VALD - Converts a string into an integer
- VALH - Converts a hex string into an integer
- VALS - Converts a Pinstring into an integer
String Functions
Script : stringtest.apel
Examples of using the following functions:
- LENGTH - Length of a string
- UPPER - Convert string to uppercase
- LOWER - Convert string to lowercase
- SPLIT - splits a string into a string array
- SUBST - returns part of a string
- ASC - Returns the ANSI character code corresponding to the first letter in a string
- DECV - Returns a string that has been converted from an integer
- DATE - Returns a string indicating the current system date.
- TIME - Return the current time
Demonstration of the available string operators
Integer Functions
Script : integertest.apel
Examples of using the following functions:
- AND - Performs a bitwise AND between two values or variables.
- XOR - Performs a bitwise XOR between two values or variables.
- OR - Performs a bitwise OR between two values or variables.
- NOT - Performs bitwise inversion on an expression.
- RND - Returns a random number.
- CHR - Returns the character associated with the specified ANSI character code.
Demonstration of the available integer operators and operator precedence
Log Files
Script : logtest.apel
The LogTest.apel script demonstrates the following.
- Accessing a standard include (file that is stored in C:\Program Files (x86)\Atomic Programming\Infinity II APEL\Include called LogFile.apel which deals with log files
- Reading, writing and clearing log files
- Accessing local functions
The output from APEL console is shown below
Boundary Scan Testing
Script : ScanTest.apel
This script uses JTAG SAMPLE mode. This mode is the standard operating mode of the device where all pins operate as normal. All of the pins are continuously sampled and tests that one of the LEDS is toggling High as Low. Once a High and Low has been sampled then the script will complete.
Script : CheckSignals.apel
This script uses JTAG EXTEST mode. This mode allows the JTAG to control the IO cells on the devices in the JTAG chain mode. Port A on the ATmega164P is connected to 8 pins on an Altera EPM3032. All 8 pins on port A are individually toggled high and low and the equivalent port on the EPM3032 is tested to ensure that the pins states match. The test is then repeated by changing the direction of the pins and the pins on the EPM3032 are toggled. This methodology allows custom test scripts to be created that optimise test time and test coverage.