Updating Chapter 3

Chapter 3 does not require any special consideration after the upgrade to MPLAB C30 v.3.02. So we will take the opportunity to work on the examples proposed:

  1. Sensing a button before starting the sequence is a step in the right direction to help the visual synchronization as long as the operator has good motion coordination skills. Here is the simple enough code that assumes the leftmost button on the Explorer 16 demonstration board (connected to PORTD pin 6 -RD6) is used: Exercise 3-1
  2. Things can be improved further if a little electro-mechanical ingenuity is used. Adding a pendulum and a second contact to detect the beginning of the hand sweep and the counter hand sweep to produce a reversed sequence (a good opportunity to show a for loop counting down). The following code will assume that the second switch is connected in parallel to the rightmost button on the Explorer16 (PORTD pin 13 -RD13): Exercise 3-2

As I am writing this, I feel the urge to explore other more sophisticated options. For example, how about checking the two switches for a few sweeps timing the hand motion and later starting the display after scaling/optimizing the delay intervals  to obtain a single message in both directions and possibly perfectly “centered”?  The algorithm could also constantly adjust the timing at each subsequent hand movement… oh how sweet!?

This entry was posted in PIC24, Tips and Tricks. Bookmark the permalink.