fixed temperature for jungfrau in server, also for negative values

This commit is contained in:
Dhanya Maliakal 2017-07-06 16:07:01 +02:00
parent 1e50bc4cc0
commit be6925c504
6 changed files with 32 additions and 11 deletions

View File

@ -17,6 +17,7 @@ boot: $(OBJS)
$(PROGS): $(OBJS) $(PROGS): $(OBJS)
# echo $(OBJS) # echo $(OBJS)
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;` @echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
$(CC) $(CFLAGS) -c -o slsDetectorFunctionList.o slsDetectorFunctionList.c
mkdir -p $(DESTDIR) mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR) mv $(PROGS) $(DESTDIR)

View File

@ -83,7 +83,13 @@
#define GET_PERIOD_MSB_REG (0x19 << 11) #define GET_PERIOD_MSB_REG (0x19 << 11)
/** Get Temperature Carlos, incorrectl as get gates */ /** Get Temperature Carlos, incorrectl as get gates */
#define GET_TEMPERATURE_TMP112_REG (0x1c << 11) // in 10ths of millidegrees of TMP112 #define GET_TEMPERATURE_TMP112_REG (0x1c << 11) // (after multiplying by 625) in 10ths of millidegrees of TMP112
#define TEMPERATURE_POLARITY_BIT (15)
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
#define TEMPERATURE_VALUE_BIT (0)
#define TEMPERATURE_VALUE_MSK (0x00007FFF << TEMPERATURE_VALUE_BIT)
/* Get Frames from Start 64 bit register (frames from start Run Control) */ /* Get Frames from Start 64 bit register (frames from start Run Control) */
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << 11) #define FRAMES_FROM_START_PG_LSB_REG (0x24 << 11)

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 94d2b8cd58bbf69d26f491b7b81e2b269aac32b9 Repsitory UUID: ac8afb3a4dc53ac14f7034d281acc8f0a700ca8d
Revision: 83 Revision: 87
Branch: developer Branch: developer
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 1427 Last Changed Rev: 1442
Last Changed Date: 2017-06-28 10:27:40 +0200 Last Changed Date: 2017-07-03 17:44:52 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "94d2b8cd58bbf69d26f491b7b81e2b269aac32b9" #define SVNREPUUID "ac8afb3a4dc53ac14f7034d281acc8f0a700ca8d"
//#define SVNREV 0x1427 //#define SVNREV 0x1442
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x1427 #define SVNREV 0x1442
#define SVNDATE 0x20170628 #define SVNDATE 0x20170703
// //

View File

@ -841,8 +841,22 @@ int getADC(enum ADCINDEX ind, int imod){
char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"}; char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"};
printf("Getting Temperature for %s\n",tempnames[ind]); printf("Getting Temperature for %s\n",tempnames[ind]);
u_int32_t addr = GET_TEMPERATURE_TMP112_REG; u_int32_t addr = GET_TEMPERATURE_TMP112_REG;
int retval = bus_r(addr)/10; uint32_t regvalue = bus_r(addr);
printf("\nReal Temperature %s: %f °C\n",tempnames[ind],(double)retval/1000.00); uint32_t value = regvalue & TEMPERATURE_VALUE_MSK;
double retval = value;
// negative
if (regvalue & TEMPERATURE_POLARITY_MSK) {
// 2s complement
int ret = (~value) + 1;
// attach negative sign
ret = 0 - value;
retval = ret;
}
// conversion
retval *= 625.0/10.0;
printf("\nReal Temperature %s: %f °C\n",tempnames[ind],retval/1000.00);
return retval; return retval;
} }