generate 40KHz square wave:

Status
Not open for further replies.
The Ultrasonic transmitter (transducer) is effectively a capacitor and when you supply a voltage in one direction, it gets charged.
You must now supply a voltage in the opposite direction to fully discharge it and charge it in the opposite direction. This is how you will get the greatest output. If you drive it with a transistor, you need a resistor across the device to discharge it. That's why push-pull is the best method.
 
Last edited:
40khz using ATMEGA16

load the 16-bit timer1 with below values and you will get 40khz pwm.
frequency may be slightly more or less then 40khz. to get exact 40khz just adjust Icr1l......................Thats it.
Tccr1a = &B10100010
Tccr1b = &B00011001
Icr1h = &H00
Icr1l = &HC7

Ocr1bh = &H00
Ocr1bl = &H50
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…