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

3:

 

Integrate JPA-SCPI Parser into Your Code

 

The final step is to integrate JPA-SCPI Parser into your code. The easy-to-use functions of JPA-SCPI Parser make this simple.

  1. Set your compiler to include the scpi.c and cmds.c files in your build.

  2. #include "scpi.h" in any of your code modules that call JPA-SCPI Parser functions

  3. Modify your code to carry out the following steps after a termination character/signal has been received on the comm port, indicating the end of the received command line string:

  1. Pass a pointer to the input command line string to the SCPI_Parse() function. The JPA-SCPI Parser will parse the first command in the command line.

  2. Check the return code from SCPI_Parse(). It will indicate one of these results:

    • The input command was recognized as a valid command

    • The input command was not recognized (returned error code indicates the exact reason)

    • There are no (more) commands to parse in the input command line

  3. If the command is valid, use the JPA-SCPI Parser access functions to convert the user parameters into useable variables - SCPI_ParamType(), SCPI_ParamUnits(), SCPI_ParamToDouble(), SCPI_ParamToLong(), SCPI_ParamToString(), etc.

  4. Validate the parameters and if ok, carry out whatever actions are necessary for that command.

  5. If the command was not valid, handle the error as required by your instrument.

  6. SCPI_Parse() returns a pointer to the start of the next command in the input command line. Return to step 1, using this new pointer. Stop parsing the command line when SCPI_Parse() indicates there are no more commands to parse.

Sample code and comprehensive instructions are included with JPA-SCPI Parser to take you through all the steps needed to create your SCPI parser.