8968 views|4 replies

18

Posts

0

Resources
The OP
 

PWM-DAC adjusts LED lights [Copy link]

Read the value of the potentiometer through AD conversion, adjust the duty cycle according to the value of the potentiometer, and then adjust the output DC voltage and the brightness of the LED. In layman's terms, the potentiometer is the knob of a desk lamp, and the LED is the desk lamp. Main function: main() { temp1=Read_AD_Data(0x94)//Convert potentiometer valueif(counts>100) { counts=0; if(DIR==1)//Control the increase or decrease of variable valuevalue++; if(DIR==0) value--; } if(value==1000) DIR=0; if(value==0) DIR=1; if(temp1
The question is, in reality, can your LED desk lamp support you to use PWM to control the switch?

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2363832&ptid=644206][color=#999999]ywlzh posted on 2018-5-9 15:08[/color][/url][/size] The question is, in reality, can your LED desk lamp support you to use PWM to control the switch? [/quote] The DC voltage generated by PWM will be connected to the LED. There is no problem with the hardware. There is another part in my entire program, which will use delays and other statements. Will this make the time longer and slower? The human eye can distinguish the on and off of the light, so we see the flickering phenomenon

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2363921&ptid=644206][color=#999999]Zhao Wei 0317 Published on 2018-5-9 17:44[/color][/url][/size] The DC voltage generated by PWM will be connected to the LED. There is no problem with the hardware. There is another part in my entire program, which will use delay, and...[/quote] The timer is not turned on

I don't quite understand the program you wrote. I have done LED dimming with a microcontroller before. I modified the table lamps at home and it works fine now. But it was adjusted with buttons. Some MCUs have PWM functions, which are the simplest. Just configure them directly. I have also used timers. I used two timers, one to control the frequency and the other to control the duty cycle. The adjustment effect is very good.

PWM-DAC adjusts LED lights


This post is from 51mcu

Latest reply

I don't quite understand the program you wrote. I have done LED dimming with a microcontroller before. I modified the table lamps at home and it works fine now. But it was adjusted with buttons. Some MCUs have PWM functions, which are the simplest. Just configure them directly. I have also used timers. I used two timers, one to control the frequency and the other to control the duty cycle. The adjustment effect is very good.  Details Published on 2018-6-30 17:11
 

1234

Posts

4

Resources
2
 
The question is, in reality, can your LED desk lamp support you to use PWM to control the switch?
This post is from 51mcu
 
Personal signature天地庄周马;江湖范蠡船。
个性签名还是放QQ号吧,2060347305,添加说明EEworld好友
 
 

18

Posts

0

Resources
3
 
ywlzh posted on 2018-5-9 15:08 The question is, in reality, can your LED desk lamp support you to use PWM to control the switch?
The DC voltage generated by PWM will be connected to the LED. There is no problem with the hardware. There is another part in my entire program, which will use delays and other statements. Will this make the time longer and slower? The human eye can distinguish the on and off of the light, so we see the flickering phenomenon
This post is from 51mcu

Comments

The timer is not on  Details Published on 2018-5-28 17:22
 
 
 

20

Posts

0

Resources
4
 
Zhao Wei 0317 Published on 2018-5-9 17:44 The DC voltage generated by PWM will be connected to the LED. There is no problem with the hardware. There is another part in my entire program, which will use delay, and...
The timer is not turned on
This post is from 51mcu
 
 
 

2

Posts

0

Resources
5
 
I don't quite understand the program you wrote. I have done LED dimming with a microcontroller before. I modified the table lamps at home and it works fine now. But it was adjusted with buttons. Some MCUs have PWM functions, which are the simplest. Just configure them directly. I have also used timers. I used two timers, one to control the frequency and the other to control the duty cycle. The adjustment effect is very good.
This post is from 51mcu
 
 
 

Guess Your Favourite
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