![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test program to test / develop the SOLID slow control
Dependencies: AD5384 SWSPI S25FL216K S_SCTRL_SMlib T_adt7320 adc_ad9249 sscm_comm mbed
Diff: main.cpp
- Revision:
- 3:8b181fe62a39
- Parent:
- 2:51bbbc3fc8c2
diff -r 51bbbc3fc8c2 -r 8b181fe62a39 main.cpp --- a/main.cpp Mon Oct 06 11:02:10 2014 +0000 +++ b/main.cpp Wed Oct 08 11:16:21 2014 +0000 @@ -9,7 +9,7 @@ #include "S_SCTRL_SM1_PinDef.h" #include "S_SCTRL_SM1_hwfunct.h" -#define VERSION "1.23" +#define VERSION "1.41" #define DEBUGPF(x) printf((x)); // pin function pin id @@ -47,8 +47,7 @@ AD9249 adc[2][2]={AD9249( &spi_adc,hwl.csb1[0]), AD9249( &spi_adc,hwl.csb2[0]), AD9249( &spi_adc2,hwl.csb1[1]), AD9249 ( &spi_adc2,hwl.csb2[1])}; - AD5384 dac[2]={AD5384(&spi,hwl.dac_cs[0]), AD5384(&spi2,hwl.dac_cs[1]) }; - + AD5384 dac[2][1]={AD5384(&spi,hwl.dac_cs[0],hwl.dac_rst[0]), AD5384(&spi2,hwl.dac_cs[1],hwl.dac_rst[1]) }; adt7320 temp[2][3]= { adt7320(&spi, hwl.t_cs[0]),adt7320(&spi, hwl.tc_cs1[0]),adt7320(&spi, hwl.tc_cs2[0]), adt7320(&spi2, hwl.t_cs[1]),adt7320(&spi2, hwl.tc_cs1[1]),adt7320(&spi2, hwl.tc_cs2[1]) }; //float humi; @@ -76,7 +75,7 @@ }*/ // init parts for (u8 cc= conls; cc < conle ; cc++) { - if( testDAC) { dac[cc].init1(); + if( testDAC) { dac[cc][0].init1(); } } @@ -99,16 +98,21 @@ } if( testDAC ) { u16 dataread,dr2; - u8 ch = count%32; + u8 ch = count%39; + float value=2.742; // count%16383; u16 gain=(count)%16383;//0x1235; //dataread=dac[cc].set_volt(ch,value); - dr2=dac[cc].set_dac(ch,gain); + dr2=dac[cc][0].set_dac(ch,gain); wait(0.001); - dataread=dac[cc].get_dac(ch); - printf("ch %02X offset set to %04X ",ch,dr2); - printf("readback %04X",dataread); - dataread=dac[cc].get_ctrl(); + dataread=dac[cc][0].get_dac(ch); + printf("ch %02X dac %04X ",ch,dr2); + printf("rb %04X ",dataread); + dataread=dac[cc][0].get_offset(ch); + dr2=dac[cc][0].get_gain(ch); + printf("gain %04X ",dr2); + printf("offset %04X",dataread); + dataread=dac[cc][0].get_ctrl(); printf(" cntrl %04X\n\r",dataread); } if( testTEMP) {