Download Educational Robot Design - USQ ePrints
Transcript
movf Temp,w addlw LOW TheNotes btfsc STATUS,C incf PCLATH,f movwf PCL TheNotes dt 0x00;Rest 0 dt .5 ;Low C 1 dt .20 ;Low D 2 dt .45 ;Low E3 dt .69 ;Low F 4 dt .79 ;Low G 5 dt .99 ;A 6 dt .116;B 7 dt .132;C 8 dt .139;D 9 dt .152;E A dt .163;F B dt .168;G C dt .178;High A D dt .187;High B E dt .195;High C F dt .198;High D G ;-----------------------------------------------;StopMusic ; As it says ;-----------------------------------------------StopMusic ;I can stop the music call NoteOff bcf INTCON, T0IE ;tmr0 interrupt enabled goto IntEnd ;-----------------------------------------------;DoMusic ; Toggles the Sound on and off so they become ; a musical note ;-----------------------------------------------DoMusic movf NoteToggle,w subwf 0x01,w skpnz goto NoteOn goto NoteOff ;-----------------------------------------------;NoteOn ; Turns DortD pin 0 on for on portion of note ; ;-----------------------------------------------NoteOn bsf PORTD,0 ;turn the note on bsf NoteToggle,0 123