Code: Select all
var out1c : sbit at coils[0].0; out2c : sbit at coils[0].1;
out3c : sbit at coils[0].2; updownc : sbit at coils[0].3;
Shouldn't that syntax be valid?
Code: Select all
var out1c : sbit at coils[0].0; out2c : sbit at coils[0].1;
out3c : sbit at coils[0].2; updownc : sbit at coils[0].3;
As your structure is not a SFR, this cannot be achieved using sbit.The mikroPascal PRO for PIC32 compiler has sbit data type which provides access to bit-addressable SFRs.
You can declare a sbit varible in a unit in such way that it points to a specific bit in SFR register.
Code: Select all
program sbit;
var coils : dword;
test : sbit at coils.27;
begin
coils := 0;
test := 1;
test := 0;
end.
Code: Select all
program MyProgram;
...
var MyVar: byte;
var Abit: sbit at MyVar.0; // this is where Abit is fully defined
...
begin
...
end.
Indeedjpc wrote:maybe you can store your coils in a few 32bit vars as this seems to workCode: Select all
program sbit; var coils : dword; test : sbit at coils.27; begin coils := 0; test := 1; test := 0; end.
Code: Select all
program sbit;
var coils : array[4] of byte;
coilsb : dword at coils;
out1c : sbit at coilsb.0;
updownc : sbit at coilsb.16;
begin
coils[2]:=0;
coils[2].0 :=1; // equivalent
updownc:=1; // assignments
end.