|
|
|
Quick Start User Guide
 |
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.
-
Set your compiler to include the
scpi.c
and cmds.c files in your build.
-
#include "scpi.h" in any of your code
modules that call JPA-SCPI Parser functions
-
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:
-
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.
-
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
-
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.
-
Validate the parameters and if ok, carry out whatever actions are necessary for that
command.
-
If the command was
not valid, handle the error as required by your instrument.
-
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.
|