CH10解s
- 格式:pdf
- 大小:138.39 KB
- 文档页数:2
第十章 质心运动定理与动量定理思 考 题10-1 分析下列陈述是否正确:(1) 动量是一个瞬时的量,相应地,冲量也是一个瞬时的量。
(2) 将质量为m 的小球以速度向上抛,小球回落到地面时的速度为。
因与的大小相等,所以动量也相等。
1v 2v 1v 2v (3) 力F 在直角坐标轴上的投影为、、,作用时间从t =0到t =t x F y F z F 1,其冲量的投影应是111,,t F I t F I t F I z z y y x x ===。
(4) 一物体受到大小为10 N 的常力F 作用,在t =3 s 的瞬时,该力的冲量的大小I = Ft = 30 N ·s。
10-2 当质点系中每一质点都作高速运动时,该系统的动量是否一定很大?为什么? 10-3 炮弹在空中飞行时,若不计空气阻力,则质心的轨迹为一抛物线。
炮弹在空中爆炸后,其质心轨迹是否改变?又当部分弹片落地后,其质心轨迹是否改变?为什么?10-4 质量为的楔块A 放在光滑水平面上。
质量为的杆BC 可沿铅直槽运动,其一端放在楔块A 上。
在思考题10-4附图所示瞬时,楔块的速度为,加速度为,求此时系统质心的速度及加速度。
1m 2m A v Aa思考题10-4附图 思考题10-5附图 10-5 质点系由三个质量均为m 的质点组成。
在初瞬时,这三个质点位于思考题10-5 附 0t 图所示位置,并分别具有初速度。
已知CO BO AO v v v ,,,235.1,200k j i v k v ++==B A i v 30=C 。
试 求此时质点系质心的位置及速度。
长度单位为m ,时间单位为s 。
6-6 试求思考题10-6附图所示各均质物体的动量,设各物体质量均为m 。
思考题10-6附图10-7 两个半径和质量相同的均质圆盘A,B ,放在光滑的水平面上,分别受到力 的作用,如思考题10-7附图所示,且B A F F ,B A F F =。
设两圆盘受力后自静止开始运动,在某一瞬时两圆盘的动量分别为。
Appendix FSelected SolutionsF.10Chapter10Solutions10.1The defining characteristic of a stack is the unique specification of how it is to be accessed.Stack is a LIFO(Last in First Out)structure.This means that the last thing that is put in thestack will be thefirst one to get out from the stack.10.3(a)PUSH R1(b)POP R0(c)PUSH R3(d)POP R710.5One way to check for overflow and underflow conditions is to keep track of a pointer thattracks the bottom of the stack.This pointer can be compared with the address of thefirst andlast addresses of the space allocated for the stack.;;Subroutines for carrying out the PUSH and POP functions.This;program works with a stack consisting of memory locations x3FFF ;(BASE)through x3FFB(MAX).R6is the bottom of the stack.;POP ST R1,Save1;are needed by POP.ST R2,Save2ST R3,Save3LD R1,NBASE;BASE contains-x3FFF.ADD R1,R1,#-1;R1contains-x4000.ADD R2,R6,R1;Compare bottom of stack to x4000BRz fail_exit;Branch if stack is empty.12APPENDIX F.SELECTED SOLUTIONSLD R1,BASE;Iterate from the top of;the stackLDI R0,BASE;Load the value from theNOT R3,R6;top of stackADD R3,R3,#1;Generate the;negative of the;bottom-of-stack pointerADD R6,R6,#1;Increment the;bottom-of-stack;pointerpop_loop ADD R2,R1,R3;Compare iterating;pointer to;bottom-of-stack pointerBRz success_exit;Branch if no more;entries to shiftLDR R2,R1,#-1;Load the entry to shiftSTR R2,R1,#0;Shift the entryADD R1,R1,#-1;Increment the;iterating pointerBRnzp pop_loopPUSH ST R1,Save1;Save registers thatST R2,Save2;are needed by PUSH.ST R3,Save3LD R1,MAX;MAX contains-x3FFBADD R2,R6,R1;Compare stack pointer to-x3FFBBRz fail_exit;Branch if stack is full.ADD R1,R6,#0;Iterate from the bottom;of stackLD R3,NBASE;NBASE contains;-x3FFFADD R3,R3,#-1;R3=-x4000push_loop ADD R2,R1,R3;Compare iterating;pointer to;bottom-of-stack pointerBRz push_entry;Branch if no more;entries to shiftLDR R2,R1,#0;Load the entry to shiftSTR R2,R1,#-1;Shift the entryADD R1,R1,#1;Decrement the;iterating pointerBRnzp push_loopF.10.CHAPTER10SOLUTIONS3push_entry ADD R6,R6,#-1;Increment the;bottom-of-stack pointerSTI R0,BASE;Push a value onto stackBRnzp success_exitsuccess_exit LD R1,Save1;Restore originalLD R2,Save2;register valuesLD R3,Save3AND R5,R5,#0;R5<---successRETfail_exit LD R1,Save1;Restore originalLD R2,Save2;register valuesLD R3,Save3AND R5,R5,#0ADD R5,R5,#1;R5<---failureRETBASE.FILL x3FFFNBASE.FILL xC001;NBASE contains-x3FFF.MAX.FILL xC005Save1.FILL x0000Save2.FILL x0000Save3.FILL x000010.7;Subroutines for carrying out the PUSH and POP functions.This;program works with a stack consisting of memory locations x3FFF ;(BASE)through x3FFB(MAX).R6is the stack pointer.R3contains ;the size of the stack element.R4is a pointer specifying the;location of the element to PUSH from or the space to POP to;POP ST R2,Save2;are needed by POP.ST R1,Save1ST R0,Save0LD R1,BASE;BASE contains-x3FFF.ADD R1,R1,#-1;R1contains-x4000.ADD R2,R6,R1;Compare stack pointer to x4000BRz fail_exit;Branch if stack is empty.ADD R0,R4,#0ADD R1,R3,#0ADD R5,R6,R3ADD R5,R5,#-1ADD R6,R6,R34APPENDIX F.SELECTED SOLUTIONS pop_loop LDR R2,R5,#0STR R2,R0,#0ADD R0,R0,#1ADD R5,R5,#-1ADD R1,R1,#-1BRp pop_loopBRnzp success_exitPUSH ST R2,Save2;Save registers thatST R1,Save1;are needed by PUSH.ST R0,Save0LD R1,MAX;MAX contains-x3FFBADD R2,R6,R1;Compare stack pointer to-x3FFBBRz fail_exit;Branch if stack is full.ADD R0,R4,#0ADD R1,R3,#0ADD R5,R6,#-1NOT R2,R3ADD R2,R2,#1ADD R6,R6,R2push_loop LDR R2,R0,#0STR R2,R5,#0ADD R0,R0,#1ADD R5,R5,#-1ADD R1,R1,#-1BRp push_loopsuccess_exit LD R0,Save0LD R1,Save1;Restore originalLD R2,Save2;register values.AND R5,R5,#0;R5<--success.RETfail_exit LD R0,Save0LD R1,Save1;Restore originalLD R2,Save2;register values.AND R5,R5,#0ADD R5,R5,#1;R5<--failure.RETBASE.FILL xC001;BASE contains-x3FFF.MAX.FILL xC005Save0.FILL x0000F.10.CHAPTER10SOLUTIONS5Save1.FILL x0000Save2.FILL x000010.9(a)BDECJKIHLG(b)Push ZPush YPop YPush XPop XPush WPush VPop VPush UPop UPop WPop ZPush TPush SPop SPush RPop RPop T(c)14different output streams.10.11Correction,The question should have read:In the example of Section10.2.3,what are the contents of locations0x01F1and0x01F2?They are part of a larger structure.Provide a name for that structure.x01F1-0x6200x01F2-0x6300They are part of the Interrupt Vector Table.10.13(a)PC=x3006Stack:—–—–xxxxx-Saved SSP(b)PC=x6200Stack:—–—–PSR of Program A-R66APPENDIX F.SELECTED SOLUTIONS x3007xxxxx(c)PC=x6300Stack:—–—–PSR for device B-R6x6203PSR of Program Ax3007xxxxx(d)PC=x6203Stack:—–—–PSR for device Bx6203PSR of Program A-R6x3007xxxxx(e)PC=x6400Stack:—–—–PSR for device B-R6x6204PSR of Program Ax3007xxxxx(f)PC=x6204Stack:—–—–PSR for device BF.10.CHAPTER10SOLUTIONS7x6204PSR of Program A-R6x3007xxxxx(g)PC=x3007Stack:—–—–PSR for device Bx6204PSR of Program Ax3007xxxxx-Saved.SSP10.14Correction-If the buffer is full,a character has been stored in0x40FE.LDI R0,KBDRLDI R1,PENDBFLD R2,NEGENDADD R2,R1,R2BRz ERR;Buffer is fullSTR R0,R1,#0;Store the characterADD R1,R1,#1STI R1,PENDBF;Update next available empty;buffer location pointerBRnzp DONEERR LEA R0,MSGPUTSDONE RTIKBDR.FILL xFE02PBUF.FILL x4000PENDBF.FILL x40FFNEGEND.FILL xBF01;xBF01=-(x40FF)MSG.STRINGZ"Character cannot be accepted;input buffer full."10.15Note:This problem introduces the concept of a data structure called a queue.A queue has aFirst-In-First-Out(FIFO)property-Data is removed in the order as it is inserted.By havingthe pointer to the next available empty location wrap around to the beginning of the bufferin this problem,the queue becomes a circular queue.A circular queue is space efficient as itmakes use of entries which have been removed by the consuming program.These conceptswill be covered in detail in a data structure or algorithms course.The solution to Problem10.15is not provided.Note that in this instance,we have provided asolution to10.14,which should help with10.15.8APPENDIX F.SELECTED SOLUTIONS10.17The Multiply step works by adding the multiplicand a number of times to an accumulator.Thenumber of times to add is determined by the multiplier.The number of instructions executedto perform the Multiply step=3+3*n,where n is the value of the multiplier.We will ingeneral do better if we replace the core of the Multiply routine(lines17through19of Figure10.14)with the following,doing the Multiply as a series of shifts and adds:AND R0,R0,#0ADD R4,R0,#1;R4contains the bit mask(x0001) Again AND R5,R2,R4;Is correspondingBRz BitZero;bit of multiplier=1ADD R0,R0,R1;Multiplier bit=1;-->add;shifted multiplicandBRn Restore2;Product has already;exceeded rangeBitZero ADD R1,R1,R1;Shift the;multiplicand bitsBRn Check;Mcand too big;-->check if any;higher mpy bits=1ADD R4,R4,R4;Set multiplier bit to;next bit positionBRn DoRangeCheck;We have shifted mpyBRnzp Again;bit into bit15;-->done.Check AND R5,R2,R4BRp Restore2ADD R4,R4,R4BRp CheckDoRangeCheck10.19This program assumes that hex digits are all capitalized.LD R3,NEGASCIILD R5,NEGHEXTRAP x23ADD R1,R0,R3;Remove ASCII templateLD R4,HEXTEST;Check if digit is hexADD R0,R1,R4BRnz NEXT1ADD R1,R1,R5;Remove extra;offset for hexF.10.CHAPTER10SOLUTIONS9NEXT1TRAP x23ADD R0,R0,R3;Remove ASCII templateADD R2,R0,R4;Check if digit is hexBRnz NEXT2ADD R0,R0,R5;Remove extra;offset for hexNEXT2ADD R0,R1,R0;Add the numbersADD R1,R0,R4;Check if digit>9BRnz NEXT3LD R2,HEXADD R0,R0,R2;Add offset for hex digits NEXT3LD R2,ASCIIADD R0,R0,R2;Add the ASCII template DONE TRAP x21TRAP x25ASCII.FILL x0030NEGASCII.FILL x-0030HEXTEST.FILL#-9HEX.FILL x0007NEGHEX.FILL x-710.21;;R1contains the number of digits including’x’.Hex;digits must be in CAPS.ASCIItoBinary AND R0,R0,#0;R0will be used for our resultADD R1,R1,#0;Test number of digits.BRz DoneAtoB;There are no digits;LD R3,NegASCIIOffset;R3gets xFFD0,i.e.,-x0030LEA R2,ASCIIBUFFLD R6,NegXCheckLDR R4,R2,#0ADD R6,R4,R6BRz DoHexToBinADD R2,R2,R1ADD R2,R2,#-1;R2now points to"ones"digit ;LDR R4,R2,#0;R4<--"ones"digitADD R4,R4,R3;Strip off the ASCII template10APPENDIX F.SELECTED SOLUTIONSADD R0,R0,R4;Add ones contribution ;ADD R1,R1,#-1BRz DoneAtoB;The original number had one digitADD R2,R2,#-1;R2now points to"tens"digit ;LDR R4,R2,#0;R4<--"tens"digitADD R4,R4,R3;Strip off ASCII templateLEA R5,LookUp10;LookUp10is BASE of tens valuesADD R5,R5,R4;R5points to the right tens valueLDR R4,R5,#0ADD R0,R0,R4;Add tens contribution to total ;ADD R1,R1,#-1BRz DoneAtoB;The original number had two digitsADD R2,R2,#-1;R2now points to"hundreds"digit ;LDR R4,R2,#0;R4<--"hundreds"digitADD R4,R4,R3;Strip off ASCII templateLEA R5,LookUp100;LookUp100is hundreds BASEADD R5,R5,R4;R5points to hundreds valueLDR R4,R5,#0ADD R0,R0,R4;Add hundreds contribution to totalRETDoHexToBin;R3=NegASCIIOffset;R2=Buffer Pointer;R1=Num of digits+x;ST R7,SaveR7LD R6,NumCheckADD R1,R1,#-1ADD R2,R2,R1;LDR R4,R2,#0;R4<--"ones"digitADD R4,R4,R3;Strip off the ASCII templateADD R7,R4,R6BRnz Cont1LD R7,NHexDiffADD R4,R4,R7Cont1ADD R0,R0,R4;Add ones contribution;ADD R1,R1,#-1F.10.CHAPTER10SOLUTIONS11BRz DoneAtoB;The original number had one digitADD R2,R2,#-1;R2now points to"tens"digit ;LDR R4,R2,#0;R4<--"tens"digitADD R4,R4,R3;Strip off ASCII templateADD R7,R4,R6BRnz Cont2LD R7,NHexDiffADD R4,R4,R7Cont2LEA R5,LookUp16ADD R5,R5,R4LDR R4,R5,#0ADD R0,R0,R4;ADD R1,R1,#-1BRz DoneAtoB;The original number had two digitsADD R2,R2,#-1;R2now points to"hundreds"digit ;LDR R4,R2,#0ADD R4,R4,R3;Strip off ASCII templateADD R7,R4,R6BRnz Cont3LD R7,NHexDiffADD R4,R4,R7Cont3LEA R5,LookUp256ADD R5,R5,R4LDR R4,R5,#0ADD R0,R0,R4;DoneAtoB LD R7,SaveR7RETNegASCIIOffset.FILL xFFD0NumCheck.FILL#-9NHexDiff.FILL#-7NegXCheck.FILL xFF88SaveR7.FILL x0000ASCIIBUFF.BLKW4LookUp10.FILL#0.FILL#10.FILL#2012APPENDIX F.SELECTED SOLUTIONS.FILL#30.FILL#40.FILL#50.FILL#60.FILL#70.FILL#80.FILL#90;LookUp100.FILL#0.FILL#100.FILL#200.FILL#300.FILL#400.FILL#500.FILL#600.FILL#700.FILL#800.FILL#900LookUp16.FILL#0.FILL#16.FILL#32.FILL#48.FILL#64.FILL#80.FILL#96.FILL#112.FILL#128.FILL#144.FILL#160.FILL#176.FILL#192.FILL#208.FILL#224.FILL#240LookUp256.FILL#0.FILL#256.FILL#512.FILL#768.FILL#1024.FILL#1280.FILL#1536.FILL#1792.FILL#2048.FILL#2304F.10.CHAPTER10SOLUTIONS13.FILL#2560.FILL#2816.FILL#3072.FILL#3328.FILL#3584.FILL#384010.23This program reverses the input string.For example,given an input of“Howdy”,the outputis“ydwoH”.9.7Note:This problem belongs in chapter10.The three errors that arose in thefirst student’s program are:1.The stack is left unbalanced.2.The privilege mode and condition codes are not restored.3.Since the value in R7is used for the return address instead of the value that was saved onthe stack,the program will most likely not return to the correct place.。
【10-6】若某一终端以2400波特的速率发送异步串行数据,发送1位需要多少时间?假设一个字符包含7个数据位、1个奇偶校验位、1个停止位,发送一个字符需要多少时间? 解:
(1) 据波特率的定义:单位时间内传送的字符位数。
其倒数为位宽,即发送字符中一个数据位所需的时间,为:
Td=1/2400=0.00041667s=0.4167(ms)
即发送一位数据所需的时间为0.4167(ms)
(2) 若一个字符包含1(起始位)+7(数据位)+1(校验位)+1(停止位)=10位,则发送一个字符所需的时间即为发送10个数据位所需的时间,为:
10 Td=4.167(ms)
即发送一个字符所需的时间为4.167(ms)
【10-9】若8251以9600波特的速率发送数据,波特率因子为16,发送时钟/TxC频率为多少?
解:
因为:fc=N*Boud
所以:/TxC的频率为:
fc=16×9600=153600Hz=153.6kHz
即/TxC的频率为153.6kHz
【10-14】若8251A的端口地址为FF0H,FF2H,要求8251A工作于异步工作方式,波特率因子为16,有7个数据位,1个奇校验位,1个停止位,试对8251A进行初始化编程。
解: ···
0FF2H
MOV DX,
MOV AL, 0
OUT D X, AL
CALL DELAY
OUT D X, AL
CALL DELAY
OUT D X, AL
CALL DELAY
40H
MOV AL,
OUT D X, AL
CALL DELAY
10B
;S2_S1_EP_PEN_L2_L1_B2_B1
10
01
01
MOV AL,
AL ;5AH: 1个停止位1,奇校验,7个数据位,N=16 OUT D X,
CALL DELAY
00X101X1B ;EH_IR_RTS_ER_SBRK_RxE_DTR_TxEN
MOV AL,
OUT D X, AL
CALL DELAY
···
DELAY PROC NEAR
0FFH MOV CX, AA: LOOP AA
DELAY ENDP。