C Language Development Kit/Functions/ResetReceive2

From OptiWiki

Jump to: navigation, search
Description This function resets the serial receiver electronics and associated

software of the specified communications port. It also clears the receive buffers.

Syntax
void resetreceive2(unsigned int port);
Arguments
unsigned int port
port specifies which serial communications port is to be reset. See the table below for details.
Terminal Supported ports Description
OPH100x COM1 Cradle CRD1001 or IrDA dongle
COM2 Same as COM1
Returns None
Remarks Like resetkey(), this routine can be used to

delete old data. In this case data still placed in the receive buffer is cleared.

Example
#include "lib.h"
#include <stdio.h>
 
#defineCOM COM2
 
void main( void )
{
    comopen( COM );
 
    while( 1 )
    {
        while( 1 )
        {
            resetkey();
            resetreceive2(COM);
            printf("\fReceiving..\n");
            if( xmodemreceive("a:test.dat") != XMR_OK)
            {
                printf("\fERROR:\nfile not received\npress any key");
                while( !kbhit())
                    idle();
                continue;
            }
 
            printf("file Received OK\n\rPress key\n\r");
            while( !kbhit())
                idle();
            break;
        }
 
        while( 1 )
        {
            resetkey();
            resetreceive2(COM);
            printf("\fSending..\n");
            if( xmodemtransmit("a:test.dat") != XMT_OK)
            {
                printf("\fERROR:\nfile not send\npress any key");
                while( !kbhit())
                    idle();
                continue;
            }
 
            printf("file send OK\n\rPress key\n\r");
            while( !kbhit())
                idle();
            break;
        }
    }
}


Views
Personal tools