B&B Electronics Asynchronous to Synchronous Converter 2010 Uživatelský manuál Strana 26

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 43
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 25
Department of Computer Science and Electronics
26
Then, the Atmega16 calculates the average of all the values read when the
sensor is above the field, i.e. the average of all the values bigger than xprima. The same
calculation is taking place when the sensor is above a white line, i.e. the average of all
the values that are smaller than xprima. After that, the two values obtained are half-
summed obtaining a closer result to the optimal threshold value.
Below follows the algorithm that calculates the 8 sensors’ threshold.
For (1000 steps)(1000 samples) do:
Watchdog reset
For (8 steps)(for 8 sensors) do:
Read analog data
If(data read bigger than max) do:
Max=data
End if
If (data read smaller that min)do:
Min=data
End if
Xprima=(max+min)/2
End for
Delay 50m sec.
End for
Figure 4-10. X prima calcule
Zobrazit stránku 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 42 43

Komentáře k této Příručce

Žádné komentáře