08M2 problems in calling up files on Tenda module

Pat13

Senior Member
I am trying to use an 08M2 and two Tenda modules on an animatronics project. it is for a pair of witches for a Halloween display. The idea is for them to say verses from various chants, at times together and at times sequentially. The files are balanced in that both voices have the same db output. Here is the code

Code:
'#08M2 Picaxe control for multiple Tenda boards for Witch conversations

symbol Aggie = C.0 'Tenda 1 RX
symbol Gertie = C.4 'Tenda 2 RX
symbol Aggie_BZ = pinC.1 'Tenda 1 Busy
symbol Gertie_BZ =pinC.3 'Tenda 2 busy
symbol Baud =T4800 'tenda baud Rate

	Init:					'starting point
		serout Aggie,Baud,($EF) 'stop tenda 1
		serout Gertie, Baud, ($EF)'stop tenda 2
		pause 10000			'wait 10 seconds
		serout Aggie, Baud, ($E8) 'set tenda 1 volume
		serout Gertie, Baud, ($E8) 'set tenda 2 volume
		pause 60000	 'wait 1 minute 
		

	

	Happy_Halloween:
			serout Aggie,Baud,($01)
			serout Gertie,Baud, ($01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($07)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
	Spellcast:
			let w0 = time
			random w0
			w1 = w0//2+8
			if w1 =2 then Its_Halloween
			if w1 =3 then Tonight
			if w1 =4 then Early_Early
			if w1 =5 then MacBeth
			if w1 =6 then Willoughby 
			
	
		Its_Halloween:
			serout Gertie, Baud, ($F5,01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F5,03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F5,05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F5,07)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
				serout Gertie, Baud, ($F5,08)
			pause 1000
			do while Gertie_BZ = 0
			loop
			goto Happy_Halloween
		Tonight:
			serout Gertie, Baud, ($F3,01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F3,03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F3,05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			goto Happy_Halloween				
	
	
	Early_Early:
			serout Gertie, Baud, ($F2,01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F2,03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F2,05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F2,07)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F2,08)
			pause 1000
			do while Gertie_BZ = 0
			loop
			goto Happy_Halloween

	MacBeth:
			serout Gertie, Baud, ($F4,01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F4,05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,07)
			serout Gertie, Baud, ($F4,07)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F4,08)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,09)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,10)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,11)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,12)
			serout Gertie, Baud, ($F4,12)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F4,13)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F4,14)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,15)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,16)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F4,17)
			pause 1000
			do while Gertie_BZ = 0
			loop
	
			serout Aggie, Baud, ($F4,18)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,19)
			serout Gertie, Baud, ($F4,19)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,20)
			pause 1000
			do while Gertie_BZ = 0
			loop
									
			goto Happy_Halloween
			

	Willoughby:
			serout Gertie, Baud, ($F6,01)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,02)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,03)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,04)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F6,05)
			pause 1000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,06)
			pause 1000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,07)
			pause 1000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F6,08)
			pause 1000
			do while Gertie_BZ = 0
			loop
			goto Happy_Halloween
The project is currently set up on a breadboard. I intend to add a PIR on pin C.2
Parts of the code do seem to be working as I intended. It does call up a file from one module, then the next file from the other and so on. However, a number of things are occuring (or not occuring).
1. The code is skipping over "Happy_Halloween" entirely and going right to "Spellcast".
2. It won't call up files on both modules at the same time, as is indicated in various sections of the code (Happy_Halloween, Macbeth).
3. It will call up the same file a couple of times before forwarding to next file (specifically in "Early_Early [$F2,07])
4. It always calls up "Early_Early" first, and will call it up multiple times
5. One of the Tenda modules is a third of the volume of the other. I have tried switching the SD cards and the 3.5mm jacks and it is the module (I realize I could have a bad module}.


Thanks in advance for any help
 

westaust55

Moderator
When you sugegst that the Happy_Halloween code section is being skipped, is it possible that the PICAXE is just stepping through rapidly.

The Tenda/MDFly modules have an active low "Busy" signal. but is the Busy output made low fast enough?
Have you tested that the busy lines are normally high and how fast they go low when mp3 output starts.
Try adding a pause for say 1.5 second before the DO...LOOP testing for completion of the busy state. (I note that you have a 1 sec pause already).
 

Pat13

Senior Member
When you sugegst that the Happy_Halloween code section is being skipped, is it possible that the PICAXE is just stepping through rapidly.

The Tenda/MDFly modules have an active low "Busy" signal. but is the Busy output made low fast enough?
Have you tested that the busy lines are normally high and how fast they go low when mp3 output starts.
Try adding a pause for say 1.5 second before the DO...LOOP testing for completion of the busy state. (I note that you have a 1 sec pause already).
Thanks for your reply westaus55
I am not sure how to test the busy lines, would i use debug for that?
I did re read the sections on serin and serout in manual two and added high commands with a 300 ms pause to Aggie and Gertie. This has helped to settle the mdfly and now it is playing Happy_Halloween. I removed the random section, as it kept calling only one section (Its_Halloween), and to see if it was playing the other sections correctly. After applying Drivesort to the files, it is playing all files correctly now. (It is interesting in that I dragged each file individually, in order, to the folder(s) and they still got out of sequence).
The volume on one of the modules is much lower than the other module. I moved SD cards, modules and speakers on the breadboard to see if it was something else, but it is the module.
Here is the revised code
Code:
'#08M2 Picaxe control for multiple Tenda boards for Witch conversations

symbol Aggie = C.0 'Tenda 1 RX
symbol Gertie = C.4 'Tenda 2 RX
symbol Aggie_BZ = pinC.1 'Tenda 1 Busy
symbol Gertie_BZ =pinC.3 'Tenda 2 busy
symbol Baud =T4800 'tenda baud Rate
symbol Trigger =C.2 'trigger, probably PIR
symbol debounce = b3

	Init:	
		high Aggie
		pause 400
		high Gertie
		pause 400			'starting point
		serout Aggie,Baud,($EF) 'stop tenda 1
		serout Gertie, Baud, ($EF)'stop tenda 2
		pause 6000			'wait 10 seconds
		serout Aggie, Baud, ($E8) 'set tenda 1 volume
		serout Gertie, Baud, ($E8) 'set tenda 2 volume
		pause 6000	 'wait 1 minute 


	Happy_Halloween:
			serout Aggie,Baud,($F2,01)
			serout Gertie,Baud, ($F2,01)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,02)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F2,03)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,04)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F2,05)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F2,06)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F2,07)
			pause 2000
			do while Aggie_BZ = 0
			loop
			goto Its_Halloween
			
	
		Its_Halloween:
			high Aggie
			pause 300
			high Gertie 
			pause 300
			serout Aggie, Baud, ($F3,01)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,02)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F3,03)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,04)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F3,05)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F3,06)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F3,07)
			pause 2000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F3,08)
			pause 2000
			do while Gertie_BZ = 0
			loop
			goto Tonight
			
		Tonight:
			high Aggie 
			pause 300
			high Gertie
			pause 300
			serout Aggie, Baud, ($F4,01)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,02)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F4,03)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,04)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F4,05)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F4,06)
			pause 2000
			do while Gertie_BZ = 0
			loop
			goto Early_Early			
	
	
	Early_Early:
			high Aggie
			pause 300
			high Gertie
			pause 300
			serout Aggie, Baud, ($F5,01)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,02)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F5,03)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,04)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F5,05)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F5,06)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F5,07)
			pause 2000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F5,08)
			pause 2000
			do while Gertie_BZ = 0
			loop
			goto MacBeth

	MacBeth:
			high Aggie
			pause 300
			high Gertie
			pause 300
			serout Aggie, Baud, ($F6,01)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,02)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,03)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,04)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F6,05)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,06)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,07)
			serout Gertie, Baud, ($F6,07)
			pause 2000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F6,08)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,09)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,10)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,11)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,12)
			serout Gertie, Baud, ($F6,12)
			pause 2000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F6,13)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			
			serout Aggie, Baud, ($F6,14)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,15)
			pause 2000
			do while Gertie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,16)
			pause 2000
			do while Aggie_BZ = 0
			loop			
			
			serout Gertie, Baud, ($F6,17)
			pause 2000
			do while Gertie_BZ = 0
			loop
	
			serout Aggie, Baud, ($F6,18)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Aggie, Baud, ($F6,19)
			serout Gertie, Baud, ($F6,19)
			pause 2000
			do while Aggie_BZ = 0
			loop
			
			serout Gertie, Baud, ($F6,20)
			pause 2000
			do while Gertie_BZ = 0
			loop
									
			goto Happy_Halloween
 
Top