AN93

Status and Control

Sample code for this layer can be found in status_control.c file. This code can be ported to other applications with minimal changes needed to compile on the host platform. The modem status may be queried, and modem control flags may be set using the two functions below:

void setControl( char controlCode, char action, char condition ): Set modem control. Possible control codes are:

SiESC: Set or clear escape flag.

SiINTM: Enable or disable U70 interrupt.

The action may be ENABLE or DISABLE. Control takes effect upon one of two conditions: NOW: Unconditionally upon entering the function call.

WHEN_TX_BUF_EMPTY: The setControl() function loops until the gUARTToModemBuffer[] is empty. This enables, for instance, setting the escape code after a given data set has been transmitted, prior to sending AT commands. It is up to the application to ensure the buffer empties within a reasonable amount of time.

char queryU70IntStatus( void ): Returns the INT flag from the ISOmodem at the same bit position as in the HIR1 register.

The Application Layer: Sample Application

Sample code for an application can be found in the modem_main.c and modem_80C51.h files. This code is application and host platform specific. By default, the program simply passes data back and forth between the modem and the UART using the buffers and function calls described above. The minimal application is shown below:

char gPollingNotInterruptMode = 0;

// Interrupt mode by default

void main( void )

 

{

 

EA = 0;

// Disable global interrupt

EA = 0;

// Dummy, as per MCU data sheet

initApplicationBuffers();

 

initHardware();

 

setControl( SiESC, DISABLE, NOW );

IT1 = 1;

// External interrupt 1 is edge triggered

EX1 = 1;

// Enable external interrupt 1

PS = 1;

// High interrupt priority for UART0

PX1 = 0;

// Low interrupt priority for modem side

EA = 1;

// Enable global interrupt

while ( 1 )

 

{

 

modemCommunicationUpdate();

 

UARTCommunicationUpdate();

 

}

}

298

Rev. 1.3

Page 298
Image 298
Silicon Laboratories SI2493/57/34/15/04, SI2494/39 manual Application Layer Sample Application, Status and Control