3.10.2 8-bit DAC

8-bit Digital-to-Analog Converter

3.10.2.1 Introduction

The Digital-to-Analog Converter (DAC) supplies a variable voltage reference, ratiometric with the input source, with programmable selectable output levels. The positive and negative input references (VSOURCE+ and VSOURCE-) can each be selected from several sources. The output of the DAC (DACx_output) can be selected as a reference voltage to several other peripherals or routed to output pins.

3.10.2.2 Supported Device Families

PIC16F171xxPIC16F180xxPIC16F181xx
PIC18F-Q24PIC18F-Q40PIC18F-Q41
PIC18F-Q43PIC18F-Q83PIC18F-Q84

3.10.2.3 Required header files


#include "mcc_generated_files/dac/dac[X].h"
Note: Replace [X] with instance number of selected DAC module

3.10.2.4 Module Documentation

3.10.2.4.1 DAC1

This is the generated header file for the DAC1 driver using PIC10/12/16/18 MCUs.

Module description

This is the generated header file for the DAC1 driver using PIC10/12/16/18 MCUs.

Version: DAC1 Driver Version 2.1.0
Functions
  • void DAC1_Initialize (void)

    Initializes the DAC1 module. This routine is called only once during system initialization, before calling other APIs.

  • void DAC1_SetOutput (uint8_t inputData)

    Passes the digital input data into the DAC1 Voltage Reference Control register.

  • uint8_t DAC1_GetOutput (void)

    Reads the digital input data sent to the DAC1 Voltage Reference Control register.

Function Documentation

DAC1_GetOutput()

uint8_t DAC1_GetOutput (void )

Reads the digital input data sent to the DAC1 Voltage Reference Control register.

Parameters:
None.
Returns:

uint8_t inputData - Digital data sent to the DAC1

DAC1_Initialize()

void DAC1_Initialize (void )

Initializes the DAC1 module. This routine is called only once during system initialization, before calling other APIs.

Section: Included Files Section: DAC1 APIs

Parameters:
None.
Returns:

None.

Section: Included Files Section: DAC1 APIs

DAC1_SetOutput()

void DAC1_SetOutput (uint8_t inputData)

Passes the digital input data into the DAC1 Voltage Reference Control register.

Parameters:
inputData

- 8-bit digital data passed to DAC1

Returns:

None.

3.10.2.5 File Documentation

3.10.2.5.1 source/dac1.c File Reference

This is the generated driver implementation file for the DAC1 driver using PIC10/12/16/18 MCUs.

#include <xc.h>
#include "../dac1.h"

Functions

  • void DAC1_Initialize (void)

    Initializes the DAC1 module. This routine is called only once during system initialization, before calling other APIs.

  • void DAC1_SetOutput (uint8_t inputData)

    Passes the digital input data into the DAC1 Voltage Reference Control register.

  • uint8_t DAC1_GetOutput (void)

    Reads the digital input data sent to the DAC1 Voltage Reference Control register.

Detailed Description

This is the generated driver implementation file for the DAC1 driver using PIC10/12/16/18 MCUs.

DAC1 Generated Driver File

Version: DAC1 Driver Version 2.1.0

3.10.2.5.2 source/dac1.h File Reference

#include <stdbool.h>
#include <stdint.h>

Functions

  • void DAC1_Initialize (void)

    Initializes the DAC1 module. This routine is called only once during system initialization, before calling other APIs.

  • void DAC1_SetOutput (uint8_t inputData)

    Passes the digital input data into the DAC1 Voltage Reference Control register.

  • uint8_t DAC1_GetOutput (void)

    Reads the digital input data sent to the DAC1 Voltage Reference Control register.

Detailed Description

DAC1 Generated Driver API Header File