Page 108 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 108

Chapter 4: Prog ramming the P arallax Propeller Chip           87


                                The PreciseBlinker1 program was downloaded into the BOE and run with exactly the
                             same results as happened with the FastBlinker1 program, but PreciseBlinker1 deals with
                             actual time rather than clock cycles.
                                I retested the PreciseBlinker1 program using a 40-MHz clock and got exactly the same
                             results as with the 80-MHz version. This is precisely what I expected, thus proving that
                             this approach makes dealing with delays and durations entirely independent of the actual
                             clock speed.
                                Up to this point, I have demonstrated programs that toggle various GPIO pins at a 50%
                             duty rate, which means that half the time they are on and the other half they are off. Viewing
                             such a signal on an oscilloscope would reveal what is known as a square wave. Figure 4.16
                             is a screen capture of the PreciseBlinker1 output from pin 15.
                                Notice that the "on-time" or high portion of the signal trace is exactly 50 ms, as expected
                             from the program. Of course, the "off-time" or low portion is also 50 ms, which makes the
                             total waveform duration equal to 100 ms, or equivalently, 10 Hz.
                                I have included a photo of the oscilloscope that I used to measure the waveform
                             for those readers who might be interested. Figure 4.17 shows a PicoScope model 3406B,
                             which is a high performance PC oscilloscope. This instrument requires a PC to show the
                             waveform because it has no organic display. The 3406B is a four-channel device capable of
                             measuring signals up to 200 MHz with exceptional accuracy. I would urge readers to check
                             out the Pico Technologies website to learn more about these highly capable and flexible
                             instruments. However, be forewarned that they are not cheap; as the old adage goes, you
                             get what you pay for. I am not disappointed in this instrument because it has performed
                             flawlessly and enabled me to measure and record all the detailed waveforms that are shown
                             in this book.

































                             Figure 4.16  Oscilloscope real-time view of pin 15.
   103   104   105   106   107   108   109   110   111   112   113