mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
highvoltage again
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@59 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -889,25 +889,36 @@ float getTemperature(int tempSensor, int imod){
|
|||||||
|
|
||||||
int getHighVoltage(int val, int imod){
|
int getHighVoltage(int val, int imod){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Getting High Voltage of module:%d\n",imod);
|
printf("Setting/Getting High Voltage of module:%d with val:%d\n",imod,val);
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t addr=HV_REG;
|
volatile u_int32_t addr=HV_REG;
|
||||||
|
int loop;
|
||||||
|
int found=0;
|
||||||
int input []={ 0, 90,110,120,150,180,200};
|
int input []={ 0, 90,110,120,150,180,200};
|
||||||
int value1[]={0x0,0x0,0x2,0x4,0x6,0x8,0xA};
|
int value1[]={0x0,0x0,0x2,0x4,0x6,0x8,0xA};
|
||||||
int value2[]={0x0,0x1,0x3,0x5,0x7,0x9,0xB};
|
int value2[]={0x0,0x1,0x3,0x5,0x7,0x9,0xB};
|
||||||
//changing anything here should also be changed in
|
if(val!=-1)
|
||||||
//server_funcs.c to check if wrongly written
|
{
|
||||||
switch(val){
|
for(loop=0;loop<7;loop++)
|
||||||
case -1: break;
|
if(val==input[loop]) {
|
||||||
case 0: bus_w(addr,0x0); break;
|
found=1;
|
||||||
case 90: bus_w(addr,0x0); bus_w(addr,0x1); break;
|
#ifdef VERBOSE
|
||||||
case 110: bus_w(addr,0x2); bus_w(addr,0x3); break;
|
printf("Value sent for val:%d is %d and then %d\n",val,value1[loop],value2[loop]);
|
||||||
case 120: bus_w(addr,0x4); bus_w(addr,0x5); break;
|
#endif
|
||||||
case 150: bus_w(addr,0x6); bus_w(addr,0x7); break;
|
bus_w(addr,value1[loop]);
|
||||||
case 180: bus_w(addr,0x8); bus_w(addr,0x9); break;
|
bus_w(addr,value2[loop]);
|
||||||
case 200: bus_w(addr,0xA); bus_w(addr,0xB); break;
|
val=bus_r(addr);
|
||||||
default : printf("Not a valid voltage\n"); return -1; break;
|
if(val!=value2[loop])
|
||||||
}
|
{
|
||||||
|
printf("Error setting high voltage:Value read is %d\n",val);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found){
|
||||||
|
printf("Not a valid voltage\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
val=bus_r(addr);
|
val=bus_r(addr);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("High Voltage of module:%d is %d\n",imod,val);
|
printf("High Voltage of module:%d is %d\n",imod,val);
|
||||||
|
@ -878,8 +878,10 @@ int set_dac(int fnum) {
|
|||||||
printf("DAC/TEMP/HV set to %f V\n", retval);
|
printf("DAC/TEMP/HV set to %f V\n", retval);
|
||||||
#endif
|
#endif
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
if((itemp==HIGH_VOLTAGE)&&(retval!=-1))
|
if (itemp==HIGH_VOLTAGE){
|
||||||
ret =OK;
|
if (retval!=-1)
|
||||||
|
ret=OK;
|
||||||
|
}
|
||||||
else if (retval==val || val==-1)
|
else if (retval==val || val==-1)
|
||||||
ret=OK;
|
ret=OK;
|
||||||
|
|
||||||
@ -887,7 +889,7 @@ int set_dac(int fnum) {
|
|||||||
printf("Setting dac/hv %d of module %d: wrote %f but read %f\n", ind, imod, val, retval);
|
printf("Setting dac/hv %d of module %d: wrote %f but read %f\n", ind, imod, val, retval);
|
||||||
|
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(&ret,sizeof(ret));
|
n = sendDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
|
Reference in New Issue
Block a user