You may be generating you ultrasound signal but not realising it...
You're looping for 1000 counts, delaying 10uS for the high pulse, and 10uS for the low... (ignore any software delays for now). Now that's 20uS cycle time - which equates to 50kHz (somewhat less in reality because of software excecution times). However you are only outputing 1000 cycles (the For-Next loop count). This means you're only outputing 50kHz for 1/50th of a second.
So, if your For-Next loop is itself in another loop, you'll be hearing an annoying buzz at or around that loop time eg 50Hz, but you won't hear the ultrasound. Put it on a scope and see what you've got. You've probably got 50kHz being switched on/off at about 40/50 times per second - and it's that on/off switching that you can hear in your speaker.
Try this... it'll give you constant ultrasound output... see if it works and move-on from there...
MakeSound:
High gpio.0
PauseUS 10
Low gpio.0
PauseUS 10
goto MakeSound
Bookmarks