3.10.3 10-bit DAC

10-bit Digital-to-Analog Converter

3.10.3.1 Introduction

The Digital-to-Analog Converter (DAC) supplies a variable voltage reference, ratiometric with the input source, programmable selectable output levels, and multiple sources for the positive and negative input references.

3.10.3.2 Supported Device Families

PIC16F176xPIC16F177x

3.10.3.3 Required Header Files:

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

3.10.3.4 Module Documentation

3.10.3.4.1 DAC1

This file contains the prototypes and other data types for the DAC1 driver using PIC10/12/16/18 microcontrollers.

Module description

This file contains the prototypes and other data types for the DAC1 driver using PIC10/12/16/18 microcontrollers.

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

    Initializes the DAC1 module. This routine is called only once, before any other DAC1 routine.

  • void DAC1_Load16bitInputData (uint16_t input16BitData)

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

  • void DAC1_Load10bitInputData (uint16_t input10BitData)

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

  • void DAC1_Load8bitInputData (uint8_t input8BitData)

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

  • uint16_t DAC1_Read10BitInputData (void)

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

Function Documentation

DAC1_Initialize()

void DAC1_Initialize (void )

Initializes the DAC1 module. This routine is called only once, before any other DAC1 routine.

Parameters:
None.
Returns:

None.

DAC1_Load10bitInputData()

void DAC1_Load10bitInputData (uint16_t input10BitData)

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

Parameters:
input10BitData

- 10-bit digital data sent to DAC1

Returns:

None.

DAC1_Load16bitInputData()

void DAC1_Load16bitInputData (uint16_t input16BitData)

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

Parameters:
input16BitData

- 16-bit digital data sent to DAC1

Returns:

None.

DAC1_Load8bitInputData()

void DAC1_Load8bitInputData (uint8_t input8BitData)

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

Parameters:
input8BitData

- 8-bit digital data sent to DAC1

Returns:

None.

DAC1_Read10BitInputData()

uint16_t DAC1_Read10BitInputData (void )

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

Parameters:
None.
Returns:

uint16_t input10BitData - 10-bit digital data sent to DAC1

3.10.3.5 File Documentation

3.10.3.5.1 source/dac1.c File Reference

This file contains the DAC1 driver implementations using PIC10/12/16/18 microcontrollers.

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

Functions

  • void DAC1_Initialize (void)

    Initializes the DAC1 module. This routine is called only once, before any other DAC1 routine.

  • void DAC1_Load16bitInputData (uint16_t input16BitData)

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

  • void DAC1_Load10bitInputData (uint16_t input10BitData)

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

  • void DAC1_Load8bitInputData (uint8_t input8BitData)

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

  • uint16_t DAC1_Read10BitInputData (void)

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

Macro Definition Documentation

DAC1_DoubleBufferLatch

#define DAC1_DoubleBufferLatch( ) (DACLDbits.DAC1LD = 1)

Loads data from DAC buffer onto the DAC output

3.10.3.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, before any other DAC1 routine.

  • void DAC1_Load16bitInputData (uint16_t input16BitData)

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

  • void DAC1_Load10bitInputData (uint16_t input10BitData)

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

  • void DAC1_Load8bitInputData (uint8_t input8BitData)

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

  • uint16_t DAC1_Read10BitInputData (void)

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