How produce 38khz square wave?  

Setb half time (1/f) and them Clr half time (1/f)

lowled: clr       P1.4          mov        r0,#8                                           

 

 

  djnz     r0,$                                                                                              

  setb      P1.4

  mov    r0,#7

  djnz      r0,$

  dinz      r1,lowled

              ret