Hey guys, this should be an easy one. How can I repeat a loop for a set number of clock cycles (a set amount of time)? Say I want to repeat a loop for 500 clock cycles, how could I do that?
Carl,
Do you want to delay something by 500 clock cycles (just use a WAITCNT) or do you want to exit the loop if at least 500 clock cycles have passed? In the latter case, you save the initial clock setting, then start the REPEAT and exit when at least 500 clock cycles have passed (like this):
start := cnt ' save initial time
repeat
'' something
until (cnt - start) => 500
THanks Mike. That's what I was looking for. Also, how can I clear out the entire eeprom? Basically, here's the problem I am having. I loaded a large program to the eeprom of the prop. Then I loaded a significantly smaller program to the eeprom. However, it would seem that some parts of the larger program have been left behind, as they sometimes start running in the middle of my new program. Could clearing the eeprom entirely fix this?
Comments
Will the loop always execute the same commands?
Rick
Do you want to delay something by 500 clock cycles (just use a WAITCNT) or do you want to exit the loop if at least 500 clock cycles have passed? In the latter case, you save the initial clock setting, then start the REPEAT and exit when at least 500 clock cycles have passed (like this):