4.10.1 5-bit DAC

5-bit Digital-to-Analog Converter

4.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.

4.10.1.2 Supported Device Families

PIC12/16F150x PIC12/16F157x PIC12/16F161x
PIC12/16F182x PIC12/16F184x PIC16F145x
PIC16F153xx PIC16F170x PIC16F171x
PIC16F176x PIC16F177x PIC16F178x
PIC16F183xx PIC16F184xx PIC16F188xx
PIC16F191xx PIC16F193x PIC16F194x
PIC18F-K22 PIC18F-K40 PIC18F-K42
PIC18F-K50 PIC18F-Q10

4.10.1.3 Required header files


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

4.10.1.4 Module Documentation

4.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

4.10.1.5 File Documentation

4.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

4.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