The program is attached, it may look strange due to the inverter (it doesent quiet follow the standed stepping sequence). also not that i have elliminated the GoSub commands to illiminate execution time. (program will be much shorter when they were used).
the attached PDF is hte motor range, but the exact resistance is around 26 Ohms (its one we use in work as a special), we often fun it over 300 RPM (1KHz). I need the PWM at low speeds because even though the current should only technically pe 0.9A i get spikes (i assume so) and these destroy the FET chip. so at low speeds especially i want to PWM the voltage down to keep the current down (V=IR).
symbol varA = b0
symbol varB = b1
symbol varC = b2
symbol varD = b3
symbol varE = b4
symbol varF = b5
symbol varG = b6
symbol varH = b7
let dirs = %00010111
main:
read 0,varA
label_131:
if pin3 = 1 then label_132 'Decision command
label_231:
if pin3 = 1 then label_131 'Decision command
if varA = 1 then label_236 'Compare command
label_232:
if pin3 = 1 then label_131 'Decision command
if varA = 2 then label_240 'Compare command
label_233:
if pin3 = 1 then label_131 'Decision command
if varA = 3 then label_249 'Compare command
label_258:
if pin3 = 1 then label_131 'Decision command
if varA = 4 then label_260 'Compare command
label_269:
if pin3 = 1 then label_131 'Decision command
if varA = 5 then label_271 'Compare command
label_280:
if pin3 = 1 then label_131 'Decision command
if varA = 6 then label_282 'Compare command
if varA > 6 then label_303 'Compare command
goto label_131
label_303:
let varA = 0 'Expression command
write 0,varA
goto label_131
label_282: high 0
high 1
pause 1 'Wait command
low 0
pause 1 'Wait command
low 1
pause 1 'Wait command
high 0
pause 1 'Wait command
goto label_280
label_271: high 0
high 1
pause 1 'Wait command
low 0
pause 2 'Wait command
low 1
pause 1 'Wait command
high 0
pause 2 'Wait command
goto label_269
label_260: high 0
high 1
pause 2 'Wait command
low 0
pause 2 'Wait command
low 1
pause 2 'Wait command
high 0
pause 2 'Wait command
goto label_258
label_249: high 0
high 1
pause 3 'Wait command
low 0
pause 3 'Wait command
low 1
pause 3 'Wait command
high 0
pause 3 'Wait command
goto label_233
label_240: high 0
high 1
pause 5 'Wait command
low 0
pause 5 'Wait command
low 1
pause 5 'Wait command
high 0
pause 5 'Wait command
goto label_232
label_236: high 0
high 1
pause 10 'Wait command
low 0
pause 10 'Wait command
low 1
pause 10 'Wait command
high 0
pause 10 'Wait command
goto label_231
label_132: pause 100 'Wait command
if pin3 = 1 then label_134 'Decision command
goto label_231
label_134: let varA = varA + 1 'Inc command
write 0,varA
goto label_231