PIC18F14K50 processor
PBP Program to receive a DTMF tone from a dedicated tone receiver chip and to process various stuff depending on the tone received.

So, I check for valid tone receipt and all that... and place the received tone into a variable called ToneIn once one comes through. From there I use a "Select Case" condition to perform various tasks depending on the value of the tone - there's 16 available DTMF tones.

Here's the Select Case part of the code:

Code:
'********************************************************
Act_On_Tone:
'********************************************************

Pause 100

'Main Case condition for each various tone received
select Case ToneIN
    case 0 'DTMF D
        Pause 1000
    case 1 'DTMF 1
        Pause 1000
    case 2 'DTMF 2
        Pause 1000
    case 3 'DTMF 3
        Pause 1000
    case 4 'DTMF 4
        Pause 1000
    case 5 'DTMF 5
        Pause 1000
    case 6 'DTMF 6
        Pause 1000
    case 7 'DTMF 7
        'Arm Flight Computer
        FC_Arm = 0
        Pause 500
        FC_Arm = 1        
        
    case 8 'DTMF 8
        'Report back (audibly) the Pressure Sensor Status
        Pause 2000
        PTT = 0
        Pause 200
        if sensor1 = 0 then
            sound Audio_Out,[100,50]
            'FREQOUT PORTC.1,1000,1000
        else
            'FREQOUT Audio_Out,1000,2000
            sound Audio_Out,[100,50]
            Pause 500            
            'FREQOUT Audio_Out,1000,2000
            sound Audio_Out,[100,50]
            Pause 500            
            'FREQOUT Audio_Out,1000,2000
            sound Audio_Out,[100,50]
        endif
        PTT = 1     
          
    case 9 'DTMF 9
        Pause 1000
    case 10 'DTMF 0  
        Pause 1000
    case 11 'DTMF *  
        Pause 1000
    case 12 'DTMF #
        Pause 1000
    case 13 'DTMF A
        Pause 1000
    case 14 'DTMF B
        'Activate Channel 1 for 2 sec
        Ch1_Out = 1
        Pause 2000
        Ch1_Out = 0        
    case 15 'DTMF C
        'Activate Channel 2 for 3 sec
        Ch2_Out = 1
        Pause 3000
        Ch2_Out = 0      
    CASE else
      
end select

Return
Now here's the weird bit: if the incoming tone value matches a CASE condition with code in it, it'll run that bit of code and all is sweet. If the incoming tone value doesn't match a CASE condition with any code in it, the case condition for "15" is assumed and that section of code is executed for condition ToneIn=15. Notice I put a "Pause 1000" into all the conditions that previously didn't have code - this line of code appears to stop this weird behavior from occurring ie. the code for ToneIn=15 won't execute if tones 1,2,3,4,5,6,9,*,#,A are received. Remove that "Pause 1000" line and the ToneIn=15 condition is somehow executed for all those other tone values.

Any clues?

Thanks

Troy