Square wave problem
Cenlasoft
Posts: 265
Hello,
I am trying to use an ultrasonic TX and I have attached a schematic showing the circuit I built. I simply using pin 0 to send out a square wave that is .5ms in duration with an interval of 20 ms. It is a continuous wave. It works for about 45 sec to 1 min and then stops. I checked this with a scope with the ultrasonic sensor and without. The prop simply stops sending the square wave. If I press reset on the prop it starts again.
Thanks for any help.
Cenlasoft
I am trying to use an ultrasonic TX and I have attached a schematic showing the circuit I built. I simply using pin 0 to send out a square wave that is .5ms in duration with an interval of 20 ms. It is a continuous wave. It works for about 45 sec to 1 min and then stops. I checked this with a scope with the ultrasonic sensor and without. The prop simply stops sending the square wave. If I press reset on the prop it starts again.
Thanks for any help.
Cenlasoft
Comments
Another idea would be a recursion in your program which eats up the whole HUB-RAM.
Try disconnecting this circuit completely...
Then running your prop program and puttnig your square wave pin on your scope and see if it'll keep working beyond the 45s-1min. If it is still working, then this circuit is the problem.
If this is the case I'm betting it has something to do with an interaction with the speaker/ transducer and your hex inverter. If you're using a piezo speaker perhaps you're hitting a natural frequency of it and it's overdriving the hex inverter and it's heating up and then going into shutdown? ...not sure.
What do you think?
-Phil
{{
USTX.spin
Curtis Desselles
}}
Con
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
freqPin = 0
NewFreq = 40_000
Var
long stack1[32]
Obj
Pub Main
cognew(US_out(freq_Pin),stack1)
PUb US_out(fpin) | t
'' US pulse generator
'' -- uses ctra to modulate pin at 40kHz
ctra := (%00100 << 26) | fpin
frqa := 2_147_483 ' 40kHz @ 80MHz system freq
dira[fpin] := 1
t := cnt
repeat
outa[fpin] := 0 ' allow modulation
waitcnt(t += (clkfreq / 1_000_000 * 500)) ' on 0.5ms
outa[fpin] := 1 ' kill modulation
waitcnt(t += (clkfreq / 1_000 * 18)) ' off 19.5ms
-Phil
Cenlasoft
@w8an: cog 0 just stops when it reaches the end of the main method (provided no-one messed with its stack).
Noted
Thanks
Cenlasoft