El 08/07/2019 a las 22:43, James Richters escribió:
ports that are defined by port numbers and pins in an ini file,
Well, then they are dynamic. They are not hardcoded. I would use something like: TPortIdentifier=(Pin_1, pin_2, Port_x, Port_y...); TIOPort=object private FPortPin:boolean; FPortByte:boolean; procedure SetPortPin(value:boolean); procedure SetPortByte(value:byte); public OtherData:... // pin, port etc or other data PortAdress:PWord; // pointer to memory Name:string; constructor Init(aName:name;aPword:pWord); property PortPin:boolean read fPortPin write SetPortPin; property PortByte:byte read fPortByte write SetPortByte; end; 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. Or you can use a TFPGMap from the standard library fgl. -- Saludos Santiago A.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal