wimbeaumont Project / S_SCTRL_SMlib

Dependents:   S_SCTRL_e_test SPItest sscm

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DEIMOS32.h Source File

DEIMOS32.h

00001 #ifndef DEIMOS32_H
00002 #define DEIMOS32_H
00003 
00004 /*
00005  * class related to DEIMOS specific operationt
00006      
00007  * v0.10  initial development 
00008  * v1.00  added  class, only setHV 
00009  * v1.04  forget to assign DAC channel corrected. 
00010   *
00011  * (C) Wim Beaumont Univeristeit Antwerpen  2014 , 2015
00012 */ 
00013 
00014 
00015 #include "AD5384.h"
00016 #define DEIMOSHDRVER 1.06
00017 
00018 // BIAS channel nr in the layout so have to subtract 1 to control the channel
00019 #define  DACBIASCH  39 
00020 // CAL 1  DAC CH
00021 #define  DACCAL1CH  33
00022 #define  DACCAL2CH  34
00023 #define  DACCAL3CH  35
00024 #define  DACCAL4CH  36
00025 
00026 #define HVmin 60   
00027 #define DVmax 4.5  // max volt out of the DAC 
00028 class Deimos32  {
00029     float HVnom;
00030     u32 serialnr;
00031     u8 con;
00032     AD5384* dac; // 
00033     public:
00034         // init
00035         // volt  the max value of the HV source 
00036         // connectornr : the connector the DEIMOS is connected to
00037         // dacdev to witch DAC device the channel is connected 
00038         Deimos32( float volt, u8 connectornr,AD5384* dacdev  ){        
00039             serialnr=2000; con=connectornr;// real connector nr 
00040             HVnom=volt; 
00041             dac= dacdev;        
00042         }
00043         
00044         
00045         float   setHV(float volt ,u16&  dacvalue ) {
00046             if (HVnom < HVmin ) return -22;
00047             float dv=HVnom-volt;
00048             if (dv > DVmax  || dv < 0  ) return -23;
00049             dacvalue=dac->set_volt(DACBIASCH , dv);
00050             return 0;
00051         } 
00052         float getHv(){
00053             if (HVnom < HVmin ) return -22;
00054             float act_hv=HVnom - dac->get_volt(DACBIASCH);
00055             return act_hv;
00056         }
00057         float getHvNom(){return HVnom;} 
00058     };
00059 #endif