beautypg.com

Comtrol API (6508) for the MS-DOS User Manual

Page 34

background image

34

API Functions

EvModemChange

EvModemChange

Application modem input change event function

EvModemChange(Dev,unsigned char

MdmChange,unsigned char
MdmState
)

int Dev

Device number

unsigned char MdmChange

Modem input lines which
changed. Can be any
combination of the
flags:

COM_MDM_DSR

,

COM_MDM_CTS

, or

COM_MDM_CD

.

If a flag is set that modem
line is changed, if a flag is
not set that modem line did
not change.

unsigned char MdmState

Current state of the modem
inputs. Can be any
combination of the

COM_MDM_CTS

,

COM_MDM_DSR

, and

COM_MDM_CD

flags. If a

flag is set that modem line
is

ON

, if a flag is not set

that modem line is

OFF

.

void

This function is not part of the

API

, it must be written

by the developer as part of the application program.
The function name EvModemChange is an example
name only, this event function can be given any name
desired.
This function is not called directly by the application.
Instead, it is dispatched by the

API

’s internal

ISR

(interrupt service routine) when it detects that receive
data is available. Before this function will be
dispatched it must be installed with
aaInstallMdmChgEvent(), and modem input change
detection must be enabled. Detection is enabled using
the DetectEn parameter of aaOpen() or aaReconfigure().
The function installed here is called during an
interrupt service routine (

ISR

). Keep your code short

and remember that many standard C library calls do

Function

Purpose

Call

Return

Comments

Warning

not work in

ISR

s, such as printf().

If using the Microsoft C compiler, stack checking must
be disabled during the event function and any functions
called by the event function.
Stack checking can be turned off and on with:

#pragma check_stack(off)
#pragma check_stack(on)