这是我用CUPL配合 WINCUPL 使用 GAL16V8 写的小程式 功能是希望可以依次控制2组LED动作, 但是程式不论著么修改都只有1组LED在动作(count2组有动作) 难道是说1个CUPL程式只能有一组sequence? 请前辈们指导一下 谢谢
Name Name ; PartNo 00 ; Date 2008/4/15 ; Revision 01 ; Designer Engineer ; Company 111 ; Assembly None ; Location ; Device g16v8a ;
/* *************** INPUT PINS *********************/ PIN 1 = clk ;/* */ PIN 2 = di ;/* lcd dir control */ PIN 3 = CTR ;/* */ PIN 11 = en ;/* */ PIN 4 = di2 ;/* lcd dir control */
/* *************** OUTPUT PINS *********************/ PIN 19 = q3 ; PIN 18 = q2 ; PIN 17 = q1 ; PIN 16 = q0 ;
PIN 15 = q7 ; PIN 14 = q6 ; PIN 13 = q5 ; PIN 12 = q4 ;
field count2 = [q3..0]; field number = [q7..4];
$define S0 'b'0000 $define S1 'b'0001 $define S2 'b'0010 $define S3 'b'0100 $define S4 'b'1000
$define n0 'b'0000 $define n1 'b'0001 $define n2 'b'0010 $define n3 'b'0100 $define n4 'b'1000
fld up = di; /* led up */ fld down = !di; /* led down */ fld up2 = di2; /* led up */ fld do2= !di2; /* led down */
sequence count2 { /* free running counter */
present S0 if up next S1; if down next S4; present S1 if up next S2; if down next S4; present S2 if up next S3; if down next S1; present S3 if up next S4; if down next S2; present S4 if up next S1; if down next S3; }
sequence number{ /* free running counter */ present n0 if up2 next n1; if do2 next n4; present n1 if up2 next n2; if do2 next n4; present n2 if up2 next n3; if do2 next n1; present n3 if up2 next n4; if do2 next n2; present n4 if up2 next n1; if do2 next n3; } |