Author Topic: WinCUPL, ATF22V10BQL - State machine not working.  (Read 1866 times)

0 Members and 1 Guest are viewing this topic.

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
WinCUPL, ATF22V10BQL - State machine not working.
« on: December 09, 2020, 10:43:22 pm »
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:
Code: [Select]
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:
Code: [Select]
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.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14001
  • Country: gb
    • Mike's Electric Stuff
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #1 on: December 09, 2020, 11:09:50 pm »
I think the issue is that the PLD registers will reset to zero on power-up, and your not-working code doesn't say what to do in that case, so nothing happens.
Should just be a case of adding a present 0 next 1023 line to the state machine.


 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: georgian

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #2 on: December 09, 2020, 11:17:33 pm »
I can't have any 0. I'm using the upper 3 bits for latch enable on some 4511 ICs. Having this pins LOW will show some unwanted 0 on the display.
For example, my clock shows 00 00 00 -> 12 23 20 -> 00 00 00 -> 12 23 21 -> 00 00 00 and it should be 12 23 20 -> 12 23 21 - > ...
I don't mind having the 0s on first start, but after that there should be none.

EDIT*** 1023 is just a random number that dosen't do anything bad.
« Last Edit: December 09, 2020, 11:19:14 pm by georgian »
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14001
  • Country: gb
    • Mike's Electric Stuff
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #3 on: December 09, 2020, 11:34:36 pm »
I don't mind having the 0s on first start, but after that there should be none.
So adding a line as I suggested should solve the issue - it will only ever be 0 from power-up until the first clock pulse.
 As there is no "next 0" line, it will never return to 0
For a simple example, if you wanted 123123 etc.

0->1
1->2
2->3
3->1

would output 0123123123....

« Last Edit: December 09, 2020, 11:36:30 pm by mikeselectricstuff »
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: georgian

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #4 on: December 09, 2020, 11:39:33 pm »
Unfortunatly it dosen't work. I made the modification as you sugested and i get an error and the cod ewon't compile.
Code:
Code: [Select]
Sequence counter {
present 'D'0 next 'D'807;
/* present 'D'1023 next 'D'55; */
present 'D'807 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'807;
}

Error:
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14001
  • Country: gb
    • Mike's Electric Stuff
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #5 on: December 10, 2020, 09:25:54 am »
So you've effectively run out of space in the device. First thing to try is  to initialise to a different state from the 0 power-up state, as there may be one that optimises better.
Also try the inverted-output method.
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: georgian

Offline georgianTopic starter

  • Regular Contributor
  • *
  • Posts: 54
  • Country: at
Re: WinCUPL, ATF22V10BQL - State machine not working.
« Reply #6 on: December 10, 2020, 09:58:26 pm »
I got it working. Finaly. I had to invert the output pins and also invert all my numbers. The start/stop ZERO is now All pins HIGH and i'm verry happy with it. I did think about this method, but with external NOT gates... did't thing it could be possible to invert all output pins at once.

Code: [Select]
field counter = ![Q9..Q0];

Sequence counter {
present 'D'0 next 'D'960;
present 'D'960 next 'D'968;
present 'D'968 next 'D'96;
present 'D'96 next 'D'928;
present 'D'928 next 'D'896;
present 'D'896 next 'D'912;
present 'D'912 next 'D'412;
present 'D'412 next 'D'666;
present 'D'666 next 'D'153;
present 'D'153 next 'D'936;
present 'D'936 next 'D'904;
present 'D'904 next 'D'0;
/*present 'D'904 next 'D'0;*/
}


Thank you for the tip. Heave a great day.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf