Add NHQ200 HV Power Supply Driver
r1385 | dcl | 2006-12-21 17:50:19 +1100 (Thu, 21 Dec 2006) | 2 lines
This commit is contained in:
131
site_ansto/hardsup/nhq200util.h
Normal file
131
site_ansto/hardsup/nhq200util.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------
|
||||
N H Q 2 0 0 U T I L
|
||||
|
||||
A few utility functions for talking to a NHQ 200
|
||||
voltage controller via the SINQ setup: TCP/IP--MAC--RS-232--
|
||||
NHQ200.
|
||||
|
||||
Mark Koennecke, Juli 1997
|
||||
Mark Lesha, January 2006 (based on ITC4 code)
|
||||
Douglas Clowes, December 2006 (based on LAKESHORE340 code)
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SINQNHQ200
|
||||
#define SINQNHQ200
|
||||
|
||||
/*----------------------- ERRORCODES--------------------------------------
|
||||
Most functions return a negative error code on failure. Error codes
|
||||
defined are those defined for serialsinq plus a few additional ones:
|
||||
*/
|
||||
|
||||
#define NHQ200__BADCOM -501
|
||||
/* command not recognized */
|
||||
#define NHQ200__BADPAR -502
|
||||
/* bad parameter to command */
|
||||
#define NHQ200__BADMALLOC -503
|
||||
/* error allocating memory */
|
||||
#define NHQ200__BADREAD -504
|
||||
/* error analysing command string on Read */
|
||||
#define NHQ200__FAULT -505
|
||||
/* fault or overload condition exists in NHQ200 */
|
||||
#define NHQ200__NONHQ200 -510
|
||||
/* Controller is not NHQ200 */
|
||||
#define NHQ200__BADSET -530
|
||||
/* failed three times to set temperature */
|
||||
#define NHQ200__READONLY -531
|
||||
/*------------------------------------------------------------------------*/
|
||||
typedef struct __NHQ200 {
|
||||
int iRead;
|
||||
int iControl;
|
||||
void *pData;
|
||||
char pAns[80]; /* should be enough for NHQ200 errors */
|
||||
/* The NHQ200 does not need multipliers or dividers but
|
||||
leave them in anyway for back compatibility or future use
|
||||
but force the value to 1.0 all the time */
|
||||
float fDiv;
|
||||
float fMult;
|
||||
int iReadOnly;
|
||||
prs232 controller;
|
||||
} NHQ200;
|
||||
|
||||
typedef struct __NHQ200 *pNHQ200;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int NHQ200_Open(pNHQ200 *pData,char *pHost, int iPort, int iChannel, int iMode);
|
||||
/***** creates an NHQ200 datastructure and opens a connection to the NHQ200
|
||||
controller. Input Parameters are:
|
||||
the hostname
|
||||
the port number
|
||||
the RS-232 channel number on the Mac.
|
||||
iMode: 1 for ReadOnly, 0 for normal mode
|
||||
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
|
||||
*/
|
||||
|
||||
void NHQ200_Close(pNHQ200 *pData);
|
||||
/****** close a connection to an NHQ200controller and frees its
|
||||
data structure. The only parameter is a pointer to the data
|
||||
structure for this controller. This pointer will be invalid after
|
||||
this call.
|
||||
*/
|
||||
|
||||
int NHQ200_Config(pNHQ200 *pData, int iTmo, int iRead,
|
||||
int iControl, float fDiv, float fMult);
|
||||
/***** configure some aspects of a NHQ200temperature controller.
|
||||
The parameter are:
|
||||
- a pointer to the data structure for the controller as
|
||||
returned by NHQ200_Open
|
||||
- a value for the connection timeout
|
||||
- the temperature sensor to use for reading the
|
||||
temperature.
|
||||
- the temperature sensor used by the NHQ200controller
|
||||
for regulating the temperature.
|
||||
- the divisor needed to calculate the real temperature
|
||||
from the sensor.
|
||||
The function returns 1 on success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int NHQ200_Send(pNHQ200 *pData, char *pCommand, char *pReply, int iLen);
|
||||
/******* send a the command in pCommand to the NHQ200controller.
|
||||
A possible reply is returned in the buffer pReply.
|
||||
Maximum iLen characters are copied to pReply.
|
||||
The first parameter is a pointer to a NHQ200data structure
|
||||
as returned by NHQ200_Open.
|
||||
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int NHQ200_Read(pNHQ200 *pData, float *fVal);
|
||||
/******* reads the current actual temperature of the sensor
|
||||
configured by ConfigNHQ200for reading. The value is returned
|
||||
in fVal. The first parameter is a pointer to a NHQ200
|
||||
data structure as returned by NHQ200_Open.
|
||||
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
int NHQ200_Set(pNHQ200 *pData, float fVal);
|
||||
/****** sets a new preset temperature in the NHQ200temperature
|
||||
controller. Parameters are:
|
||||
- a pointer to a NHQ200data structure as returned by NHQ200_Open.
|
||||
- the new preset value.
|
||||
|
||||
Return values are 1 for success, a negative error code on
|
||||
failure.
|
||||
*/
|
||||
|
||||
void NHQ200_ErrorTxt(pNHQ200 *pData, int iCode, char *pError, int iLen);
|
||||
/******* translates one of the negative error NHQ200error codes
|
||||
into text. Maximum iLen bytes will be copied to the
|
||||
buffer pError;
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user