Download teraterm
Creating a periodic event is one of the most natural and common requirements in an embedded system, so it is not surprising that it appeared in our first program. We can demonstrate Ticker by returning to the very first program example in this book, number 2.1. This is a very simple example of digital signal processing.Īttach a function to be called by the Ticker, specifying the interval in secondsĪttach a member function to be called by the Ticker, specifying the interval in secondsĪttach a function to be called by the Ticker, specifying the interval in microsecondsĪttach a member function to be called by the Ticker, specifying the interval in microseconds Note that while this sort of approach gives some benefit, the actual measurement now takes 10 times as long. Try running the revised program and see whether a more stable output results.
#Download teraterm code
You will see that this code fragment sums 10 ADC values and takes their average. Try inserting the for loop shown below, replacing the ADCdata=Ain line in Program Example 5.4. This should help to find the underlying average value and remove the high-frequency noise element. the ‘wiper’ of the potentiometer) you are likely to see some high-frequency noise superimposed on this exactly how much will depend on what equipment is running nearby, how long your interconnecting wires are, and a number of other things.Ī very simple first step to improve this situation is to average the incoming signal. If you look with the oscilloscope at the ADC input (i.e. Several effects may be at play here, but almost certainly you are seeing the effect of some interference, and all the problems it can bring. You may already have noticed that the PWM value in Section 5.2.2 or 5.2.3 also appeared to vary, even when the potentiometer was not being moved. If you leave Program Example 5.4 running, with a fixed input and values displayed on Tera Term, you may be surprised to see that the measured value is not always the same, but varies around some average value. Rob Toulson, Tim Wilmshurst, in Fast and Effective Embedded Systems Design, 2012 5.3.3 Applying Averaging to Reduce Noise
This is a very simple example of digital signal processing.ĪDCdata=ADCdata+Ain∗3.3 //sum 10 samples Try running the revised program and see if a more stable output results. This should help to find the underlying average value and remove the high frequency noise element. If you look with the oscilloscope at the ADC input (i.e., the “wiper” of the potentiometer) you are likely to see some high frequency noise superimposed on this exactly how much will depend on what equipment is running nearby, how long your interconnecting wires are, and a number of other things.Ī very simple first step to improve this situation is to average the incoming signal. You may already have noticed that the PWM value in Sections 5.2.2 or 5.2.3 also appeared to vary, even when the potentiometer was not being moved. If you leave Program Example 5.4 running, with a fixed input and values displayed on Tera Term or CoolTerm, you may be surprised to see that the measured value is not always the same but varies around some average value. Rob Toulson, Tim Wilmshurst, in Fast and Effective Embedded Systems Design (Second Edition), 2017 5.3.3 Applying Averaging to Reduce Noise