3.2 APM - Analog Peripheral Manager
3.2.1 Introduction
The MPLAB® Code Configurator (MCC) Melody Analog Peripheral Manager Peripheral Library (PLIB) driver generates APIs to support APM-specific peripheral functionality on target MCUs.
The Analog Peripheral Manager (APM) allows analog modules to be core independently switched on and off periodically using timers. This feature can be used to manage analog peripherals that are available on the device such as the Analog-to-Digital Converter (ADC), Comparator (CMP), Digital-to-Analog Converter (DAC), Operational Amplifier (OPA) and the Fixed Voltage Reference (FVR) modules, among others.
3.2.2 Supported Device Families
PIC18F-Q71 |
3.2.3 Required header files:
#include "mcc_generated_files/apm/apm.h"
3.2.4 Module Documentation
3.2.4.1 APM
This file contains API prototypes and other datatypes for APM module.
3.2.4.1.1 Module description
This file contains API prototypes and other datatypes for APM module.
Functions
-
void APM_Initialize (void)
This API initializes the APM module.
-
void APM_Start (void)
This function starts the APM Operation.
-
void APM_Stop (void)
This function stops the APM Operation.
-
void APM_PrescalerSet (uint16_t prescalerVal)
This function sets a value for the Prescaler in APM.
-
void APM_PeriodSet (uint16_t periodVal)
This function sets a value for the Period in APM.
-
void APM_Start1CountSet (uint16_t Start1Val)
This function sets a count in Start 1 Event of the APM.
-
void APM_Start2CountSet (uint24_t Start2Val)
This function sets a count in Start 2 Event of the APM.
-
void APM_End1CountSet (uint24_t End1Val)
This function sets a count in End 1 Event of the APM.
-
void APM_End2CountSet (uint24_t End2Val)
This function sets a count in End 2 Event of the APM.
-
uint16_t APM_StatusGet (void)
This function returns the status of the peripherals in APM.
3.2.4.1.2 Function Documentation
APM_End1CountSet()
void APM_End1CountSet (uint24_t End1Val)
This function sets a count in End 1 Event of the APM.
APM should be initialized with APM_Initialize() before calling this API. This function must be called after the APM_Start1CountSet() is called. |
|
none |
APM_End2CountSet()
void APM_End2CountSet (uint24_t End2Val)
This function sets a count in End 2 Event of the APM.
APM should be initialized with APM_Initialize() before calling this API. This function must be called after the APM_Start1CountSet() is called. This function must be called after the APM_Start2CountSet() is called. This function must be called after the APM_End1CountSet() is called. |
|
none |
APM_Initialize()
void APM_Initialize (void )
This API initializes the APM module.
This routine must be called only once, before any other APM routine is called. |
|
none |
APM_PeriodSet()
void APM_PeriodSet (uint16_t periodVal)
This function sets a value for the Period in APM.
APM should be initialized with APM_Initialize() before calling this API. |
|
none |
APM_PrescalerSet()
void APM_PrescalerSet (uint16_t prescalerVal)
This function sets a value for the Prescaler in APM.
APM should be initialized with APM_Initialize() before calling this API. |
|
none |
APM_Start()
void APM_Start (void )
This function starts the APM Operation.
This routine must be called only once after the APM_Initialize() is called. |
|
none |
APM_Start1CountSet()
void APM_Start1CountSet (uint16_t Start1Val)
This function sets a count in Start 1 Event of the APM.
APM should be initialized with APM_Initialize() before calling this API. |
|
none |
APM_Start2CountSet()
void APM_Start2CountSet (uint24_t Start2Val)
This function sets a count in Start 2 Event of the APM.
APM should be initialized with APM_Initialize() before calling this API. This function must be called after the APM_Start1CountSet() is called. |
|
none |
APM_StatusGet()
uint16_t APM_StatusGet (void )
This function returns the status of the peripherals in APM.
APM should be initialized with APM_Initialize() before calling this API. |
|
16-bit data from APMSTATUS register. |
APM_Stop()
void APM_Stop (void )
This function stops the APM Operation.
This routine must be called only once after the APM_Initialize() is called. |
|
none |
3.2.5 File Documentation
3.2.5.1 source/apm.c File Reference
This is the generated driver implementation file for the APM driver using PIC18 MCUs.
#include <xc.h> #include "../apm.h"
3.2.5.1.1 Functions
-
void APM_Initialize (void)
This API initializes the APM module.
-
void APM_Start (void)
This function starts the APM Operation.
-
void APM_Stop (void)
This function stops the APM Operation.
-
void APM_PrescalerSet (uint16_t prescalerVal)
This function sets a value for the Prescaler in APM.
-
void APM_PeriodSet (uint16_t periodVal)
This function sets a value for the Period in APM.
-
void APM_Start1CountSet (uint16_t Start1Val)
This function sets a count in Start 1 Event of the APM.
-
void APM_Start2CountSet (uint24_t Start2Val)
This function sets a count in Start 2 Event of the APM.
-
void APM_End1CountSet (uint24_t End1Val)
This function sets a count in End 1 Event of the APM.
-
void APM_End2CountSet (uint24_t End2Val)
This function sets a count in End 2 Event of the APM.
-
uint16_t APM_StatusGet (void)
This function returns the status of the peripherals in APM.
3.2.5.1.2 Detailed Description
This is the generated driver implementation file for the APM driver using PIC18 MCUs.
APM Generated Driver File
3.2.5.2 source/apm.h File Reference
#include <stdint.h>
3.2.5.2.1 Functions
-
void APM_Initialize (void)
This API initializes the APM module.
-
void APM_Start (void)
This function starts the APM Operation.
-
void APM_Stop (void)
This function stops the APM Operation.
-
void APM_PrescalerSet (uint16_t prescalerVal)
This function sets a value for the Prescaler in APM.
-
void APM_PeriodSet (uint16_t periodVal)
This function sets a value for the Period in APM.
-
void APM_Start1CountSet (uint16_t Start1Val)
This function sets a count in Start 1 Event of the APM.
-
void APM_Start2CountSet (uint24_t Start2Val)
This function sets a count in Start 2 Event of the APM.
-
void APM_End1CountSet (uint24_t End1Val)
This function sets a count in End 1 Event of the APM.
-
void APM_End2CountSet (uint24_t End2Val)
This function sets a count in End 2 Event of the APM.
-
uint16_t APM_StatusGet (void)
This function returns the status of the peripherals in APM.
3.2.5.2.2 Detailed Description
APM Generated Driver API Header File