In my case board already has defined pins like this:
and since AvrCo doesn't have a bit pointer I will not be able to simply loop through an array of records like in my first post, but to manually code something like this:
Of course this is over simplified example of what I have, but you can see from it that using bit setting and getting functions would complicate things, make code less readable, and make me maintain bits pin list at two places: var section and code section.
Code
const
DI_1_TAGNUM: word = 14;
DI_2_TAGNUM: word = 15;
var
{$PDATA}
DI_1[@PinA, 0]: bit;
DI_2[@PinA, 1]: bit;
DI_1_TAGNUM: word = 14;
DI_2_TAGNUM: word = 15;
var
{$PDATA}
DI_1[@PinA, 0]: bit;
DI_2[@PinA, 1]: bit;
and since AvrCo doesn't have a bit pointer I will not be able to simply loop through an array of records like in my first post, but to manually code something like this:
Code
case TagNum of
...
DI_1_TAGNUM:
if Command = cmdRead then Result := DI_1; endif;
if Command = cmdWrite then DI_1 := NewValue; endif;|
DI_2_TAGNUM:
if Command = cmdRead then Result := DI_2; endif;
if Command = cmdWrite then DI_2 := NewValue; endif;|
...
endcase;
...
DI_1_TAGNUM:
if Command = cmdRead then Result := DI_1; endif;
if Command = cmdWrite then DI_1 := NewValue; endif;|
DI_2_TAGNUM:
if Command = cmdRead then Result := DI_2; endif;
if Command = cmdWrite then DI_2 := NewValue; endif;|
...
endcase;
Of course this is over simplified example of what I have, but you can see from it that using bit setting and getting functions would complicate things, make code less readable, and make me maintain bits pin list at two places: var section and code section.