home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s078 / 1.img / STEPPER.PLD < prev    next >
Encoding:
Text File  |  1991-12-08  |  5.7 KB  |  131 lines

  1. Name      Stepper;
  2. Partno    CA0024;
  3. Date      10/10/86;
  4. Rev       01;
  5. Designer  Woolhiser;
  6. Company   Personal CAD Systems, Inc.;
  7. Assembly  None;
  8. Location  None;
  9. Device    p19r6t;
  10.  
  11. /************************************************************************/
  12. /*                                                                  */
  13. /* Stepper Motor Controller                                         */
  14. /*                                                                  */
  15. /* Memory mapped stepper motor controller interfaced to the         */
  16. /* 8048 single chip micro processor.  Generates either full         */
  17. /* or half step sequences for a unipolar drive stepper motor.       */
  18. /* A high current buffer is required to drive the motor coils.      */
  19. /*                                                                  */
  20. /*         Half Step Control Sequence Table                         */
  21. /*                                                                  */
  22. /*              Step    Q0  Q1  Q2  Q3                              */
  23. /*               1       1   0  1   0                               */
  24. /*               2       1   0  0   0                               */
  25. /*            v  3       1   0  0   1   ^                           */
  26. /* Clockwise  v  4       0   0  0   1   ^  Counterclockwise         */
  27. /* Rotation   v  5       0   1  0   1   ^  Rotation                 */
  28. /*            v  6       0   1  0   0   ^                           */
  29. /*            v  7       0   1  1   0   ^                           */
  30. /*               8       0   0  1   0                               */
  31. /*               1       1   0  1   0                               */
  32. /************************************************************************/
  33. /* Allowable Target Device Types :  PALT19R6                        */
  34. /************************************************************************/
  35.  
  36. /** Inputs **/
  37.  
  38. Pin 1 = STEP_CLK;               /* Stepper Motor Clock Defines Rate    */
  39. Pin [2,3,22,23] = [A8..11];     /* 8048 Upper 4 Address Bits        */
  40. Pin [4..11] = [DB0..7];         /* 8048 Multiplexed Address/Data Bits    */
  41. Pin 13 = !COE;                  /* Common Output Enable for Registers    */
  42. Pin 14 = !ALE;                  /* 8048 ALE output used latches Address */
  43.  
  44. /** Outputs **/
  45.  
  46. Pin [20..17] = ![Q3..0];    /* Motor Coil Control Lines        */
  47. Pin 16 = !COMPLETE;        /* Step Process Complete Signal        */
  48. Pin 15 = !STATUS;        /* Status Bit Accessible to 8048     */
  49.  
  50. /** Declarations and Intermediate Variable Definitions **/
  51.  
  52. $define STEP1   'b'0101        /* Half Step Sequence States */
  53. $define STEP2   'b'0001
  54. $define STEP3   'b'1001
  55. $define STEP4   'b'1000
  56. $define STEP5   'b'1010
  57. $define STEP6   'b'0010
  58. $define STEP7   'b'0110
  59. $define STEP8   'b'0100
  60.  
  61. $define FULL_STEP_UP   'h'FF0    /* Stepper Control Addresses */
  62. $define FULL_STEP_DOWN 'h'FF1
  63. $define HALF_STEP_UP   'h'FF2
  64. $define HALF_STEP_DOWN 'h'FF3
  65. $define READ_STEP      'h'FF4
  66.  
  67. Field ADDRESS = [A11..8,DB7.lq,DB6.lq,DB5.lq,DB4.lq,DB3.lq,DB2.lq,DB1.lq,DB0.lq];
  68. Field MOTOR   = [Q3..0];
  69.  
  70. full_up   = ADDRESS:FULL_STEP_UP;
  71. full_down = ADDRESS:FULL_STEP_DOWN;
  72. half_up   = ADDRESS:HALF_STEP_UP;
  73. half_down = ADDRESS:HALF_STEP_DOWN;
  74. hold      = ADDRESS:[000..7FF];
  75.  
  76. /** Logic Equations **/
  77.  
  78. Sequence MOTOR {
  79.         Present STEP1
  80.                 if full_up      next STEP3      out COMPLETE;
  81.                 if full_down    next STEP7      out COMPLETE;
  82.                 if half_up      next STEP2      out COMPLETE;
  83.                 if half_down    next STEP8      out COMPLETE;
  84.                 if hold         next STEP1;
  85.         Present STEP2
  86.                 if full_up      next STEP4      out COMPLETE;
  87.                 if full_down    next STEP8      out COMPLETE;
  88.                 if half_up      next STEP3      out COMPLETE;
  89.                 if half_down    next STEP1      out COMPLETE;
  90.                 if hold         next STEP2;
  91.         Present STEP3
  92.                 if full_up      next STEP5      out COMPLETE;
  93.                 if full_down    next STEP1      out COMPLETE;
  94.                 if half_up      next STEP4      out COMPLETE;
  95.                 if half_down    next STEP2      out COMPLETE;
  96.                 if hold         next STEP3;
  97.         Present STEP4
  98.                 if full_up      next STEP6      out COMPLETE;
  99.                 if full_down    next STEP2      out COMPLETE;
  100.                 if half_up      next STEP5      out COMPLETE;
  101.                 if half_down    next STEP3      out COMPLETE;
  102.                 if hold         next STEP4;
  103.         Present STEP5
  104.                 if full_up      next STEP7      out COMPLETE;
  105.                 if full_down    next STEP3      out COMPLETE;
  106.                 if half_up      next STEP6      out COMPLETE;
  107.                 if half_down    next STEP4      out COMPLETE;
  108.                 if hold         next STEP5;
  109.         Present STEP6
  110.                 if full_up      next STEP8      out COMPLETE;
  111.                 if full_down    next STEP4      out COMPLETE;
  112.                 if half_up      next STEP7      out COMPLETE;
  113.                 if half_down    next STEP5      out COMPLETE;
  114.                 if hold         next STEP6;
  115.         Present STEP7
  116.                 if full_up      next STEP1      out COMPLETE;
  117.                 if full_down    next STEP5      out COMPLETE;
  118.                 if half_up      next STEP8      out COMPLETE;
  119.                 if half_down    next STEP6      out COMPLETE;
  120.                 if hold         next STEP7;
  121.         Present STEP8
  122.                 if full_up      next STEP2      out COMPLETE;
  123.                 if full_down    next STEP6      out COMPLETE;
  124.                 if half_up      next STEP1      out COMPLETE;
  125.                 if half_down    next STEP7      out COMPLETE;
  126.                 if hold         next STEP8;
  127. }
  128.  
  129. STATUS.oe = ADDRESS:READ_STEP;
  130. STATUS = COMPLETE;
  131.