SECTION 6
Conversions and Interfaces
PEN*KEY
R
6200/6300 Hand-Held Computer Programmer’s Reference Guide 6-13
EXAMPLE:
LOCAL VARIABLES
01 COM_PORT BINARY BYTE
CONSTANTS
OPEN (TTY, TTYBUF) TT_NAME, TT_
&
T TT_CR + TT_AS_IS
COM_PORT = 1
++ifdef 6200
IF (MOD_LOCATION = LOC_INTERNAL_MODEM) OR
& (MOD_LOCATION = LOC_INTNL_ACOUSTIC) THEN
COM_PORT = 3
ENDIF
++endif
PUTCTL (TTY) COM_PORT, TT_COMPORT
PUTCTL (TTY) TCOM_SPEED,TT_BAUD, PARITY,TT_PARITY,
DATA_BITS,TT_DATA
IF PACKED_DATA THEN PUTCTL(TTY) TT_TRANSPARENT
TTY.ERR_PROC = @TTYERR
5. Modify calls to PGMDM1P and PGHAD3P. PGMDM1P (modem detection)
and PGHAD3P (Hayes commands) were changed to support different COM
ports. Libraries from PLNLIB V1.08 or greater must be used. The
READ.ME file from RPGDEV V5.20 includes updated documentation for
these routines.
EXAMPLE:
NUMERIC FUNCTION AUTODETECT = PGMDM1P
NUMERIC FUNCTION HAYES = PGHAD3P
MODEM_TYPE = AUTODETECT (CONFIG.TCOM_SPEED, COM_PORT)
. . .
MODEM_ERROR = HAYES(COM_PORT, CONFIG.TCOM_SPEED,
&
MODEM_STRING, DATA_BITS, PARITY,
&
MDM_CFGWAIT, MDM_CFGRETRY, OPT_RESP, OPT_ENGLISH)
6. Update the modem configuration strings. The PL/N include file PCHACNP
has been updated with configuration strings for new modems and for
cellular connections.
EXAMPLE:
LOCAL VARIABLES
01 MODEM_STRING
05 CH(MDM_MAXLENGTH) PIC X
IF CELLCALL THEN
IF MICROCOM THEN
MODEM_STRING = MDM_M_CELLULAR
ELSE
MODEM_STRING = MDM_A_CELLULAR
ENDIF
ELSE
IF MICROCOM THEN
MODEM_STRING = MDM_M_LANDLINE
ELSE
MODEM_STRING = MDM_MNP10
ENDIF
ENDIF
MODEM_ERROR = HAYES(COM_PORT, CONFIG.TCOM_SPEED,
& MODEM_STRING, DATA_BITS, PARITY,
& MDM_CFGWAIT, MDM_CFGRETRY, OPT_RESP, OPT_ENGLISH)
6. Conversions and
Interfaces