\input manualMacros.tex
\manBegin
\manPageInfo{RCI Reference Manual}{}{}
\manTitle{PUT PIO}{3}
\manSection{NAME}
{\raggedright
{\tt \manName{PUT_PIO}},
{\tt \manName{PUT_DAC}},
{\tt \manName{PUT_SLU}},
{\tt \manName{PUT_PENDANT_MSG}},
{\tt \manName{SET_PIO}},
{\tt \manName{CLEAR_PIO}},
-- RCI {\it CHG} macros for setting robot controller output signals.

}
\manSection{USAGE}
\cverbatim
#include <rci.h>

PUT_PIO(rbt, num, val)
   RCI_RBT *rbt;
   int num;
   unsigned long val;

PUT_DAC(rbt, num, val)
   RCI_RBT *rbt;
   int num;
   int val;

PUT_SLU(rbt, num, buffer, size)
   RCI_RBT *rbt;
   int num, size;
   char *buffer;

PUT_PENDANT_MSG(rbt, buffer, size)
   RCI_RBT *rbt;
   char *buffer;
   int size; 

SET_PIO(rbt, num, mask)
   RCI_RBT *rbt;
   int num;
   unsigned long mask;

CLEAR_PIO(rbt, num, mask)
   RCI_RBT *rbt;
   int num;
   unsigned long mask;@endcverbatim
\manSection{ARGUMENTS}
\manItem{{\tt rbt} --}
Pointer to RCI robot structure.
\manItem{{\tt num} --}
Channel or unit number.
\manItem{{\tt val} --}
Output value.
\manItem{{\tt buffer} --}
Byte packet buffer.
\manItem{{\tt size} --}
Size of byte packet buffer.
\manSection{DESCRIPTION}
These macros control the robot controller output signals.
Not all of these outputs may be available; information describing
which features are available is read into the {\tt HOW} structure at the
start of each control session.
The macros may be called from any part of an RCI program.

{\tt PUT_PIO()} sets the value of the parallel port {\tt num} to
{\tt val}. Each parallel port is described by the type
{\tt unsigned short}, which is 16 bits long on VAX or SUN systems.
The number of available parallel output ports is given in the
{\tt numPioOut} field of the {\tt HOW} structure. The set value
is read back into the {\tt pioOutput} field.

{\tt PUT_DAC()} sets the value of the DAC channel {\tt num} to
{\tt val}.
The number of available DAC channels is given in the
{\tt numDac} field of the {\tt HOW} structure. The set value
is recorded in the {\tt dacOutput} field. Values which lie beyond the DAC
range (for instance, many DACs are only 12 bits long) 
are clipped, although the recorded value in the {\tt HOW} structure
does not necessarily
reflect this clipping.

{\tt PUT_SLU()} sends the given byte buffer to the indicated
serial line unit. The entire buffer is transferred to the
robot controller during the next cycle, and its size will be
truncated to {\tt MAX_SLUBUF}. 
The number of available SLUs is given in the
{\tt numSlu} field of the {\tt HOW} structure. 
There is no facility (at present) for
reading back the status of the transmitted information.

{\tt PUT_PENDANT_MSG()} outputs the given byte buffer to the
robot teach pendant. A teach pendant is available if 
{\tt PENDANT_AVAIL} is set in the options field of the {\tt HOW}
structure. The entire buffer is transferred to the
robot controller during the next cycle, and its size will be truncated to
{\tt MAX_SLUBUF}. The dispatched pendant message is recorded in the
{\tt pendantMsg} field of the {\tt HOW} structure.

\manInset{{\bf NOTE}: Because {\tt PUT_SLU()} and {\tt PUT_PENDANT_MSG()} are
implemented as macros, it is very important to make sure the buffer
pointer {\tt buffer} is either a {\tt char*}, or is cast to a {\tt char*}.}

{\tt SET_PIO()} sets individual bits (specified by {\tt mask})
in the parallel port {\tt num}. The final set value is read back into the
{\tt pioOutput} field of the {\tt HOW} structure.

{\tt CLEAR_PIO()} clears individual bits (specified by {\tt mask}) 
in the parallel port {\tt num}. The final set value is read back into the
{\tt pioOutput} field of the {\tt HOW} structure.

\manSection{DIAGNOSTICS}
Failures will result in an abort condition. Defined abort codes include:

\manItem{{\tt ETooMany} --}
Too much information to write to the robot controller in one burst.
This is a possibility if a lot information is being transferred to the
serial line units.
\manSection{SEE ALSO}
\raggedright
{\tt CHG(3)}, {\tt HOW(3)}.
\manEnd
\end
