Microchip® Advanced Software Framework

Quick Start Guide for BOD - Basic

In this use case, the BOD33 and BOD12 will be configured with the following settings:

  • Continuous sampling mode
  • Prescaler setting of 2
  • Reset action on low voltage detect

Quick Start

Prerequisites

There are no special setup requirements for this use-case.

Code

Copy-paste the following setup code to your user application:

static void configure_bod33(void)
{
struct bod33_config config_bod33;
bod33_get_config_defaults(&config_bod33);
bod33_set_config(&config_bod33);
}
static void configure_bod12(void)
{
struct bod12_config config_bod12;
bod12_get_config_defaults(&config_bod12);
bod12_set_config(&config_bod12);
}

Add to user application initialization (typically the start of main()):

Workflow

  1. Create a BOD33 module configuration struct, which can be filled out to adjust the configuration of a physical BOD peripheral.
    struct bod33_config config_bod33;
  2. Initialize the BOD33 configuration struct with the module's default values.
    bod33_get_config_defaults(&config_bod33);
    Note
    This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
  3. Configure the BOD33 module with the desired settings.
    bod33_set_config(&config_bod33);
  4. Enable the BOD33 module so that it will monitor the power supply voltage.

The workflow of the BOD12 is the same as for the BOD33.

Use Case

Code

Copy-paste the following code to your user application:

while (true) {
/* Infinite loop */
}

Workflow

  1. Enter an infinite loop so that the BOD can continue to monitor the supply voltage level.
    while (true) {
    /* Infinite loop */
    }