Getting Started

(lily) #1

Chapter 9 – Digital Meets Analog – ADC and DAC


Digital Meets Analog – ADC and


But First - A Debugging Tale


t follows, I liberally ‘borrowed’ code from the Butterfly,
ble style to allow a user from the PC to ask for a measure
oltage. All was well except for a tiny problem with the
oltage measurement. Tiny as in the first time I tried to measure voltage on the
Butterfly I destroyed it. Well destroyed is a bit harsh. It looks just like it always
so I had ordered six Butterflys
moky Joe since my favorite
n my hardware
p, legs in the air,
nted in the Dead Butterfly Museum.
ut Lepidopteron death is not what this is about. I eventually found that I had


t tale. Lets just say this event led me to becoming a bit paranoid about
hardware and I went forward on
ed with the ADC code.
just fine,
and the


When que with: The
reading is 1.1 volts.


And pr PC. My response involved lots of
obscen the Butterfly
wasn’t destroy
‘volt’. My first assum
room. Sound
voltage eren ure the ambient room light to calibrate the
oltage erence before we measure volts. So I covered the light sensor and the


crewing things up. The USART uses a higher voltage than the Butterfly and they

Chapter 9 –


DAC


Bu


In the ADC project tha
adding my own inimita
of light, temperature, and v
v


did, but it doesn’t work. Fortunately I know myself
because, as I said elsewhere, my nickname is S
learning method is producing copious quantities of smoke i
projects. The Butterfly didn’t smoke though. It just died. Belly u
ready for a pin thru the thorax to be box mou
B
done something unbelievably stupid and since you wouldn’t believe it, I won’t
relate tha
the voltage measurement part of the Butterfly
tiptoes and slightly hyperventilating as I proceed


My next version was able to read the light just fine, and the temperature
voltage just one time.
I re sted: volt the hardware responded to HyperTerminal


omptly died
ities an

. No further responses to the
d complaints about flushing another $19.99, but
ed this time, it rebooted just fine and only crashed when I asked for
ption, reasonable I thought, was that it’s the light level in the
crazy? Well, it seems that the light sensor affects the Butterfly
ref
ref


ce and we have to meas
v
Butterfly still crashed. Then I went the other direction and put a bright light on it
to no avail. So I thought that if its all that sensitive to light derived voltages
maybe the USART traffic voltage is propagating about unpredictably and
s

Free download pdf