Solved

Com Ports in Delph 3

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now