areaDetector  3-14
EPICS areaDetector framework
Macros | Functions
merlin_low.h File Reference
#include <asynOctetSyncIO.h>

Go to the source code of this file.

Macros

#define MPX_HEADER   "MPX"
 
#define MPX_SET   (char*)"SET"
 
#define MPX_GET   (char*)"GET"
 
#define MPX_CMD   (char*)"CMD"
 
#define MPX_DATA_HEADER   "CMD"
 
#define MPX_DATA_ACQ_HDR   "HDR"
 
#define MPX_QUAD_DATA   "MQ1"
 
#define MPX_PROFILE   "PR1"
 
#define MPX_MSG_LEN_DIGITS   10
 
#define MPX_MSG_DATATYPE_LEN   3
 
#define MPX_MAXLINE   256
 
#define MPX_IMG_HDR_LEN   256
 
#define MPX_IMG_HDR_DAC_LEN   128
 
#define MPX_IMG_HDR_MAX_CHIPS   16
 
#define MPX_IMG_HDR_FULL_LEN   MPX_IMG_HDR_LEN + MPX_IMG_HDR_DAC_LEN * MPX_IMG_HDR_MAX_CHIPS
 
#define MPX_ACQUISITION_HEADER_LEN   2044
 
#define MPX_X_SIZE   256
 
#define MPX_Y_SIZE   256
 
#define MPX_IMAGE_PIXELS   65536
 
#define MPX_IMAGE_BYTES   MPX_IMAGE_PIXELS * 2
 
#define MPX_IMG_FRAME_LEN   MPX_IMG_HDR_LEN + MPX_IMAGE_BYTES + MPX_MSG_DATATYPE_LEN + 2
 
#define MPX_IMG_FRAME_LEN24   MPX_IMG_HDR_LEN + MPX_IMAGE_BYTES * 2 + MPX_MSG_DATATYPE_LEN + 2
 
#define MAX_BUFF_MERLIN_QUAD   2000000
 
#define MAX_BUFF_UOM   5300000
 
#define MPX_OK   0 /*Ok*/
 
#define MPX_ERR   1 /*Unknown Error*/
 
#define MPX_ERR_CMD   2 /*Command not known.*/
 
#define MPX_ERR_PARAM   3 /*Param out of range.*/
 
#define MPX_ERR_BUSY   4 /*The controller is busy and not accepting commands */
 
#define MPX_ERR_CONN   100 /*Not connected to detector.*/
 
#define MPX_ERR_WRITE   101 /*Error writing to socket.*/
 
#define MPX_ERR_READ   102 /*Error reading from socket.*/
 
#define MPX_ERR_LEN   103 /*Length of command and value too long, or NULL*/
 
#define MPX_ERR_DATA   110 /*Data formatting error.*/
 
#define MPX_ERR_UNEXPECTED   111 /*unexpected response from labview */
 
#define MPXVAR_GETSOFTWAREVERSION   (char*) "SOFTWAREVERSION"
 
#define MPXVAR_DETECTORSTATUS   (char*) "DETECTORSTATUS"
 
#define MPXVAR_NUMFRAMESTOACQUIRE   (char*) "NUMFRAMESTOACQUIRE"
 
#define MPXVAR_ACQUISITIONTIME   (char*) "ACQUISITIONTIME"
 
#define MPXVAR_ACQUISITIONPERIOD   (char*) "ACQUISITIONPERIOD"
 
#define MPXVAR_TRIGGERSTART   (char*) "TRIGGERSTART"
 
#define MPXVAR_TRIGGERSTOP   (char*) "TRIGGERSTOP"
 
#define MPXVAR_NUMFRAMESPERTRIGGER   (char*) "NUMFRAMESPERTRIGGER"
 
#define MPXVAR_COUNTERDEPTH   (char*) "COUNTERDEPTH"
 
#define MPXVAR_ENABLECOUNTER1   (char*) "ENABLECOUNTER1"
 
#define MPXVAR_CONTINUOUSRW   (char*) "CONTINUOUSRW"
 
#define MPXVAR_ROI   (char*) "ROI"
 
#define MPXVAR_ENABLEBACKROUNDCORR   (char*) "BCKGRNDCORRECTION"
 
#define MPXVAR_BACKGROUNDCOUNT   (char*) "BCKGRND"
 
#define MPXVAR_ENABLEIMAGEAVERAGE   (char*) "IMGAVERAGE"
 
#define MPXVAR_IMAGESTOSUM   (char*) "IMAGESTOSUM"
 
#define MPXVAR_COLOURMODE   (char*) "COLOURMODE"
 
#define MPXVAR_CHARGESUMMING   (char*) "CHARGESUMMING"
 
#define MPXVAR_THSSCAN   (char*) "THSCAN"
 
#define MPXVAR_THWINDOWMODE   (char*) "THWINDOWMODE"
 
#define MPXVAR_THWINDOWSIZE   (char*) "THWINDOWSIZE"
 
#define MPXVAR_THSTART   (char*) "THSTART"
 
#define MPXVAR_THSTOP   (char*) "THSTOP"
 
#define MPXVAR_THSTEP   (char*) "THSTEP"
 
#define MPXVAR_THRESHOLD0   (char*) "THRESHOLD0"
 
#define MPXVAR_THRESHOLD1   (char*) "THRESHOLD1"
 
#define MPXVAR_THRESHOLD2   (char*) "THRESHOLD2"
 
#define MPXVAR_THRESHOLD3   (char*) "THRESHOLD3"
 
#define MPXVAR_THRESHOLD4   (char*) "THRESHOLD4"
 
#define MPXVAR_THRESHOLD5   (char*) "THRESHOLD5"
 
#define MPXVAR_THRESHOLD6   (char*) "THRESHOLD6"
 
#define MPXVAR_THRESHOLD7   (char*) "THRESHOLD7"
 
#define MPXVAR_OPERATINGENERGY   (char*) "OPERATINGENERGY"
 
#define MPXCMD_STARTACQUISITION   (char*) "STARTACQUISITION"
 
#define MPXCMD_STOPACQUISITION   (char*) "STOPACQUISITION"
 
#define MPXCMD_THSCAN   (char*) "THSCAN"
 
#define MPXCMD_SOFTWARETRIGGER   (char*) "SWTRIGGER"
 
#define MPXCMD_RESET   (char*) "RESET"
 
#define MPXCMD_PROFILECONTROL   (char*) "PROFILES"
 
#define MPXCMD_PROFILES   (char*) "PROFILES"
 
#define MPXCMD_BACKGROUNDACQUIRE   (char*) "BCKGRND"
 
#define OPT_START_STRING   "OPT1"
 
#define OPT_END_STRING   "END1"
 
#define OPT_TOKEN_LEN   4
 
#define PROFILE_SELECT_POS   4
 
#define DACS_PRESENT_POS   5
 
#define MPXPROFILES_IMAGE   1
 
#define MPXPROFILES_XPROFILE   2
 
#define MPXPROFILES_YPROFILE   4
 
#define MPXPROFILES_SUM   8
 

Functions

int mpxSet (const char *command, const char *value)
 Interface library to merlin Labview system. More...
 
int mpxGet (const char *command, char *value)
 Get a value for the specified command. More...
 
int mpxCmd (const char *command)
 Send a cmd command. More...
 
int mpxData (unsigned int *data)
 Read the latest data frame. More...
 
int mpxConnect (const char *host, int commandPort, int dataPort)
 Connect to the Labview program. More...
 
int mpxIsConnected (int *conn)
 Test the connection status. More...
 
int mpxDisconnect (void)
 Disconnect from the Labview program. More...
 

Macro Definition Documentation

◆ DACS_PRESENT_POS

#define DACS_PRESENT_POS   5

◆ MAX_BUFF_MERLIN_QUAD

#define MAX_BUFF_MERLIN_QUAD   2000000

◆ MAX_BUFF_UOM

#define MAX_BUFF_UOM   5300000

◆ MPX_ACQUISITION_HEADER_LEN

#define MPX_ACQUISITION_HEADER_LEN   2044

◆ MPX_CMD

#define MPX_CMD   (char*)"CMD"

◆ MPX_DATA_ACQ_HDR

#define MPX_DATA_ACQ_HDR   "HDR"

◆ MPX_DATA_HEADER

#define MPX_DATA_HEADER   "CMD"

◆ MPX_ERR

#define MPX_ERR   1 /*Unknown Error*/

◆ MPX_ERR_BUSY

#define MPX_ERR_BUSY   4 /*The controller is busy and not accepting commands */

◆ MPX_ERR_CMD

#define MPX_ERR_CMD   2 /*Command not known.*/

◆ MPX_ERR_CONN

#define MPX_ERR_CONN   100 /*Not connected to detector.*/

◆ MPX_ERR_DATA

#define MPX_ERR_DATA   110 /*Data formatting error.*/

◆ MPX_ERR_LEN

#define MPX_ERR_LEN   103 /*Length of command and value too long, or NULL*/

◆ MPX_ERR_PARAM

#define MPX_ERR_PARAM   3 /*Param out of range.*/

◆ MPX_ERR_READ

#define MPX_ERR_READ   102 /*Error reading from socket.*/

◆ MPX_ERR_UNEXPECTED

#define MPX_ERR_UNEXPECTED   111 /*unexpected response from labview */

◆ MPX_ERR_WRITE

#define MPX_ERR_WRITE   101 /*Error writing to socket.*/

◆ MPX_GET

#define MPX_GET   (char*)"GET"

◆ MPX_HEADER

#define MPX_HEADER   "MPX"

◆ MPX_IMAGE_BYTES

#define MPX_IMAGE_BYTES   MPX_IMAGE_PIXELS * 2

◆ MPX_IMAGE_PIXELS

#define MPX_IMAGE_PIXELS   65536

◆ MPX_IMG_FRAME_LEN

#define MPX_IMG_FRAME_LEN   MPX_IMG_HDR_LEN + MPX_IMAGE_BYTES + MPX_MSG_DATATYPE_LEN + 2

◆ MPX_IMG_FRAME_LEN24

#define MPX_IMG_FRAME_LEN24   MPX_IMG_HDR_LEN + MPX_IMAGE_BYTES * 2 + MPX_MSG_DATATYPE_LEN + 2

◆ MPX_IMG_HDR_DAC_LEN

#define MPX_IMG_HDR_DAC_LEN   128

◆ MPX_IMG_HDR_FULL_LEN

#define MPX_IMG_HDR_FULL_LEN   MPX_IMG_HDR_LEN + MPX_IMG_HDR_DAC_LEN * MPX_IMG_HDR_MAX_CHIPS

◆ MPX_IMG_HDR_LEN

#define MPX_IMG_HDR_LEN   256

◆ MPX_IMG_HDR_MAX_CHIPS

#define MPX_IMG_HDR_MAX_CHIPS   16

◆ MPX_MAXLINE

#define MPX_MAXLINE   256

◆ MPX_MSG_DATATYPE_LEN

#define MPX_MSG_DATATYPE_LEN   3

◆ MPX_MSG_LEN_DIGITS

#define MPX_MSG_LEN_DIGITS   10

◆ MPX_OK

#define MPX_OK   0 /*Ok*/

◆ MPX_PROFILE

#define MPX_PROFILE   "PR1"

◆ MPX_QUAD_DATA

#define MPX_QUAD_DATA   "MQ1"

◆ MPX_SET

#define MPX_SET   (char*)"SET"

◆ MPX_X_SIZE

#define MPX_X_SIZE   256

◆ MPX_Y_SIZE

#define MPX_Y_SIZE   256

◆ MPXCMD_BACKGROUNDACQUIRE

#define MPXCMD_BACKGROUNDACQUIRE   (char*) "BCKGRND"

◆ MPXCMD_PROFILECONTROL

#define MPXCMD_PROFILECONTROL   (char*) "PROFILES"

◆ MPXCMD_PROFILES

#define MPXCMD_PROFILES   (char*) "PROFILES"

◆ MPXCMD_RESET

#define MPXCMD_RESET   (char*) "RESET"

◆ MPXCMD_SOFTWARETRIGGER

#define MPXCMD_SOFTWARETRIGGER   (char*) "SWTRIGGER"

◆ MPXCMD_STARTACQUISITION

#define MPXCMD_STARTACQUISITION   (char*) "STARTACQUISITION"

◆ MPXCMD_STOPACQUISITION

#define MPXCMD_STOPACQUISITION   (char*) "STOPACQUISITION"

◆ MPXCMD_THSCAN

#define MPXCMD_THSCAN   (char*) "THSCAN"

◆ MPXPROFILES_IMAGE

#define MPXPROFILES_IMAGE   1

◆ MPXPROFILES_SUM

#define MPXPROFILES_SUM   8

◆ MPXPROFILES_XPROFILE

#define MPXPROFILES_XPROFILE   2

◆ MPXPROFILES_YPROFILE

#define MPXPROFILES_YPROFILE   4

◆ MPXVAR_ACQUISITIONPERIOD

#define MPXVAR_ACQUISITIONPERIOD   (char*) "ACQUISITIONPERIOD"

◆ MPXVAR_ACQUISITIONTIME

#define MPXVAR_ACQUISITIONTIME   (char*) "ACQUISITIONTIME"

◆ MPXVAR_BACKGROUNDCOUNT

#define MPXVAR_BACKGROUNDCOUNT   (char*) "BCKGRND"

◆ MPXVAR_CHARGESUMMING

#define MPXVAR_CHARGESUMMING   (char*) "CHARGESUMMING"

◆ MPXVAR_COLOURMODE

#define MPXVAR_COLOURMODE   (char*) "COLOURMODE"

◆ MPXVAR_CONTINUOUSRW

#define MPXVAR_CONTINUOUSRW   (char*) "CONTINUOUSRW"

◆ MPXVAR_COUNTERDEPTH

#define MPXVAR_COUNTERDEPTH   (char*) "COUNTERDEPTH"

◆ MPXVAR_DETECTORSTATUS

#define MPXVAR_DETECTORSTATUS   (char*) "DETECTORSTATUS"

◆ MPXVAR_ENABLEBACKROUNDCORR

#define MPXVAR_ENABLEBACKROUNDCORR   (char*) "BCKGRNDCORRECTION"

◆ MPXVAR_ENABLECOUNTER1

#define MPXVAR_ENABLECOUNTER1   (char*) "ENABLECOUNTER1"

◆ MPXVAR_ENABLEIMAGEAVERAGE

#define MPXVAR_ENABLEIMAGEAVERAGE   (char*) "IMGAVERAGE"

◆ MPXVAR_GETSOFTWAREVERSION

#define MPXVAR_GETSOFTWAREVERSION   (char*) "SOFTWAREVERSION"

◆ MPXVAR_IMAGESTOSUM

#define MPXVAR_IMAGESTOSUM   (char*) "IMAGESTOSUM"

◆ MPXVAR_NUMFRAMESPERTRIGGER

#define MPXVAR_NUMFRAMESPERTRIGGER   (char*) "NUMFRAMESPERTRIGGER"

◆ MPXVAR_NUMFRAMESTOACQUIRE

#define MPXVAR_NUMFRAMESTOACQUIRE   (char*) "NUMFRAMESTOACQUIRE"

◆ MPXVAR_OPERATINGENERGY

#define MPXVAR_OPERATINGENERGY   (char*) "OPERATINGENERGY"

◆ MPXVAR_ROI

#define MPXVAR_ROI   (char*) "ROI"

◆ MPXVAR_THRESHOLD0

#define MPXVAR_THRESHOLD0   (char*) "THRESHOLD0"

◆ MPXVAR_THRESHOLD1

#define MPXVAR_THRESHOLD1   (char*) "THRESHOLD1"

◆ MPXVAR_THRESHOLD2

#define MPXVAR_THRESHOLD2   (char*) "THRESHOLD2"

◆ MPXVAR_THRESHOLD3

#define MPXVAR_THRESHOLD3   (char*) "THRESHOLD3"

◆ MPXVAR_THRESHOLD4

#define MPXVAR_THRESHOLD4   (char*) "THRESHOLD4"

◆ MPXVAR_THRESHOLD5

#define MPXVAR_THRESHOLD5   (char*) "THRESHOLD5"

◆ MPXVAR_THRESHOLD6

#define MPXVAR_THRESHOLD6   (char*) "THRESHOLD6"

◆ MPXVAR_THRESHOLD7

#define MPXVAR_THRESHOLD7   (char*) "THRESHOLD7"

◆ MPXVAR_THSSCAN

#define MPXVAR_THSSCAN   (char*) "THSCAN"

◆ MPXVAR_THSTART

#define MPXVAR_THSTART   (char*) "THSTART"

◆ MPXVAR_THSTEP

#define MPXVAR_THSTEP   (char*) "THSTEP"

◆ MPXVAR_THSTOP

#define MPXVAR_THSTOP   (char*) "THSTOP"

◆ MPXVAR_THWINDOWMODE

#define MPXVAR_THWINDOWMODE   (char*) "THWINDOWMODE"

◆ MPXVAR_THWINDOWSIZE

#define MPXVAR_THWINDOWSIZE   (char*) "THWINDOWSIZE"

◆ MPXVAR_TRIGGERSTART

#define MPXVAR_TRIGGERSTART   (char*) "TRIGGERSTART"

◆ MPXVAR_TRIGGERSTOP

#define MPXVAR_TRIGGERSTOP   (char*) "TRIGGERSTOP"

◆ OPT_END_STRING

#define OPT_END_STRING   "END1"

◆ OPT_START_STRING

#define OPT_START_STRING   "OPT1"

◆ OPT_TOKEN_LEN

#define OPT_TOKEN_LEN   4

◆ PROFILE_SELECT_POS

#define PROFILE_SELECT_POS   4

Function Documentation

◆ mpxCmd()

int mpxCmd ( const char *  command)

Send a cmd command.

  • command - command name
    Returns
    int - error code

◆ mpxConnect()

int mpxConnect ( const char *  host,
int  commandPort,
int  dataPort 
)

Connect to the Labview program.

This opens two TCP/IP sockets.

  • host - IP address
  • commandPort - port number to send commands
  • dataPort - port number to read data from
    Returns
    int - error code

◆ mpxData()

int mpxData ( unsigned int *  data)

Read the latest data frame.

This blocks until either a frame is read or the socket is closed (either using mpxDisconnect or another mechanism).

The data buffer must be assigned by the user, and it won't be overwritten until this function is called again.

◆ mpxDisconnect()

int mpxDisconnect ( void  )

Disconnect from the Labview program.

This closes the sockets opened using mpxConnect.

Returns
int - error code

◆ mpxGet()

int mpxGet ( const char *  command,
char *  value 
)

Get a value for the specified command.

  • command - command name
  • value - returned value
    Returns
    int - error code

◆ mpxIsConnected()

int mpxIsConnected ( int *  conn)

Test the connection status.

  • int pointer - 1=connected 0=not connected
    Returns
    error code.

◆ mpxSet()

int mpxSet ( const char *  command,
const char *  value 
)

Interface library to merlin Labview system.

Matthew Pearson Nov 2011

Interface library to merlin Labview system.

  • command - command name
  • value - value to set
    Returns
    int - error code