1958 views|8 replies

820

Posts

2

Resources
The OP
 

MCU IO [Copy link]

This post was last edited by 1nnocent on 2021-6-3 17:26

The LED of the microcontroller is as shown above. PE5 is connected to the IO of the microcontroller. When the PE5 level is set low, LED2 lights up (PE5 is set to push-pull output mode).

When using, set the initial level of PE5 to high (the default state is off), and then use another IO output PWM to connect to PE5 to drive LED2. It should have a flashing effect. When the PWM level is high, the state of LED2 remains unchanged (not lit). When the PWM level is low, the initial high level of PE5 is pulled down, and LED2 lights up. However, the actual use does not achieve the expected effect;

Then, the initial level of PE5 is set to low (lit by default), and the PWM output of another IO is connected to PE5, and LED2 is seen flashing (this phenomenon shows that when the PWM is low and the initial level of PE5 is consistent, LED2 remains lit; but when the PWM is high, the initial low level of PE5 is pulled high? LED2 goes out?). So the high level can pull the low level high? ? ? This is obviously inconsistent with the theory. Why is this imagination?

This post is from stm32/stm8

Latest reply

The IO mode is set incorrectly. If the IO is connected in parallel, the mode must not be set to push-pull mode. The phenomenon observed by the OP is "level competition". If the IO is to be used in parallel, it must be configured in weak pull-up mode.   Details Published on 2021-6-4 15:13
 

820

Posts

2

Resources
2
 

Is it because PE5 output is push-pull output mode? ? ?

This post is from stm32/stm8
 
 

5979

Posts

8

Resources
3
 

I don't understand. The description is not clear.

This post is from stm32/stm8

Comments

That is, two IO ports are connected to the same LED, one IO port outputs high and low level control, and the other outputs PWM control; There are two situations, one is low level + PWM and the other is high level + PWM. The phenomenon is that the former can flash, and the latter cannot be off all the time. Problem  Details Published on 2021-6-3 18:50
 
Personal signature生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 

650

Posts

8

Resources
4
 

If you want to use PWM to control the LED light to gradually turn on and off, just set PE5 to PWM output. If you just want to control the light to turn on or off, just configure PE5 to push-pull output and connect another PWM pin to PE5? Do you want to use PE5's IO high and low level control and PWM to control the brightness? What is your requirement?

This post is from stm32/stm8

Comments

I just wanted to try it out of curiosity. It's a problem with push-pull output. The specific analysis should be combined with the push-pull circuit diagram.  Details Published on 2021-6-3 18:54
I just wanted to try it out of curiosity. It's a problem with push-pull output. The specific analysis should be combined with the push-pull circuit diagram.  Details Published on 2021-6-3 18:46
 
 
 

820

Posts

2

Resources
5
 
29447945 Published on 2021-6-3 18:14 If you want to use PWM to control the LED light to gradually turn on and off, just set PE5 to PWM output. If you just want to control the light to turn on or off, just configure PE5 to push-pull input...

I just wanted to try it out of curiosity. It's a problem with push-pull output. The specific analysis should be combined with the push-pull circuit diagram.

This post is from stm32/stm8
 
 
 

820

Posts

2

Resources
6
 
chenzhufly posted on 2021-6-3 17:49 I don't understand it, the description is not clear at all

That is, two IO ports are connected to the same LED, one IO port outputs high and low level control, and the other outputs PWM control;

There are two situations, one is low level + PWM

The other is high level + PWM

The phenomenon is that the former can flash, but the latter cannot be off all the time.

The problem has now been clarified

This post is from stm32/stm8
 
 
 

820

Posts

2

Resources
7
 
29447945 Published on 2021-6-3 18:14 If you want to use PWM to control the LED light to gradually turn on and off, just set PE5 to PWM output. If you just want to control the light to turn on or off, just configure PE5 to push-pull input...

I just want to try whether the IO has PWM output. I can only use LED to try. PE5 is not a PWM output pin. So I tried it like this. There are only two pins on the board, PE45, that have LED.

This post is from stm32/stm8
 
 
 

6555

Posts

0

Resources
8
 

The IO port of the microcontroller connected to the light-emitting diode, push-pull output depends on how your program is set

The former can flash, but the latter cannot be off all the time. It depends on the program.

This post is from stm32/stm8
 
 
 

1w

Posts

142

Resources
9
 

The IO mode is set incorrectly. If the IO is connected in parallel, the mode must not be set to push-pull mode. The phenomenon observed by the OP is "level competition". If the IO is to be used in parallel, it must be configured in weak pull-up mode.

This post is from stm32/stm8
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list