<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\chapter{è½¯ä»¶è®¾è®¡}

\section{æ€»ä½“æ–¹æ¡ˆ}

è¯¥ç³»ç»Ÿçš„ä¿¡å·æ£€æµ‹ä¸Žæ•°æ®ä¼&nbsp;é€éƒ¨åˆ†ï¼Œæ¶‰åŠçš„è½¯ä»¶éƒ¨åˆ†è¾ƒå°‘ã€‚ä¸»è¦æ˜¯ 2051 å•ç‰‡æœºæ•°æ®ä¸²è¡Œé€šä¿¡åŠé€šä¿¡åè®®çš„ç¨‹åºè®¾è®¡ã€‚

å¯¹äºŽ 2051 çš„ç¨‹åºè®¾è®¡\cite{cn12}ï¼Œç”±äºŽæ‰€éœ€å®žçŽ°çš„åŠŸèƒ½è¾ƒç®€å•ï¼Œé‡‡ç”¨æ±‡ç¼–çš„å½¢å¼ã€‚ç¼–è¯‘å™¨é‡‡ç”¨ Keil 7.02bã€‚è¯¥ç¼–è¯‘å™¨æ˜¯ 51 ç³»åˆ—å•ç‰‡æœºç¨‹åºè®¾è®¡çš„å¸¸ç”¨å·¥å…·ï¼Œæ—¢å¯ç”¨æ±‡ç¼–ï¼Œä¹Ÿæ”¯æŒ C è¯­è¨€ç¼–è¯‘ã€‚åŒæ—¶å…·æœ‰å®Œå–„çš„è°ƒè¯•åŠŸèƒ½ã€‚

\section{ç¨‹åºæµå›¾}

\begin{figure}[!ht]
  \centering
  \begin{tikzpicture}
  [ every node/.style = { font = \small, minimum height = 2.5em } ]
    \node [draw, rectangle, minimum width = 11em, minimum height = 2em] (a) at (0,0) {åˆå§‹å‚æ•°è®¾ç½®};
    \node [draw, rectangle, minimum width = 11em, rounded corners = 1.2em, below = of a] (b) {ç­‰å¾…ä¸­æ–­};
    \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of b] (c) {ä¸­æ–­æœåŠ¡ç¨‹};
    \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of c, yshift = 2ex] (d) {è¯»å– P1 å£å€¼};
    \node [draw, rectangle, minimum width = 11em, rectangle, below = of d, minimum height = 2em] (e) {å‘é€æ•°æ®å¸§};
    \node [draw, rectangle, minimum width = 11em, diamond, aspect=3, below = of e] (f) {å»¶æ—¶$\qty{200}\ms$};
    \node [draw, rectangle, minimum width = 11em, rectangle, below = of f, minimum height = 2em, yshift = 2ex] (g) {æ¸…ä¸­æ–­æ&nbsp;‡å¿—};
    \node [draw, rectangle, minimum width = 10em, rounded corners = 1.2em, below = of g] (h) {ä¸­æ–­è¿”å›ž};
    \draw [-&gt;] (a.south) -- (b.north);
    \draw [-&gt;] (b.south) -- (c.north);
    \draw [-&gt;] (c.south) -- (d.north);
    \draw [-&gt;] (d.south) -- (e.north);
    \draw [-&gt;] (e.south) -- (f.north);
    \draw [-&gt;] (f.south) -- (g.north);
    \draw [-&gt;] (g.south) -- (h.north);
    \draw [-&gt;] (h.east) --++ (1,0) |- (b.east);
  \end{tikzpicture}
  \caption{ä¸²è¡Œå‘é€æµç¨‹å›¾}
  \label{5-1}
\end{figure}

\section{æ¨¡å—è¯´æ˜Ž}

\begin{enumerate}
  \item ä¸»ç¨‹åºï¼š
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      MAIN:
      MOV SP,#0X60  ï¼›å&nbsp;†æ&nbsp;ˆåˆå§‹åŒ–
      CALL INIT     ï¼›å„å¯„å­˜å™¨å‚æ•°è®¾ç½®
      MOV 40H,#0x01 ï¼›æ‰“é¶æ¬¡æ•°ç½® 1
      AJMP $        ï¼›ç­‰å¾…ä¸­æ–­
  \end{lstlisting}
  \item åˆå§‹åŒ–ç¨‹åºï¼š
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      INIT:
      MOV TMOD,#0X21ï¼›æ³¢ç‰¹çŽ‡å‘ç”Ÿå™¨
      MOV TL1,#0XFD ï¼›æ³¢ç‰¹çŽ‡ 9600bps
      MOV TH1,#0XFD
      CLR ET1       ï¼›ç¦æ­¢ timer1
      SETB PT1      ï¼›æ—¶é’Ÿ 1 ä¼˜å…ˆçº§:é«˜
      MOV SCON,#0x40ï¼›ä¸²å£å·¥ä½œæ¨¡å¼ 1,SM2=0,REN=0
      MOV PCON,#0   ï¼›æ³¢ç‰¹çŽ‡ 9600bps
      SETB EA       ï¼›ä¸­æ–­å…è®¸
      CLR PS        ï¼›å…³é—­ä¸²å£ä¸­æ–­
      CLR ES        ï¼›ä¸²å£ä¼˜å…ˆçº§:ä½Ž
      SETB EX0      ï¼›å¼€å¤–éƒ¨ä¸­æ–­ INT0 SETB IT0 ï¼›ä¸‹é™æ²¿æœ‰æ•ˆ
      CLR PX0       ï¼›INT0 ä¼˜å…ˆçº§:ä½Ž
      SETB TR1      ï¼›æ—¶é’Ÿ 1 å¼€å§‹è®¡æ•°
      RET
  \end{lstlisting}
  \item ä¸­æ–­æœåŠ¡ç¨‹åºï¼š
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      _INT0:        ï¼›ISR ä¸­æ–­æœåŠ¡ç¨‹åº
      NOP
      CALL DELAY_2MSï¼›åŒæ­¥å»¶æ—¶
      MOV P1,#0xff  ï¼›è¯» P1 å£å‰å…ˆç½® 1
      MOV A,P1      ï¼›è¯» P1 å£
      CALL INT0_SEND
      RET
  \end{lstlisting}
  \item æ•°æ®å¸§ä¼&nbsp;é€å­ç¨‹åºï¼š
  \begin{figure}[htbp]
    \centering\small
    \setstretch{1.4}
    \caption{æ•°æ®å¸§æ&nbsp;¼å¼}
    \begin{tabular}{|*{4}{&gt;{\centering\arraybackslash}p{.22\linewidth}|}}
      \hline
      æ&nbsp;‡å¿—ä½SYNC &amp; æ‰“é¶æ¬¡æ•° &amp; æ‰“é¶æˆç»© &amp; æ&nbsp;¡éªŒä½CHECKSUM\\
      \hline
      \#0x30 &amp; TIMES &amp; RESULT &amp; TIMES\ensuremath+RES\\
      \hline
    \end{tabular}
  \end{figure}
  \clearpage
  ä¾‹ï¼š30 02 15 17ï¼ˆåå…­è¿›åˆ¶ï¼‰
  
  è¡¨ç¤ºç¬¬äºŒæ¬¡æ‰“é¶ï¼Œå‡»ä¸­ç¬¬ 21 å·ï¼ˆå¯¹åº”çŽ¯æ•°ï¼š7 çŽ¯ åç§»æ–¹å‘ï¼šå³ä¸Šï¼‰ã€‚
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      INT0_SEND:      ï¼›æ•°æ®å¸§ä¼&nbsp;é€å­ç¨‹åº
      PUSH ACC        ï¼›ä¿æŠ¤ ACC
      CLR A
      ADD A,#0X30
      CALL UART_SEND  ï¼›å‘é€æ&nbsp;‡å¿—ä½
      MOV A,40H
      CALL UART_SEND  ï¼›å‘é€æ‰“é¶æ¬¡æ•°
      POP ACC
      CALL UART_SEND  ï¼›å‘é€æ‰“é¶æˆç»©
      ADD A,#0X30
      ADD A,0040H
      CALL UART_SEND  ï¼›å‘é€æ&nbsp;¡éªŒä½
      INC 0040H       ï¼›æ‰“é¶æ¬¡æ•°ç´¯åŠ&nbsp; 1
      CALL DELAY_200MSï¼›å»¶æ—¶ 200ms
      CLR EX0         ï¼›å…³å¤–éƒ¨ä¸­æ–­
      CLR IE0         ï¼›æ¸…INT0å¤–éƒ¨ä¸­æ–­è¯·æ±‚æ&nbsp;‡å¿—ä½â€”é˜²æ­¢å¤–éƒ¨ä¸­æ–­å¯„å­˜
                        è€Œå¼•èµ·å¤šæ¬¡ä¸­æ–­ã€‚
      SETB EX0        ï¼›å¼€ä¸­æ–­
      RETI
  \end{lstlisting}
  \item ä¸²è¡Œå‘é€å­—èŠ‚
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      UART_SEND:      ï¼›ä¸²è¡Œå‘é€ä¸€ä¸ªå­—èŠ‚
      MOV SBUF,A
      JNB TI,$        ï¼›ç­‰å¾…å‘é€å®Œæ¯•
      CLR TI          ï¼›
      RET
  \end{lstlisting}
  \item å®šæ—¶ç¨‹åºï¼š
  \begin{lstlisting}[basicstyle=\linespread{1.32}\small\ttfamily\selectfont, breaklines=true]
      DELAY_2MS:      ï¼›ç”¨å®šæ—¶å™¨å»¶æ—¶ 2ms
      MOV R7,#21;21
      DLY1:MOV R6,#42
      DLY2:DJNZ R6,DLY2
      DJNZ R7,DLY1
      RET
      DELAY_10MS:     ï¼›è°ƒç”¨ DELAY_2MSï¼Œå®žçŽ°å»¶æ—¶ 10ms
      MOV R5,#5
      DLY: CALL DELAY_2MS
      DJNZ R5,DLY
      RET
\end{lstlisting}
\end{enumerate}</pre></body></html>