LJMP SET_TIMER
KEY6:CJNE R0,#20H,KEY7 ;K6键按下 mov p0,#0DFH ;第六个灯亮 MOV 30H,#0FDH ;设置音阶6 MOV 31H,#92H LJMP SET_TIMER
KEY7:CJNE R0,#40H,KEY8 ;K7键按下 mov p0,#0BFH ;第七 个灯亮 MOV 30H,#0FDH ;设置音阶7 MOV 31H,#0D6H LJMP SET_TIMER
KEY8:CJNE R0,#80H,NOKEY ;K8按下 mov p0,#07FH ;第八个灯亮 MOV 30H,#0FDH ;设置音阶8 MOV 31H,#0FBH
SET_TIMER:SETB TR0 ;发声 LJMP START
NOKEY:CLR TR0 ;无键按下 LJMP START
INT_T0: ;T0中断服务程序 MOV TH0,30H ;定时器赋初值 MOV TL0,31H
CPL BUZZ ;输出方波RETIEND RETI END
8