AN93

3.DTR is assumed to be connected to the ESC pin of the modem. It has been programmed to HANG UP when DTR is negated.

4.When the modem is in RECEIVE operation (RTS negated), it is not possible to communicate with the modem. The only control is to hang up using DTR.

5.The modem “automatically” takes care of figuring out if it is supposed to be in “V.29 Long Train” vs. “V.29 Short Train”. The primary host responsibility is to take care of RTS.

6.Data to/from the modem is expected to be in V.80 format.

Example Program in C/C++

This program shows how to establish an SDLC V.29 FastPOS link and keep the loop alive.

How to use the program:

This program is meant to run for only a few minutes for testing. It is run after a reset is done, loads a patch from “patch.txt” and calls using the atdt line it finds in “tel_no.txt”. Both files need to terminate in CR LF.

The tel_no.txt file must contain a complete telephone number dialing line followed by a CR, e.g. ATDT8,5551212.

//V29_test.cpp : Defines the entry point for the console application.

//Copyright 2005 Silicon Labs Inc. All rights reserved.

//Rev 0.0602

#include "stdafx.h" #include "windows.h" #include "stdlib.h" #include <stdio.h> #include <time.h>

char

fnamePatch[]=".\\patch.txt";

char

fnameTelno[]=".\\Tel_no.txt";

char

*SendAndWaitFor(char *cpCommand, char *cpInBuffRd,

 

char *cpResponse, int iTimeoutMs);

char

*WaitForResponse(char *cpResponse, char *cpInputBuffer,

 

int iTimeOutInMs);

void

SetupSerPort(void);

void

AssertRTS(bool bAssert);

void

AssertDTR(bool bAssert);

void

Delay(long iMs) ;

bool

GetFileTextLine(char *cpIn);

void

LoadAndSendPatch(void);

char

*cpInBuffer;

char

*cpOutBuffer;

char

*cpInputWr;

char

*cpErrorString;

FILE

*hpPatchFile;

FILE

*hpTelNoFile;

DCB

dcb;

HANDLE

hCom;

char

*pcCommPort = "COM1";

COMMTIMEOUTS sCOMMTIMEOUTS;

int

iCharCount;

char

*cpInputRd, *cpInputRd_temp, cpInput_test[255];

262

Rev. 1.3

Page 262
Image 262
Silicon Laboratories SI2493/57/34/15/04, SI2494/39 manual Example Program in C/C++, How to use the program