9楼说得很正确,要开启比较器的时钟,STM8L151有路由功能(Routing interface (RI))需要设置,按照手册说明
the DAC_OUT1 can be routed to any
I/O of group 5 by setting the corresponding I/O switch bit (CH13E in the RI_IOSR1 register,
CH14E in the RI_IOSR2 register or CH15E in the RI_IOSR3 register).
如果不开启比较器的时钟,对应的寄存器是写不进去的,也就不会有DA输出