19-01

From
Jump to: navigation, search

Credits[edit]

Equations[edit]

/**********************************************************************/
/*Super Off Road U74                                                  */
/*5-bit counter increments every clock cycle                          */
/*Direction bit is registered on clock edge based on quadrature input */
/*Output is enabled when selected by decoded input signals            */
/**********************************************************************/

/** Inputs **/

PIN     1   = CLK;  /*one quadrature input used as clock*/
PIN     2   = QUAD; /*other quadrature input used for direction*/
PIN     7   = !OPT; /*optical select*/
PIN     8   = ZA0; /*address*/
PIN     9   = ZA1;
PIN    11   = !OE;

/** Outputs **/

PIN    12   = !OE_CTL; /*fed back to output enable pin*/
PIN    13   = DIR; /*direction output*/
PIN    14   = CNT4; /*counter output*/
PIN    15   = CNT3;
PIN    16   = CNT2;
PIN    17   = CNT1;
PIN    18   = CNT0;

/** Logic Equations **/

/*U74 decodes address 1*/
OE_CTL = OPT & !ZA1 & ZA0;

/*counter and direction updated on clock edge and controlled by output enable*/
DIR.d = !QUAD;
CNT0.d = !CNT0;
CNT1.d = CNT1 $ CNT0;
CNT2.d = CNT2 $ (CNT1 & CNT0);
CNT3.d = CNT3 $ (CNT2 & CNT1 & CNT0);
CNT4.d = CNT4 $ (CNT3 & CNT2 & CNT1 & CNT0);