Example #1
0
/* Update analog differential voltage output to servo */
void mctrl_update(void) {
    data = pid_output() & 0x0FFF;
    
    DACpreloadA(data);                  // Preload data into DAC channel A internal register
    DACloadBshiftA( (4096 - data) );    // Load data into DAC channel B and output it; load in preloaded channel A data and output it
    
}
Example #2
0
/* Update analog differential voltage output to servo */
void mctrl_update(void) {
    unsigned int volatile data;
    
    data = (pid_output() + MAX_12BIT/2) & 0x0FFF;
    
    DACpreloadA(data);                  // Preload data into DAC channel A internal register
    DACloadBshiftA( (MAX_12BIT - data) );    // Load data into DAC channel B and output it; load in preloaded channel A data and output it
    
}