Hello.
I am trying to write a very simple Delphi4 32-bit console app which toggles 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:
Exception EPrivilege in module z.exe at 00008254. Privileged instruction.
Does Delphi4 have built-in support for toggling RTS? I could not find it.
Thank you.
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;
This may help: http://mc-computing.com/languages/delphi/delphi_serialio.htm
Thanks for the reference. There was no mention in there how to access the modem control register to toggle RTS... but there were quite a few external links; I haven't yet looked at them all but I will.