|
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>] |
|