Chapter 1 Command Outline
1.1 Receive and Send Protocols

> It is able to control it with a common message in USB, LAN.
> You need to install the USB driver in USB.
> Please implement "installs Logger Utility"
> and implement "installs the USB driver".
> TCP/IP protocol is used in LAN.
> A Ip address uses that set up it with "the IP address setting of manual"
> A port number uses '2' 1 column for under the port number that set up it with
> "the Port setting of manual".
> For example 8802 are used as a port, in the case that a port number is set up with 880X.

Messages

> Data received or sent by the USB and LAN interface is called a message.
> The following are the message types:
> Of these, program messages are those received by the unit from the controller,
> while response messages are those sent from the unit to the controller.
> Program messages are command messages or query messages.
> - Command messages are orders for control of the device, such as for making
>   settings or for reset or the like.
> - Query messages are orders for responses relating to the results of operation,
>   results of measurement, or the state of device settings.
> - Response messages are sent in response to query program messages. After a query message
>   has been received, a response message is produced the moment that its syntax has been checked.

Command syntax

> When no ambiguity would arise, the term "command" is henceforth used to refer to both command
> and query program messages.(Control commands : HIOKI unique SCPI)
> The unit accepts commands without distinction between lower case and upper case letters.
> The names of commands are as far as possible mnemonic. Furthermore, all commands have a long form,
> and an abbreviated short form.
> In command references in this manual, the short form is written in upper case letters, and then
> this is continued in lower case letters so as to constitute the long form.
> Either of these forms will be accepted during operation, but intermediate forms will not be accepted.
> Further, during operation both lower case letters and upper case letters will be accepted without distinction.
> The unit generates response messages in the long form (when headers are enabled) and in upper case letters.
> (Example)
> For "CONFigure", either "CONFIGURE" (the long form) or "CONF" (the short form) will be accepted.
> However, any one of "CONFIG", "CONFIGU", or "CON" is wrong and will generate an error.

Command program headers

> Commands must have a header, which identifies the command in question.
> There are three kinds of header: the simple command type, the compound command type, and standard command type.

Query program headers

> These are for commands used for interrogating the unit about the result of an operation or about a setting.
> These can be recognized as queries by a question mark appearing after the program header.
> The structure of the header is identical to that of a command program header, with "?" always being affixed to
> the last command. There are queries possible in each of the three previously described types of command form.

Response messages

> Response messages relating to queries are made up from header portions (which also may be absent due to header
> disablement) and data portions identical to those of program messages, and as a general rule are sent
> in an identical format to the format of the program message corresponding to their originating query.

Terminators and separators

> 1. Message Terminator

> > A terminator is used in order to separate the transmission of one message from another, and this terminator
> > is not itself included in the message.
> > Set the delimiter for the message terminator.
> > >> delimiter is CR+LF

> 2. Message Unit Separator

> > A semicolon ";" is used as a message unit separator when it is desired to set out several messages on a single line.

> 3. Header separator

> > With a message which has both a header and data, a space "_" is used as a header separator to separate the header
> > from the data. The space "_" is used by way of explanation, but it does not appear on the actual program.

> 4. Data separator

> > Commas are used as data separators for separating several data items from one another.

The command tree

> The rule when writing several messages of compound command form on the same line,when no colon is prefixed to
> the next header after the semicolon (the message unit separator), is that that header is considered
> as continuing on from the header before the last colon in the message directly preceding.
> This corresponds to the general concept of the current directory in the directory structure of UNIX or MS-DOS,
> and this directly preceding header is called the "current path".
> (Example 1)

> > :CONF:TDIV 1.E+0;:CONF:RECTIME 0,0,0,10

> (Example 2)

> > :CONF:TDIV 1.E+0;RECTIME 0,0,0,10

> Both Example 1 and Example 2 are messages setting TIME/DIV to 1s and recording length to 10 sec.
> With Example 1, because there is a colon directly after the semicolon, the current path is the "root".
> Accordingly the reference of the next command is performed from the root.
> On the other hand, with Example 2, because with ":CONF:TDIV 1. E+3;" the current path has become ":CONF",
> it is now possible to omit the ":CONF:" before "RECTIME".
> To reiterate, the colon at the beginning of a command forces the search for the command to begin from the root.
> Thus in Example 1:

Data format

> The unit uses character data, decimal data and character string data as a data format.

> 1.Character data

> > -1. The first character must be alphabetic.
> > -2. The characters after the first character can only be alphabetic characters, numerals, or underline characters (_).
> > -3. As alphabetic characters, during sending only upper case letters are used, but during receiving both upper case
> > and lower case letters are permitted.

> > 2.Decimal data
> > Decimal data values are represented in what is termed NR format.
> > There are three types of NR format from NR1 to NR3, and each of these can appear as either a signed number
> > or an unsigned number. Unsigned numbers are taken as positive.
> > Further, if the accuracy of a numerical value exceeds the range with which the unit can deal, it is rounded off.
> > (5 and above is rounded up; 4 and below is rounded down.)
> > The term "NRf format" includes all these three formats.
> > When the unit is receiving it accepts NRf format, but when it is sending it utilizes whichever one of the formats
> > NR1 to NR3 is indicated in the particular command.

> 2.Character string data

> > Character string data is enclosed within quotation marks.
> > -1. The data is composed of 8 bit ASCII characters.
> > -2. Characters which cannot be handled by the unit are replaced by spaces.
> > -3. When the unit is sending, only the double quotation mark (") is used as a quotation mark, but when receiving
> > both this double quotation mark and also the single quotation mark (') are accepted.

1.2 The Status Byte and the Event Registers
The status byte

> Each bit of the status byte is a summary (logical OR) of the event register corresponding to that bit.
> The values for the status byte, standard event status register, and event status register 0 are valid.

| Status byte bit settings
bit 7 | Unused: 0
bit 6 | Unused: 0
bit 5(ESB) | Event summary bit. Shows a summary of the standard event status register.
bit 4(MAV) | Message available. Shows that a message is present in the output queue.
bit 3 | Unused: 0
bit 2 | Unused: 0
bit 1 | Unused: 0
bit 0(ESB0) | Event summary bit 0 Shows a summary of event status register 0.

> The following commands are used for reading the status byte.
> Reading the status byte *STB?

Standard event status register (SESR)

> The summary of this register is set in bit 5 of the status byte.
> The circumstances when the contents of the standard event status register are cleared are as listed below.

> > 1. When the *CLS command is received.
> > 2. When the contents have been read by an *ESR? query.
> > 3. When the power is turned off and turned on again.

| Bit allocations in the standard event status register
bit 7(PON) | The power has been turned on again. Since this register was last read, the unit has been powered off and on.
bit 6(URQ) | User request: not used.
bit 5(CME) | Command error. There is an error in a command that has been received; either an error in syntax, or an error in meaning.
bit 4(EXE) | Execution error. An error has occurred while executing a command. Range error; Mode error.
bit 3(DDE) | Device dependent error. It has been impossible to execute some command, due to an error other than a command error, a query error, or an execution error.
bit 2(QYE) | Query error. The queue is empty, or data loss has occurred (queue overflow).
bit 1 | Request for controller right (not used) Unused: 0
bit 0(OPC) | Operation finished. Only set for the *OPC command.

> The following commands are used to read the standard event status register, and to set or read the standard
> event status enable register.
> Read the standard event status register *ESR?

Event status register 0 (ESR0)

> The summary of this register is set in bit 0 of the status byte.
> The circumstances when the contents of event status register 0 are cleared are as listed below.

> > 1. When the *CLS command is received.
> > 2. When the contents have been read by an :ESR0? query.
> > 3. When the power is turned off and turned on again.

| The bits of event status register 0
bit 7 | Unused: 0
bit 6 | Unused: 0
bit 5 | Unused: 0
bit 4 | Unused: 0
bit 3 | Unused: 0
bit 2 | Trigger wait finished (set when the trigger event occurs).
bit 1 | Measurement operation concluded (set by STOP).
bit 0 | Error not related to the USB and LAN interface; printer error etc.

> The following commands are used for reading the event status register 0, and for setting the event status
> enable register 0 and for reading it.
> Reading event status register 0 :ESR0?

1.3 The Input Buffer and the Output Queue

> Input buffer

> > The unit has an input buffer of 2048 bytes capacity.
> > Messages which are received are put into this buffer and executed in order.
> > However, an ABORT command is executed instantly as soon as it is received.

> Output queue

> > The unit has an output queue of 2048 bytes capacity.
> > Response messages are accumulated in this queue and are read out from the controller.
> > If the length of a response message has exceeded 2048 bytes, a query error occurs.

> The circumstances when the output queue is cleared are as listed below:

> > 1. When the controller has read out its entire contents.
> > 2. When the power is turned off and turned on again.
> > 3. Upon receipt of the next message.