Research Article
A Low-Cost Online Data Acquisition and Processing System for Industrial Pollutants’ Monitoring
Algorithm 1
Receiving data using serial port.
| \documentclass[11pt]{article} | | \usepackage{CJK} | | \usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} | | \usepackage{algorithm} | | \usepackage{algorithmicx} | | \usepackage{algpseudocode} | | \usepackage{amsmath} | | \usepackage{indentfirst} | | \floatname{algorithm}{Algorithm} | | \renewcommand{\algorithmicrequire}{\textbf{Input:}} | | \renewcommand{\algorithmicensure}{\textbf{Output:}} | | \begin{document} | | \begin{CJK∗}{UTF8}{gkai} | | \begin{algorithm} | | \caption{Receiving Data using Serial Port} | | \begin{algorithmic}[1] %每行显示行号 | | \Require $port:$SerialPort Object | | \State $count \gets $ number of bytes of data in the receive buffer | | \State delay | | \While{number of bytes of receive buffer$ > $0} | | \While{$(count < $number of bytes of receive buffer) \textbf{and} (number of bytes of receive buffer$ < $preset cache size)} | | \State $count \gets $ number of bytes of receive buffer | | \State $delay$ | | \EndWhile | | \State store received data | | \State process received data | | \EndWhile | | \end{algorithmic} | | \end{algorithm} | | \end{CJK∗} | | \end{document} |
|