I don't know exactly what you are trying to do, but....
Most stepper motor controllers need only a very short pulse to toggle them. If that is your case, then you don't need to issue a pulse more than a couple of instructions long. You can do that in PBP with something as simple as
PORTB.0 = 0
@ nop
PORTB.0 = 1
If you truly DO need to hold the pin low (or high) for awhile, then you can set the pin to one state during one loop, and set it to the other state on a later loop. The pulse width is the loop time X the number of loops you have selected.
You can check all your inputs while you are in the loop. You will have to experiment a bit to get your timing right.
Or, you could use what I call a pseudo-interrupt. Not precise, but possibly workable in your case. Sit in a loop that checks your inputs AND for a timer roll-over. When the timer rolls over, reload it with a suitable value and jump to a routine that sets/resets your stepper controller pins. Then go back to the loop.
And then there are interrupts. If you can tolerate the overhead, you can use "ON INTERRUPT GOTO" structures. Check the PBP manual.
Or you can use Darrel Taylor's "Instant Interrupts". Search for that on this forum.
Lots of ways.
Bookmarks