Hello.
I am trying to write a very simple Delphi4 32-bit console application {$APPTYPE CONSOLE} which sets and clears the RTS pin of the COM1 RS232 serial port.
What is the simplest way to do this?
I tried writing asm code (see below) but not surprisingly I got a run-time exception (see below).
Does Delphi4 have built-in support for setting/clearing RTS? I could not find it.
Thank you.
---------begin code--------------
procedure SetRTS;
asm
mov dx, 03fch; {get COM1 MCR}
in al,dx;
or al, 2; {set RTS}
out dx, al;
end;
procedure ClearRTS;
asm
mov dx, 03fch;
in al,dx;
and al, 0fdh;
out dx, al;
end;
---------end code-------------
-------begin runtime error message-------------
Exception EPrivilege in module z.exe at 00008254.
Privileged instruction.[/QUOTE]
-------end runtime error message-------------
I am trying to write a very simple Delphi4 32-bit console application {$APPTYPE CONSOLE} which sets and clears the RTS pin of the COM1 RS232 serial port.
What is the simplest way to do this?
I tried writing asm code (see below) but not surprisingly I got a run-time exception (see below).
Does Delphi4 have built-in support for setting/clearing RTS? I could not find it.
Thank you.
---------begin code--------------
procedure SetRTS;
asm
mov dx, 03fch; {get COM1 MCR}
in al,dx;
or al, 2; {set RTS}
out dx, al;
end;
procedure ClearRTS;
asm
mov dx, 03fch;
in al,dx;
and al, 0fdh;
out dx, al;
end;
---------end code-------------
-------begin runtime error message-------------
Exception EPrivilege in module z.exe at 00008254.
Privileged instruction.[/QUOTE]
-------end runtime error message-------------