Solved

Com Ports in Delph 3

Posted on 1997-09-06
2
237 Views
Last Modified: 2010-04-16
I have recently upgraded to Delphi 3 and find that I am unable to compile a Delphi 1 program which sent a phone
number to the com port.
As I am a beginner, could someone show me how to do the same in Delphi 3
0
Comment
Question by:kennys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Johann091297 earned 200 total points
ID: 1215567
if u used the port[xxx]:=? to access the com port, u cant anymore since this function is obsolete from delphi 2.0, here is a replica of the port function- just use getport and setport;

instead of: port[888]:=10; use: setport(888,10);
instead of: i:=port[888]; use: i:=getport(888);

procedure setport(index:word;const value:byte);assembler;
  asm
    mov al,value
    mov dx,index
    out dx,al
  end;


function getport(index:word):byte;assembler;
  asm
    mov dx,index
    in al,dx
    mov result,al
  end;

0
 

Author Comment

by:kennys
ID: 1215568
I thank you for your help sofar but need more !!


My modem is on com port 2 so I assume I use
setport(2,xx) to set the port to 2.

What is the second parameter(xx) for in setport.

Can you show me how to send a number to com port 2

Do I need to close the port and if so, how.

In the Delphi 1 program I used the following:-

 begin
   CloseComm(ComID);
   StrPCopy(Prt2, Prt);
   ComID := OpenComm(Prt2, 1024, 2048);
   dialed:=s;
   
   Vol = Volume D = TP =pulse dialing
   DialString := 'ATM2' + Vol + 'D' + TP + S + ',,' + ^M^J;
   StrPCopy(Send, DialString);
   if WriteComm(ComID, Send, StrLen(Send)) >= 0 then
   begin

    ShowMessage('          Dialing ' + S + #13 + #13');

    DialString := 'ATH' + ^M^J;
    startt:=timetostr(time);
    StrPCopy(Send, DialString);
 
    WriteComm(ComID, Send, StrLen(Send));

   end;
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
A look at what happened in the Verizon cloud breach.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question