Solved

Com Ports in Delph 3

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Invest in your employees with these five simple steps to improve employee engagement and retention.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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