hw functions for the SOLID slow control
Dependents: S_SCTRL_e_test SPItest sscm
DEIMOS32.h@15:2cf8211a3870, 2015-01-29 (annotated)
- Committer:
- wbeaumont
- Date:
- Thu Jan 29 11:02:08 2015 +0000
- Revision:
- 15:2cf8211a3870
- Parent:
- 14:ee02872b282b
- Child:
- 16:6bbb6bb0678a
sthv return DAC value
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wbeaumont | 11:0416cf017b7a | 1 | #ifndef DEIMOS32_H |
wbeaumont | 11:0416cf017b7a | 2 | #define DEIMOS32_H |
wbeaumont | 11:0416cf017b7a | 3 | |
wbeaumont | 14:ee02872b282b | 4 | /* |
wbeaumont | 14:ee02872b282b | 5 | * class related to DEIMOS specific operationt |
wbeaumont | 14:ee02872b282b | 6 | |
wbeaumont | 14:ee02872b282b | 7 | * v0.10 initial development |
wbeaumont | 14:ee02872b282b | 8 | * v1.00 added class, only setHV |
wbeaumont | 15:2cf8211a3870 | 9 | * v1.04 forget to assign DAC channel corrected. |
wbeaumont | 14:ee02872b282b | 10 | |
wbeaumont | 14:ee02872b282b | 11 | */ |
wbeaumont | 14:ee02872b282b | 12 | |
wbeaumont | 14:ee02872b282b | 13 | |
wbeaumont | 14:ee02872b282b | 14 | #include "AD5384.h" |
wbeaumont | 15:2cf8211a3870 | 15 | #define DEIMOSHDRVER 1.06 |
wbeaumont | 11:0416cf017b7a | 16 | |
wbeaumont | 11:0416cf017b7a | 17 | // BIAS channel nr in the layout so have to subtract 1 to control the channel |
wbeaumont | 11:0416cf017b7a | 18 | #define DACBIASCH 39 |
wbeaumont | 11:0416cf017b7a | 19 | // CAL 1 DAC CH |
wbeaumont | 11:0416cf017b7a | 20 | #define DACCAL1CH 33 |
wbeaumont | 11:0416cf017b7a | 21 | #define DACCAL2CH 34 |
wbeaumont | 11:0416cf017b7a | 22 | #define DACCAL3CH 35 |
wbeaumont | 11:0416cf017b7a | 23 | #define DACCAL4CH 36 |
wbeaumont | 11:0416cf017b7a | 24 | |
wbeaumont | 14:ee02872b282b | 25 | #define HVmin 60 |
wbeaumont | 14:ee02872b282b | 26 | #define DVmax 4.5 // max volt out of the DAC |
wbeaumont | 14:ee02872b282b | 27 | class Deimos32 { |
wbeaumont | 14:ee02872b282b | 28 | float HVnom; |
wbeaumont | 14:ee02872b282b | 29 | u32 serialnr; |
wbeaumont | 14:ee02872b282b | 30 | u8 con; |
wbeaumont | 14:ee02872b282b | 31 | AD5384* dac; // |
wbeaumont | 14:ee02872b282b | 32 | public: |
wbeaumont | 14:ee02872b282b | 33 | // init |
wbeaumont | 15:2cf8211a3870 | 34 | // volt the max value of the HV source |
wbeaumont | 15:2cf8211a3870 | 35 | // connectornr : the connector the DEIMOS is connected to |
wbeaumont | 14:ee02872b282b | 36 | // dacdev to witch DAC device the channel is connected |
wbeaumont | 14:ee02872b282b | 37 | Deimos32( float volt, u8 connectornr,AD5384* dacdev ){ |
wbeaumont | 15:2cf8211a3870 | 38 | serialnr=2000; con=connectornr;// real connector nr |
wbeaumont | 15:2cf8211a3870 | 39 | HVnom=volt; |
wbeaumont | 15:2cf8211a3870 | 40 | dac= dacdev; |
wbeaumont | 14:ee02872b282b | 41 | } |
wbeaumont | 14:ee02872b282b | 42 | |
wbeaumont | 15:2cf8211a3870 | 43 | |
wbeaumont | 15:2cf8211a3870 | 44 | float setHV(float volt ,u16& dacvalue ) { |
wbeaumont | 15:2cf8211a3870 | 45 | if (HVnom < HVmin ) return -22; |
wbeaumont | 14:ee02872b282b | 46 | float dv=HVnom-volt; |
wbeaumont | 15:2cf8211a3870 | 47 | if (dv > DVmax || dv < 0 ) return -23; |
wbeaumont | 15:2cf8211a3870 | 48 | dacvalue=dac->set_volt(DACBIASCH , dv); |
wbeaumont | 14:ee02872b282b | 49 | return 0; |
wbeaumont | 14:ee02872b282b | 50 | } |
wbeaumont | 14:ee02872b282b | 51 | float getHv(){ |
wbeaumont | 15:2cf8211a3870 | 52 | if (HVnom < HVmin ) return -22; |
wbeaumont | 15:2cf8211a3870 | 53 | float act_hv=HVnom - dac->get_volt(DACBIASCH); |
wbeaumont | 15:2cf8211a3870 | 54 | return act_hv; |
wbeaumont | 14:ee02872b282b | 55 | } |
wbeaumont | 15:2cf8211a3870 | 56 | float getHvNom(){return HVnom;} |
wbeaumont | 14:ee02872b282b | 57 | }; |
wbeaumont | 11:0416cf017b7a | 58 | #endif |