4482 views|36 replies

142

Posts

0

Resources
The OP
 

Please check if this program is correct. It doesn't work when I download it. [Copy link]

 

This post is from PCB Design

Latest reply

Thank you. I had a preconceived idea. I didn't notice that it was 51.  Details Published on 2017-12-23 08:02
 

142

Posts

0

Resources
2
 

This post is from PCB Design
 
 

142

Posts

0

Resources
3
 
AT89S52 microcontroller used
This post is from PCB Design
 
 
 

200

Posts

1

Resources
4
 
Try calling delay_us instead of delay_ms to see if it works. Is it optimized away during compilation?
This post is from PCB Design
 
 
 

142

Posts

0

Resources
5
 
leo121 posted on 2017-12-18 17:55 Try calling delay_us instead of delay_ms to see if it works? Is it optimized away during compilation?
I changed it, but it doesn't work. The delay program should be fine. I've used it with STM32 before.
This post is from PCB Design
 
 
 

2w

Posts

341

Resources
6
 
Is P2^6 connected to the hardware REEP correct? Just call a delay directly for 51 delay, and there is no need to nest anything or change R23 to a larger resistance value. There is no problem with the circuit. The program for 51 microcontroller to drive the buzzer can be found on the Internet. Try it and select the right driver port.
This post is from PCB Design
 
 
 

252

Posts

0

Resources
7
 
First confirm whether the buzzer is active or passive.
This post is from PCB Design
 
 
 

1634

Posts

0

Resources
8
 
There are unreasonable places in both software program and hardware circuit. The software delay time is too long, try changing 500 to 5. You can't compare with the delay of STM32, the clock of STM32 is 72M, and the clock of AT89S52 is only equivalent to 1M. The transistor selection in the circuit is wrong, use 8550-PNP transistor instead, reverse the emitter and collector, short-circuit R23, and open R24.

This post is from PCB Design

Comments

Why can't I use 8050?  Details Published on 2017-12-22 08:20
 
 
 

142

Posts

0

Resources
9
 
This post was last edited by dinghao1 on 2017-12-19 09:38
qwqwqw2088 posted on 2017-12-18 20:25 Is P2^6 connected to the hardware REEP correct? The delay of 51 can just call a delay directly, and there is no need to nest anything or change R23 to a larger resistance value. The circuit...
This post is from PCB Design

Comments

Look at the delay of this multi-layer for loop, what is the actual delay. It is best to have an oscilloscope. If not, use a multimeter. Adjust the delay to the multimeter to see the change. Hundreds of ms, or longer. Measure the change in the io port level. See how the transistor base voltage changes.  Details Published on 2017-12-19 14:18
 
 
 

142

Posts

0

Resources
10
 
qwqwqw2088 posted on 2017-12-18 20:25 Is P2^6 connected to the hardware REEP correct? 51's delay can just call a delay, and there is no need to nest anything or change R23 to a larger resistance value. The circuit...
The key is that after I removed R23, I used a multimeter to measure the microcontroller pin directly, and it was always 5v, without any change
This post is from PCB Design
 
 
 

142

Posts

0

Resources
11
 
jj1989 posted on 2017-12-18 20:44 First confirm whether the buzzer is active or passive.
Active
This post is from PCB Design
 
 
 

142

Posts

0

Resources
12
 
xu__changhua posted on 2017-12-18 21:35 There are unreasonable places in both the software program and the hardware circuit. The software delay time is too long, try changing 500 to 5. You can't compare with the delay of STM32...
After changing the program, I removed R23 and directly used a multimeter to measure the microcontroller pin. It has always been 5v, no change. This is not because the 51 load is not enough.
This post is from PCB Design
 
 
 

875

Posts

1

Resources
13
 
The main function is not right. It will eventually stop in WHILE() and will not move. Maybe the delay in front of you is too short, and you can't hear the sound at all, so you may see the phenomenon you said.
This post is from PCB Design
 
 
 

142

Posts

0

Resources
14
 
Cao Wei 1993 posted on 2017-12-19 11:13 The main function is not right, it will always stop in WHILE() and will not move. Maybe the delay in front of you is too short, and you can't hear the sound at all, so...
I changed the delay time, but there is no response
This post is from PCB Design

Comments

It's not a time issue, put the buzzer part in the main function into the WHILE and see if it works. I don't see any problems in other places.  Details Published on 2017-12-19 15:03
 
 
 

3471

Posts

11

Resources
15
 
Take a look at the delay of this multi-layer for loop and see what the actual delay is. An oscilloscope is best. If you don't have one, use a multimeter. Adjust the delay to the multimeter and you can see the change. It can be several hundred ms, or even longer. Measure the change in the io port level. See how the transistor base voltage changes.
This post is from PCB Design
 
 
 

3191

Posts

0

Resources
16
 
Try putting those four statements in a while loop.
This post is from PCB Design
Personal signature为江山踏坏了乌骓马,为社稷拉断了宝雕弓。
 
 
 

875

Posts

1

Resources
17
 
dinghao1 posted on 2017-12-19 13:45 I changed the delay time, but there is no response
It is not a time problem, put the buzzer part in the main function into the WHILE and see if it works. I don't see any problems in other places.
This post is from PCB Design
 
 
 

142

Posts

0

Resources
18
 
ienglgge posted on 2017-12-19 14:18 Take a look at the delay of this multi-layer for loop and see what the actual delay is. An oscilloscope is best. If you don't have one, use a multimeter. Adjust the delay to the multimeter and you can...
No response after downloading the program, voltage remains unchanged
This post is from PCB Design

Comments

Write two programs to output continuous high and low levels respectively. Test whether it is normal. If it is normal, try adjusting the delay function.  Details Published on 2017-12-19 18:13
 
 
 

142

Posts

0

Resources
19
 

This post is from PCB Design
 
 
 

142

Posts

0

Resources
20
 
Is this the program that has been downloaded?
This post is from PCB Design
 
 
 

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