35 views|0 replies

1147

Posts

2

Resources
The OP
 

【Follow me Season 2 Episode 3】DAC configuration waveform generation and testing [Copy link]

 

Add DAC function configuration in Stack

Add DAC0 pin P014 and configure it as enable, pin conflict

Confirm that the 12th channel AN012 of ADC0 has occupied P014

The AN012 pin of ADC0 is configured as None, and the pin configuration of DAC0 does not conflict.

Add DAC function call in common_init

Added sine wave generation function program

#include "math.h"

#define M_PI 3.14159265358979323846

void gpt_blue_callback(timer_callback_args_t * p_args)

{

FSP_PARAMETER_NOT_USED(p_args);

uint16_t dacvalue = 0;

static double w = 0.0;

w += M_PI / 30;

if (w >= M_PI * 2)

{

in = 0.0;

}

dacvalue = (sin(in) + 1) / 2 * 4096;

R_DAC_Write(&g_dac0_ctrl, dacvalue);

Use a pen oscilloscope to measure the output waveform of the P014 pin, as shown below

The test environment is as follows

This post is from DigiKey Technology Zone
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list