External Modem Emulator
- Posted by Ben Logan <wbljr79 at HOTMAIL.COM> Jan 26, 2000
- 559 views
Thanks, Bernie, and Jeff. I was able to get the com ports working. Here's what I'm trying to accomplish: I have two computers on the same desk; a P166 with a controller-less modem (winmodem--BLEHCK), and a 486 with a 14.4k modem. I've recently installed Linux (Redhat 5.2) on the P166, and it won't work with the winmodem. (I'm still running Windows on the P166, I'm just playing around with Linux.) So...I was thinking...what if I could redirect the input and output on the 486 so that anything coming in thru COM1 is sent out COM2, and anything coming in thru COM2 is sent out COM1. Now, assuming that the modem in the 486 is on COM2, if I connect the two computers via a serial cable (COM1 on 486 to COM1 on P166) then the P166 will be fooled into thinking that it's got an external modem. (I'm speculating, not stating fact.) So far, it seems to be working. I can control the 486's modem from the P166 in Windows or Linux. Some things don't seem to work properly, but I think it's probably because it's so slow. One thing I don't understand is that it will only work if I set flow control to software...it won't work on hardware. Now that I've explained what I'm trying to do, I was wondering if anyone can tell me how to make it work better--or tell me that there's no chance of getting it to work properly. I've included the program I wrote. It runs on the 486. -------------------MEMU.EX----------------------- --Modem emulator...fools computer on other end of serial cable, into thinking --it owns an external modem. --Anything that comes in com2 is sent out com1, and anything that comes in --com1 is sent out com2. --Some concepts are taken from E-TERM.EX--Thanks to PJB Systems --Pressing any key breaks out of the program. without type_check include serial.e integer key,data,rcnt sequence rBuffer rBuffer = {} clear_screen() puts(1,"Modem Emulator in operation...press a key to terminate...") SetPortBPDS(1,19200,0,8,1) --Configure the ports SetPortBPDS(2,19200,0,8,1) rcnt = 0 key = -1 while key < 0 do data = GetSerialByte(2) --See if modem has sent any data if data > 0 then rBuffer &= data --Yes, so put it in buffer rcnt = 200 --This must be 200 in order not to lose data else rcnt = rcnt -1 end if if rcnt < 1 then rcnt = 0 key = get_key() --If user has pressed a key, then exit prog if length(rBuffer) > 0 then --If there's anything in buffer, for i = 1 to length(rBuffer) do --Send it out SendSerialByte(1,rBuffer[i]) --com1 end for rBuffer = {} --Empty the buffer end if data = GetSerialByte(1) --Get data from com1 (remote 'puter) if data > 0 then --If any data was waiting, SendSerialByte(2,data) --send it to modem end if end if end while puts(1,"\n\nDone.\n") ------------------------------------------------- Thanks in advance, Ben ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com