作者haha0805 (星)
看板Programming
标题[问题] 8051
时间Sat Jun 13 21:44:36 2009
这是作业@ @
我已经自己写过了
但我部知道对不对
所以请版友帮我看一下,假如可以跟我说一下哪里有错吧
万分感谢
以下是我自己写的题目加答案:
Write a program to create a square wave of T = 160 ms on pin P2.2 while at
the same time the 8051 is sending out 55H and AAH to P1 continuously.
ORG 0000H
LJMP MAIN
ORG 001BH
LJMP ISR_T1
ORG 0030H
MAIN: MOV TMOD,#10H
MOV A,#55H
MOV P1,A
MOV R3,#32
AGAIN: MOV TL1,#00H
MOV TH1,#EEH
MOV IE,#88H
SETB TR1
BACK: JNB TF1,BACK
CLR TR1
CLR TF1
DJNZ R3,AGAIN
ISR_T1:
CPL P2.2
CPL A
MOV P1,A
RETI
END
Write a program in which every 2 seconds, the LED connected to P2.7 is
turned on and off four times,while at the same time the 8051 is getting data
from P1 and sending it to P0 continuously.Make sure the on and off states are
50ms in duration.
ORG 0000H
LJMP MAIN
ORG 001BH
LJMP ISR_T1
ORG 0030H
MAIN: MOV TMOD,#10H
MOV P1,#0FFH
MOV R3,#40
AGAIN: MOV TL1,#4BH
MOV TH1,#FDH
MOV IE,#88H
SETB TR1
BACK: JNB TF1,BACK
MOV A,P1
MOV P0,A
CLR TR1
CLR TF1
DJNZ R3,AGAIN
ISR_T1:
MOV R2,#4
TURN: CPL P2.7
DJNZ R2,TURN
RETI
END
Write a program using interrupts to get data from P1 and send it to P2 while
Timer0 is generating a square wave of 3kHZ.
ORG 0
LJMP MAIN
ORG 000BH
MOV TL0,#00H
MOV TH0,#0F4H
RETI
ORG 30H
MAIN: MOV TMOD,
#00000001B
MOV P1,#0FFH
MOV TL0,#00H
MOV TH0,#0F4H
MOV IE,#82H
SETB TR0
MOV A,P1
MOV P2,A
HERE: SJMP HERE
END
如有错请纠正,谢谢!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.193.197.202
1F:→ dnlgjaska:能不能用c写一写再翻8086? 那麽就一定对 210.192.255.29 06/16 19:04
2F:→ MOONRAKER:8051作业为何要翻8086? 125.232.96.107 06/18 03:40
3F:推 Peruheru:应该是讲错了XD 192.192.154.54 06/19 16:33
4F:→ ericwang1017:先用keil C把 c code 翻成asm较好 219.81.161.142 06/22 23:51