B&B Electronics Asynchronous to Synchronous Converter 2010 Manual do Utilizador Página 26

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 43
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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
Vista de página 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 42 43

Comentários a estes Manuais

Sem comentários