Ritchie Thai's Blog – January 2011 Archive (5)

Removed Post

I have removed this post because it was based on misinformation. I have decided not to delete the post because I wish the comments to be preserved.

Added by Ritchie Thai on January 28, 2011 at 5:00am — 7 Comments

Tip: DT location in code matters.

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…

Continue

Added by Ritchie Thai on January 26, 2011 at 5:30am — 4 Comments

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!

Added by Ritchie Thai on January 26, 2011 at 12:54am — 1 Comment

Tip: DT Uses Up A LOT of lines.

Each dt (define table) directive uses up a line for each character in your table/string. If you're not careful, your code could get long despite being short.


Here's how the define table directive works. Each character in your string is actually translated into a single retlw (return literal in W).

 

For example:

dt "Hello!"

 

is translated into:

retlw 'H'
retlw 'e'

retlw 'l'
retlw 'l'
retlw 'o'
retlw '!'

Added by Ritchie Thai on January 26, 2011 at 12:00am — No Comments

Tip: The directory of your MPLAB project can cause problems.

If the path size of your MPLAB project's directory is too long, for example:

C:\Users\Main\Desktop\ritchie-thai\current-projects\aer201

then a .hex file will not be created.

 

I am now using a workspace with the much shorter path:

C:\mplab-test\KeyPad_LCD

 

Don't computers suck?

Added by Ritchie Thai on January 25, 2011 at 10:30pm — 1 Comment

© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service