1.29.6.2 DAC_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 DAC_DataWrite (DAC_CHANNEL_NUM channel, uint16_t data)
void DAC_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 MHC.

Precondition

  • DAC_Initialize must have been called.

  • The DAC_IsReady() function should have returned true.

Parameters

Param Description
channel Points to DAC 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++)
    {
        DAC_DataWrite (DAC_CHANNEL_0, myData[i]);
    }
if(DAC_IsReady() == true)
{
    DAC_DataWrite(data);
}

Remarks

None.