| « A2D | Expanding the PIC » |
This post is going to start off a new category: Tips.
Posts in the tips category are going to be generally short and they wont be chronologically significant. They are just meant to demonstrate common techniques and/or common errors.
There are two letters that will absolutely devastate your code if your not careful, they are s and c. s and c are used in most bit orientated instructions (bcf, bsf, btfss, btfsc). They stand for Set and Clear or 1 and 0 respectively. When making your code and going over your logic, make sure you note what you are setting high and what needs to be set low. Reversing these two letter will utterly change your code, often for the worst. I've had code that went from useless to perfectly working by changing only one letter. A tip for debugging code, ALWAYS simplify your code first and then always check your bit orientated operations and make sure you're using the right instruction. With that in mind you will spend more time programming and testing and less time debugging.