ATD Example

  • strict warning: Only variables should be passed by reference in /homepages/26/d141797381/htdocs/drupal-6.38/sites/all/modules/webfm/webfm.module on line 2409.
  • strict warning: Only variables should be passed by reference in /homepages/26/d141797381/htdocs/drupal-6.38/sites/all/modules/webfm/webfm.module on line 2409.
  • strict warning: Only variables should be passed by reference in /homepages/26/d141797381/htdocs/drupal-6.38/sites/all/modules/webfm/webfm.module on line 2409.
  • strict warning: Only variables should be passed by reference in /homepages/26/d141797381/htdocs/drupal-6.38/sites/all/modules/webfm/webfm.module on line 2409.

This implementation of the S12ATD10B8C module is suitable for a system requiring a single ATD channel only. Reads automatically kick off a new sequence of eight conversions of the defined channel with the result being the average of those eight conversions. The maximum rate for updated data is approximately 20KHz. The defines within the c file may conflict with the header file for your 9s12 variant. Typical test:

// Note: printf is user defined
void main(void) { 
  int cur_data, prev_data; 
  atdStart(); 
  while(1) { 
    if(atdRead(&cur_data) == ATD_SUCCESS) { 
      if(cur_data != prev_data) {         
        printf("atd:0x%02x\r",cur_data);
        prev_data = cur_data; 
      }
    } 
  } 
}

AttachmentSize
[file] atd.c6.95 KB
[file] atd.h1020 bytes