hw functions for the SOLID slow control
Dependents: S_SCTRL_e_test SPItest sscm
Diff: DEIMOS32.h
- Revision:
- 15:2cf8211a3870
- Parent:
- 14:ee02872b282b
- Child:
- 16:6bbb6bb0678a
diff -r ee02872b282b -r 2cf8211a3870 DEIMOS32.h --- a/DEIMOS32.h Sun Dec 07 22:38:07 2014 +0000 +++ b/DEIMOS32.h Thu Jan 29 11:02:08 2015 +0000 @@ -6,12 +6,13 @@ * v0.10 initial development * v1.00 added class, only setHV + * v1.04 forget to assign DAC channel corrected. */ #include "AD5384.h" -#define DEIMOSHDRVER 1.00 +#define DEIMOSHDRVER 1.06 // BIAS channel nr in the layout so have to subtract 1 to control the channel #define DACBIASCH 39 @@ -30,25 +31,28 @@ AD5384* dac; // public: // init - // volt the value of the HV source - // connectornr : the connector the DEIMOS is conneted to + // volt the max value of the HV source + // connectornr : the connector the DEIMOS is connected to // dacdev to witch DAC device the channel is connected Deimos32( float volt, u8 connectornr,AD5384* dacdev ){ - serialnr=2000; con=connectornr; - HVnom=volt; // can not be initialized now because need two parameters for the command + serialnr=2000; con=connectornr;// real connector nr + HVnom=volt; + dac= dacdev; } - float setHV(float volt) { - if (HVnom < HVmin ) return -2; + + float setHV(float volt ,u16& dacvalue ) { + if (HVnom < HVmin ) return -22; float dv=HVnom-volt; - if (dv > DVmax || dv < 0 ) return -3; - dac->set_volt(DACBIASCH , dv); + if (dv > DVmax || dv < 0 ) return -23; + dacvalue=dac->set_volt(DACBIASCH , dv); return 0; } float getHv(){ - if (HVnom < HVmin ) return -2; - return HVnom - dac->get_volt(DACBIASCH); + if (HVnom < HVmin ) return -22; + float act_hv=HVnom - dac->get_volt(DACBIASCH); + return act_hv; } - + float getHvNom(){return HVnom;} }; #endif \ No newline at end of file