Interrupts and Serial Port programming in Assembly level for 8051 Microcontroller

Write ALP that continuously gets 8-bit data from P0 and sends it to P1 while simultaneously creating square wave of 200 milliseconds period on P2.1. Use Timer 0 (Mode 2) to create square wave. (Crystal frequency=11.0592MHz).

Assembly Code:

ASM Code:
  ORG 0000H SJMP MAIN   ORG 000BH //Timer 0 ISR Address CLR TF0 CPL P2.1 //Complement P2.1 RETI //Return from ISR   ORG 0030H MAIN: MOV TMOD, #02H MOV TH0, #0A4H MOV P0,#0FFH MOV IE,#82H SETB TR0   HERE: MOV A,P0 MOV P1,A SJMP HERE   END    

Write ALP to transmit data serially. Set baud rate at 4800, 8-bit data and 1 stop bit.

Assembly Code:

ASM Code:
  ORG 0000H SJMP MAIN   ORG 0030H MAIN:MOV TMOD,#20H MOV TH1,#-6 MOV SCON,#50H SETB TR1 BACK: MOV SBUF,#"A" AGAIN: JNB TI,AGAIN CLR TI SJMP BACK END  

Write ALP to transmit data serially. Set baud rate at 19200, 8-bit data and 1 stop bit.

Assembly Code:

ASM Code:
  ORG 0000H SJMP MAIN   ORG 0030H MAIN:MOV A,PCON //Set PCON.7 = 1 without modifying other bits for increased baud rate SETB ACC.7 MOV PCON,A   MOV TMOD,#20H MOV TH1,#-3 MOV SCON,#50H   SETB TR1   BACK: MOV SBUF,#"D" AGAIN: JNB TI,AGAIN CLR TI SJMP BACK END