You are on page 1of 1

org 0000h forever: mov P1,#0FFh ;make P1 as input mov P2,#0FFh ;test P2 mov P3,#0FFh ;test P3 mov P2,#00h

mov P3,#00h here3: repete0: ;// for pin p3.0 JB P1.0,again0 ;moniter P1.0 lcall here1 ; if no input check P1.0 again0: setb P3.0 lcall delay cpl P3.0 lcall delay lcall repete0 ;repete 5ms loop repete1:;// for pin p3.1 here1: JB P1.1,again1; moniter P1.1 lcall here2; If no input check P1.2 again1: setb P3.1 lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( cpl P3.1 lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall repete1 ;repete 10ms loop repete2:;// for pin p3.2 here2: JB P1.2,again2; moniter P1.2 lcall here3; if no input check P1.0 again2: setb P3.2 lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( cpl P3.2 lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall delay ; sorry I forgot the exact code :( lcall repete2;repete 20ms loop lcall forever; forever loop ;---------- this is delay subroutine for 5ms -----------;---------- this is delay subroutine for 5ms-----------org 400h delay:mov TMOD,#01 ;Timer 0, 16-bitmode mov TL0,#0 ;TL0=0, the low byte mov TH0,#0EEH ;TH0=EE, the high byte setb TR0 ;Start timer 0 AGAIN: JNB TF0,AGAIN ;Monitor timer flag 0 clr TR0 ;Stop the timer 0 clr TF0 ;Clear timer 0 flag ret end

You might also like