stm8l DAC_OUT2

hlala 2018-03-07 06:25:58
#include"iostm8l151c8.h"
void CLK_INIT(void)
{
CLK_PCKENR1=0x80; //DAC外设时钟开启。
CLK_PCKENR2=0X20; //比较器外设时钟开启。致于为什么我也没弄明白。
}
void RI_IOSWITCH(void)
{
RI_IOSR3=0x10; //I/O 路由开关。DAC_OUT2:PB4,PB5,PB6
}
void GPIO_INIT(void)
{
PB_DDR=0; //本段不是必须的,可不要,都是复位默认的。
PB_CR1=0;
PB_CR2=0; PF_DDR=0;
PF_CR1=0; PF_CR2=0;
}
void DAC_INIT(void)
{
//DAC_CH1CR1=0; //本四行与上面说的一样,可不要。
//DAC_CH1CR2=0;
//DAC_CH2CR1=0;
//DAC_CH2CR2=0;
DAC_CH2CR1_EN=1; DAC_CH1CR1_EN=1;
DAC_CH2RDHRH=0x08;DAC_CH2RDHRL=0x00;
DAC_CH1RDHRH=0x04; DAC_CH1RDHRL=0x00;
}
void main(void)
{
CLK_INIT();RI_IOSWITCH();
//GPIO_INIT(); DAC_INIT();
while(1);
}
//DAC1,DAC2输出正常。调试时注意,如没有电压输出,多注意在硬件上的VREF+,VDDA是否连上电源。在网上求了几天没人关注,最后还是自己搞定了。
...全文
379 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgl7903 2018-03-07
  • 打赏
  • 举报
回复
Ultra-low-power with FlexPowerControl – 1.71 V to 3.6 V power supply – -40 °C to 85/105/125 °C temperature range – 300 nA in V BAT mode: supply for RTC and 32x32-bit backup registers – 30 nA Shutdown mode (5 wakeup pins) – 120 nA Standby mode (5 wakeup pins) – 420 nA Standby mode with RTC – 1.1 µA Stop 2 mode, 1.4 µA with RTC – 100 µA/MHz run mode (LDO Mode) – 39 μA/MHz run mode (@3.3 V SMPS Mode) – Batch acquisition mode (BAM) – 4 µs wakeup from Stop mode – Brown out reset (BOR) – Interconnect matrix • Core: Arm ® 32-bit Cortex ® -M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator™) allowing 0-wait-state execution from Flash memory, frequency up to 80 MHz, MPU, 100DMIPS and DSP instructions • Performance benchmark – 1.25 DMIPS/MHz (Drystone 2.1) – 273.55 CoreMark ® (3.42 CoreMark/MHz @ 80 MHz) • Energy benchmark – 294 ULPMark™ CP score – 106 ULPMark™ PP score • Clock Sources – 4 to 48 MHz crystal oscillator – 32 kHz crystal oscillator for RTC (LSE) – Internal 16 MHz factory-trimmed RC (±1%) – Internal low-power 32 kHz RC (±5%) – Internal multispeed 100 kHz to 48 MHz oscillator, auto-trimmed by LSE (better than ±0.25 % accuracy) – 3 PLLs for system clock, USB, audio, ADC • Up to 114 fast I/Os, most 5 V-tolerant, up to 14 I/Os with independent supply down to 1.08 V • RTC with HW calendar, alarms and calibration • LCD 8× 40 or 4× 44 with step-up converter • Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors • 16x timers: 2x 16-bit advanced motor-control, 2x 32-bit and 5x 16-bit general purpose, 2x 16- bit basic, 2x low-power 16-bit timers (available in Stop mode), 2x watchdogs, SysTick timer • Memories – Up to 1 MB Flash, 2 banks read-while- write, proprietary code readout protection – Up to 128 KB of SRAM including 32 KB with hardware parity check – External memory interface for static memories supporting SRAM, PSRAM, NOR and NAND memories – Quad SPI memory interface • 4x digital filters for sigma delta modulator • Rich analog peripherals (independent supply) – 3x 12-bit ADC 5 Msps, up to 16-bit with hardware oversampling, 200 µA/Msps – 2x 12-bit DAC output channels, low-power sample and hold – 2x operational amplifiers with built-in PGA – 2x ultra-low-power comparators • 20x communication interfaces – USB OTG 2.0 full-speed, LPM and BCD – 2x SAIs (serial audio interface) – 3x I2C FM+(1 Mbit/s), SMBus/PMBus – 5x USARTs (ISO 7816, LIN, IrDA, modem)

27,383

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 单片机/工控
社区管理员
  • 单片机/工控社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧