Software Functional Description
General
The PM 6685 software is divided into two main modules: the GPIB
and DEVICE modules. The GPIB fully implements the Message Ex
-
change protocol as described in the IEEE 488.2 - 1987 standard.
The DEVICE module is a real-time measurement executive that can
be interrupted to do other tasks, such as handling the keyboard, per
-
forming bus commands etc.
The basic structure of the main module is as follows:
main PM6685()
{
Initialize();
while (TRUE)
{
if (BREAKFLAG_KEYBOARD)
{
HandleKeyboard();
}
if (BREAKFLAG_PRESET)
{
PresetDevice();
}
if (BREAKFLAG_GPIBCOMMAND)
{
ExecuteGpibCommands();
}
if (BREAKFLAG_RESTART)
{
RestartMeasurement();
}
while (not any BREAKFLAG)
{
Measure( );
}
}
}
All break flags are set by interrupt-driven events, either from exter
-
nal functions (the GPIB interface) or from internal functions (timers
etc.).
The Initialize procedure does all necessary initialization at power
up. It also does the power up tests. See Power-On test in chapter 2.
The Handlekeyboard procedure controls all user input/output via
the front panel, except displaying the measurement results.
The PresetDevice procedure reprograms the complete device when
the PRESET key has been pressed (in local mode). It aborts pending
measurements.
The ExecuteGpibCommands procedure executes GPIB commands
and, if a query is received, it starts the response formatter and sends
the requested data to the GPIB interface. If the display is switched
on, the results are also displayed.
The RestartMeasurement procedure aborts pending measure
-
ments; the measure loop will later continue to measure. This is
mainly used when the RESTART key is pressed.
The Measure procedure is the measurement control loop that is used
in local mode. It sends its result to the display.
The ParseGpibInputData procedure parses the GPIB messages
found in the input buffer and sends executable statements to the
ExeceuteGpibCommands procedure. The input of data to the input
buffer from the external GPIB interface is fully controlled in inter
-
rupts. These interrupts are always enabled so the new data bytes can
be stored in the input buffer while parsing commands. This
ParseGpibInputDat is also executed in interrupt.
Software Functional Description 4-15