JPA Consultingaccelerating product development

 
 

Introduction

Why SCPI?

Why use the JPA-SCPI Parser?

JPA-SCPI Parser

Overview

Features

DATASHEET

Quick-start user guide

Create Command Set file-pair

Integrate into your code

Specifications

Download Manual

Free Demo

Ordering

Order Info & Pricing

Terms & Conditions

ORDER NOW

SCPI Explained

What is SCPI?

SCPI Commands

Links

Support

Support Request

Contact Us

Quick Start User Guide

2:

 

Create the Command Specifications

 

Once you have decided which SCPI Instrument Class(es) your instrument belongs to, and what additional commands you wish to support, it is a simple matter of defining the command specifications.

The command specifications are defined in this pair of files:

cmds.c

cmds.h

cmds.c

The cmds.c file is created from one or more of the supplied templates.

Now add your own commands to the cmds.c file.

For example, this is the command specification for a DMM (Digital Multi-Meter) to set its function to DC voltage measurement and to set the range:

[SENSe:]VOLTage:DC:RANGe {<range>}

 

The keyword sequence of this command is represented in cmds.c by this code:

const char *SSpecCmdKeywords[] =

  /*                              Index

                                  -----          */

  :

  "[SENSe:]VOLTage:DC:RANGe",  /*   15           */
  :

};

NOTE: The simliarity between the specification and the code - this is what makes JPA-SCPI Parser so easy to use. 

The type, number and order of parameters that are used with this command are then set in cmds.c. In this case it is a required (not optional) numerical value parameter without units:

const struct strSpecCommand sSpecCommand[] =
{
  /*    Param 1                 Param 2                    Index
        -------                 -------                    -----       */

       :
  {{   { REQ  NUM  sNoUnits  },{ NOP             } }},  /*   15        */
       :

};

Other types of parameter are just as easy to specify. You can also specify choices of parameters such as {<range>|MINimum|MAXimum}. Again a close correspondence between the command specification and cmds.c makes the process easy.

Other features you can specify include:

 

Default parameters, such as {MINimum|MAXimum|DEFault}, where DEFault is returned if no parameter is entered

 

Optional parameters, such as [<resolution>]

View an example cmds.c file

 

cmds.h

The small cmds.h file contains the unit types supported by your parameters, e.g. volts, amps, etc. It also contains constants such as the maximum number of parameters allowed.

Any platform-specific information required by JPA-SCPI Parser (e.g. maximum value representable by an unsigned long variable, etc.) is also kept in cmds.h.

View an example cmds.h file

 

Step 3: Integrate into Your Code >>