Jump to main content

##

# 2.26.5 DACC_DataWrite Function

## C

The prototype of this function varies based on device family. Refer to the generated header file for the actual prototype to be used.

    void DACC_DataWrite (DACC_CHANNEL_NUM channel, uint32_t data)

    void DACC_DataWrite(uint16_t data)

## Summary

Converts a Digital data to Analog value

## Description

This function converts a Digital data to Analog value. The behavior of this function call will vary based on the mode selected within MCC.

## Precondition

DACC_Initialize must have been called.

## Parameters

Param | Description
--- | ---
channel | Points to DACC Channel
data | Digital data to be converted to Analog value.

## Returns

None

## Example

Example of this function varies based on device family. Refer to the one which is applicable for the device being used.

    char myData[COUNT] = {"0xff","0x3E","0x7A","0x3F"};//COUNT is user
        //dependent
        bool status = false;

        //considering count = 4
        for (uint8_t i = 0; i<4; i++)
        {
            DACC_DataWrite (DACC_CHANNEL_0, myData[i]);
        }

    bool status = false;
    DACC_ChannelSelect(DACC_CHANNEL_0);
    if (true == DACC_IsReady())
    {
        DACC_DataWrite (0xff);
    }
    else
    {
        //DACC is not ready to accept new conversion request
        //User Application code
    }

## Remarks

None.