Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4790

Help with Using the Catalex MP3 Player

$
0
0
Hi Thank you for reading

I am using a Catlex MP3 Player (It was Cheap) from ebay to play specific sound bytes driven from a GPO dial telephone.... Dial 3 it plays track three, dial 7 it plays track 7 etc.

I would expect the code to go back to scanning the dial waiting for the next number dialed after the playing message has finished.

But:- Every so it just stalls and wont do anything till I reset.

Do I need to tidy up anything or have I missed anything obvious .... I am not a software guy at all so go easy on me.

Code:

' Name      : Messages.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler  : MPASM
' Target PIC  : PIC16F628A
' Hardware    : VeroBoard
' Oscillator  : 4 Megs External
' Keywords    : MP3 Messages
' Description : Messages
' Using the Catalex MP3 Player.
           
           
            DEFINE OSC 4        'Set oscillator in MHz
            'OSCCON = $60  '4 Megs Xtal
            TRISA=0        'Port A all outputs
            TRISB=%00001100 'Make RB3 and RB4 inputs
            'OPTION_REG.7=0 'Enable internal pull-ups
            CMCON=7        'No Analogs
           
           
            DEFINE HSER_TXSTA 24H  'Set transmit status and control
            DEFINE HSER_RCSTA 90H  'Set receive status and control
            DEFINE HSER_BAUD 9615  'Baud Rate 9600 Catalex Uart
            define HSER_CLROERR 1  ' Clear Buffer
            define HSER_SPBRG 25    '
           

' Alias pins
            HOOK Var PORTB.3    'Hook input
            PULSE VAr PORTB.4      'Pulse Input
            VOL con 20              ' Volume Level 0 to 30
            MESSAGE Var word        ' Message Number 
           
            hserout [$7E,$FF,$06,$09,$00,$00,$02,$EF] 'Select TF Device
            pause 200         
            hserout [$7E,$FF,$06,$06,$00,$00,$14,$EF] 'Volume Set
            pause 200
            Gosub shhh              'Stop playing
            'pause 20
           
           
dial:      count pulse,5000,Message
            pause 10
           
           
            if message=1 then  'Mess1
            gosub Track1
            ENDif
            if message=2 then  'Mess2 
            gosub Track2
            endif
            if message=3 then  'Mess3
            gosub Track3
            Endif           
            if message=4 then  '
            gosub Track4
            ENDif           
            if message=5 then  '
            gosub Track5
            ENDif
            if message=6 then  '
            gosub Track6
            ENDif
            if message=7 then  '
            gosub Track7
            ENDif
            if message=8 then  '
            gosub Track8
            ENDif
            if message=9 then  '
            gosub Track9
            ENDif
            if message=10 then  '
            gosub Track10
            ENDif
           
            goto dial
           
           
track1:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$01,$EF] 'Message 1
            return
           
track2:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$02,$EF] 'Message 2
            return         
                       
track3:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$03,$EF] 'Message 3
            return
                     
track4:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$04,$EF] 'Message 4
            return         
               
track5:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$05,$EF] 'Message 5
            return
           
track6:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$06,$EF] 'Message 6
            return
           
track7:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$07,$EF] 'Message 7
            return   
           
track8:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$08,$EF] 'Message 8
            return
           
track9:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$09,$EF] 'Message 9
            return         
           
track10:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$0A,$EF] 'Message 10
            return
           
d_tone:    gosub shhh
            hserout [$7E,$FF,$06,$03,$00,$00,$0C,$EF] 'Tone low res
            return           
           
           
Shhh :      hserout [$7E,$FF,$06,$16,$00,$00,$00,$EF] 'Stop Playing
            pause 200
            Return                   
           
                     
       
  End


Viewing all articles
Browse latest Browse all 4790

Trending Articles