MDrive Example Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | 'MDRIVE DEMO PROGRAM 'Last modified 08/25/2016 'Sample test program for demonstration purposes only 'Not tested or verified for safety or any function CP 'preclear program memory '******Global Setup Parameters**** S1=0,0,0 'I1-4 set as GP,LOW Active, sinking S2=0,0,0 S3=0,0,0 S4=0,0,0 P=0 Ms=180 'Microstep Res to 0.001 deg/ustep '******Main Program********* PG 1 LB aa R1=Il 'Set register 1 = inputs 4-1 BR z1,R1=0 'conditional branches based BR za,R1=1 'upon the value of IL BR zb,R1=2 BR zc,R1=3 BR zd,R1=4 BR ze,R1=5 BR zf,R1=6 BR zg,R1=7 BR zh,R1=8 BR zi,R1=9 BR zj,R1=10 BR zk,R1=11 BR zl,R1=12 BR zm,R1=13 BR zn,R1=14 BR zo,R1=15 BR aa '*******Program Motion Components******* LB z1 BR aa, P=0 'branch to main prog, position=0 MA 0 'index to abs. pos. 0 H 'Suspend prog. until move completes CL zz 'call the print position sub. BR aa 'BR to main prog when complete LB za 'same as above BR aa, P=36000 MA 36000 H CL zz BR aa LB zb BR aa, P=-36000 MA -36000 H CL zz BR aa LB zc BR aa, P=18000 MA 18000 H CL zz BR aa LB zd BR aa, P=-27000 MA -27000 H CL zz BR aa LB ze BR aa, P=9000 MA 9000 H CL zz BR aa LB zf BR aa, P=-9000 MA -9000 H CL zz BR aa LB zg BR aa, P=4500 MA 4500 H CL zz BR aa LB zh BR aa, P=-4500 MA -4500 H CL zz BR aa LB zi BR aa, P=3000 MA 3000 H CL zz BR aa LB zj BR aa, P=-3000 MA -3000 H CL zz BR aa LB zk BR aa, P=6000 MA 6000 H CL zz BR aa LB zl BR aa, P=-6000 MA -6000 H CL zz BR aa LB zm BR aa, P=7500 MA 7500 H CL zz BR aa LB zn BR aa, P=-7500 MA -7500 H CL zz BR aa LB zo BR aa, P=0 MA 0 H CL zz BR aa '****Print Position Subroutine**** LB zz R2=P/100 'set register 2 to position/100, 'this will display degrees as the unit 'of measure for motor position PR "Position Selected = ",R1 PR "Absolute Position (Degrees) = ",R2 RT E PG |