<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ --> <head> <title>io.c (Embed with GNU)</title> <meta name="description" content="io.c (Embed with GNU)"> <meta name="keywords" content="io.c (Embed with GNU)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="index.html#Top" rel="start" title="Top"> <link href="leds_002ec.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Code-Listings.html#Code-Listings" rel="up" title="Code Listings"> <link href="leds_002ec.html#leds_002ec" rel="next" title="leds.c"> <link href="mvme_002eS.html#mvme_002eS" rel="prev" title="mvme.S"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <a name="io_002ec"></a> <div class="header"> <p> Next: <a href="leds_002ec.html#leds_002ec" accesskey="n" rel="next">leds.c</a>, Previous: <a href="mvme_002eS.html#mvme_002eS" accesskey="p" rel="prev">mvme.S</a>, Up: <a href="Code-Listings.html#Code-Listings" accesskey="u" rel="up">Code Listings</a> [<a href="leds_002ec.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> </div> <hr> <a name="I_002fO-code-sample"></a> <h3 class="section">A.5 I/O code sample</h3> <div class="example"> <pre class="example">#include "w89k.h" /* * outbyte -- shove a byte out the serial port. We wait till the byte */ int outbyte(byte) unsigned char byte; { while ((inp(RS232REG) & TRANSMIT) == 0x0) { } ; return (outp(RS232PORT, byte)); } /* * inbyte -- get a byte from the serial port */ unsigned char inbyte() { while ((inp(RS232REG) & RECEIVE) == 0x0) { }; return (inp(RS232PORT)); } </pre></div> </body> </html>