Rant: I know where the bug is, how to fix it, but why?

In one of my define tables, if the table gets to a certain length I get a bug in my code. Just take one character away from that and everything is fine. I have found no significance in regard to... actually, I never counted it until now.

If there are 33 characters, my code bugs out. 32 is okay. Well, 32 is a very important number, but I have longer tables elsewhere. There is also no reason for this to bug out. It's simply absurd!

Views: 33

Comment

You need to be a member of Personal Mechatronics Lab to add comments!

Join Personal Mechatronics Lab

Comment by Yifan Wang on January 27, 2011 at 9:23am

QUOTE FROM THE OTHER BLOG

If there is a certain length of code coming before the DT (define table) directive, then characters/entries in the DT past a certain point will fail to return a value. Instead, upon reaching that character, the program will restart from the beginning.

 

Remember, or realize, that DT is actually a short form for a long list of retlw instructions. That means that having a DT holding a long string counts as many instructions.

 

This does NOT appear to be an issue of crossing the 2000 line limit, because I counted my lines and each character in the DTs, and I am still a good ways away from the next program memory page.

 

I spent hours working this out. Our book was not helpful at all. I had many theories and many false leads. Unless we hear official word from someone more experienced, my reccomendation would be to keep your DTs at or near the top of your code.


© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service