Download filezillafor windows
      ' Channel 1 variables DimCHANNEL_1_NOTE asByte ' Note to play read from tune data for channel 1 DimCHANNEL1_TIME_ON asWord    ' Midi event trigger for channel 1 chime DimTRACK_1_DATA asWord ' Music data pointer for channel 1 DimCHANNEL_1_FINISHED asCHANNEL_INFO.0  ' Indicate if track finished          ' Channel 2 variables DimCHANNEL_2_NOTE asByte ' Note to play read from tune data for channel 2 DimCHANNEL2_TIME_ON asWord    ' Midi event trigger for channel 2 chime DimTRACK_2_DATA asWord ' Music data pointer for channel 2 DimCHANNEL_2_FINISHED asCHANNEL_INFO.1  ' Indicate if track finished ' Channel 3 variables DimCHANNEL_3_NOTE asByte ' Note to play read from tune data for channel 3 DimCHANNEL3_TIME_ON asWord    ' Midi event trigger for channel 3 chime DimTRACK_3_DATA asWord ' Music data pointer for channel 3 DimCHANNEL_3_FINISHED asCHANNEL_INFO.2  ' Indicate if track finished                                 SymbolTRIGGER_NOTE_1 = TRISB.0
SymbolTRIGGER_NOTE_2 = TRISB.1
SymbolTRIGGER_NOTE_3 = TRISB.2
DimTIMER1asTMR1L.Word
' Combine TMR1L/TMR1H into 16-bit variable TIMER1         SymbolGIE= INTCON.7 ' Global Interrupt Enable/Disable          ON_INTERRUPTGotoNOTE_INT ' Point the hardware interrupt to the interrupt handler Delayms100   ' Wait for the PICmicro to stabilise ALL_DIGITAL= True ' Set PORTA and PORTE to all digital mode LowPORTB ' Discharge the capacitors before we start LowPORTA ' Make all of PORTA outputs to help discharge the capacitors Delayms500                                                                                                      ' Wait for them to discharge
' Jump over the interrupt handling subroutine and the general subroutines
GotoMAIN_PROGRAM_LOOP            '----[INTERRUPT HANDLER TO PLAY THREE NOTES]---------------------------------------- NOTE_INT: TIMER1= 65460 ' Load TMR1 to increase the interrupt interval IncNOTE_1_COUNTER        ' \    IncNOTE_2_COUNTER '  Increment each channel's toggle counter IncNOTE_3_COUNTER ' / ' Note generator for channel 1               IfNOTE_1_COUNTER >= NOTE_1 Then ' Is it time to toggle PORTA.0 ? TRISA= TRISA^ 1   ' Yes. So XOR with 1 to toggle the pin ClearNOTE_1_COUNTER ' And reset the toggle counter Endif ' Note generator for channel 2 IfNOTE_2_COUNTER >= NOTE_2 Then ' Is it time to toggle PORTA.1 ? TRISA= TRISA^ 2   ' Yes. So XOR with 2 to toggle the pin ClearNOTE_2_COUNTER ' And reset the toggle counter Endif ' Note generator for channel 3 IfNOTE_3_COUNTER >= NOTE_3 Then ' Is it time to toggle PORTA.2 ? TRISA= TRISA^ 4   ' Yes. So XOR with 4 to toggle the pin ClearNOTE_3_COUNTER ' And reset the toggle counter Endif         ClearPIR1.0 ' Clear TMR1 interrupt flag RetfieFAST   ' Return from the interrupt and restore WREG, BSR and STATUS
Home | Previous Page | Next Page