Step 4More Debugging
C has four easy ways to comment out lines.
Putting "//"in front of a line comments out that line.
Enclosing one or more lines in "/*"and "*/"will comment out an entire section. For this method to work effectively, there must be no other "*/" in the code block (other than the ending one). So an effective discipline is to use // for comments within blocks of code, and reserve the /* */ construct for comment blocks and for commenting out sections of code.
Placing "#if 0" at the start of a block to comment out and ending the section with "#endif".
More selective control is possible using "#ifdef (identifier)" at the start of a block and "#endif" at the end. If you want the block to be compiled, use "#define (identifier)" earlier in the program. Note the quote marks are for emphasis only and are not to be included.
Combining these techniques should provide a useful approach to debugging your ATtiny2313 programs. You may find these tools useful as we proceed through this Instructable.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|







































