DAC资源分配情况
RA6M5支持情况
野火板卡引出情况配置过程
RTT配置添加
Kconfig中添加如下信息:
drv_config.h中之前已经预留DAC配置,因此不需要再添加。
配置代码
在emu中运行menuconfig,打开dac两通道配置。
运行scons --target=mdk5,把dac部分导入工程打开新生成的keil工程后运行RASC,增加dac相关配置
生成代码配置编译固件
结果验证
\ | / - RT - Thread Operating System / | \ 5.2.0 build May 28 2024 22:13:52 2006 - 2024 Copyright by RT-Thread team Hello RT-Thread! msh > msh > msh > msh >lis list msh >list de device msh >list device device type ref count -------- -------------------- ---------- dac1 DAC Device 0 dac0 DAC Device 0 uart4 Character Device 2 pin Pin Device 0 msh >dac Usage: dac probe <dac_name> - probe dac by name dac write <channel> <value> - write dac value on the channel dac disable <channel> - disable dac channel dac enable <channel> - enable dac channel msh >dac probe dac0 probe dac0 success msh > dac enable 0 dac0 channel 0 enables success msh > dac write 0 2000 dac0 channel 0 write value is 2000 msh > dac write 0 1000 dac0 channel 0 write value is 1000 msh > dac write 0 500 dac0 channel 0 write value is 500 msh > dac probe dac1 probe dac1 success msh >dac enable 1 dac1 channel 1 enables success msh >dac write 1 200 dac1 channel 1 write value is 200 msh >dac write 1 2000 dac1 channel 1 write value is 2000 msh >dac write 1 4000 dac1 channel 1 write value is 4000 msh >
运行结果:
在输入dac write x 200时,示波器测到的电压为69mv
在输入dac write x 2000时,示波器测到的电压为1.5v
在输入dac write x 4000时,示波器测到的电压为3.1v