![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
firmware for the SOLID Slow Control Module for SM1
Dependencies: S_SCTRL_SMlib adc_ad9249 mbed sscm_comm AD5384 SWSPI T_adt7320
Diff: main.cpp
- Revision:
- 11:b1e6d7c18790
- Parent:
- 10:efd3f490648c
- Child:
- 12:54b96bf7b291
--- a/main.cpp Tue Jan 20 16:00:27 2015 +0000 +++ b/main.cpp Thu Jan 29 11:04:59 2015 +0000 @@ -30,9 +30,10 @@ * v 1.78 canged the place of cmd read to the end of the mail loop was at the start * v 1.79 added hv stet /get string to replace bi(ias) old commands are still working * wait only if cmd is not ready + * v 1.86 corrected dac assignment in DEIMOS32 class , correced gain factor in dac AD5384 class */ -#define VERSION "1.79" +#define VERSION "1.89" #include "SWSPI_BI.h" @@ -183,7 +184,7 @@ if(cmd.con > 2) {cmd.status=101;goto DACENDCMD;} if( deimos[cmd.con-1] ) {cmd.status=102;goto DACENDCMD;} // if already init don't init again. float hvnom=u162float( cmd.dataout , cmd.datain); - deimos[cmd.con-1]= new Deimos32(hvnom ,cmd.con-1,&dac[cmd.con-1][cmd.devnr-1]); + deimos[cmd.con-1]= new Deimos32(hvnom ,cmd.con,&dac[cmd.con-1][cmd.devnr-1]); cmd.status=0;goto DACENDCMD; } if ((!strcmp( cmd.cmd, "sbia")) || (!strcmp( cmd.cmd, "sthv")) ) { @@ -193,15 +194,21 @@ if (cmd.con ==2) strtcnt=1; // else it is assumed to be 9 float retvalue=0; for ( u8 bcnt=strtcnt ; bcnt < stpcnt; bcnt++) { - if ( ! deimos[bcnt]) retvalue=200; - else retvalue+=-deimos[bcnt]->setHV(biasvolt); + u16 dacvalue; + if ( ! deimos[bcnt]) retvalue=200; + else { + retvalue+=-deimos[bcnt]->setHV(biasvolt,dacvalue); + cmd.datain=0; cmd.dataout=dacvalue; + } } cmd.status=u8(retvalue);goto DACENDCMD; } - if ((!strcmp( cmd.cmd, "gbia")) || (!strcmp( cmd.cmd, "gthv"))) { + if ((!strcmp( cmd.cmd, "gbia")) || (!strcmp( cmd.cmd, "gthv")) || (!strcmp( cmd.cmd, "gthn")) ) { if ( cmd.con ==0 ) cmd.con=1; if (deimos[cmd.con-1]) { - float volt=deimos[cmd.con-1]->getHv(); + float volt; + if (!strcmp( cmd.cmd, "gthn")) volt=deimos[cmd.con-1]->getHvNom(); + else volt=deimos[cmd.con-1]->getHv(); float2_2u16( volt , cmd.dataout , cmd.datain); cmd.status=0; }