I am having quite a problem using a silabs 8051F120 micro.
void DAC_Init() { SFRPAGE = DAC0_PAGE; DAC0CN = 0x84; SFRPAGE = DAC1_PAGE; DAC1CN = 0x00; }
As can be seen above I am using two DAC's one of which on SFR page '0' and the other on SFR page '1'. I am working on a live system using the silabs debug adapter and running Keil version 9.05. When I write to DAC0 (i.e. DAC0H) it seems that it writes to both DAC0H as well as DAC1H, furthermore when I write to DAC1H nothing happens.
I understand that DAC0 uses sfr page '0' and that DAC1 uses sfr page '1'
if((current_speed + acceleration) <= max_speed) { current_speed += acceleration; SFRPAGE = DAC1_PAGE; DAC1L = 0; SFRPAGE = DAC1_PAGE; DAC1H = current_speed; SFRPAGE = LEGACY_PAGE; if(current_speed == max_speed) { return(1); } } if((current_speed_2 + acceleration_2) <= max_speed_2) { current_speed_2 += acceleration_2; DAC0L = 0; DAC0H = current_speed_2; if(current_speed_2 == max_speed_2) { return(1); } }
Above is a snippet of the code, the top part will not work for some reason. While "current_speed" changes it does not write into DAC1H.
#define DAC0_PAGE 0x00 /* DAC 0 */ #define DAC1_PAGE 0x01 /* DAC 1 */
Any help is appeciated
Regrads John Garrelts
Note that, taking the names literally, this is dimensionally inconsistent!
Perhaps the names could have been better chosen...?