Sound not playing all tones

Mecmike

New Member
I have built a large model crane and am using picaxe to try and simulate realistic control and driver information read out.
The control of the motors is all sorted and working smoothly.
my problem is with the displays 3-20x4 lcds
my first problem is with the alarm sound on line 29 program works in pe6 simulation but not when connected
to board small speaker is connected as manual, pin B.6 -10 mf cap -speaker -0v, only the first tone is heard but skips second.
Can someone please help
Thanks Mike

;*** Boom angle-length display ***

; Note boom start length 24.6 mts each section increases length by 11.00 mts (35.6-46.6-57.6)

#picaxe 20X2
; 20x4 lcd display B.7
init:

setfreq M32 ;set speed
symbol baud = N4800_32
let b1 = 80 ; set alarm approaching max jib angle (amber led)
let b2 = 84 ; set max angle warning/cut out (red led, two tone alarm)

setup:
pause 1000
Serout B.7, Baud, (254,1,254,133,"GOTTWALD",254,153,"AMK500-93")
pause 50000
Serout B.7, Baud,(254,1,254,133,"boom Angle",254,200," Degree`s",254,153,"boom length",254,220," Metre`s")
pause 1000

main:
do
readadc B.2, b0 ; read angle sensor
serout B.7,Baud,(254,197,#b0," ") ; display angle
pause 30
if b0 => b1 then high B.0 else low B.0 endif ; approaching max angle alarm (amber)
if b0 => b2 then high B.1 ; max angle alarm (red)
sound B.6, (123, 100, 121, 100) ; sound audible alarm two tone
else low B.1 endif

readadc B.3,b4 ; read length sensor
let b5=b4/4 ; calculate
serout B.7,Baud,(254,217,#b5," ") ; display length
pause 30
loop
 

AllyCat

Senior Member
Hi,

A program "working" in the Simulator but not in the "real" hardware usually indicates a "hardware" problem, for example insufficient decoupling (capacitors) across the supply rail pins or a "forgotten" pull-down (resistor) on the programming input pin (if the programming cable is not connected). Also, does it work any better if you "comment out" any of the "output driving" commands.

But also try a few software changes, for example what happens if the tones are reversed (i.e. sound B.6, (121, 100, 123, 100)) or other frequencies used : e.g 119, 120, etc. (in case the speaker works better at certain frequencies) ? Do you really need to use SETFREQ M32 ?

Cheers, Alan.
 

Mecmike

New Member
Thanks for your help
problem has been solved wrong value decoupling cap 10nf instead of 100nf across picaxe supply soldered across socket pins helped
lowered setfreq to M8 all seems to work ok now.
There is another similar section of code to add which I am working on and is working in simulation just need to tidy it up and try on the hardware
Mike
 
Top