Hello guys, I'm having a hard time trying to inplement a custom counter.
It works if I start it from 0, but that is a problem for me as the output pins should never be all LOW. I want to start the counter from 1023 (PIN 14 to 23 HIGH) and it dosen't work. All the pins stay LOW.
I do get a lot of warnnings and errors but it dosen't look like it matters.
I have the latest WinCupl version from microchip website and windows 7.
Not working code:
Name Counter1 ;
PartNo 00 ;
Date 07.12.2020 ;
Revision 01 ;
Designer ME ;
Company Private ;
Assembly None ;
Location ;
Device g22v10 ;
/* *************** INPUT PINS *********************/
PIN 1 = clk;
PIN [14..23] = [Q9..Q0];
field counter = [Q0..Q9];
Sequenced counter {
present 'D'1023 next 'D'55;
present 'D'55 next 'D'119;
present 'D'119 next 'D'247;
present 'D'247 next 'D'95;
present 'D'95 next 'D'127;
present 'D'127 next 'D'611;
present 'D'611 next 'D'357;
present 'D'357 next 'D'870;
present 'D'870 next 'D'87;
present 'D'87 next 'D'103;
present 'D'103 next 'D'39;
present 'D'39 next 'D'63;
present 'D'63 next 'D'1023;
}
Working code:
Name Counter1 ;
PartNo 00 ;
Date 07.12.2020 ;
Revision 01 ;
Designer ME ;
Company Private ;
Assembly None ;
Location ;
Device g22v10 ;
/* *************** INPUT PINS *********************/
PIN 1 = clk;
PIN [14..23] = [Q9..Q0];
field counter = [Q0..Q9];
Sequenced counter {
present 'D'0 next 'D'55;
present 'D'55 next 'D'119;
present 'D'119 next 'D'247;
present 'D'247 next 'D'95;
present 'D'95 next 'D'127;
present 'D'127 next 'D'611;
present 'D'611 next 'D'357;
present 'D'357 next 'D'870;
present 'D'870 next 'D'87;
present 'D'87 next 'D'103;
present 'D'103 next 'D'39;
present 'D'39 next 'D'63;
present 'D'63 next 'D'0;
}
Many thanks,
Georgian.