C Language Development Kit/Functions/PutCom

From OptiWiki

Jump to: navigation, search
Availability All terminals
Description putcom() transmits a character through the serial communications port that was last opened by comopen().
Syntax H 13, OPH 100x, OPL 97xx, DCL 153x
int putcom( int c );

PHL xxxx, DWT 7133

void putcom( int c );
Arguments
int c

c is the character that is to be transmitted.

Returns For H 13, OPH 100x, OPL 97xx, DCL 153x series OK or ERROR.

For PHL xxxx, DWT 7133 series None.

Remarks When the COM port was not opened previously, ERROR will be returned.
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    int ch;
 
    comopen( COM2 );    // Open the COM port for the cradle
 
    for(;;)
    {
        if( (ch = getcom( 0 )) != -1)
        {
            putchar( ch );
            putcom( ch );
        }
 
        if( (ch = getchar()) != EOF)
        {
            putchar( ch );
            putcom( ch );
        }
        idle();    // Very important to lower the power consumption
    }
}


Views
Personal tools