<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">El 08/07/2019 a las 22:43, James
Richters escribió:<br>
</div>
<blockquote type="cite"
cite="mid:57ae01d535cd$d850a7f0$88f1f7d0$@productionautomation.net">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">ports that
are defined by port numbers and pins in an ini file,</span></p>
</div>
</blockquote>
Well, then they are dynamic. They are not hardcoded.<br>
<br>
I would use something like:<br>
<br>
<pre>TPortIdentifier=(Pin_1, pin_2, Port_x, Port_y...);</pre>
<pre>
TIOPort=object
private
FPortPin:boolean;
FPortByte:boolean;
procedure SetPortPin(value:boolean);
procedure SetPortByte(value:byte);
public
</pre>
<pre> OtherData:... // pin, port etc or other data</pre>
<pre> PortAdress:PWord; // pointer to memory</pre>
<pre> Name:string;
constructor Init(aName:name;aPword:pWord);
property PortPin:boolean read fPortPin write SetPortPin; </pre>
<pre> property PortByte:byte read fPortByte write SetPortByte;
end;</pre>
<pre> TPortList=array[TPortIdentifier] of TIOPort;
var
PortList:TPortList;
begin
// fill the array with name and values from Ini file
PorList[Pin_1].init('Pin-1',@xxxx);
PorList[Pin_2].init('Pin-2',@xxxx);
// call
PortList[pin_1].PortPin:=true;
PortList[pin_2].PortPin:=false;
end.
</pre>
<br>
Or you can use a TFPGMap from the standard library fgl. <br>
<br>
<pre class="moz-signature" cols="72">--
Saludos
Santiago A.
</pre>
</body>
</html>