Firmware  0.0.0
Loading...
Searching...
No Matches
Analog

This module takes over all analog functions of the firmware. This includes measuring track voltage and current, measuring temperature, and monitoring all of those measurements.

Initialization

Initialization takes place in init(). This function performs the following operations:

  • Creates queues for raw voltage and current vales as well as temperatures in Si units
  • Initializes the ADC in continuous mode and applies a curve fitting calibration
  • Initializes the internal temperature sensor
  • Creates an ADC and temperature task

ADC task

Once started, the ADC task runs continuously. It measures voltages and currents at a frequency of 8kHz. A total of 160 samples are recorded within one conversion frame meaning one frame lasts exactly 20ms. All measurements are written to the corresponding voltages or currents queue.

If the measured currents indicate a short circuit, the bug LED is switched, state is set to short circuit and a Z21 track short circuit message is broadcast.

Temperature task

Once started, the temperature task runs continuously. The internal temperature sensor is read once per second and the result is converted into degrees Celsius. The result is written to the corresponding queue.

Conversions

The convert.hpp header provides some conversion functions to convert between raw ADC values ​​and Si units. The following functions are defined:

Previous Next
API Reference DCC