Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Debugging

Pseudocode helps you form a plan for your program, but it seldom survives intact for very long when you actually try to run it. Your final programs seldom follow the exact logic of your pseudocode. You will spend much of your time finding out why a plan that makes perfect sense to you does not make sense to the microcontroller. You start by forming a hypothesis about where the misunderstanding might be. Avoid hypotheses that are out of your control, such as looking for bugs in the microcontroller compiler.

The most common problem is that it’s sometimes difficult to adopt the literal thinking style of a computer. To help you eavesdrop on your microcontroller’s thinking, most programming languages have a debug command. This command causes the processor to send a message to be printed out in a window of the programming environment, intended purely for the programmer’s eyes.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint