完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
/*---------------------------------------------------------------------------------------------------------*/
/* */ /* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */ /* */ /*---------------------------------------------------------------------------------------------------------*/ //*********************************************************************************************************** // Website: http://www.nuvoton.com // E-Mail : MicroC-8bit@nuvoton.com //*********************************************************************************************************** //*********************************************************************************************************** // File Function: ML51 simple GPIO toggle out demo code //*********************************************************************************************************** #include "ML51.h" /** * @brief PWM output run under low power run mode * @param None * @return None * @Details Initial all PWM output, setting PWM */ void main (void) { /* Setting Multi function pin setting for GPIO toggle * include gipo.c in Common for GPIO mode setting */ ALL_GPIO_QUASI_MODE; PWM0_ClockSource(PWM_FSYS,1); // define PWM0 clock source is FSYS, since this time . MFP_P05_PWM0_CH0; // multi function pin define P0.5 as PWM0 channel 0 output P05_PUSHPULL_MODE; PWM0_ConfigOutputChannel(0,Independent,EdgeAligned,0x6FF,10); // setting PWM channel 0 as 10% duty high of 0x6FF PWM period = 0x00B3 MFP_P24_PWM0_CH1; // multi function pin define P2.4 as PWM0 channel 1 output P24_PUSHPULL_MODE; PWM0_ConfigOutputChannel(1,Independent,EdgeAligned,0x6FF,20); // setting PWM channel 1 as 20% duty high of 0x6FF PWM period = 0x0166 MFP_P03_PWM0_CH2; // multi function pin define P0.3 as PWM0 channel 2 output P03_PUSHPULL_MODE; PWM0_ConfigOutputChannel(2,Independent,EdgeAligned,0x6FF,30); // setting PWM channel 2 as 30% duty high of 0x6FF PWM period = 0x0219 MFP_P22_PWM0_CH3; // multi function pin define P2.2 as PWM0 channel 3 P22_PUSHPULL_MODE; PWM0_ConfigOutputChannel(3,Independent,EdgeAligned,0x6FF,40); // setting PWM channel 3 as 40% duty high of 0x6FF PWM period = 0x02CC MFP_P01_PWM0_CH4; // multi function pin define P0.1 as PWM0 channel 4 P01_PUSHPULL_MODE; PWM0_ConfigOutputChannel(4,Independent,EdgeAligned,0x6FF,50); // setting PWM channel 4 as 50% duty high of 0x6FF PWM period = 0x037F MFP_P20_PWM0_CH5; // multi function pin define P0.5 as PWM0 channel 0 P20_PUSHPULL_MODE; PWM0_ConfigOutputChannel(5,Independent,EdgeAligned,0x6FF,60); // setting PWM channel 5 as 60% duty high of 0x6FF PWM period = 0x0432 /* Enable Low power run mode */ FsysSelect(FSYS_LIRC); PWM0_RUN(); set_PCON_LPR; while(1); } |
|
相关推荐
1个回答
|
|
sp; */
在ML51低功耗模式下,可以使用PWM,但需要注意以下几点: 1. PWM的频率应尽量选择较低的值,以减少功耗。 2. 在PWM输出过程中,MCU不能进入睡眠模式,否则PWM输出将被停止。 3. 在PWM输出过程中,应尽量减少其他外设的功耗,以减少总功耗。 |
|
|
|
只有小组成员才能发言,加入小组>>
705 浏览 0 评论
1114 浏览 1 评论
2491 浏览 5 评论
2826 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2671 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
661浏览 9评论
671浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
789浏览 6评论
634浏览 5评论
679浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 23:33 , Processed in 1.121130 second(s), Total 81, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号