📄 chap.5.parallel_io.ps
字号:
2487 1184(.)N2487 1205(.)N2487 1225(.)N2487 1246(.)N2487 1266(.)N2487 1287(.)N2631 1143(.)N2631 1164(.)N2631 1184(.)N2631 1205(.)N2631 1225(.)N2631 1246(.)N2631 1266(.)N2631 1287(.)N2775 1143(.)N2775 1164(.)N2775 1184(.)N2775 1205(.)N2775 1225(.)N2775 1246(.)N2775 1266(.)N2775 1287(.)N2919 1143(.)N2919 1164(.)N2919 1184(.)N2919 1205(.)N2919 1225(.)N2919 1246(.)N2919 1266(.)N2919 1287(.)N3063 1143(.)N3063 1164(.)N3063 1184(.)N3063 1205(.)N3063 1225(.)N3063 1246(.)N3063 1266(.)N3063 1287(.)N3207 999 MXY0 -144 Dl-1151 0 Dl0 144 Dl1151 0 Dl1575 MY0 -144 Dl-1151 0 Dl0 144 Dl1151 0 Dl2200 1431(.)N2200 1452(.)N2200 1472(.)N2200 1493(.)N2200 1513(.)N2200 1534(.)N2200 1554(.)N2200 1575(.)N2344 1431(.)N2344 1452(.)N2344 1472(.)N2344 1493(.)N2344 1513(.)N2344 1534(.)N2344 1554(.)N2344 1575(.)N2487 1431(.)N2487 1452(.)N2487 1472(.)N2487 1493(.)N2487 1513(.)N2487 1534(.)N2487 1554(.)N2487 1575(.)N2631 1431(.)N2631 1452(.)N2631 1472(.)N2631 1493(.)N2631 1513(.)N2631 1534(.)N2631 1554(.)N2631 1575(.)N2775 1431(.)N2775 1452(.)N2775 1472(.)N2775 1493(.)N2775 1513(.)N2775 1534(.)N2775 1554(.)N2775 1575(.)N2919 1431(.)N2919 1452(.)N2919 1472(.)N2919 1493(.)N2919 1513(.)N2919 1534(.)N2919 1554(.)N2919 1575(.)N3063 1431(.)N3063 1452(.)N3063 1472(.)N3063 1493(.)N3063 1513(.)N3063 1534(.)N3063 1554(.)N3063 1575(.)N10 s3135 820(0)N2991 819(1)N2847(2)X2703(3)X2559(4)X2408(5)X2120(7)X2264(6)X14 s1660 1532(PCreg)N1660 962(PAreg)N1660 1250(PBreg)N12 s576 1782(Again)N837(referring)X1200(to)X1301(our)X1455(chemical)X1830(plant)X2049(example,)X2426(assume)X2735(the)X2879(3)X2953(valves)X3225(\(Input)X3486(A,)X3605(Input)X3834(B,)X3949(and)X4115(Out\))X576 1894(are)N724(associated)X1150(with)X1351(PADR)X1636(bits)X1805(2,)X1907(1,)X2008(and)X2176(0)X2253(respectively,)X2772(and)X2940(the)X3087(Input)X3319(Sensor)X3609(with)X3809(PBDR)X4088(bit)X4219(7.)X576 2006(Then,)N822(the)X964(following)X1362(instruction)X1798(would)X2062(open)X2273(the)X2415(input)X2637(valves)X2907(and)X3070(close)X3292(the)X3434(output)X3704(valve.)X7 f1152 2166(*PAreg)N1558(=)X1674(0x06;)X2022(/*)X2196 0.4219(%00000110)AX2776(*/)X1 f576 2326(The)N750(following)X1148(would)X1412(close)X1634(the)X1776(inputs)X2035(and)X2198(open)X2409(the)X2551(output.)X7 f1152 2486(*PAreg)N1558(=)X1674(0x01;)X2022(/*)X2196 0.4219(%00000001)AX2776(*/)X1 f576 2674(Assuming)N989(that)X1158(the)X1300(chemical)X1673(process)X1985(is)X2073(to)X2172(proceed)X2501(as)X2605(follows:)X3 f776 2786(Repeat)N1088(forever)X1436({)X1 f976 2926(1.)N1120(open)X1331(inputs,)X1614(close)X1836(output.)X976 3066(2.)N1120(wait)X1310(until)X1511(tank)X1701(is)X1789(full.)X976 3206(3.)N1120(open)X1331(output,)X1625(close)X1847(inputs.)X3 f976 3318(})N1 f576 3458(The)N750(program)X1100(would)X1364(look)X1559(like:)X7 f1152 3618(#define)N1616(PAaddr)X2022 0.4167(0xFE050000)AX1152 3730(#define)N1616(PBaddr)X2022 0.4167(0xFE050010)AX1152 3954(unsigned)N1674(char)X1964(*PAreg,)X2428(*PBreg;)X1152 4178(PAreg)N1500(=)X1616(PAaddr;)X1152 4290(PBreg)N1500(=)X1616(PBaddr;)X1152 4514(do)N1326({)X1728 4626(*PAreg)N2134(=)X2250(0x06;)X1728 4738(while)N2076(\(\(*PBreg)X2598(&)X2714(0x80\))X3062(==)X3236(0\);)X1728 4850(*PAreg)N2134(=)X2250(0x01;)X1152 4962(while)N1500(\(1\);)X1 f576 5150(Notice)N867(that)X1046(this)X1219(program)X1579(is)X1677(an)X1802(in\256nite)X2109(loop)X2314(\(by)X2476(design\).)X2817(This)X3022(is)X3121(typical)X3419(for)X3566(a)X3644(program)X4005(used)X4216(to)X576 5262(control)N890(an)X1022(industrial)X1427(process.)X1804(The)X1995(\256rst)X2185(line)X2371(of)X2492(the)X7 f2685(do)X2876(...)X3125(while)X3489(\(1\))X1 f3703(loop)X3914(will)X4104(open)X576 5374(inputs)N836(and)X1000(close)X1223(outputs.)X1555(The)X1730(second)X2022(line)X2193(waits)X2422(until)X2625(the)X2769(tank)X2961(is)X3051(full,)X3235(and)X3400(the)X3544(third)X3752(line)X3923(opens)X4173(the)X576 5486(output)N846(and)X1009(closes)X1268(the)X1410(inputs.)X50 p%%Page: 50 512 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(50)X2505(-)X3 f3717(Lecture)X4062(Notes)X576 803(5.3.)N768(Timing)X1091(and)X1269(I/O)X1432(Operation)X1878(Duration)X1 f776 943(On)N919(closer)X1175(examination)X1678(of)X1784(the)X1928(proceeding)X2382(program)X2734(segment,)X3105(one)X3271(problem)X3619(becomes)X3983(evident.)X576 1055(The)N762(problem)X1119(is)X1219(that)X1399(the)X1552(output)X1833(valve)X2077(will)X2262(only)X2468(remain)X2771(open)X2993(for)X3140(as)X3255(long)X3461(as)X3576(it)X3665(takes)X3898(the)X4051(68000)X576 1167(CPU)N804(to)X921(execute)X1258(the)X7 f1452(BRA)X1 f1668(instruction)X2122(associated)X2561(with)X2775(the)X7 f2970(while)X3337(\(1\))X1 f3554(statement,)X3991(and)X4173(the)X576 1279(assignment)N1036(statement)X1433(to)X7 f1569(*PAreg)X1 f1944(at)X2040(the)X2184(top)X2333(of)X2439(the)X2583(loop.)X2828(Assuming)X3243(a)X3312(typical)X3601(CPU)X3813(clock)X4048(speed,)X576 1391(this)N740(will)X915(amount)X1229(to)X1329(about)X1568(5)X1641(to)X1741(10)X1862(microseconds)X2416(\()X9 f2448(m)X1 f2503(-secs\).)X2800(In)X2905(reality,)X3201(this)X3365(is)X3454(not)X3602(even)X3810(enough)X4119(time)X576 1503(to)N676(allow)X915(the)X1058(valve)X1292(mechanism)X1756(to)X1855(actually)X2185(get)X2327(open.)X2586(One)X2770(solution)X3104(to)X3203(the)X3345(problem)X3690(would)X3954(be)X4069(to)X4168(put)X576 1615(a)N649(sensor)X924(at)X1024(the)X1172(bottom)X1475(of)X1585(the)X1733(vessel,)X2022(but)X2175(another)X2494(solution)X2834(would)X3104(be)X3225(to)X3330(allow)X3574(the)X3722(vessel)X3987(to)X4093(drain)X576 1727(for)N712(a)X779(\256xed)X995(length)X1260(of)X1364(time.)X776 1867(One)N960(way)X1144(to)X1243(delay)X1476(would)X1740(be)X1855(to)X1954(add)X2117(a)X2184("do-nothing")X2708(loop)X2903(before)X3173(the)X7 f3349(while)X3697(\(1\))X1 f3895(such)X4095(as:)X7 f1152 2027(for)N1384(\(i=0;)X1732(i)X1848(<)X1964(1000000;)X2486(i++\))X2776(;)X1 f576 2215(However,)N976(there)X1193(are)X1335(at)X1429(least)X1630(two)X1798(problems)X2180(with)X2375(this)X2538(solution.)X576 2355(1.)N720(The)X923(actual)X1208(time)X1434(delay)X1697(depends)X2066(on)X2216(the)X2388(CPU)X2628(clock)X2891(speed,)X3188(and)X3381(is)X3499(therefore)X3901(somewhat)X720 2467(unpredictable.)N576 2607(2.)N720(The)X894(CPU)X1104(is)X1192(completely)X1645("tied-up")X2020(while)X2258(delaying.)X576 2747(The)N758(second)X1057(problem)X1410(above)X1672(is)X1768(the)X1918(most)X2137(severe)X2415(because,)X2776(for)X2920(example,)X3303(the)X3453(CPU)X3671(may)X3869(want)X4088(to)X4195(do)X576 2859(some)N817(other)X1053(useful)X1325(work)X1559(while)X1810(waiting)X2136(for)X2285(the)X2440(vessel)X2712(to)X2824(empty.)X3150(In)X3267(particular,)X3698(it)X3789(may)X3992(want)X4216(to)X576 2971(periodically)N1067(check)X1322(the)X1470(level)X1688(sensor)X1963(to)X2068(assure)X2338(that)X2513(the)X2661(output)X2937(valve)X3176(has)X3334(not)X3487(become)X3817(clogged)X4152(and)X576 3083(one)N739(of)X843(the)X985(inputs)X1244(has)X1396(not)X1543(started)X1824(leaking!)X776 3223(The)N958(proper)X1241(solution)X1583(to)X1690(the)X1840(timing)X2124(problem)X2477(is)X2573(to)X2680(use)X2840(an)X2963(external)X3306(timer)X3542(to)X3649(measure)X4002(elapsed)X576 3335(time)N788(and)X966(provide)X1299(a)X1381(mechanism)X1859(for)X2010(the)X2167(CPU)X2392(to)X2506(check)X2770(to)X2884(see)X3046(if)X3144(the)X3301(desired)X3618(time)X3829(interval)X4163(has)X576 3447(elapsed.)N937(Another)X1276(chip,)X1490(the)X1632(8253)X1848(is)X1936(used)X2136(for)X2272(timing.)X5 p%%Trailerxtxs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -