Guest User

Untitled

a guest
Jan 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. void init()
  2. {  
  3.     //calib clock @ 8MHz
  4.     uint8_t osccal_data = pgm_read_byte(CLK_CALIB_DATA);
  5.     if (osccal_data != 0xff) OSCCAL = osccal_data;
  6.  
  7.     //adc
  8.     a2dInit();
  9.    
  10.     fSnd = 0;
  11.     fReset = 0;
  12.  
  13.     //port
  14.     DDRB = 0xff;
  15.     DDRD = 0xff;
  16.  
  17.  
  18.     return;
  19. }
  20.  
  21. void calib_adc(void)
  22. {
  23.     uint8_t i;
  24.     uint16_t sval = 0;
  25.    
  26.     for (i=0; i<100; i++){
  27.         sval += a2dConvert8bit(ADC_CH_ADC0);
  28.     }
  29.  
  30.     adc_zero = sval / 100;
  31.     //PRINT(" adczero = %x\n", adc_zero);
  32.     wait = 303;
  33.  
  34.     return;
  35. }
Add Comment
Please, Sign In to add comment