Reading Modem Answers from COM-Port 
Author Message
 Reading Modem Answers from COM-Port

Hi!

How does a REXX-Script has to look, that sends an 'AT' to the Modem at COM2:
and assigns the modem-answer 'OK' to a variable. In my trials until now I
found only the sendet 'AT' in the datastream!

Bye...



Sat, 09 May 1998 03:00:00 GMT  
 Reading Modem Answers from COM-Port

Quote:
>>How does a REXX-Script has to look, that sends an 'AT' to the Modem at
>COM2:
>You will want to locate RXASYNC.DLL somewhere (Hobbes perhaps). It has all
>the extended functions to control the modem, and return data to rexx
>variables.

Without RXASYNC.DLL you can use many REXX commands to deal with the COM2
stream.  For example, here's a simple dialer:
/*    DIAL.Cmd         */
arg   number
say  'Dialing' number 'at' time() 'on' date()

'echo ATZ0> com3:'
call syssleep 1
'echo ATDT'number',;Z0 > com3:'
/* dial, wait a sec(,), send reset */
DROP NUMBER
Return
~~~~~~~~~~~~~~~~~

You can "open" com2 and read its characters, etc. as shown in this "reader":

/* Puller.Cmd  edit input from Modem   12/13/94   wah */
newdir=directory('G:\MC1')
/*mode 'com2:19200,O,7,1, worked well 12/14/94  */
Say "Date & Time:" Date(u) Time()
ComPort = "COM2" ; ComStream='' ; siz=0 ; buffer='' ; liner = 1; chr=0
Nl='D'x
parity='O' ; data=7 ; stop=1   /*parse arg Parity data stop .*/

call SysCurPos 0,0 ;  call SysCls
Address CMD mode ComPort':19200,'Parity','data','stop','
rc=stream(ComPort,'c','open read')
say;Say "Ready to READ FROM" ComPort "...";say

signal on halt   name error
signal on syntax name error

do FOREVER      /*til CANCEL*/


    char=charin(ComPort)
    chr=c2d(CHAR)
 if chr<32  then
  char='['c2x(char)']'
buffer=buffer || char

call writeln

END
RETURN

writeln:
kilr = pos('][08][01]',buffer)
if kilr>0 then
 buffer=delstr(buffer,kilr-3,13)
buffer=left(buffer,length(buffer)-3)
if liner>24  then
      do
       liner=0
       call sysCurPos liner,00
      end
 liner=liner+1
 if left(buffer,4)='[10]' then
  say buffer date() time()
 else
  say left(buffer,79)
 buffer=''
Return

Error:
 say date() time()
exit  0

Warren



Wed, 13 May 1998 03:00:00 GMT  
 Reading Modem Answers from COM-Port
Quote:
>How does a REXX-Script has to look, that sends an 'AT' to the Modem at

COM2:
You will want to locate RXASYNC.DLL somewhere (Hobbes perhaps). It has all
the extended functions to control the modem, and return data to rexx
variables.


Wed, 13 May 1998 03:00:00 GMT  
 Reading Modem Answers from COM-Port
Quote:
>Without RXASYNC.DLL you can use many REXX commands to deal with the COM2
>stream.  For example, here's a simple dialer:
>/*    DIAL.Cmd         */

I agree completely.... below is a cmd file to beep a number and send a
numeric message... remove references to YDBAUTIL if you do not have that
tool, or don't need to set your process priority high.

fyi: this was cloned from a cmd file that was part of the TIMESET package
found on hobbes.

/* REXX */
/* Procedure to call a beeper number and beep a person      */
/*    syntax:  beeper nnnnnnn 12345 com1 0
          or:  beeper nnnnnnn 12345                         */
/* Author: Kirk Sticken                                     */
/* Date  : 11/23/94                                         */
/*                                                          */
parse arg parms
if words(parms)=2 then ,
  parse value parms with PhoneNumber NumMessage ComPort delay
else ,
  parse value parms with PhoneNumber ComPort NumMessage delay therest

if PhoneNumber == "" then
   PhoneNumber = "94"

if ComPort == "" then
   ComPort = "COM1"

if NumMessage == "" then
   NumMessage = "999"

if delay="" then delay=0

CrLf = X2C("0D0A")

k=0
do i=1 to length(PhoneNumber)
  if substr(PhoneNumber,i,1)="," then k=k+1
end

State = STREAM(ComPort,"C","OPEN")

dialwait=(length(PhoneNumber)*.5+8.5)%1 + delay
msgwait=(length(NumMessage)*.5+15.5)%1
totalwait=dialwait+msgwait

wt1="ATDT"Phonenumber
commas=dialwait/2%1
wt1=wt1||substr(",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",1,commas)
say "*****     beeper2 will dial" ComPort "and send("wt1||NumMessage")"
wt1=wt1||NumMessage||crlf

if rxfuncquery('RxProcId') then ,
  do
    call rxfuncadd 'RxProcId','YDBAUTIL','RxProcId'
    call rxfuncadd 'RxSetPriority','ydbautil','RxSetPriority'
    say 'rc='rc 'adding functions'
  end
parse value rxprocid() with pid ppid tid therest
say 'pid='pid', parent pid='ppid',threadid='tid
setrc=rxsetpriority('p','t',+0,pid) /* set process to time-critical */
say 'setrc='setrc 'from setting priority'

say "flt000i Initializing modem on" ComPort
CALL LINEOUT ComPort, "ATL3X3"||CrLf    /* Set modem to loud */

call syssleep 5

say "flt000i dialing" wt1

CALL LINEOUT ComPort, wt1               /* Dial In */
call syssleep totalwait

CALL LINEOUT ComPort,"ATH"CrLf          /* Hang Up */

State = STREAM(ComPort,"C","CLOSE")
setrc=rxsetpriority('p','r',-0,pid)
say 'setrc='setrc 'from setting priority'

return



Mon, 18 May 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Windows modem (real COM port ??)

2. ANN: SENDSMS.COM to explore AT command of a serial port modem

3. Writing to a com port (modem)

4. Ada, Com Ports and Modems

5. reading modem port in MacFortran

6. reading the modem port in macfortran

7. Reading COM-port from Clarion app.

8. Reading a COM port

9. Can i best read a COM-port in Clipper

10. COM port reading

11. read data from com port

12. COM port reading in LabVIEW - part II

 

 
Powered by phpBB® Forum Software