Microchip® Advanced Software Framework

Quick Start Guide for CCL - Basic

In this use case, the LUT0 and LUT1 input source is configured as I/O pin.

The LUT0 and LUT1 pair is connected to internal sequential logic, which is configured as D flip flop mode.

Setup

Prerequisites

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

Code

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

void configure_ccl(void)
{
struct ccl_config conf;
ccl_init(&conf);
}
{
struct ccl_lut_config conf;
conf.truth_table_value = 0x02;
conf.input0_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.input1_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.input2_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.filter_sel = CCL_LUTCTRL_FILTSEL_FILTER;
struct system_pinmux_config lut0_input_pin0_conf, lut0_input_pin1_conf, lut0_input_pin2_conf;
system_pinmux_get_config_defaults(&lut0_input_pin0_conf);
system_pinmux_get_config_defaults(&lut0_input_pin1_conf);
system_pinmux_get_config_defaults(&lut0_input_pin2_conf);
lut0_input_pin0_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut0_input_pin0_conf.mux_position = CCL_LUT0_IN0_MUX;
lut0_input_pin1_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut0_input_pin1_conf.mux_position = CCL_LUT0_IN1_MUX;
lut0_input_pin2_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut0_input_pin2_conf.mux_position = CCL_LUT0_IN2_MUX;
system_pinmux_pin_set_config(CCL_LUT0_IN0_PIN, &lut0_input_pin0_conf);
system_pinmux_pin_set_config(CCL_LUT0_IN1_PIN, &lut0_input_pin1_conf);
system_pinmux_pin_set_config(CCL_LUT0_IN2_PIN, &lut0_input_pin2_conf);
struct system_pinmux_config lut0_out_pin_conf;
system_pinmux_get_config_defaults(&lut0_out_pin_conf);
lut0_out_pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT;
lut0_out_pin_conf.mux_position = CCL_LUT0_OUT_MUX;
system_pinmux_pin_set_config(CCL_LUT0_OUT_PIN, &lut0_out_pin_conf);
}
{
struct ccl_lut_config conf;
conf.truth_table_value = 0x02;
conf.input0_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.input1_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.input2_src_sel = CCL_LUT_INPUT_SRC_IO;
conf.filter_sel = CCL_LUTCTRL_FILTSEL_FILTER;
struct system_pinmux_config lut1_input_pin0_conf, lut1_input_pin1_conf, lut1_input_pin2_conf;
system_pinmux_get_config_defaults(&lut1_input_pin0_conf);
system_pinmux_get_config_defaults(&lut1_input_pin1_conf);
system_pinmux_get_config_defaults(&lut1_input_pin2_conf);
lut1_input_pin0_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut1_input_pin0_conf.mux_position = CCL_LUT1_IN0_MUX;
lut1_input_pin1_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut1_input_pin1_conf.mux_position = CCL_LUT1_IN1_MUX;
lut1_input_pin2_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
lut1_input_pin2_conf.mux_position = CCL_LUT1_IN2_MUX;
system_pinmux_pin_set_config(CCL_LUT1_IN0_PIN, &lut1_input_pin0_conf);
system_pinmux_pin_set_config(CCL_LUT1_IN1_PIN, &lut1_input_pin1_conf);
system_pinmux_pin_set_config(CCL_LUT1_IN2_MUX, &lut1_input_pin2_conf);
struct system_pinmux_config lut1_out_pin_conf;
system_pinmux_get_config_defaults(&lut1_out_pin_conf);
lut1_out_pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT;
lut1_out_pin_conf.mux_position = CCL_LUT1_OUT_MUX;
system_pinmux_pin_set_config(CCL_LUT1_OUT_PIN, &lut1_out_pin_conf);
}

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

Workflow

  1. Creates a CCL configuration struct, which can be filled out to adjust the configuration of CCL.
    struct ccl_config conf;
  2. Settings and fill the CCL configuration struct with the default settings.
  3. Initializes CCL module.
    ccl_init(&conf);
  4. Creates a LUT configuration struct, which can be filled out to adjust the configuration of LUT0.
    struct ccl_lut_config conf;
    1. Fill the LUT0 configuration struct with the default settings.
  5. Adjust the LUT0 configuration struct.
    conf.truth_table_value = 0x02;
    conf.input0_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.input1_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.input2_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.filter_sel = CCL_LUTCTRL_FILTSEL_FILTER;
  6. Set up LUT0 input and output pin.
    struct system_pinmux_config lut0_input_pin0_conf, lut0_input_pin1_conf, lut0_input_pin2_conf;
    system_pinmux_get_config_defaults(&lut0_input_pin0_conf);
    system_pinmux_get_config_defaults(&lut0_input_pin1_conf);
    system_pinmux_get_config_defaults(&lut0_input_pin2_conf);
    lut0_input_pin0_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut0_input_pin0_conf.mux_position = CCL_LUT0_IN0_MUX;
    lut0_input_pin1_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut0_input_pin1_conf.mux_position = CCL_LUT0_IN1_MUX;
    lut0_input_pin2_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut0_input_pin2_conf.mux_position = CCL_LUT0_IN2_MUX;
    system_pinmux_pin_set_config(CCL_LUT0_IN0_PIN, &lut0_input_pin0_conf);
    system_pinmux_pin_set_config(CCL_LUT0_IN1_PIN, &lut0_input_pin1_conf);
    system_pinmux_pin_set_config(CCL_LUT0_IN2_PIN, &lut0_input_pin2_conf);
    struct system_pinmux_config lut0_out_pin_conf;
    system_pinmux_get_config_defaults(&lut0_out_pin_conf);
    lut0_out_pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT;
    lut0_out_pin_conf.mux_position = CCL_LUT0_OUT_MUX;
    system_pinmux_pin_set_config(CCL_LUT0_OUT_PIN, &lut0_out_pin_conf);
  7. Writes LUT0 configuration to the hardware module.
  8. Creates a LUT configuration struct, which can be filled out to adjust the configuration of LUT1.
    struct ccl_lut_config conf;
    1. Fill the LUT1 configuration struct with the default settings.
  9. Adjust the LUT1 configuration struct.
    conf.truth_table_value = 0x02;
    conf.input0_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.input1_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.input2_src_sel = CCL_LUT_INPUT_SRC_IO;
    conf.filter_sel = CCL_LUTCTRL_FILTSEL_FILTER;
  10. Set up LUT1 input and output pin.
    struct system_pinmux_config lut1_input_pin0_conf, lut1_input_pin1_conf, lut1_input_pin2_conf;
    system_pinmux_get_config_defaults(&lut1_input_pin0_conf);
    system_pinmux_get_config_defaults(&lut1_input_pin1_conf);
    system_pinmux_get_config_defaults(&lut1_input_pin2_conf);
    lut1_input_pin0_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut1_input_pin0_conf.mux_position = CCL_LUT1_IN0_MUX;
    lut1_input_pin1_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut1_input_pin1_conf.mux_position = CCL_LUT1_IN1_MUX;
    lut1_input_pin2_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT;
    lut1_input_pin2_conf.mux_position = CCL_LUT1_IN2_MUX;
    system_pinmux_pin_set_config(CCL_LUT1_IN0_PIN, &lut1_input_pin0_conf);
    system_pinmux_pin_set_config(CCL_LUT1_IN1_PIN, &lut1_input_pin1_conf);
    system_pinmux_pin_set_config(CCL_LUT1_IN2_MUX, &lut1_input_pin2_conf);
    struct system_pinmux_config lut1_out_pin_conf;
    system_pinmux_get_config_defaults(&lut1_out_pin_conf);
    lut1_out_pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT;
    lut1_out_pin_conf.mux_position = CCL_LUT1_OUT_MUX;
    system_pinmux_pin_set_config(CCL_LUT1_OUT_PIN, &lut1_out_pin_conf);
  11. Writes LUT1 configuration to the hardware module.
  12. Configure the sequential logic with the D flip flop mode.

Use Case

Code

Copy-paste the following code to your user application:

while (true) {
/* Do nothing */
}