Help with Using the Catalex MP3 Player
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    239

    Smile Help with Using the Catalex MP3 Player

    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

  2. #2
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    299

    Default Re: Help with Using the Catalex MP3 Player

    My best guess is that you may occasionally get dial pulses while the software is somewhere other than the top of "dial:".

    You could use CASE SELECT instead of a bunch of IF/THEN clauses. With CASE SELECT you can only Select one option. With the string of IF/THENs, you could exit one and enter another before returning to receive the next "incoming call".

    You are apparently still using PBP 2.6. You might consider upgrading. Lastly, you mix & match capital and small case letters. Every once in awhile that matters.
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,890

    Default Re: Help with Using the Catalex MP3 Player

    Every 10msec you check for 5 seconds if there are pulses.

    If something happens in the middle of the 10ms you will loose it guess.

    So then you are trapped in the if-then loop.

    Maybe you should reset the variable message before looping back.

    Even better think of a loop based on interrupts.

    Having an output toggled in the loop will assure you the the loop is working OK but the variable is not in the check range.

    Ioannis

  4. #4
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    239

    Default Re: Help with Using the Catalex MP3 Player

    Quote Originally Posted by Ioannis View Post
    Every 10msec you check for 5 seconds if there are pulses.

    If something happens in the middle of the 10ms you will loose it guess.

    So then you are trapped in the if-then loop.

    Maybe you should reset the variable message before looping back.

    Even better think of a loop based on interrupts.

    Having an output toggled in the loop will assure you the the loop is working OK but the variable is not in the check range.

    Ioannis
    Thank you all for your replies

    I put a message reset variable in as Ioannis suggested

    gosub Track8
    ENDif
    if message=9 then '
    gosub Track9
    ENDif
    if message=10 then '
    gosub Track10
    ENDif
    >>>>>>>>>>>>>>Set Message to zero here
    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

  5. #5
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    1,049

    Default Re: Help with Using the Catalex MP3 Player

    There’s another switch contact on the rotary dial to tell you the dial is in the home position doing nothing.
    The dial switch does nothing while the dial is being rotated clockwise by the finger so when the
    home switch changes state you can wait 10ms or so for contact bounce and start counting transitions from one to zero on the dial switch with 10ms or so delays for contact bounce.
    Stop counting when the dial is in the home position again, and divide the count by 2.

Similar Threads

  1. VS1053 (MP3 board) and Picbasic?
    By Michael in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 28th December 2011, 22:36
  2. Embedded MP3 player from Sparkfun
    By ScaleRobotics in forum General
    Replies: 3
    Last Post: - 10th March 2010, 04:41
  3. MP3 Player Using VS1011
    By lindomar in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th October 2009, 19:26
  4. Block diagram for PIC based mp3 player
    By joseph Degorio in forum Schematics
    Replies: 13
    Last Post: - 18th December 2007, 16:13
  5. Replies: 1
    Last Post: - 27th May 2006, 00:54

Members who have read this thread : 12

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts