Frontend user code

From MidasWiki
Revision as of 13:15, 1 November 2013 by Suz (talk | contribs) (Created page with "Links ==== Links ==== <div style="column-count:3;-moz-column-count:3;-webkit-column-count:3"> * Frontend Operation * Frontend Application </div> == Introduction== Th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search




This section describes the features of the user-written part of a Frontend, referred to here as frontend.c. To make a custom frontend, users will usually modify one of the templates provided in the MIDAS package for their particular hardware and other requirements. A partial list of the templates provided is shown below:

Hardware Filename Directory (MIDAS package) Purpose Language
VME fevmemodules.c ../midas/examples/Triumf/c/ Access to VME modules C
VME fevme.cxx ../midas/examples/Triumf/c++/ Access to VME modules C++
CAMAC frontend.c ../midas/examples/experiment/ Access to CAMAC modules C
RS485 bus mscb_fe.c ../midas/examples/slowcont/ Slow controls C
EPICS frontend.c ../midas/examples/epics/ Slow controls C

The features of a typical frontend program are best explained by reference to examples of the user code provided in the Midas Package.

Frontend code sections

The following sections refer to the templates for user frontend code found in the MIDAS packages (see Introduction.

Include files

The following example show the standard include files needed for VME access with VMIC. The user may add any other include files as needed. In this case, header files for several device drivers have also been added. The optional include file "experim.h" is often included. This is a special include file for ease of communication between the C code and the ODB, and is generated by the user (see experim.h).

#include <stdio.h>     // C standard headers
#include <stdlib.h>
#include "midas.h"     // MIDAS include file
#include "mvmestd.h"   // VME header file
#include "vmicvme.h"   // VMIC header file
#include "vmeio.h"     // optional hardware header files
#include "v1190B.h"
#include "v792.h"
#include "vf48.h"
#include "v1729.h"
#include "experim.h"   // user-created with odbedit make command

Global declarations

The declarations are system wide. Some may be changed to suit the user, but none should not be removed.

This value can be modified to reflect the purpose of the code
If set to TRUE, the function frontend_loop() runs after every equipment loop. If FALSE, frontend_loop() does not run. The user can add suitable code to this routine if desired (e.g. to check for a condition).
The time interval (defined in milliseconds) between the refresh of a frontend status display. The value of zero disables the display. If the frontend is started in the background with the display enabled, the stdout should be redirected to the null device to prevent the process from hanging.
specifies the maximum size (in bytes) of the expected event.
specifies the maximum size (in bytes) of the buffer to be allocated by the system.