From 19bd39eece7fdad71b19b0eb26047a7e421a0f33 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 16 Jun 2020 12:47:06 +0200 Subject: [PATCH] WIP --- .../eigerDetectorServer/FebControl.c | 26 +++++-------------- .../eigerDetectorServer/FebControl.h | 4 +-- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 4677cd1d4..e4bea9475 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -12,11 +12,6 @@ #include #include -char Module_dac_names[16][10] = {"VSvP", "Vtrim", "Vrpreamp", "Vrshaper", - "VSvN", "Vtgstv", "Vcmp_ll", "Vcmp_lr", - "Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb", - "Vcmp_rr", "Vcp", "Vcn", "Vishaper"}; - const unsigned int Feb_Control_leftAddress = 0x100; const unsigned int Feb_Control_rightAddress = 0x200; @@ -505,23 +500,18 @@ float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps, return vmin + (vmax - vmin) * digital / (nsteps - 1); } -int Feb_Control_SetDAC(unsigned int dac_ch, int value) { - return Feb_Control_SendDACValue(Feb_Control_rightAddress, dac_ch, &value); -} - -int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, - unsigned int *value) { - +int Feb_Control_SetDAC(unsigned int ch, int value) { + unsigned int dst_num = Feb_Control_rightAddress; if (ch < 0 || ch > 15) { LOG(logERROR, ("invalid ch for SetDAC.\n")); return 0; } - *value &= 0xfff; + value &= 0xfff; unsigned int dac_ic = (ch < 8) ? 1 : 2; unsigned int dac_ch = ch % 8; unsigned int r = - dac_ic << 30 | 3 << 16 | dac_ch << 12 | *value; // 3 write and power up + dac_ic << 30 | 3 << 16 | dac_ch << 12 | value; // 3 write and power up if (Feb_Control_activated) { if (!Feb_Interface_WriteRegister(dst_num, 0, r, 1, 0)) { @@ -530,12 +520,8 @@ int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, } } - float voltage = Feb_Control_DACToVoltage(*value, 4096, 0, 2048); - - LOG(logINFO, - ("%s set to %d (%.2fmV)\n", Module_dac_names[ch], *value, voltage)); - LOG(logDEBUG1, ("Dac number %d (%s) of dst %d set to %d (%f mV)\n", ch, - Module_dac_names[ch], dst_num, *value, voltage)); + float voltage = Feb_Control_DACToVoltage(value, 4096, 0, 2048); + LOG(logINFO, ("\tset to %d (%.2fmV)\n", value, voltage)); return 1; } diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.h b/slsDetectorServers/eigerDetectorServer/FebControl.h index 2f6cf53ae..86056a2aa 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.h +++ b/slsDetectorServers/eigerDetectorServer/FebControl.h @@ -31,9 +31,7 @@ int Feb_Control_VoltageToDAC(float value, unsigned int *digital, unsigned int nsteps, float vmin, float vmax); float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps, float vmin, float vmax); -int Feb_Control_SetDAC(unsigned int dac_ch, int value); -int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, - unsigned int *value); +int Feb_Control_SetDAC(unsigned int ch, int value); // trimbits int Feb_Control_SetTrimbits(unsigned int *trimbits, int top);