Microchip® Advanced Software Framework

acc_example.c File Reference

Analog Comparator Controller (ACC) example for SAM.

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

#include <asf.h>
#include <stdio_serial.h>
#include <conf_board.h>
#include <conf_clock.h>

Macros

#define ADC_CLOCK   6400000
 The ADC Clock value. More...
 
#define ADC_STARTUP_TIME_SETTING   0x8u
 The ADC Start Up Time value. More...
 
#define ADC_TRACK_SETTING   0x0u
 The ADC Start Up Time value. More...
 
#define ADC_TRANSFER_SETTING   0x1u
 The ADC Start Up Time value. More...
 
#define DACC_ANALOG_CONTROL
 Analog control value. More...
 
#define DACC_CHANNEL_0   0
 The DAC Channel value. More...
 
#define MAX_DIGITAL   (4095)
 The maximal digital value. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define VOLT_REF   (3300)
 Reference voltage for DACC,in mv. More...
 

Functions

void ACC_Handler (void)
 Interrupt handler for the ACC. More...
 
static void configure_console (void)
 [acc_irq_handler_end] More...
 
static void dsplay_menu (void)
 Display main menu. More...
 
static int16_t get_input_voltage (void)
 Get voltage from user input, the input range is: (1/6)*ADVREF~(5/6)*ADVREF (mv) More...
 
int main (void)
 ACC example application entry point. More...
 

#define ADC_CLOCK   6400000

The ADC Clock value.

Referenced by main().

#define ADC_STARTUP_TIME_SETTING   0x8u

The ADC Start Up Time value.

Referenced by main().

#define ADC_TRACK_SETTING   0x0u

The ADC Start Up Time value.

Referenced by main().

#define ADC_TRANSFER_SETTING   0x1u

The ADC Start Up Time value.

Referenced by main().

#define DACC_ANALOG_CONTROL
Value:
(DACC_ACR_IBCTLCH0(0x02) \
| DACC_ACR_IBCTLCH1(0x02) \
| DACC_ACR_IBCTLDACCORE(0x01))

Analog control value.

Referenced by main().

#define DACC_CHANNEL_0   0

The DAC Channel value.

Referenced by main().

#define MAX_DIGITAL   (4095)

The maximal digital value.

Referenced by main().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- ACC IRQ Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: acc_example.c:68

Referenced by main().

#define VOLT_REF   (3300)

Reference voltage for DACC,in mv.

Referenced by get_input_voltage(), and main().

void ACC_Handler ( void  )

Interrupt handler for the ACC.

[acc_irq_handler_start]

[acc_irq_handler_start]

[acc_irq_handler_status]

Compare Output Interrupt

[acc_irq_handler_status] [acc_irq_handler_result_1]

[acc_irq_handler_result_1]

[acc_irq_handler_result_2]

[acc_irq_handler_result_2]

[acc_irq_handler_result_3]

[acc_irq_handler_result_3] [acc_irq_handler_result_end]

[acc_irq_handler_result_end] [acc_irq_handler_end]

static void configure_console ( void  )
static

[acc_irq_handler_end]

Configure UART console.

References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_PARITY, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

static void dsplay_menu ( void  )
static

Display main menu.

Referenced by main().

static int16_t get_input_voltage ( void  )
static

Get voltage from user input, the input range is: (1/6)*ADVREF~(5/6)*ADVREF (mv)

References uart_read(), us_value, and VOLT_REF.

Referenced by main().