1. Testing COM ports

Hello All

I am trying to test a COM port, but am not getting anything
reasonable back.  I have a modem on COM2 (on a PCMCIA card)
and am trying to read the response to an ATZ with the following:

object o
integer i,fn
sequence s

fn=open("COM2","ub")
if fn=-1 then
    puts(2,"No Go\n")
else
  printf(1,"The file handle is %d\n",fn)
  puts(fn,"atz\n")
  puts(1,"Com port written to\n")
  printf(1,"\n",{})
  while 1 do
    i=getc(fn)
    if i=-1 then
      puts(1,"All done\n")
      exit
    end if
    puts(1,i)
  end while
end if


The output I get is:

The file handle is 3
Com port written to

96  60
7  7
71  47
0  0


And then the pgm hangs until I press ctl-Break.  I would like to
get an OK back and go on and process - or determine that there is
no modem on COM2 and handle that.  Any ideas?

Thanks

John Kinne

new topic     » topic index » view message » categorize

2. Re: Testing COM ports

Hi john, et al.
I've tried three ways of getting a response from the modem.

fn=open("COM2","ub")
  puts(fn,"atz\r")
  -- note the ^^ carriage return instead of linefeed \n
  close(fn)
fn=open("COM2","rb")
  while 1 do
    o=getc(fn)
    puts(1,o)
    -- ctrl-break, some work needs to be done here...
  end while


include ports.e --available at the Euphoria homepage.
Output(97,#2F8)  --a
Output(116,#2F8) --t
Output(122,#2F8) --z
Output(13,#2F8)  --\r

and finally this cheap alternative:
system ("echo atz > com2",2)

 Regards, Einar.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Testing COM ports

--=====================_846935324==_

To John Kinne, et al

BIOS interrupt #14 give access to com port, by four basic functions
I send you this modem demo.
it sent a help command to the modem and display the modem answer to screen.
It work find with my USR sporter. under dos mode only, didn't test it
extensively.


--=====================_846935324==_

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu