This COMATOS implementation of the DMC contains three tasks:

1. Keyboard Task: This task runs every 30ms. It contains a state machine that consists of 4 states (No Push, Maybe Push, Pushed, Debounce Press). If the key is pressed this task sends a message to Measurement Task in order to initiate the process.

2. Measurement Task: When the message is received from the keyboard task, the keyboard task will hold in Debounce Press state until an acknowledge bit is sent from the display task. The measurement task first discharges the capacitor by setting PortB Pin2 to 0. It runs 25ms later to begin charging, and the timer will start counting as well. When the task is complete, it will send a message to Display Task for initiation.

3. Display Task: This Task formats the capacitance value and displays it thru UART.

Previous Next