*debug 1

*********************************************************
*						        *
* This script file is used to configure the CODEX Modem *
*						        *
*********************************************************

set_port 1
set_speed 2400
set_parity NO_PARITY
set_data_bits 8
open_comm
iferror bye_comm
print "Initialization successful "


type "AT",0d,0a
iferror bye_t1
timeout 15
match "OK"
iferror bye_m1

***************************
*			  *
*   Programming modem     *
*			  *
***************************


**********************************
*** Setting Modulation Options ***
**********************************

type "AT&L0*MM0*AY1*LS0*MX7*MN0*AP0*CA0&X0*RT2Y0*MD1&G0",0d,0a
match "OK"
iferror MODERR


*************************************************************
*** Setting Error Correction and Data Compression Options ***
*************************************************************

type "AT*SM3*EC0*DC1*BK0*MF1*SL0",0d,0a
match "OK"
iferror EC/DC


**********************************************
*** Set ACU (Automatic Call Unit) settings ***
**********************************************   

type "AT&M1*DA0*AA1E0*MS1Q0V1*XC0",0d,0a
match "OK"
iferror ATFORM


****************************
*** Set Terminal Options ***
****************************

type "ATM*FL1*SC1&D6*RS0*CT3&R0*DL0&C1*CD3*MR0&S1*OS0*DT0",0d,0a
match "OK"
iferror TERMERR

* TELCO OPTIONS (SET MODEM SPEAKER ON AND VOLUME MEDIUM)
type "ATM1",0d,0a
match "OK"
iferror TELCO


goto bye
:TELCO
print "TELCO ERROR"
goto exit
:bye_t1
print "Error during modem programming. Type failed."
goto exit
:TERMERR
print "ERROR WHILE SETTING TERMINAL OPTIONS"
goto exit
:EC/DC
print "ERROR WHILE SETTING EC/DC OPTIONS"
goto exit
:MODERR
print "ERROR WHILE SETTING MODULATION OPTIONS"
goto exit
:ATFORM
print "ERROR WHILE SETTING ACU OPTIONS"
goto exit

:bye_m1
print "No answer from modem."
goto exit

:bye_comm
print "**** INIT ERROR !!"
goto exit



:bye 
print "Modem programmed successfully"

:exit

