need WINCUPL counter program which counts from 0.0 to 9.9

Thread Starter

Arfa Ahmed

Joined Apr 16, 2016
2
it is possible to make a counter which counts from 0.0 to 9.9 using WINCUPL program.
if it is possible please anyone help me.
below is the program of decade counter, what changes we need to convert it in (0.0 to 9.9) counter?

Name count10 ;
PartNo 00 ;
Date 4/1/2016 ;
Revision 01 ;
Designer Engineer ;
Company Karachi University ;
Assembly None ;
Location ;
Device G16V8 ;

/* *************** INPUT PINS *********************/
PIN 1 = clk ; /* */
PIN 2 = clr ; /* */
PIN 3 = dir ; /* */
PIN 11 = !oe ; /* */

/* *************** OUTPUT PINS *********************/

PIN [14..17] = [Q3..0] ; /* */
PIN 18 = carry ; /* */

field count = [Q3..0];

$define S0 'b'0000
$define S1 'b'0001
$define S2 'b'0010
$define S3 'b'0011
$define S4 'b'0100
$define S5 'b'0101
$define S6 'b'0110
$define S7 'b'0111
$define S8 'b'1000
$define S9 'b'1001

field mode = [clr,dir] ;
up = mode:0;
down = mode:1 ;
clear = mode:[2..3] ;

sequenced count
{
present S0 if up next S1 ;
if down next S9 ;
if clear next S0 ;
if down out carry ;
present S1 if up next S2 ;
if down next S0 ;
if clear next S0 ;
present S2 if up next S3 ;
if down next S1 ;
if clear next S0 ;
present S3 if up next S4 ;
if down next S2 ;
if clear next S0 ;
present S4 if up next S5 ;
if down next S3 ;
if clear next S0 ;
present S5 if up next S6 ;
if down next S4 ;
if clear next S0 ;
present S6 if up next S7 ;
if down next S5 ;
if clear next S0 ;
present S7 if up next S8 ;
if down next S6 ;
if clear next S0 ;
present S8 if up next S9 ;
if down next S7 ;
if clear next S0 ;
present S9 if up next S0 ;
if down next S8 ;
if clear next S0 ;
if up out carry ;
}
 
Top