📄 chap.6.parallel_io.ps
字号:
2272(We)X2435(refer)X2646(to)X2750(these)X2976(units)X3191(as)X3299("clock)X3575(ticks".)X3872(The)X4050(length)X576 2015(of)N686(a)X759(clock)X999(tick)X1175(in)X1281(terms)X1526(of)X1637(seconds)X1972(is)X2067(determined)X2532(by)X2659(the)X2808(input)X3037(clock)X3277(rate)X3453(to)X3559(the)X3708(8253)X3931(chip,)X4152(and)X576 2127(the)N722(mode)X964(in)X1067(which)X1330(the)X1476(chip)X1670(is)X1762(con\256gured.)X2249(For)X2410(the)X2555(systems)X2886(in)X2988(our)X3143(Lab)X3320(con\256gured)X3758(for)X3897(Lab)X4074(2,)X4173(the)X576 2239(length)N850(of)X963(a)X1039(tick)X1217(is)X1314(1000)X9 f(m)S1 f1561(-seconds)X1930(or)X2043(1)X2124(ms.)X2317(The)X2500(steps)X2725(involved)X3095(in)X3203(programming)X3761(a)X3838(delay)X4081(of)X4195(10)X576 2351(seconds)N904(are)X1046(as)X1150(follows:)X776 2491(1.)N920(Stop)X1120(timer)X1348(\(if)X1463(running\).)X776 2631(2.)N920(Initialize)X1288(timer)X1516(count)X1754(value)X1987(\(10,000)X2307(ticks\).)X776 2771(3.)N920(Start)X1126(timer)X1354(running.)X776 2911(4.)N920(Check)X1190(if)X1273(timer)X1501(has)X1653(reached)X1977(0.)X2097(If)X2185(not,)X2356(then)X2546(go)X2666(to)X2765(4.)X776 3051(5.)N920(Continue)X1297(\(delay)X1562(of)X1666(10)X1786(seconds)X2114(is)X2202(now)X2391(\256nished\).)X576 3191(The)N751(device)X1028(interface)X1391(of)X1496(the)X1639(8253)X1856(timer)X2085(is)X2174(described)X2568(in)X2668(detail)X2908(in)X3008(the)X3151(Lab)X3326(2)X3399(and)X3564(Lab)X3740(3)X3814(handouts.)X4211(In)X576 3303(fact,)N778(there)X1004(are)X1155(two)X1331(8253's)X1624(on)X1752(each)X1961(LAB-NB)X2350(board,)X2625(and)X2796(each)X3005(8253)X3229(has)X3389(3)X3469(timers.)X3766(Each)X3991(timer)X4227(is)X576 3415(represented)N1048(by)X1172(a)X1243(16-bit)X1501(counter)X1818(register.)X2159(These)X2417(three)X2638(registers,)X3016(along)X3258(with)X3457(one)X2 f3624(mode)X1 f3861(register)X4179(for)X576 3527(status)N819(and)X982(control)X1279(information,)X1782(make)X2015(up)X2135(the)X2277(hardware)X2659(interface)X3021(to)X3120(the)X3262(chip.)X776 3667(The)N957(details)X1240(of)X1351(the)X1500(8253)X1724(interfacing)X2174(will)X2356(be)X2479(handled)X2816(for)X2960(you)X3136(via)X3286(a)X3361(set)X3500(of)X3612(three)X3837(C)X3933(functions)X576 3779(that)N745(serve)X972(to)X1071(implement)X1508(the)X1650(main)X1867(functions)X2249(de\256ned)X2556(above.)X2834(Namely:)X7 f1152 4051(void)N1442 0.4062(InitTimers\(\);)AX1152 4275(void)N1442 0.4038(LoadTimers\(int)AX2312(delay\);)X1152 4499(int)N1384 0.4091(CheckZero90;)AX576 4687 0.4167(InitTimers)AN1 f1183(does)X1386(the)X1531(initial)X1784(con\256guration)X2324(of)X2431(the)X2576(8253)X2796(timer)X3028(used)X3232(for)X3372(the)X3518(1ms)X3706(delay.)X7 f4001(Load-)X576 4799(Timers)N1 f950(is)X1040(called)X1297(to)X1398(accomplish)X1863(steps)X2081(1,)X2179(2,)X2277(and)X2441(3)X2514(above.)X2793(Step)X2989(4,)X3086(checking)X3459(to)X3559(see)X3707(if)X3791(the)X3934(timer)X4163(has)X576 4911(reached)N900(zero)X1090(or)X1194(not,)X1365(is)X1453(accomplished)X2007(by)X2127(calling)X7 f2448 0.4219(CheckZero)AX1 f2970(.)X776 5051(As)N907(with)X1103(many)X1342(devices,)X1680(there)X1898(is)X1988(a)X2057(need)X2265(to)X2366("poll")X2620(the)X2764(timer)X2994(to)X3095(detect)X3352(when)X3586(it)X3666(has)X3820("timed)X4105(out".)X576 5163(Logically,)N994(this)X1157(is)X1245(done)X1456(as)X1560(shown)X1834(in)X1933(Figure)X2208(6.1.)X52 p%%Page: 52 312 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(52)X2505(-)X3 f3717(Lecture)X4062(Notes)X1 f11 s2325 836 MXY0 432 Dl2311 1210 MXY14 57 Dl2339 1210 MXY-14 57 Dl2757 1699 MXY144 0 Dl0 576 Dl2887 2217 MXY14 57 Dl2915 2217 MXY-14 57 Dl2275 MY28 0 Dl2966 MX28 0 Dl3031 MX28 0 Dl3095 MX28 0 Dl3160 MX28 0 Dl3189 MX0 -28 Dl2217 MY0 -28 Dl2160 MY0 -28 Dl2102 MY0 -28 Dl2045 MY0 -28 Dl1987 MY0 -28 Dl1929 MY0 -28 Dl1872 MY0 -28 Dl1814 MY0 -28 Dl1757 MY0 -28 Dl1699 MY0 -28 Dl1642 MY0 -28 Dl1584 MY0 -28 Dl1527 MY0 -28 Dl1469 MY0 -28 Dl1412 MY0 -28 Dl1354 MY0 -28 Dl1296 MY0 -28 Dl1239 MY0 -28 Dl1181 MY0 -28 Dl1124 MY0 -28 Dl1066 MY0 -28 Dl1008 MY0 -28 Dl-28 0 Dl3129 MX-28 0 Dl3070 MX-28 0 Dl3010 MX-28 0 Dl2950 MX-28 0 Dl2891 MX-28 0 Dl2831 MX-28 0 Dl2771 MX-28 0 Dl2711 MX-28 0 Dl2652 MX-28 0 Dl2592 MX-28 0 Dl2533 MX-28 0 Dl2473 MX-28 0 Dl2414 MX-28 0 Dl2354 MX-28 0 Dl2383 965 MXY-57 14 Dl2383 994 MXY-57 -14 Dl1894 1699 MXY-144 0 Dl0 576 Dl1735 2217 MXY14 57 Dl1764 2217 MXY-14 57 Dl2325 1268 MXY-431 431 Dl431 432 Dl432 -432 Dl-432 -431 Dl2757 1124 MXYD~ -179 35 -36 144 36 144 144 107 216 -35 144 -107 35 -72 0 -108 -144 -107 -72 0 D~~2959 1109 MXY-57 14 Dl2959 1138 MXY-57 -14 Dl14 s1678 2378(Yes)N2829 2383(No)N12 s2721 1450(Loop)N2613 1303(Busy-Wait)N14 s2073 1732(CheckZero\(\)?)N3 f12 s1468 2588(Figure)N1765(6.1.)X1933(Illustration)X2421(of)X2525(a)X2597(``Busy-Wait'')X3186(Loop)X1632 2700(for)N1779(``Polling'')X2220(a)X2292(Device)X2589(Status)X2868(Register.)X1 f576 2860(The)N782(decision)X1160(block)X1431(checks)X1750(the)X1925(``timed-out'')X2485(bit)X2644(of)X2781(the)X2956(8253)X3205(Status)X3497(Register)X3875(by)X4028(calling)X576 2972(CheckZero,)N1066(and)X1243(executes)X1613(two)X1795(different)X2165(segments)X2561(of)X2679(code)X2899(depending)X3338(upon)X3568(the)X3724(outcome.)X4141(The)X576 3084(dotted)N841(line)X1010(shows)X1273(the)X1415(case)X1605(of)X1709("busy-wait")X2190(polling)X2487(in)X2586(which)X2845(a)X2912(pure)X3107(delay)X3340(is)X3428(implemented.)X3 p%%Trailerxtxs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -