franko,
good day!
i mean, i think that your PULSIN method is the problem. try to monitor your variable WORD 'i' after your PULSIN method, such as,
Code:
...
PULSIN DATAPLS,1,i
SEROUT2 porta.0,16780,["i: ",#i] ;connect to hyperterminal at 2400, 8N1, no parity.
...
just like that.
also I'm in doubt of what you are doing. are you actually trying to count the number of pulses at DATAPLS pin? when you use the PULSIN method, you are actually measuring the period of high signal (since your second argument is '1': PULSIN DATAPLS,1,i). if your period is less than (40us at 4MHz) it will never satisfy your IF statement, therefore the motor will not stop. hope i enlightened your mind, somehow.
regards,
Bookmarks