# ATEasy Driver Authoring Reference Guide **Version:** 1.0 **ATEasy Version:** 14.0 **Based on:** Keysight N6900/N7900 Series APS Driver (KeysightN6900N7900.drt) **Reference Files:** KeysightN6900N7900.drt, .syt, .pgt, .pjt --- ## Table of Contents 1. [Project Structure Overview](#1-project-structure-overview) 2. [Driver File (.drt) — Complete Structure](#2-driver-file-drt--complete-structure) 3. [Summary Block Rules](#3-summary-block-rules) 4. [Interface Blocks](#4-interface-blocks) 5. [Types Section — Enums](#5-types-section--enums) 6. [Commands Section](#6-commands-section) 7. [Events Section](#7-events-section) 8. [Procedures Section](#8-procedures-section) 9. [IOTables Section](#9-iotables-section) 10. [Procedure Naming Convention](#10-procedure-naming-convention) 11. [System File (.syt)](#11-system-file-syt) 12. [Program File (.pgt)](#12-program-file-pgt) 13. [Project File (.pjt)](#13-project-file-pjt) 14. [Calling Driver Commands from a Test Program](#14-calling-driver-commands-from-a-test-program) 15. [SkipOnInit Pattern](#15-skiponinit-pattern) 16. [Design Rules Checklist](#16-design-rules-checklist) --- ## 1. Project Structure Overview A complete ATEasy driver project consists of four files that all share the same base name: | File | Extension | Purpose | |------|-----------|---------| | Project | `.pjt` | Ties all files together; defines start program and EXE info | | System | `.syt` | Registers drivers with interface settings; one per test station | | Program | `.pgt` | Contains tests and procedures that use the driver | | Driver | `.drt` | The instrument driver: commands, procedures, IO tables | All four files should reside in the same folder and reference each other with relative paths using `.\filename`. --- ## 2. Driver File (.drt) — Complete Structure A driver file has the following top-level sections in this exact order: ``` ATEasy 14.0 Driver ================================================================================ Summary ================================================================================ ... Interfaces ================================================================================ ... Libraries ================================================================================ Types ================================================================================ ... Forms ================================================================================ Commands ================================================================================ ... Events ================================================================================ ... Procedures ================================================================================ ... IOTables ================================================================================ ... Variables ================================================================================ END ``` Every section header must be present even if empty. The file must end with `END`. --- ## 3. Summary Block Rules ``` Summary ================================================================================ File = KeysightN6900N7900.drt DefaultName = PS Company = "Marvin Test Solutions, Inc." Programmers = "Claude Elwood Shannon" HelpFile = "" HelpTopic = "" ATEasyVersion = "14.0.165.0" AutoSaveVersion = False PromptVersionOnSave = False Versions = { Version1 = Create,user,Mon Apr 20 26 12:00:00 Version2 = LastSaved,ronniey,Wed Apr 22 26 13:45:40 } Manufacturer = Keysight Technologies Models = { "N6976A", "N7976A" } Parameters = {SkipOnInit, Number} Description = ! Models :N6976A, N7976A ! Manufacturer :Keysight Technologies ! Description :Brief description of the instrument ! Interface :GPIB/USB/LAN ! Manual :Manual title and part number ! ! Initialization ! ========================================================================================= ! 1. Select the Interface type from the Driver Shortcut Interface page. ! 2. Set the instrument address in the Interface page. ! 3. Set "SkipOnInit" to 1 to skip initialization on startup (default=0 = initialize). ! ! Changes ! ========================================================================================= ! April 22, 2026 ! > Initial release. ``` **Key rules:** - `DefaultName` — short abbreviation used to call the driver from test programs. Use `PS` for power supplies, `DMM` for multimeters, `SG` for signal generators, etc. - `Programmers` — name of the author - `Models` — list all supported model numbers, one per line, quoted, comma-separated - `Parameters = {SkipOnInit, Number}` — include this for all drivers to support the SkipOnInit pattern - `Description` — use `!` comment lines to document models, interfaces, manual reference, initialization instructions, and change history --- ## 4. Interface Blocks Always include **all interfaces** the instrument physically supports. Never include only GPIB if the instrument also supports USB and LAN. ### GPIB ``` Interface { Type = Gpib InputTerminator = "\n" OutputTerminator = "\n" Send Timeout = 1000 Receive Timeout = 5000 TrigTimeout = 5000 Delay = 250 ReceiveBufferSize = 512 InputEOI = True OutputEOI = True } ``` ### USB (USBTMC) ``` Interface { Type = Usb InputTerminator = "\n" OutputTerminator = "\n" Send Timeout = 1000 Receive Timeout = 1000 TrigTimeout = 1000 Delay = 250 ReceiveBufferSize = 256 USBTMC = True } ``` ### LAN / TCP-IP (WinSock) ``` Interface { Type = WinSock InputTerminator = "\r\n" OutputTerminator = "\r\n" Send Timeout = 1000 Receive Timeout = 1000 TrigTimeout = 1000 Delay = 250 ReceiveBufferSize = 256 Protocol = 1 Server = False ConnectTimeout = 1000 OpenOnAccess = False } ``` ### Serial (COM Port) ``` Interface { Type = Com InputTerminator = "\n" OutputTerminator = "\n" Send Timeout = 1000 Receive Timeout = 1000 TrigTimeout = 1000 Delay = 250 ReceiveBufferSize = 256 BaudRate = 9600 DataBits = 8 StopBits = 1 Handshake = Hardware Parity = None Infrared = False } ``` **Note:** WinSock uses `"\r\n"` terminators; all other interfaces use `"\n"`. --- ## 5. Types Section — Enums ### Rules 1. **Always declare enums `Public`** so they are accessible from outside the driver (test programs, other modules) 2. **No underscores** in enum type names or constant names 3. **Constant names must be derived from the enum type name** — concatenate the type name (minus "enum") with the constant meaning 4. **Every constant must have a `!` description comment** 5. **Use enum types as procedure parameter types** — not `Long` — wherever the parameter is an enum value ### Naming Pattern | Enum Type | Constant Prefix | Example Constants | |-----------|----------------|-------------------| | `enumOutputState` | `aOutputState` | `aOutputStateOff`, `aOutputStateOn` | | `enumFunction` | `aFunction` | `aFunctionVoltage`, `aFunctionCurrent` | | `enumTriggerSource` | `aTriggerSource` | `aTriggerSourceBus`, `aTriggerSourceExternal`, `aTriggerSourceImmediate` | | `enumTransientMode` | `aTransientMode` | `aTransientModeFixed`, `aTransientModeStep`, `aTransientModeList`, `aTransientModeArb` | | `enumProtectionMode` | `aProtectionMode` | `aProtectionModeCCTrip`, `aProtectionModeCVTrip`, `aProtectionModeOff` | | `enumDisplayView` | `aDisplayView` | `aDisplayViewVI`, `aDisplayViewVP`, `aDisplayViewVIP` | | `enumSenseWindow` | `aSenseWindow` | `aSenseWindowHanning`, `aSenseWindowRectangular` | ### Example ``` enumTriggerSource: Enum Public { aTriggerSourceBus: Long Const = 1 ! Trigger source is BUS (*TRG command). aTriggerSourceExternal: Long Const = 2 ! Trigger source is External (rear BNC input). aTriggerSourceImmediate: Long Const = 3 ! Trigger source is Immediate (free-running). } enumOutputState: Enum Public { aOutputStateOff: Long Const = 0 ! Output is disabled. aOutputStateOn: Long Const = 1 ! Output is enabled. } ``` --- ## 6. Commands Section The Commands section defines the **hierarchical command tree** that is exposed to the test program. It is the user-facing API of the driver. ### Structure Rules 1. **Top-level nodes** reflect the instrument's major subsystems: `Set`, `Get`, `Measure`, `Fetch`, `Initiate`, `Abort`, `Trigger`, `Reset`, `SelfTest`, `Initialize`, `State` 2. **`Measure` and `Fetch` are always top-level nodes** — never nest them under `Get` 3. **Nesting must mirror the instrument's SCPI subsystem hierarchy** — `Set Output Protection OVP` not `Set OVP` 4. **Procedure names must match the full command tree path** — `Set Output Protection OVP` → `SetOutputProtectionOVP()` 5. **Leaf commands that are On/Off use enum constants as arguments** — `SetOutputState(aOutputStateOn)` not `SetOutputState(1)` 6. **Every command and sub-node has a `!` description comment** 7. **No underscores** in command node names or procedure names ### Command Tree Syntax ``` Set ! Top-level node (no procedure) { Output ! Sub-node (no procedure) { Voltage: SetOutputVoltage() ! Leaf with parameter — calls procedure { Limit: SetOutputVoltageLimit() ! Child of leaf — also has sub-commands Slew { Level: SetOutputVoltageSlewLevel() State { On: SetOutputVoltageSlewState(aOutputStateOn) ! Leaf with enum arg Off: SetOutputVoltageSlewState(aOutputStateOff) } } } State { On: SetOutputState(aOutputStateOn) ! Enum constant passed directly Off: SetOutputState(aOutputStateOff) } } } ``` ### Standard Top-Level Command Nodes ``` Set { ... } ! All configuration commands Get { ... } ! All query commands Fetch { ... } ! Retrieve buffered measurements (no new trigger) Measure { ... } ! Trigger and return a new measurement Initiate { ... } ! Arm trigger systems Abort { ... } ! Cancel triggered operations Trigger: Trigger() ! Send BUS trigger (*TRG) SelfTest: SelfTest() ! Run instrument self-test Initialize: Initialize() ! Initialize/verify instrument Reset: Reset() ! Factory reset (*RST) { Error: ClearError() ! Clear error queue (*CLS) } State { Save: StateSave() Recall: StateRecall() } ``` --- ## 7. Events Section The `OnInit` event is the only event typically used. With the `SkipOnInit` pattern it simply delegates to the `Initialize()` procedure: ``` Events ================================================================================ Procedure OnInit(): Void Public ! Occurs when the driver is started. -------------------------------------------------------------------------------- { if Driver.Parameters("SkipOnInit")<>0 Initialize() endif } ``` **Note:** The condition `<>0` means "if SkipOnInit is NOT zero, run Initialize". This is intentional — set `SkipOnInit=1` in the driver shortcut to **enable** initialization. Default (blank or 0) skips it. --- ## 8. Procedures Section ### Design Rule: Procedures + SendString Only **All instrument commands must be implemented as Procedures using `SendString` and `ReceiveDouble`/`ReceiveLong`/`ReceiveString`.** Do not use IoTables for instrument commands. Procedures support breakpoints for debugging; IoTables do not. The only IoTables that should exist are the four utility helpers: `SendString`, `ReceiveDouble`, `ReceiveLong`, `ReceiveString`. ### Procedure Syntax ``` Procedure ProcedureName(param1, param2): Void ! Brief description. -------------------------------------------------------------------------------- param1: Val Double ! Val = input parameter (passed by value) param2: Var String ! Var = output parameter (passed by reference) localVar: Long ! Local variable (no Val/Var = local) { ! procedure body } ``` ### Parameter Qualifiers | Qualifier | Meaning | |-----------|---------| | `Val` | Input parameter — passed by value, caller's variable not modified | | `Var` | Output parameter — passed by reference, value returned to caller | | `[Val]` | Optional input parameter — can be omitted by caller | | *(none)* | Local variable — declared inside the procedure | ### Parameter Naming Prefix Convention Parameter names use a type prefix so the type is immediately visible at the call site. Output (`Var`) parameters add a `p` prefix before the type prefix to signal pass-by-reference. | Type | Val prefix | Var prefix | Examples | |------|-----------|-----------|---------| | Double | `d` | `pd` | `dVoltage`, `pdVoltage` | | Long | `l` | `pl` | `lCount`, `plCount` | | String | `s` | `ps` | `sMode`, `psMode` | | Bool | `b` | `pb` | `bState`, `pbState` | | Enum type | `en` | `pen` | `enOnOff`, `penSource` | | Double array | `ad` | `pad` | `adValues`, `padResults` | **The `en` / `pen` prefix is mandatory for all enum-typed parameters.** This immediately distinguishes an enum parameter from a generic Long at the call site, making the code self-documenting. ``` ! Correct — en prefix signals this is an enumTriggerSource value Procedure SetTriggerSourceTransient(enSource): Void enSource: Val enumTriggerSource ! Correct — pen prefix for Var (output) enum parameter Procedure GetTriggerSource(penSource): Void penSource: Var enumTriggerSource ! Wrong — n prefix does not communicate that an enum is expected Procedure SetTriggerSourceTransient(nSource): Void nSource: Val enumTriggerSource ``` ### Optional Parameters with Defaults ``` Procedure MeasureArrayFromBuffer(padResults, lSampleCount, lTriggerCount): Void -------------------------------------------------------------------------------- padResults: Var Double[] lSampleCount: [Val] Long = 0 ! Optional — defaults to 0 if not supplied lTriggerCount: [Val] Long = 0 ! Optional — defaults to 0 if not supplied { if lSampleCount Driver Set Trigger SampleCount(lSampleCount) endif ... } ``` ### Standard Procedure Patterns **Simple send (no response):** ``` Procedure SetOutputVoltage(dVoltage): Void ! Sets the output voltage level (V). -------------------------------------------------------------------------------- dVoltage: Val Double { SendString("VOLT "+Str(dVoltage)) } ``` **Send with validation:** ``` Procedure SetOutputCurrent(dCurrent): Void ! Sets the output current level (A). -------------------------------------------------------------------------------- dCurrent: Val Double { if dCurrent<0 or dCurrent>16.7 DisplayError(-2, "Current must be between 0 and 16.7 A.") endif SendString("CURR "+Str(dCurrent)) } ``` **On/Off with enum parameter:** ``` Procedure SetOutputState(nOnOff): Void ! Enables or disables the power supply output. -------------------------------------------------------------------------------- nOnOff: Val enumOutputState { if nOnOff=aOutputStateOn SendString("OUTP ON") else SendString("OUTP OFF") endif } ``` **Select/case with enum parameter:** ``` Procedure SetTriggerSourceTransient(enSource): Void ! Sets the transient trigger source. -------------------------------------------------------------------------------- enSource: Val enumTriggerSource { select enSource case aTriggerSourceBus SendString("TRIG:TRAN:SOUR BUS") case aTriggerSourceExternal SendString("TRIG:TRAN:SOUR EXT") case aTriggerSourceImmediate SendString("TRIG:TRAN:SOUR IMM") endselect } ``` **Query returning Double:** ``` Procedure GetOutputVoltage(pdVoltage): Void ! Returns the output voltage setting (V). -------------------------------------------------------------------------------- pdVoltage: Var Double { SendString("VOLT?") ReceiveDouble(pdVoltage) } ``` **Query returning Bool (from Long):** ``` Procedure GetOutputState(pbState): Void ! Returns True if the output is enabled. -------------------------------------------------------------------------------- pbState: Var Bool lVal: Long { SendString("OUTP?") ReceiveLong(lVal) if lVal=1 pbState=True else pbState=False endif } ``` **Query returning String:** ``` Procedure GetOutputFunction(psFunction): Void ! Returns output regulation function string. -------------------------------------------------------------------------------- psFunction: Var String { SendString("FUNC?") ReceiveString(psFunction) } ``` **No-parameter command:** ``` Procedure SetOutputProtectionClear(): Void ! Clears any latched protection fault. -------------------------------------------------------------------------------- { SendString("OUTP:PROT:CLE") } ``` **INFinity pattern (0 = INF):** ``` Procedure SetListCount(nCount): Void ! Sets the list repeat count. Use 0 for INFinity. -------------------------------------------------------------------------------- nCount: Val Long { if nCount=0 SendString("LIST:COUN INF") else SendString("LIST:COUN "+Str(nCount)) endif } ``` **Initialize procedure:** ``` Procedure Initialize(): Void ! Initializes the driver: verifies interface and instrument identity. -------------------------------------------------------------------------------- sID: String { if Driver.InterfaceType<>Driver.InterfaceType.aioGpib and Driver.InterfaceType<>Driver.InterfaceType.aioUsb and Driver.InterfaceType<>Driver.InterfaceType.aioWinSock DisplayError(-8, "Please configure this driver to use a GPIB, USB, or LAN interface.") endif Driver Get System Identification(sID) if Pos("MODEL_STRING", sID)<0 DisplayError(-9, "Unable to find instrument at address 0x"+Str(GetDriverAddress(), 16)) endif } ``` **DisplayError helper (always include):** ``` Procedure DisplayError(lErrorNumber, sErrorMsg): Void ! Displays an error message and halts. -------------------------------------------------------------------------------- lErrorNumber: Val Long sErrorMsg: Val String { error lErrorNumber, sErrorMsg } ``` --- ## 9. IOTables Section Only four IoTables are used. All instrument commands use Procedures instead. ``` IOTables ================================================================================ IoTable SendString(s): Void -------------------------------------------------------------------------------- IoOperation Output:String { Mode = ParameterToAscii Argument = "s" MaxSize = 0 } IoOperation Send { Timeout = 1000 } IoTable ReceiveDouble(pdValue): Void -------------------------------------------------------------------------------- IoOperation Receive { } IoOperation Input:Double { Mode = AsciiToParameter Argument = "pdValue" } IoTable ReceiveLong(plValue): Void -------------------------------------------------------------------------------- IoOperation Receive { } IoOperation Input:Long { Mode = AsciiToParameter Argument = "plValue" } IoTable ReceiveString(psValue): Void -------------------------------------------------------------------------------- IoOperation Receive { Timeout = 5000 Size = NoMoreThan 256 } IoOperation Input:String { Mode = AsciiToParameter Argument = "psValue" MaxSize = 0 } ``` --- ## 10. Procedure Naming Convention **The procedure name must spell out the full command tree path.** Every word in the path from the top-level node down to the leaf becomes part of the procedure name with no separators (no underscores, no spaces). ### Mapping Examples | Command Tree Path | Procedure Name | |-------------------|---------------| | `Set Output Voltage` | `SetOutputVoltage` | | `Set Output Voltage Limit` | `SetOutputVoltageLimit` | | `Set Output Voltage Slew Level` | `SetOutputVoltageSlewLevel` | | `Set Output Voltage Slew State` | `SetOutputVoltageSlewState` | | `Set Output Protection OVP` | `SetOutputProtectionOVP` | | `Set Output Protection OCP State` | `SetOutputProtectionOCPState` | | `Set Output Protection OCP Delay` | `SetOutputProtectionOCPDelay` | | `Set Output Protection Watchdog State` | `SetOutputProtectionWatchdogState` | | `Set Output Protection Watchdog Delay` | `SetOutputProtectionWatchdogDelay` | | `Set Output Protection UserDefined State` | `SetOutputProtectionUserDefinedState` | | `Set Output Relay Lock` | `SetOutputRelayLock` | | `Set Sense Current Range` | `SetSenseCurrentRange` | | `Set Sense Sweep NPLC` | `SetSenseSweepNPLC` | | `Set Trigger Source Transient` | `SetTriggerSourceTransient` | | `Get Output Protection OverVoltage` | `GetOutputProtectionOverVoltage` | | `Get Output Protection OverCurrent State` | `GetOutputProtectionOverCurrentState` | | `Get Sense Current Range Auto` | `GetSenseCurrentRangeAuto` | | `Get System Identification` | `GetSystemIdentification` | | `Measure Voltage DC` | `MeasureVoltageDC` | | `Measure Current RMS` | `MeasureCurrentRMS` | | `Fetch Voltage Max` | `FetchVoltageMax` | | `Fetch AmpHour` | `FetchAmpHour` | | `Fetch WattHour` | `FetchWattHour` | | `Initiate Acquire` | `InitiateAcquire` | | `Abort Transient` | `AbortTransient` | | `State Save` | `StateSave` | | `State Recall` | `StateRecall` | ### On/Off Leaf Commands When a leaf has `On` and `Off` children that call the same procedure with different enum args, the procedure name reflects the parent node path: ``` ! Command tree: Set Output State { On: SetOutputState(aOutputStateOn) Off: SetOutputState(aOutputStateOff) } ! Procedure: Procedure SetOutputState(nOnOff): Void nOnOff: Val enumOutputState ``` --- ## 11. System File (.syt) ``` ATEasy 14.0 System ================================================================================ Summary ================================================================================ File = KeysightN6900N7900.syt DefaultName = Company = "" Programmers = "" HelpFile = "" HelpTopic = "" ATEasyVersion = "14.0.165.0" AutoSaveVersion = False PromptVersionOnSave = False Versions = { Version1 = Create,user,Wed Apr 22 26 10:36:44 } Description = Keysight N6900N7900 Example ATEasy System File Libraries ================================================================================ Types ================================================================================ Forms ================================================================================ Drivers ================================================================================ Driver PS -------------------------------------------------------------------------------- Path = .\KeysightN6900N7900.drt Type = Gpib Address = 65792 Pri = 1 Sec = 0 OpenOnAccess = True Model = Commands ================================================================================ Events ================================================================================ Procedures ================================================================================ Variables ================================================================================ END ``` **Key rules:** - The `Driver` name (e.g. `PS`) must match the driver's `DefaultName` - `Path` uses a relative path `.\filename.drt` - `Type` must match one of the driver's declared interfaces: `Gpib`, `Usb`, `WinSock`, `Com` - `Address = 65792` is a typical GPIB address (board 0, instrument address 1). Computed as: `(BoardNumber << 16) | InstrumentAddress` - `Pri` = primary GPIB address (1–30); `Sec = 0` means no secondary address - `OpenOnAccess = True` — opens the interface connection on first use rather than at startup - `Model` = optionally the specific model string to select from the driver's Models list; leave blank to use default --- ## 12. Program File (.pgt) ``` ATEasy 14.0 Program ================================================================================ Summary ================================================================================ File = KeysightN6900N7900.pgt DefaultName = Company = "" Programmers = "" HelpFile = "" HelpTopic = "" ATEasyVersion = "14.0.165.0" AutoSaveVersion = False PromptVersionOnSave = False Versions = { Version1 = Create,user,Wed Apr 22 26 10:36:44 } Description = Keysight N6900N7900 Example ATEasy Program Libraries ================================================================================ Types ================================================================================ Forms ================================================================================ Tests ================================================================================ Task 1 : "Setup and Measure" -------------------------------------------------------------------------------- Id = Setup_And_Measure Test 1.1 : "Configure Output" -------------------------------------------------------------------------------- Id = Configure_Output Type = MinMax { ! Reset instrument and clear protection PS Reset() PS Set Output Protection Clear() PS Set Output State Off() ! Configure output levels and protection PS Set Output Voltage(5) PS Set Output Current(1) PS Set Output Protection OVP(6) ! Enable output PS Set Output State On() } Test 1.2 : "Measure DC Voltage" -------------------------------------------------------------------------------- Id = Measure_DC_Voltage Type = MinMax { PS Measure Voltage DC(TestResult) } Test 1.3 : "Measure DC Current" -------------------------------------------------------------------------------- Id = Measure_DC_Current Type = MinMax { PS Measure Current DC(TestResult) } Test 1.4 : "Measure DC Power" -------------------------------------------------------------------------------- Id = Measure_DC_Power Type = MinMax { PS Measure Power DC(TestResult) } Test 1.5 : "Disable Output" -------------------------------------------------------------------------------- Id = Disable_Output Type = MinMax { PS Set Output State Off() } Commands ================================================================================ Events ================================================================================ Procedures ================================================================================ Variables ================================================================================ END ``` **Key rules:** - All empty sections (Libraries, Types, Forms, Commands, Events, Procedures, Variables) must still be present - Tests are organized as `Task N : "Task Name"` containing numbered `Test N.N : "Test Name"` blocks - `Id` fields use underscores to replace spaces (the only place underscores are acceptable) - `Type = MinMax` is the standard test type for measurements - `TestResult` is the built-in ATEasy variable that receives the measurement value in MinMax tests - Test comments use `!` prefix --- ## 13. Project File (.pjt) ``` ATEasy 14.0 Project ================================================================================ Summary ================================================================================ File = KeysightN6900N7900.pjt DefaultName = Company = "" Programmers = "" HelpFile = "" HelpTopic = "" ATEasyVersion = "14.0.165.0" AutoSaveVersion = False PromptVersionOnSave = False Versions = { Version1 = Create,user,Wed Apr 22 26 10:36:44 } Description = StartProgram = Example ExeFile = OptimizeShortCircuitBooleanExpression = True CommandLine = Defines = ExeVersionInfo = { " ", " ", "ATEasy 2026 application", "1, 0, 0, 0", " ", "(c) 2026, Company Name.", "ATEasy", " ", "0", "ATEasy", "1, 0, 0, 0", "0" } System ================================================================================ Path = .\KeysightN6900N7900.syt Programs ================================================================================ Program Example -------------------------------------------------------------------------------- Path = .\KeysightN6900N7900.pgt END ``` **Key rules:** - `StartProgram` must match the `Program` name defined in the Programs section - `System Path` uses relative path to the `.syt` file - Each program is declared with `Program ` and a `Path` to its `.pgt` file - `ExeVersionInfo` contains 12 entries for Windows EXE metadata --- ## 14. Calling Driver Commands from a Test Program Commands are called in the program using the pattern: ``` DriverDefaultName CommandTreePath(arguments) ``` The command tree path words are **space-separated** and read directly from the Commands section hierarchy. ### Examples ``` ! Driver DefaultName = PS ! Set commands PS Set Output Voltage(5.0) PS Set Output Current(1.5) PS Set Output State On() PS Set Output State Off() PS Set Output Protection OVP(6.0) PS Set Output Protection OCP On() PS Set Output Protection OCP Delay(0.1) PS Set Output Protection Clear() PS Set Output Current Slew Level(10.0) PS Set Output Current Slew State On() PS Set Output Voltage TransientMode(aTransientModeList) PS Set Sense Sweep NPLC(1) PS Set Trigger Source Transient(aTriggerSourceBus) PS Set Display On() PS Set SystemState Remote() ! Get commands PS Get Output Voltage(dVoltage) PS Get Output Current(dCurrent) PS Get Output State(bState) PS Get Output Protection OverVoltage(dOVP) PS Get System Identification(sID) PS Get System Error(sError) ! Measure commands (trigger and return result) PS Measure Voltage DC(TestResult) PS Measure Voltage RMS(TestResult) PS Measure Current DC(TestResult) PS Measure Power DC(TestResult) ! Fetch commands (return buffered result) PS Fetch Voltage DC(dVoltage) PS Fetch Current DC(dCurrent) PS Fetch AmpHour(dAH) ! Initiate / Abort PS Initiate Acquire() PS Initiate Transient() PS Abort Acquire() ! Trigger, Reset, SelfTest PS Trigger() PS Reset() PS Reset Error() PS SelfTest(lResult) PS Initialize() ! State Save/Recall PS State Save(0) PS State Recall(0) ``` ### Using enum constants in test programs Enum constants defined as `Public` in the driver are accessible from the program using the driver name prefix: ``` PS Set Output Voltage TransientMode(PS.aTransientModeList) PS Set Trigger Source Transient(PS.aTriggerSourceBus) PS Set Output State(PS.aOutputStateOn) ``` --- ## 15. SkipOnInit Pattern This pattern allows the driver's initialization check to be skipped on subsequent runs without modifying the driver itself. ### In the driver Summary block: ``` Parameters = {SkipOnInit, Number} ``` ### In the driver Events section: ``` Procedure OnInit(): Void Public ! Occurs when the driver is started. -------------------------------------------------------------------------------- { if Driver.Parameters("SkipOnInit")<>0 Initialize() endif } ``` ### In the driver Procedures section: ``` Procedure Initialize(): Void ! Initializes the driver: checks interface and verifies instrument. -------------------------------------------------------------------------------- sID: String { if Driver.InterfaceType<>Driver.InterfaceType.aioGpib and ... DisplayError(-8, "Please configure this driver to use a GPIB, USB, or LAN interface.") endif Driver Get System Identification(sID) if Pos("MODEL", sID)<0 DisplayError(-9, "Unable to find instrument at address 0x"+Str(GetDriverAddress(), 16)) endif } ``` ### Usage: - `SkipOnInit = 0` (or blank) → `Initialize()` is **not** called on startup (default — safe for production) - `SkipOnInit = 1` → `Initialize()` **is** called — interface type and instrument IDN are verified The Initialize command is also exposed in the Commands tree so it can be called explicitly at any time: ``` Initialize: Initialize() ! Verifies interface type and instrument identity. ``` --- ## 16. Design Rules Checklist Before delivering any ATEasy driver, verify every item: ### Summary - [ ] `ATEasy 14.0 Driver` header - [ ] `DefaultName` is a short, meaningful abbreviation (PS, DMM, SG, etc.) - [ ] All supported model numbers listed in `Models` - [ ] `Parameters = {SkipOnInit, Number}` present - [ ] Description block has models, manufacturer, interface types, manual reference, initialization instructions, and change log ### Interfaces - [ ] All physically supported interfaces are declared (GPIB, USB, LAN, COM) - [ ] WinSock uses `"\r\n"` terminators; all others use `"\n"` - [ ] USBTMC includes `USBTMC = True` - [ ] WinSock includes `Protocol`, `Server`, `ConnectTimeout`, `OpenOnAccess` ### Enums - [ ] All enums declared `Enum Public` - [ ] No underscores in enum type names or constant names - [ ] Constant names derived from type name (e.g. `enumFunction` → `aFunctionVoltage`) - [ ] Every constant has a `!` description comment - [ ] Enum types used as parameter types in procedures (not `Long`) ### Commands - [ ] `Measure` and `Fetch` are top-level nodes — never under `Get` - [ ] Command hierarchy mirrors instrument SCPI subsystem structure - [ ] Every node and leaf has a `!` description comment - [ ] On/Off leaves pass enum constants: `SetOutputState(aOutputStateOn)` - [ ] No underscores in command node names ### Procedures - [ ] All instrument commands implemented as Procedures (not IoTables) - [ ] Procedure names spell out the full command tree path - [ ] No underscores in procedure names - [ ] `Val` for input params, `Var` for output params - [ ] Enum-typed `Val` parameters use `en` prefix (e.g. `enOnOff`, `enMode`, `enSource`) - [ ] Enum-typed `Var` parameters use `pen` prefix (e.g. `penSource`) - [ ] Double params: `d` / `pd`; Long: `l` / `pl`; String: `s` / `ps`; Bool: `b` / `pb` - [ ] Enum type used as parameter type for enum-valued parameters - [ ] `DisplayError` procedure present - [ ] `Initialize` procedure present with interface type check and IDN verification - [ ] `OnInit` uses the SkipOnInit pattern ### IOTables - [ ] Only four utility IoTables: `SendString`, `ReceiveDouble`, `ReceiveLong`, `ReceiveString` - [ ] No instrument command IoTables ### General - [ ] All sections present even if empty (Libraries, Types, Forms, Commands, Events, Procedures, IOTables, Variables) - [ ] File ends with `END` - [ ] No underscores anywhere except in `Id` fields of test/task declarations --- *End of ATEasy Driver Authoring Reference Guide*