Microchip® Advanced Software Framework

oven_controller.h File Reference

Class B Oven controller.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Functions

void ovenctl_execute_control_step (uint32_t time, uint8_t *wattage, bool *power, enum pot_t potstate)
 Execute oven control step. More...
 
uint16_t ovenctl_get_plate_temperature (void)
 Reads a 16-bit analog value on ADC channel 0 and returns it. More...
 

void ovenctl_execute_control_step ( uint32_t  time,
uint8_t *  wattage,
bool power,
enum pot_t  potstate 
)

Execute oven control step.

This function takes information from the user interface, temperature sensor and plate (QTouch) sensing and controls the output to the induction elements via a frequency signal.

The oven has three states:

  • POWER_OFF where we just wait for input from the user interface to turn on.
  • ON_NO_POT where the user has indicated that power should be applied, but there is no pot in the plate. A safety timer changes the state back to POWER_OFF.
  • ON_ACTUATING where we have a pot on the oven, and actuate the induction elements while waiting for user input, and check if there is a pot on the oven.
Parameters
timeCurrent system time in milliseconds.
*wattagePointer to the variable representing the desired effect
*powerPointer to the variable controlling whether the induction coils should be actuated.
potstateA variable representing the latest information on whether anything is present on the plate (QTouch sensor)

References ON_ACTUATING, ON_NO_POT, ovenctl_actuate_induction_element(), ovenctl_turn_off_plate(), ovenctl_turn_on_plate(), POT_OFF, POT_ON, POWER_OFF, and rtc_get_time().

Referenced by main().

uint16_t ovenctl_get_plate_temperature ( void  )

Reads a 16-bit analog value on ADC channel 0 and returns it.

In this application CH0 is set up to read the analog voltage from a simulated thermometer.

Returns
Temperature of the induction element.

References ADC_CH0, adc_get_unsigned_result(), adc_start_conversion(), and adc_wait_for_interrupt_flag().

Referenced by main_execute_simulation_step(), and ovenctl_periodic_temperature_sanity_check().