£¨3£©ÔÚ΢»úϵͳÖУ¬ÀûÓÃ×ÜÏßʵÏÖоƬÄÚ²¿¡¢Ó¡Ë¢µç·°å¸÷²¿¼þÖ®¼ä¡¢»úÏäÄÚ¸÷²å¼þ°åÖ®¼ä¡¢Ö÷»úÓëÍⲿÉ豸֮¼ä»òϵͳÓëϵͳ֮¼äµÄÁ¬½ÓÓëͨÐÅ¡£×ÜÏßÊǹ¹³É΢ÐͼÆËã»úÓ¦ÓÃϵͳµÄÖØÒª¼¼Êõ£¬×ÜÏßÉè¼ÆºÃ»µ»áÖ±½ÓÓ°ÏìÕû¸ö΢»úϵͳµÄÐÔÄÜ¡¢¿É¿¿ÐÔ¡¢¿ÉÀ©Õ¹ÐԺͿÉÉý¼¶ÐÔ¡£
µÚ7ÕÂ×÷Òµ P281
6. Èç¹ûÖжÏÀàÐͺÅn=4£¬ËüµÄÖжϷþÎñ×Ó³ÌÐòµÄÈë¿ÚµØַΪCS:IP=0485£º0016H£¬ËüÔÚÖжÏÏòÁ¿±íÖÐÈçºÎ´æ·Å£¿ ½â£º
ÖжÏÀàÐͺÅn=4£¬ÖжÏÏòÁ¿Ö¸Õë=ÖжÏÀàÐͺšÁ4=n¡Á4=10H
´ÓÄÚ´æÖжÏÏòÁ¿Ö¸Õë00010H¿ªÊ¼µÄµ¥Ôª¿ªÊ¼´æ·ÅÖжÏÏòÁ¿£¬ CSÕ¼¸ß2¸ö×Ö½Ú£¬ IPÕ¼µÍ2¸ö×Ö½Ú¡£¾ßÌåÈçÏ£º
00010H 00011H 00012H 00013H
11. 8086ÖжÏÏìÓ¦ºÍ´¦ÀíÓÐÄÄЩÖ÷Òª²½Ö裿 ´ð£º
£¨1£©CPUÏìÓ¦ÖжϵÄÌõ¼þΪ£ºÍâÉèÌá³öÖжÏÉêÇ룬CPUÔÊÐíÖжϣ¨±¾ÖжÏλδ±»ÆÁ±Î£¬±¾ÖжÏλÓÅÏȼ¶±ð×î¸ß£©£¬µ±Ç°Ö¸ÁîÖ´ÐÐÍê¡£
£¨2£©CPUÔÚINTRÒý½ÅÉϽӵ½Ò»¸öÖжÏÇëÇóÐźţ¬Èç¹û´ËʱIF£½1£¬±¾ÖжÏλδ±»ÆÁ±Î£¬CPU¾Í»áÔÚµ±Ç°Ö¸ÁîÖ´ÐÐÍêÒÔºó¿ªÊ¼ÏìÓ¦ÍⲿµÄÖжÏÇëÇó£¬Õâʱ£¬CPUÔÚINTAÒý½ÅÁ¬Ðø·¢Á½¸ö¸ºÂö³å£¬µÚÒ»¸ö¸ºÂö³åÓÃÀ´Í¨ÖªÍâÉ裬CPU×¼±¸ÏìÓ¦Öжϣ¬ÍâÉèÔÚ½Óµ½µÚ¶þ¸ö¸ºÂö³åÒÔºó£¬ÔÚÊý¾ÝÏßÉÏ·¢ËÍÖжÏÀàÐÍÂ룬½Óµ½Õâ¸öÖжÏÀàÐÍÂëºó£¬CPU×öÈç϶¯×÷£º
¢Ù ½«ÖжÏÀàÐÍÂë·ÅÈëÔÝ´æÆ÷±£´æ£» ¢Ú ½«±êÖ¾¼Ä´æÆ÷ÄÚÈÝѹÈë¶ÑÕ»£» ¢Û ½«IFºÍTF±êÖ¾Çå0£» ¢Ü ±£»¤¶Ïµã£»
¢Ý ¸ù¾ÝÈ¡µ½µÄÖжÏÀàÐÍÂ룬¼ÆËãÖжÏÏòÁ¿Ö¸Õ룬ÔÚÖжÏÏòÁ¿±íÖÐÕÒ³öÏàÓ¦µÄÖжÏÏòÁ¿£¬½«Æä×°ÈëIPºÍCS£¬¼´×Ô¶¯×ªÏòÖжϷþÎñ×Ó³ÌÐò£»
¢Þ ÖжϷµ»Ø¡£ µÚ8Õ ×÷Òµ P253
1. 8253оƬÓм¸¸ö¼ÆÊýͨµÀ£¿Ã¿¸ö¼ÆÊýͨµÀ¿É¹¤×÷ÓÚÄļ¸ÖÖ¹¤×÷·½Ê½£¿ÕâЩ²Ù×÷·½Ê½µÄÖ÷ÒªÌصãÊÇʲô£¿ ´ð£º
£¨1£©8253оƬÓÐ3¸ö¼ÆÊýͨµÀ¡£
£¨2£©Ã¿¸ö¼ÆÊýͨµÀ¾ù¿É¹¤×÷ÓÚ6ÖÖ¹¤×÷·½Ê½¡£·½Ê½1¡ª¿ÉÖظ´´¥·¢µÄµ¥ÎÈ̬´¥·¢Æ÷£¬·½Ê½2¡ª×Ô¶¯ÖØ×°³õÖµµÄN·ÖƵÆ÷£¬·½Ê½ 3 ¡ª·½²¨·¢ÉúÆ÷£¬·½Ê½4¡ªÈí¼þ´¥·¢µÄѡͨÐźŷ¢ÉúÆ÷£¬·½Ê½5¡ªÓ²¼þ´¥·¢µÄѡͨÐźŷ¢ÉúÆ÷¡£
Êä³ö²¨ÐΣº0¡¢1 µ¥ÎÈÊä³ö£¬2¡¢4¡¢5 Ϊµ¥´Î¸ºÂö³å£¬3 Ϊ·½²¨¡£2¡¢3 ΪÁ¬Ðø²¨ÐΣ¬ÆäÓàΪ²»Á¬Ðø²¨ÐΣ»1¡¢5 ¿ÉÓ²¼þÖظ´´¥·¢¡£
³õʼµçƽ£ºÐ´Èë¿ØÖÆ×Ö£¬Ö»ÓÐ0ΪµÍµçƽ£¬ÆäÓà¾ùΪ¸ßµçƽ£»Ð´Èë³õÖµ£¬ÔÚGATEÓÐЧµÄÇé¿öÏ£¨¼ÆÊýÆڼ䣩£¬0¡¢1ΪµÍµçƽ£¬2¡¢3¡¢4¡¢5¾ùΪ¸ßµçƽ¡£
16H 00H 85H 04H 37
´¥·¢·½Ê½£º
0¡¢4Ϊµçƽ´¥·¢£¬ÉÏÉýÑؼÌÐø¡£0ÊÇGATE=0Í£Ö¹¼ÆÊý£¬ GATEÔÙ´ÎΪ1£¬´ÓÖÐÖ¹´¦¼ÌÐø¡£4ÊÇGATE=0Í£Ö¹£¬ GATEÔÙ´ÎΪ1£¬´ÓÔ×°³õÖµ¿ªÊ¼¼ÆÊý¡£
1¡¢5Ϊ±ßÑØ´¥·¢£¬¼ÆÊý¹ý³ÌÖÐÔٴγöÏÖGATEÉÏÉýÑØ£¬¼ÆÊýÆ÷°´Ô×°³õÖµ¿ªÊ¼¼ÆÊý¡£
2¡¢3Ϊµçƽ´¥·¢£¬ÉÏÉýÑØÓÐЧ£¬GATE=0Í£Ö¹¼ÆÊý£¬¼ÆÊý¹ý³ÌÖÐÔٴγöÏÖGATEÉÏÉýÑØ£¬¼ÆÊýÆ÷°´Ô×°³õÖµ¿ªÊ¼¼ÆÊý¡£
¼ÆÊý¹ý³ÌÖØÐÂдÈë³õÖµ£º
0¡¢4----ÔÚGATE=1ʱ£¬Á¢¼´°´Ð³õÖµ¿ªÊ¼¼ÆÊý¡£
1¡¢5----²»Ó°ÏìÄ¿Ç°µÄ¼ÆÊý£¬Ö»ÓÐÔÚGATEÔٴγöÏÖÉÏÉýÑØʱ£¬°´Ð³õÖµ¿ªÊ¼¼ÆÊý¡£
2¡¢3----²»Ó°Ïì±¾´ÎÊä³ö£¬±¾´Î¼ÆÊý½áÊøºó£¬ÈôGATE=1£¬£¨ÖØװгõÖµ£©°´Ð³õÖµ¿ªÊ¼¼ÆÊý¡£ ×Ô¶¯ÖØ×°ÄÜÁ¦£º2¡¢3 ¾ßÓÐ×Ô¶¯ÖØ×°ÄÜÁ¦£¨ÆäÓàûÓУ©£¬¿ÉÊä³öÁ¬ÐøµÄ²¨ÐΡ£ ¿ÉÖظ´´¥·¢ÄÜÁ¦£º1¡¢5¾ßÓпÉÖظ´´¥·¢ÄÜÁ¦£¨ÆäÓàûÓУ©¡£
2. 8253µÄ×î¸ß¹¤×÷ƵÂÊÊǶàÉÙ£¿8254Óë8253µÄÖ÷ÒªÇø±ðÊÇʲô£¿
½â£º8253µÄ×î¸ß¹¤×÷ƵÂÊÊÇ2MHz¡£8254ÊÇ8253µÄÔöÇ¿ÐͲúÆ·£¬Òý½Å¼æÈÝ£¬¹¦Äܼ¸ºõÍêÈ«Ïàͬ£¬ÆäÖ÷ÒªÇø±ðÔÚÓÚ£º
£¨1£©8253µÄ×î¸ß¹¤×÷ƵÂÊÊÇ2MHz£¬¶ø8254µÄ×î¸ß¹¤×÷ƵÂÊÊÇ10MHz£»
£¨2£©8254¾ßÓжÁ»Ø¹¦ÄÜ£¬¿ÉÒÔͬʱËø´æ1----3¸ö¼ÆÊýÆ÷µÄ¼ÆÊýÖµ¼°×´Ì¬Öµ£¬¹©CPU¶ÁÈ¡£¬¶ø8253ÿ´ÎÖ»ÄÜËø´æºÍ¶ÁÈ¡Ò»¸öͨµÀµÄ¼ÆÊýÆ÷£¬ÇÒ²»ÄܶÁȡ״ֵ̬¡£
4. Éè8253µÄͨµÀ0----2ºÍ¿ØÖƿڵĵØÖ··Ö±ðΪ300H¡¢302H¡¢304H¡¢306H£¬ÉèϵͳµÄʱÖÓÂö³åƵÂÊΪ2MHz¡£ÒªÇó£º
£¨1£©Í¨µÀ0Êä³ö1KHzµÄ·½²¨£»
£¨2£©Í¨µÀ1Êä³öƵÂÊΪ500HzµÄÐòÁиºÂö³å£» £¨3£©Í¨µÀ3Êä³öµ¥Âö³å£¬¿í¶ÈΪ400¦Ìs¡£ ÊÔ»³öÓ²¼þµç·ͼ£¬±àд¸÷ͨµÀµÄ³õʼ»¯³ÌÐò¡£
½â£º8253µÄ¿ÚµÄµØÖ··Ö±ðΪ300H¡¢302H¡¢304H¡¢306H£¬Á¬ÐøµÄżµØÖ·£¬ËµÃ÷CPUΪ8086.
£¨1£©Í¨µÀ0Êä³ö1KHzµÄ·½²¨£¬Ó¦¹¤×÷ÔÚ·½Ê½3¡£2MHz/1KHz=2000£¬Ôò¿ÉµÃͨµÀ0µÄ¶¨Ê±³õֵΪ2000¡£ £¨2£©Í¨µÀ1Êä³öƵÂÊΪ500HzµÄÐòÁиºÂö³å£¬Ó¦¹¤×÷ÔÚ·½Ê½2¡£2MHz/500Hz=4000£¬ ͨµÀ1µÄ¶¨Ê±³õÖµ=4000
£¨3£©Í¨µÀ2Êä³öµ¥Âö³å£¬¿í¶ÈΪ400¦Ìs£¬Ó¦¹¤×÷ÔÚ·½Ê½0 , ͨµÀ2µÄ¶¨Ê±³õÖµ=400¦Ìs/(1/ 2MHz)-1=799¡£ Ó²¼þÁ¬½áͼÈçÏÂͼËùʾ¡£
38
8253µÄ³õʼ»¯³ÌÐò£º £»Í¨µÀ0³õʼ»¯³ÌÐò
MOV DX£¬306H
MOV AL£¬00110111B £»Í¨µÀ0¿ØÖÆ×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½3£¬BCDÂë¼ÆÊý OUT DX£¬ AL MOV DX£¬300H
MOV AL, 00H OUT DX£¬ AL £»Ð´È˵Í×Ö½Ú MOV AL, 20H
OUT DX£¬ AL £»Ð´È˸ß×Ö½Ú £»Í¨µÀ1³õʼ»¯³ÌÐò
MOV DX£¬306H
MOV AL£¬01110101B £»Í¨µÀ1¿ØÖÆ×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½2£¬BCDÂë¼ÆÊý OUT DX£¬ AL £»Ð´ÈË·½Ê½×Ö MOV DX£¬302H
MOV AL, 00H £»µÍ×Ö½Ú OUT DX£¬AL £»Ð´È˵Í×Ö½Ú MOV AL, 40H
OUT DX£¬ AL £»Ð´È˸ß×Ö½Ú £»Í¨µÀ2³õʼ»¯³ÌÐò
MOV DX£¬306H
MOV AL, 10110001B £»Í¨µÀ2·½Ê½×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½0£¬BCDÂë¼ÆÊý OUT DX£¬AL MOV DX£¬304H
MOV AL£¬99H £»¼ÆÊý³õÖµ×Ö½Ú OUT DX£¬AL £»Ð´È˵Í×Ö½Ú
MOV AL, 07H
OUT DX£¬ AL £»Ð´È˸ß×Ö½Ú HLT
5. Éè8254µÄ¶Ë¿ÚµØַΪ40----43H£¬Ê±ÖÓƵÂÊf=5MHz£¬Í¨µÀ2½Ó1¸öLEDָʾµÆ¡£ÒªÇóLEDָʾµÆµãÁÁ4ÃëÖÓºó£¬ÔÙϨÃð4ÃëÖÓºó¡£²¢²»¶ÏÖظ´¸Ã¹ý³Ì¡£ÊÔ±àд8254³õʼ»¯³ÌÐò¡£ ½â£º
LEDָʾµÆµãÁÁ4ÃëÖÓºó£¬ÔÙϨÃð4ÃëÖÓºó¡£²¢²»¶ÏÖظ´¸Ã¹ý³Ì¡£ÀûÓÃͨµÀ2Êä³ö½ÓLEDָʾµÆ£¬ÐèÒª²úÉúÖÜÆÚΪ8ÃëµÄ·½²¨¡£
½«5MHzʱÖÓ¼Óµ½CLK2¶Ë£¬OUT2Êä³öµÄ·½²¨Âö³åÖÜÆÚ×î´óΪ0.2¦Ìs¡Á65536=13107.2¦Ìs=13.1072ms£¬´ï²»µ½8Ãë¡£´Ëʱ¿ÉÒÔʹÓÃ2¸ö8254ͨµÀ¼¶Á¬·½Ê½À´ÊµÏÖ¡£Èô¼¶Á¬1¡¢2ͨµÀ£¬ÉèÆä³õÖµ·Ö±ðΪN1ºÍN2£¬8s/(1/5MHz) =40000000£¬Ôò¼¶Á¬ºó×÷Ϊһ¸öÕûÌåµÄ¼ÆÊýֵΪN=20000000=N1¡ÁN2=5000¡Á8000¡£
ͨµÀ1£¬¿ÉÑ¡·½Ê½2»ò3£¬
ͨµÀ2£¬Ñ¡·½Ê½3£¬Á¬Ðø²¨ÐΣ¬ÊµÏÖ²»¶ÏÖظ´¡£ N1=5000 N2=8000 £»Í¨µÀ1³õʼ»¯³ÌÐò
MOV AL, 01110101B £»Í¨µÀ1·½Ê½×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½2£¬BCDÂë¼ÆÊý OUT 43H£¬AL
MOV AX, 5000H
OUT 41H£¬AL £»Ð´È˵Í×Ö½Ú
MOV AL, AH
OUT 41H£¬ AL £»Ð´È˸ß×Ö½Ú HLT
£»Í¨µÀ2³õʼ»¯³ÌÐò
MOV AL£¬10110111B £»Í¨µÀ2¿ØÖÆ×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½3£¬BCDÂë¼ÆÊý OUT 43H£¬ AL
MOV AX, 8000H OUT 42H£¬ AL £»Ð´È˵Í×Ö½Ú
39
MOV AL, AH
OUT 42H£¬ AL £»Ð´È˸ß×Ö½Ú
14. Éè8253µÄͨµÀ0----2ºÍ¿ØÖƿڵĵØÖ··Ö±ðΪ300H¡¢302H¡¢304H¡¢306H£¬¶¨ÒåͨµÀ0¹¤×÷ÔÚ·½Ê½3£¬CLK0=2MHz£¬Ê¹±àд³õʼ»¯³ÌÐò£¬²¢»³öÓ²¼þÁ¬½Óͼ¡£ÒªÇóͨµÀ0Êä³ö1.5KHzµÄ·½²¨£¬Í¨µÀ1ÓÃͨµÀ0µÄÊä³ö×÷¼ÆÊýÂö³å£¬Êä³öƵÂÊΪ300HzµÄÐòÁиºÂö³å¡£Í¨µÀ2ÿÃëÖÓÏòCPU·¢50´ÎÖжÏÇëÇó¡£ ½â£º
8253µÄ¿ÚµÄµØÖ··Ö±ðΪ300H¡¢302H¡¢304H¡¢306H£¬Á¬ÐøµÄżµØÖ·£¬ËµÃ÷CPUΪ8086.
£¨1£©Í¨µÀ0Êä³ö1.5KHzµÄ·½²¨£¬Ó¦¹¤×÷ÔÚ·½Ê½3£¬2MHz/1.5K Hz=1334£¬Ôò¿ÉµÃͨµÀ0µÄ¶¨Ê±³õֵΪ1334=536H¡£
£¨2£©Í¨µÀ1ÓÃͨµÀ0µÄÊä³ö×÷¼ÆÊýÂö³å£¬Êä³öƵÂÊΪ300HzµÄÐòÁиºÂö³å£¬Ó¦¹¤×÷ÔÚ·½Ê½2£¬ 1.5K Hz /300Hz =5¡£Í¨µÀ1µÄ¶¨Ê±³õֵΪ5¡£
£¨3£©Í¨µÀ2ÿÃëÖÓÏòCPU·¢50´ÎÖжÏÇëÇ󣬿ɹ¤×÷ÔÚ·½Ê½2£¨»ò·½Ê½3£©£¬ÒÔ2MHzÐźÅ×÷¼ÆÊýÂö³å£¬ 2MHz /50Hz=40000=9C40H¡£Í¨µÀ2µÄ¶¨Ê±³õÖµ9C40H£¨Ò²¿ÉÓÃͨµÀ1µÄÊä³ö×÷¼ÆÊýÂö³å£© Ó²¼þÁ¬½áͼÈçÏÂͼËùʾ¡£
8253µÄ³õʼ»¯³ÌÐò£º £»Í¨µÀ0³õʼ»¯³ÌÐò
MOV DX£¬306H
MOV AL£¬00110110B £»Í¨µÀ0¿ØÖÆ×Ö£¬¶ÁдÁ½×Ö½Ú£¬·½Ê½3£¬¶þ½øÖƼÆÊý OUT DX£¬ AL MOV DX£¬300H
MOV AX, 536H OUT DX£¬ AL £»Ð´È˵Í×Ö½Ú MOV AL, AH
OUT DX£¬ AL £»Ð´È˸ß×Ö½Ú £»Í¨µÀ1³õʼ»¯³ÌÐò
MOV DX£¬306H
MOV AL£¬01010100B £»Í¨µÀ1¿ØÖÆ×Ö£¬Ö»¶ÁдµÍÓî½Ú£¬·½Ê½2£¬¶þ½øÖƼÆÊý OUT DX£¬ AL £»Ð´ÈË·½Ê½×Ö MOV DX£¬302H
40