C Language Development Kit/Functions/PutCom2
From OptiWiki
< C Language Development Kit | Functions(Redirected from C Language Development Kit/Functions/putcom2)
| Description | putcom2() transmits a character through the specified serial communications port. | |||||||||
| Syntax | int putcom2(unsigned int port, int c); | |||||||||
| Arguments | port specifies which serial communications port is to be opened. See the table below for details.
unsigned int port c is the character that is to be transmitted
int c
| |||||||||
| Returns | OK or ERROR. | |||||||||
| 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. while( 1 ) { if( (ch = getcom2( COM2, 0 )) != -1) { putchar( ch ); putcom2( COM2, ch ); } if( (ch = getchar()) != EOF) { putchar( ch ); putcom2( COM2, ch ); } idle(); // Very important to lower the power consumption } } |
