Subversion Repositories BL-Ctrl

Rev

Rev 1 | Rev 51 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 50
Line 36... Line 36...
36
  if (Strom_max < Strom) Strom_max = Strom;
36
  if (Strom_max < Strom) Strom_max = Strom;
37
  ADCSRA = 0x00;  
37
  ADCSRA = 0x00;  
38
  SFIOR = 0x08;  // Analog Comperator ein
38
  SFIOR = 0x08;  // Analog Comperator ein
39
}
39
}
Line -... Line 40...
-
 
40
 
-
 
41
 
-
 
42
//############################################################################
-
 
43
//Strom Analogwerte lesen
-
 
44
void FastADConvert(void)
-
 
45
//############################################################################
-
 
46
{
-
 
47
 unsigned int i=0;  
-
 
48
 unsigned char sense;
-
 
49
  sense = ADMUX;   // Sense-Kanal merken
-
 
50
  ADMUX  =  0x06;  // Kanal 6
-
 
51
  SFIOR  =  0x00;  // Analog Comperator aus
-
 
52
  ADCSRA =  0xD3;  // Converter ein, single
-
 
53
  ADCSRA |= 0x10;  // Ready löschen
-
 
54
  ADMUX  =  0x06;  // Kanal 6
-
 
55
  ADCSRA |= 0x40;  // Start
-
 
56
  while (((ADCSRA & 0x10) == 0));
-
 
57
  ADMUX = sense;   // zurück auf den Sense-Kanal
-
 
58
  i = ADCW * 4;
-
 
59
  if(i > 200) i = 200;
-
 
60
  Strom = i;//(i + Strom * 1) / 2; 
-
 
61
  if (Strom_max < Strom) Strom_max = Strom;
-
 
62
  ADCSRA = 0x00;  
-
 
63
  SFIOR = 0x08;  // Analog Comperator ein