JMP Protocol
CONTROL MESSAGES
Each "Control" message must contain a "Command" member which may be one of
the following valid values:
"Toggle"
"Close"
"Open"
"Reset Latch"
"Reset Counter"
"Reset Usage"
Each "Control" Message must contain a numeric "Channel" member specifying
the input/output channel. This parameter is 1-based where the number '1'
specifies either the first Digital Input or first Relay Output. This depends
on the specific "Command".
There is no formal response to these command messages although a "Monitor"
message will invariably follow some for obvious reasons. Monitor messages
are sent whenever I/O status changes. These may be unsolicited but if the
control message alters I/O status the Monitor message is a logical response.
If the control message does not alter I/O status there is no response.
TOGGLE COMMAND
The "Toggle" command inverts the state of the defined output "Channel". If the
relay is open it will be closed. If it is closed it will be opened. The
optional "Duration" member parameter if positive and non-zero specifies the
milliseconds before the relay is to be returned to its original state.
Therefore the following will close Relay Output 1 assuming that it originally
is open.
{
"Message":"Control",
"Command":"Toggle",
"Channel":1
}
Similarly the following will pulse Relay Output 2. Assuming that originally
the relay is open, it will be closed for precisely 5000 milliseconds
(5 seconds).
{
"Message":"Control",
"Command":"Toggle",
"Channel":2,
"Duration":5000
}
Note then that this last version of the Toggle control message will result
in 2 Monitor messages. One when the relay closes and another 5 seconds later
when it opens.
CLOSE COMMAND
The "Close" command closes the defined output "Channel". If the relay is open
it will be closed. If it is closed it will remain closed (state = 1). The
optional "Duration" member parameter if positive and non-zero specifies the
milliseconds before the relay is to be returned to its original state.
Therefore the following will close Relay Output 1.
{
"Message":"Control",
"Command":"Close",
"Channel":1
}
Similarly the following will pulse Relay Output 2. It will be closed for
precisely 5000 milliseconds (5 seconds). There will be no change if the
relay is already closed.
{
"Message":"Control",
"Command":"Close",
"Channel":2,
"Duration":5000
}
OPEN COMMAND
The "Open" command opens the defined output "Channel". If the relay is open
it will remain so (state = 0). If it is closed it will be opened. The optional
"Duration" member parameter if positive and non-zero specifies the milliseconds
before the relay is to be returned to its original state. Therefore the
following will open Relay Output 1.
{
"Message":"Control",
"Command":"Open",
"Channel":1
}
Similarly the following will pulse Relay Output 2. It will be opened for
precisely 5000 milliseconds (5 seconds). There will be no change if the relay
is already open.
{
"Message":"Control",
"Command":"Open",
"Channel":2,
"Duration":5000
}
BLOCK COMMAND
The "Block" command allows the state of one or more relays to be changed
simultaneously. The "Mask" parameter selects the relay or relays to be affected
by the command. Here the presence of a '1' bit indicates that the associated
relay state is to be affected. The parameter's least significant bit (LSB)
represents Relay Output 1. The corresponding bit in the "States" parameter
defines the new state of the associated relay where a '1' indicates that the
relay is to be closed, a '0' it is to be opened. The optional "Duration" member
parameter if positive and non-zero specifies the milliseconds before the relay
is to be returned to its original state. Therefore the following will close
Relay Outputs 1 and 3 and open Relay Output 2 all at the same time.
{
"Message":"Control",
"Command":"Block",
"Mask":7
"States":5
}
Similarly the following will pulse Relay Outputs 1 and 2 for precisely 5000
milliseconds (5 seconds).
{
"Message":"Control",
"Command":"Block",
"Mask":3,
"States":3
"Duration":5000
}
RESET LATCH COMMAND
Latching may be enabled for any of the digital inputs. This is a form of event
capture which can be very useful in monitoring pulsed signals. A latching
input may be set to trigger on either a positive going or negative going
signal edge. In waiting for the event the input is considered to be armed.
When the trigger signal is detected the input changes state.
A LatchTime may be configured. This defines a timer setting. The timer starts
when the event occurs and the input signal is automatically reset when it
expires. This provides for a form of pulse stretching. With a latch time of
10 seconds, pulsing an input for a mere 1 millisecond results in the input
being activated for 10 seconds. The very brief event is captured. The result
is signaled for a period long enough to alert any monitoring system.
If LatchTime is not configured (default is 0) or configured for 0 seconds
there will be no automatic reset. The input state indicating the capture of
an event must be manually reset or reset by the monitoring system using the
"Reset Latch" command. An example message follows.
{
"Message":"Control",
"Command":"Reset Latch",
"Channel":2
}
RESET COUNTER COMMAND
Input transitions are tallied. The counter can be configured to tally positive
going or negative going edges. This provides an indication of the total number
of input pulses detected. The JNIOR can count signals up to 2 kHz but is
typically employed to count more reasonable paced events. At some point there
may be a need to reset the counts to 0. This might occur each time this "meter"
is read for instance and perhaps on a monthly basis. The following command
does the job.
{
"Message":"Control",
"Command":"Reset Counter",
"Channel":3
}
RESET USAGE COMMAND
Often it is necessary to keep track of how long that a piece of equipment is
in use. The JNIOR tallies the time that either an input or an output is active.
Each I/O point can be configured to tally usage time for either the high/1/ON
state or the low/0/OFF state. It is reported as a fraction of hours. At some
point you may need to reset this Usage Meter. The following command does the
job.
{
"Message":"Control",
"Command":"Reset Usage",
"Channel":11
}
The JNIOR maintains 16 separate usage meters representing the 16 internal I/O
points. This covers a mixture of inputs and outputs that varies depending on
JNIOR Model. In this example, if we are running a Model 410 with 8 inputs and
8 outputs, we are resetting the Usage Meter for Relay Output 3. Channels 1
through 8 are inputs and 9 through 16 then correspond to Relay Outputs 1
through 8. So for this example Channel 11 is Relay Output 3.
[/flash/manpages/protocol.hlp:445]