If varK = 1 Then
; Reaches here when varK = 1 ( varL = 0 or 1 )
Else
If varL = 1 Then
; Reaches here when varK = 0 and varL = 1
End If
End If
Symbol RST = B.5
Symbol CLK = B.4
Symbol DAT = B.3
BasicCell:
High RST
High CLK
High DAT
If varK = 1 Then
w0 = varJ
Gosub SetVolume ; w0 = 0 to 7
w0 = varI
Gosub SetTrack ; w0 = 0000 to 0511
Gosub PlayTrack
If varL=1 then
Gosub StopTrack
End If
Else
Gosub StopTrack
End If
Goto Back
SetVolume:
w0 = w0 | $FFF0
Goto TransmitW0
SetTrack:
w0 = w0 & $01FF
Goto TransmitW0
PlayTrack:
PauseTrack:
UnPauseTrack:
w0 = $FFFE
Goto TransmitW0
StopTrack:
w0 = $FFFF
Goto TransmitW0
TransmitW0:
Low RST
Pause 5
High RST
Pause 300
For b2 = 0 To 15
If w0 >= $8000 Then
High DAT
Else
Low DAT
End If
Pause 2
Low CLK
PauseUs 20
High CLK
w0 = w0 * 2
Next
High DAT
Return
Back:
If varK = 1 Then
w0 = varJ
Gosub SetVolume ; w0 = 0 to 7
w0 = varI
Gosub SetTrack ; w0 = 0000 to 0511
Gosub PlayTrack
If varI=0 then
Pause 3000
End If
If varI=1 then
Pause 5000
End If
If varI=4 then
Pause 5000
End If
If varL=1 then
Gosub StopTrack
End If
Else
Gosub StopTrack
End If
Goto Back
'BASIC converted from flowchart:
'C:\Users\windows 7\Desktop\testplay1.plf
'Converted 2014-10-12 at 16:14:41
{ ;Symbols
symbol varA = b0
symbol varB = b1
symbol varC = b2
symbol varD = b3
symbol varE = b4
symbol varF = b5
symbol varG = b6
symbol varH = b7
symbol varI = b8
symbol varJ = b9
symbol varK = b10
symbol varL = b11
symbol varM = b12
symbol varN = b13
symbol varO = b14
symbol varP = b15
symbol varQ = b16
symbol varR = b17
symbol varS = b18
symbol varT = b19
symbol varU = b20
symbol varV = b21
symbol varTEMPBYTE1 = b22
symbol varTEMPBYTE2 = b23
symbol varTEMPBYTE3 = b24
symbol varTEMPBYTE4 = b25
symbol varTEMPBYTE5 = b26
symbol varTEMPBYTE6 = b27
symbol varTEMPWORD1 = w11
symbol varTEMPWORD2 = w12
symbol varTEMPWORD3 = w13
}
main:
let dirsB = 63
let dirsC = 23
varI = 1
varJ = 7
varK = 1
varL = 0
high B.1
Cell_4_5:
gosub prc_PLAYER
varK = 1
if varK = 1 then
goto Cell_4_8
end if
gosub prc_PLAYER
Cell_4_9:
low B.1
stop
prc_PLAYER:
Low C.4
Low C.2
Low C.1
Low C.0
Symbol RST = B.5
Symbol CLK = B.4
Symbol DAT = B.3
BasicCell:
High RST
High CLK
High DAT
If varK = 1 Then
w0 = varJ
Gosub SetVolume
w0 = varI
Gosub SetTrack
Gosub PlayTrack
If varL = 1 then
Pause 3000
GoSub StopTrack
Else
Pause 5000
End If
Else
Gosub StopTrack
End If
Goto Back
SetVolume:
w0 = w0 | $FFF0
Goto TransmitW0
SetTrack:
w0 = w0 & $01FF
Goto TransmitW0
PlayTrack:
PauseTrack:
UnPauseTrack:
w0 = $FFFE
Goto TransmitW0
StopTrack:
w0 = $FFFF
Goto TransmitW0
TransmitW0:
Low RST
Pause 5
High RST
Pause 300
For b2 = 0 To 15
If w0 >= $8000 Then
High DAT
Else
Low DAT
End If
Pause 2
Low CLK
PauseUs 20
High CLK
w0 = w0 * 2
Next
High DAT
Return
Back:
return
Cell_4_8:
if varL = 1 then
goto Cell_4_9
end if
goto Cell_4_5
#no_data 'reduce download time
Low C.4
Low C.1
Low C.0
Symbol RST = B.5
Symbol CLK = B.4
Symbol DAT = B.3
BasicCell:
High RST
High CLK
High DAT
If varK = 1 Then
w0 = varJ
Gosub SetVolume
w0 = varI
Gosub SetTrack
Gosub PlayTrack
Gosub Hold
If varL = 1 then
Gosub StopTrack
Else
Pause 2000
End If
Else
Gosub Hold
Gosub StopTrack
End If
Goto Back
SetVolume:
w0 = w0 | $FFF0
Goto TransmitW0
SetTrack:
w0 = w0 & $01FF
Goto TransmitW0
PlayTrack:
PauseTrack:
UnPauseTrack:
w0 = $FFFE
Goto TransmitW0
StopTrack:
w0 = $FFFF
Goto TransmitW0
TransmitW0:
Low RST
Pause 5
High RST
Pause 300
For b2 = 0 To 15
If w0 >= $8000 Then
High DAT
Else
Low DAT
End If
Pause 2
Low CLK
PauseUs 20
High CLK
w0 = w0 * 2
Next
High DAT
Return
Hold:
Pause 30
If pinC.2 = 1 Then Hold
Pause 30
Return
Back:
The module is expecting a simple value of 0 to 511 to be received and it handles the mapping to the filename and extension to play; the PICAXE only has to send the correct command which includes that number.I think the code is seeking file '0001' to play on microSD card but '0001' does not exist on the card. The actual name of the file is '0001.ad4'
Or it could be that the system is not wired correctly, there's some incompatibility or other issue in the audio path, the files have not been put onto card correctly, you are not requesting the correct files to be played, the files don't contain any audio information or are silent tracks, files are being played but are ending prematurely, the output volume is not set correctly.Problem must be one of the following:
(1) voice module is defective;
(2) microSD card is defective; or
(3) code not correct.
It would certainly be worth posting a picture of your hardware as no one is immune from the occasional "D'oh!" moment. Many people, including myself, have wasted hours trying to figure something out which we were convinced was correct but was not when a different set of eyes may have spotted the error immediately or at least more quickly.No sense posting a picture of my wiring for the simple or actual project. I am very seriously doubting the viability of this voice module.
I guess that's the end of using this module. If Sparkfun can't get it to work I would be surprised if anyone without a module to hand can.Spark Fun Technical could not get the voice module to work in key mode.
PO7 connects via a push-to-make button to 0V so having it not connected is the same as having it connected and not pressing the button. I would expect Play/Stop, Next, Previous to be manual overrides to software control so not essential for software control.The datasheet for the voice module shows PO7 which is pin9 on the module connects to ground and that starts and stops play. In my project, PO7/pin9 is not connected to anything.
;pinB.0 = 14M2 output connected to mp3 TXD input pin16
;pinB.3 = 14M2 input connected to mp3 RXD output pin15
;pinB.4 = 14M2 input connected to mp3 Busy output pin13
;Baud Rate = T4800_(4,8,16,32) <????????>
;Is T4800 Baud Rate correct <????????>
;High B.0 (initialized in Basic Box below Start)
If varL=1 then ;varL=1 for 1st play of every file
serout B.0, T4800, ($EF) ;stop voice module
Pause 50
End If
If varK = 1 Then
serout B.0, T4800, ($E6) ;set volume medium level <????????>
Pause 50
serout B.0, T4800, ($F1) ;set volume medium level <????????>
Pause 50
If varI=0 Then
serout B.0, T4800, ($00)
End If
If varI=1 Then
serout B.0, T4800, ($01)
End If
If varI=2 Then
serout B.0, T4800, ($02)
End If
If varI=3 Then
serout B.0, T4800, ($03)
End If
If varI=4 Then
serout B.0, T4800, ($04)
End If
If varI=5 Then
serout B.0, T4800, ($05)
End If
If varI=6 Then
serout B.0, T4800, ($E6) ;set volume high level <????????>
Pause 50
serout B.0, T4800, ($F1) ;set volume high level <????????>
Pause 50
serout B.0, T4800, ($06)
End If
If varI=7 Then
serout B.0, T4800, ($E6) ;set volume high level <????????>
Pause 50
serout B.0, T4800, ($F1) ;set volume high level <????????>
Pause 50
serout B.0, T4800, ($07)
End If
Pause 50
Do
If pinB.4=1 Then Exit
Loop
serout B.0, T4800, ($EF)
Pause 50
varL=0
End If