3.10.1 5-bit DAC

5-bit Digital-to-Analog Converter

3.10.1.1 Introduction

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

3.10.1.2 Supported Device Families

PIC12/16F150xPIC12/16F157xPIC12/16F161x
PIC12/16F182xPIC12/16F184xPIC16F145x
PIC16F153xxPIC16F170xPIC16F171x
PIC16F176xPIC16F177xPIC16F178x
PIC16F183xxPIC16F184xxPIC16F188xx
PIC16F191xxPIC16F193xPIC16F194x
PIC18F-K22PIC18F-K40PIC18F-K42
PIC18F-K50PIC18F-Q10

3.10.1.3 Required header files


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

3.10.1.4 Module Documentation

3.10.1.4.1 DAC

Driver Version

Version: DAC Driver Version 2.1.0
Functions
  • void DAC_Initialize (void)

    This routine initializes the DAC and must be called only once, before any other DAC routine is called.

  • void DAC_SetOutput (uint8_t inputData)

    his routine pass the digital input data intoDAC voltage reference control register.

  • uint8_t DAC_GetOutput (void)

    This routine reads the digital input data fed to DAC voltage reference control register.

Function Documentation

DAC_GetOutput()

uint8_t DAC_GetOutput (void )

This routine reads the digital input data fed to DAC voltage reference control register.

Parameters:
void
Returns:

uint8_t inputData - digital data fed to DAC

DAC_Initialize()

void DAC_Initialize (void )

This routine initializes the DAC and must be called only once, before any other DAC routine is called.

Section: Included FilesSection: DAC APIs

Parameters:
void
Returns:

void

Section: Included FilesSection: DAC APIs

DAC_SetOutput()

void DAC_SetOutput (uint8_t inputData)

his routine pass the digital input data intoDAC voltage reference control register.

Parameters:
inputData

- 8bit digital data to DAC.

Returns:

void

3.10.1.5 File Documentation

3.10.1.5.1 source/dac.c File Reference

This is the generated driver implementation file for the DAC driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs.

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

Functions

  • void DAC_Initialize (void)

    This routine initializes the DAC and must be called only once, before any other DAC routine is called.

  • void DAC_SetOutput (uint8_t inputData)

    his routine pass the digital input data intoDAC voltage reference control register.

  • uint8_t DAC_GetOutput (void)

    This routine reads the digital input data fed to DAC voltage reference control register.

Detailed Description

This is the generated driver implementation file for the DAC driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs.

DAC Generated Driver File

Version: DAC Driver Version 2.1.0

3.10.1.5.2 source/dac.h File Reference

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

Functions

  • void DAC_Initialize (void)

    This routine initializes the DAC and must be called only once, before any other DAC routine is called.

  • void DAC_SetOutput (uint8_t inputData)

    his routine pass the digital input data intoDAC voltage reference control register.

  • uint8_t DAC_GetOutput (void)

    This routine reads the digital input data fed to DAC voltage reference control register.

Detailed Description

DAC Generated Driver API Header File