Solved

Com Ports in Delph 3

Posted on 1997-09-06
2
206 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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