18.08.2013 Views

ee pulse - EEWeb

ee pulse - EEWeb

ee pulse - EEWeb

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>EEWeb</strong><br />

PULSE<br />

<strong>EEWeb</strong>.com<br />

Issue 51<br />

June 19, 2012<br />

Tamara<br />

Schmitz<br />

Intersil<br />

Electrical Engin<strong>ee</strong>ring Community


<strong>EEWeb</strong><br />

Electrical Engin<strong>ee</strong>ring Community<br />

Contact Us For Advertising Opportunities<br />

1.800.574.2791<br />

advertising@<strong>ee</strong>web.com<br />

www.<strong>ee</strong>web.com/advertising


TABLE OF CONTENTS<br />

Tamara Schmitz 4<br />

INTERSIL<br />

Interview with Tamara Schmitz - Applications Manager for Optical Sensors<br />

Featured Products 10<br />

Illogical Logic - Part 3: D-Type<br />

Flip Flops<br />

BY PAUL CLARKE WITH EBM-PAPST<br />

Understanding the most common logic blocks in today’s computers and digital electronics - the<br />

edge-triggered D-Type flip-flop.<br />

Arduino for Mere M0rtals: Part 4 16<br />

BY ROBERT BERGER WITH RELIABLE EMBEDDED SYSTEMS<br />

This installment will take a closer look at the blinking LED Arduino sketch for processing<br />

programming.<br />

12<br />

RTZ - Return to Zero Comic 20<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 3<br />

TABLE OF CONTENTS


INTERVIEW<br />

Tamara<br />

Schmitz<br />

How did you get into<br />

engin<strong>ee</strong>ring and when did<br />

you start?<br />

It sounds silly, but the spark came<br />

from my Grandpa. His nickname<br />

was “Sparky” and he was an<br />

electrician for Pullman Railroad<br />

Tamara Schmitz - Applications Manager for Optical Sensors<br />

Intersil<br />

company. Also, a freight train line<br />

had tracks just beyond our back<br />

fence and I used to run outside<br />

when I heard the train coming so I<br />

could wave at the engin<strong>ee</strong>rs, count<br />

the cars and s<strong>ee</strong> if anyone was in<br />

the caboose. (Trains don’t s<strong>ee</strong>m<br />

to have cabooses anymore.) When<br />

I graduated from wanting to be a<br />

firefighter, I told people I wanted to<br />

be an engin<strong>ee</strong>r. I meant the train<br />

kind, but most others assumed the<br />

science/math/problem solver. Over<br />

the years I guess it just stuck. I do<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 4<br />

FEATURED INTERVIEW


INTERVIEW<br />

love solving problems, so becoming<br />

an engin<strong>ee</strong>r was the right fit. Most<br />

people just don’t start by wanting to<br />

drive a train.<br />

As for electrical engin<strong>ee</strong>ring,<br />

that’s much clearer. Mechanical<br />

engin<strong>ee</strong>ring made sense<br />

because bridges could withstand<br />

earthquakes. Chemical<br />

engin<strong>ee</strong>ring made sense because<br />

material science helped me s<strong>ee</strong> that<br />

durable paints could be developed<br />

for cars. Electrical engin<strong>ee</strong>ring<br />

spanned a wide array of topics, but<br />

I was fascinated by one: how did<br />

radio waves travel through the air?<br />

I wanted to understand what magic<br />

was sending signals around and<br />

through me. It s<strong>ee</strong>med that whoever<br />

controlled those would have<br />

disproportionate amounts of power<br />

to affect people for entertainment,<br />

for medical diagnosis and even<br />

for dangerous exposure. I wanted<br />

answers and access to this amazing<br />

field. Besides, it made “Sparky”<br />

proud.<br />

What are your favorite<br />

hardware tools that you use?<br />

I’m going to assume you mean in the<br />

lab. My favorite tool is the spectrum<br />

analyzer. It breaks apart a signal<br />

into its frequency components<br />

and grants me insights that can be<br />

hidden in the time domain.<br />

What are your favorite<br />

software tools that you use?<br />

I really like Matlab. And, of course, I<br />

have to mention SPICE. The ability<br />

to simulate circuits and systems<br />

is incredible—and improving<br />

constantly. Since I’m in an optical<br />

sensors group now, I’m finding a<br />

great appreciation for SolidWorks<br />

and FRED.<br />

What is your favorite<br />

debugging tool?<br />

The human body. Think of all of<br />

the tools that you have for fr<strong>ee</strong>. Skin<br />

is a temperature sensor. Eyes and<br />

ears are bandpass filters. Noses<br />

are fantastic over-current detection<br />

devices. Tongues are decent battery<br />

testers, but I don’t recommend that<br />

unless you are stranded on an<br />

Follow your dreams.<br />

I know it sounds<br />

corny, but find<br />

something you love to<br />

do. Jobs these days<br />

stretch way beyond<br />

40 or 50 hours.<br />

There are times<br />

when my driving<br />

time, my evenings<br />

and my dreams are<br />

still churning away<br />

on a problem.<br />

island or something. Fingers are<br />

crude capacitances; touching a<br />

node can add 100pF or so which<br />

might help you quickly figure out a<br />

compensation problem. These are<br />

the kind of observations and tools<br />

engin<strong>ee</strong>rs don’t usually record in<br />

their lab notebooks.<br />

What is the hardest/trickiest<br />

bug you have ever fixed?<br />

Whichever one I’m working on<br />

right now. Bugs aren’t usually so<br />

complicated that it takes a team<br />

of geniuses to find them. It’s like<br />

finding Waldo. If he’s half an inch<br />

tall, he’s easy to spot on a baseball<br />

card. However, if he’s half an inch<br />

tall and he’s somewhere on a wall<br />

mural, it’s probably going to take a<br />

lot longer.<br />

The tricky part is finding the bug.<br />

Too many people guess without<br />

a plan. The best thing to do is to<br />

“draw a box around the problem”,<br />

to quote one of my colleagues,<br />

Ken Dyer. Then you know the<br />

bug is somewhere in the box.<br />

Methodically go through the system<br />

and verify whether each block is<br />

working properly. Eventually, you<br />

will be able to shrink the box around<br />

the problem area and focus your<br />

efforts more efficiently.<br />

The exception to this method is<br />

the case where you have loads of<br />

experience. Experience can inform<br />

you of the most likely places to look.<br />

In those cases, I’d start there.<br />

What is on your bookshelf?<br />

Some old databooks that I haven’t<br />

recycled yet, a copy of my PhD<br />

thesis on RF CMOS low phase noise<br />

oscillators, the Art of Electronics,<br />

the ARRL Handbook, a picture of<br />

me pretending to pitch to a full-size<br />

statue of Babe Ruth at the Baseball<br />

Hall of Fame, various textbooks, a<br />

roaring Godzilla doll and a photo of<br />

my 3 dogs.<br />

Do you have any tricks up<br />

your sl<strong>ee</strong>ve?<br />

It’s all about the basics. Start<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 5<br />

FEATURED INTERVIEW


INTERVIEW<br />

simple. Power and ground. Check<br />

the voltage on every node/pin. Don’t<br />

assume anything. Once the basics/<br />

bias checks out, start varying over<br />

ranges. Do min and max input get<br />

expected output? Then follow the<br />

signal through the system.<br />

What has b<strong>ee</strong>n your favorite<br />

project?<br />

My favorite project was constructing<br />

a horn antenna to be used at the<br />

“Big Dish” on Stanford University’s<br />

campus. The operating frequency<br />

was 330MHz, so the horn was<br />

about the size of a coffin. I soldered<br />

copper clad pieces together and<br />

built a wooden exoskeleton for<br />

support. It was awesome to s<strong>ee</strong> the<br />

mathematics come to life, to test the<br />

antenna response in a warehouse at<br />

SRI, and then to mount it on that big,<br />

beautiful dish and s<strong>ee</strong> it work! Well,<br />

it worked until a bird decided that<br />

it was a wonderful place to build a<br />

nest.<br />

Do you have any note-worthy<br />

engin<strong>ee</strong>ring experiences?<br />

I’m particularly proud of the Test<br />

Development Engin<strong>ee</strong>ring Program<br />

I championed at San Jose State<br />

University. After noticing that<br />

electrical engin<strong>ee</strong>ring students<br />

were finding jobs as apps, test and<br />

product engin<strong>ee</strong>rs, I joined with a<br />

team of folks from Agilent, National<br />

Semiconductor, Teradyne and<br />

Intersil to put together a program<br />

to teach skills n<strong>ee</strong>ded for these<br />

areas. Students spent the spring<br />

semester learning lab techniques<br />

like measurement and soldering.<br />

They designed a PCB to test an IC<br />

and presented their work to a panel<br />

from the supporting companies. In<br />

the summer they had internships<br />

with the sponsors. In the fall, they<br />

returned to school and proc<strong>ee</strong>ded<br />

in their work—this time on ATEs.<br />

Along the way, they learned a<br />

lot about the semiconductor<br />

industry and where they would fit<br />

in. Every student got a job. They<br />

even nominated me for an IEEE<br />

certificate of appreciation. Cool<br />

stuff.<br />

If I was to tell you some of the cool<br />

things I work on now, it would break<br />

customer confidentiality. Let’s just<br />

The global work<br />

force is adjusting<br />

its footprint.<br />

While it might be<br />

advantageous to<br />

use cheaper labor,<br />

the time, cultural<br />

and communication<br />

differences are a big<br />

stumbling block for<br />

projects that span<br />

multiple continents.<br />

say that it’s fun to walk around Best<br />

Buy and s<strong>ee</strong> all of the products that<br />

use an IC from Intersil—especially<br />

one of the light sensors.<br />

How is academia different<br />

than industry?<br />

Huge difference. From the students<br />

perspective, you learn a lot of<br />

math in college. You can solve<br />

KVL and KCL with Thevenin and<br />

Norton equivalents. You can take<br />

derivatives with respect to time<br />

and to voltage. In industry, the<br />

derivatives are with respect to cost<br />

and to customer interest. It’s hard<br />

to put those into matrices (yet MBAs<br />

and economists do it all the time).<br />

From a professor standpoint, you<br />

are trying to get as many students<br />

through the system as possible.<br />

There is so much that could be<br />

taught, but there are also so many<br />

regulations about teaching (think<br />

ABET accredited). Many professors<br />

teach the same material because it<br />

is approved. It’s a lot of work to put<br />

a class together and it is too easy to<br />

use the same material “one more<br />

time”. Besides, the point of school<br />

is to learn the basics, right? The<br />

basics don’t change much. Still,<br />

the motivation and end goals do<br />

change. Our university classrooms<br />

are not at the forefront of technology.<br />

(One could argue that the research<br />

labs at a university house the<br />

forefront of technology. Yes, a ittybitty<br />

slice of it.) Remember, though,<br />

that engin<strong>ee</strong>ring is growing and<br />

changing every day. University<br />

curriculums, therefore, must<br />

theoretically teach more and more<br />

each year. Students don’t stay in<br />

school longer, so sacrifices have to<br />

be made. Often that means tough<br />

choices.<br />

I, personally, prefer the “real world”<br />

where the technological innovation<br />

creates a product or device that<br />

enables product differentiation or<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 6<br />

FEATURED INTERVIEW


INTERVIEW<br />

new platforms. People use money<br />

to say what they like and don’t<br />

like. It is impossible to survive in<br />

the semiconductor industry if you<br />

produce the same product year<br />

after year. This ever-present drive<br />

to improve and innovate is what<br />

makes it fun.<br />

What are you currently<br />

working on?<br />

I am the new manager for the<br />

applications group focused on<br />

optical sensors. (These are ambient<br />

light or proximity (IR) sensors.) I<br />

have the privilege of leading a<br />

talented team of engin<strong>ee</strong>rs as we<br />

work with the greatest electronics<br />

manufacturers around the world.<br />

Sensors are special because it isn’t<br />

just an electrical system. It’s an<br />

optical and mechanical one, too.<br />

Will the device be behind some kind<br />

of glass? Will there be plastic with<br />

a hole to allow access for the light?<br />

How much light can bounce around<br />

inside the product? How reflective<br />

is an object you want to target?<br />

(Black hair happens to be very<br />

non-reflective, yet the cell phone<br />

manufacturers want to turn off the<br />

touch scr<strong>ee</strong>n before you bring the<br />

phone to your ear. They don’t want<br />

it to only work for blondes…)<br />

What direction do you s<strong>ee</strong><br />

your business heading in the<br />

next few years?<br />

Sensors are growing like crazy!<br />

Consumer devices want to interact<br />

more naturally with their users.<br />

They want to save us power by<br />

turning down the backlight of a<br />

scr<strong>ee</strong>n in low-light conditions, so we<br />

can enjoy longer battery life. They<br />

want to understand our questions<br />

and interpret our gestures. They<br />

want to anticipate our desires and<br />

prepare. They want to help camera<br />

understand what kind of lighting<br />

conditions they operate in so we<br />

can take better pictures. There are<br />

so many more examples.<br />

What challenges do you<br />

fores<strong>ee</strong> in our industry?<br />

There are lots of challenges. The<br />

global work force is adjusting<br />

its footprint. While it might be<br />

advantageous to use cheaper<br />

labor, the time, cultural and<br />

communication differences are a<br />

big stumbling block for projects<br />

that span multiple continents. Still,<br />

money is a stronger driving force<br />

(especially in the limping recession)<br />

so we are willing to accept the<br />

challenge.<br />

Another challenge is “the next big<br />

thing”. Cell phones kept getting<br />

smaller and then acquired touch<br />

scr<strong>ee</strong>ns. They have great cameras<br />

and organize our personal and<br />

professional lives. Really, though,<br />

we haven’t s<strong>ee</strong>m much that is new.<br />

The platform s<strong>ee</strong>ms to be moving<br />

from hardware to software. It’s not<br />

“What can the silicon do”, but more<br />

“What can we do with the silicon?”<br />

Almost everyone has a cell phone.<br />

What is the next device everyone<br />

will have?<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 7<br />

FEATURED INTERVIEW


INTERVIEW<br />

Is there anything that you<br />

have not accomplished yet,<br />

that you have your sights on<br />

accomplishing in the near<br />

future?<br />

My goals have morphed over the<br />

years. I wanted to be a professor<br />

and achieved that goal. I wanted to<br />

show that I was a real engin<strong>ee</strong>r and<br />

could contribute in industry. I have<br />

achieved that goal, too. (And it pays<br />

much better than the professor gig.)<br />

At times I get frustrated with upper<br />

management and have a desire<br />

to s<strong>ee</strong> if I could do better. Ok, I<br />

have that desire even when I’m not<br />

frustrated with upper management.<br />

I like looking at choices, defining<br />

challenges, setting goals and<br />

inspiring a team. I believe a good<br />

leader is a good listener, is a wise<br />

businessman and can bring out<br />

the best in people. Engin<strong>ee</strong>ring<br />

is a spectacular skill and medium<br />

we share. We can learn to deliver<br />

premium products and the highest<br />

quality service for a fair price. It’s<br />

a win-win.<br />

Any advice you would like<br />

to give the engin<strong>ee</strong>ring<br />

community?<br />

Follow your dreams. I know it<br />

sounds corny, but find something<br />

you love to do. Jobs these days<br />

stretch way beyond 40 or 50<br />

hours. There are times when my<br />

driving time, my evenings and my<br />

dreams are still churning away on<br />

a problem. If I don’t love what I do,<br />

I’d be exhausted and miserable a<br />

lot. I might be exhausted at times,<br />

but I’m proud of my team and my<br />

<strong>EEWeb</strong><br />

Electrical Engin<strong>ee</strong>ring Community<br />

Join Today<br />

www.<strong>ee</strong>web.com/register<br />

work. That satisfaction is important<br />

to me. I want to own a house, drive<br />

my truck, take my dogs to the beach,<br />

take care of my aging parents, enjoy<br />

the time with my coworkers and<br />

make some kind of difference. I<br />

f<strong>ee</strong>l like I can do that here at Intersil.<br />

I hope you find your place, too. ■<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 8<br />

FEATURED INTERVIEW


Avago Technologies<br />

Tri-color High Brightness<br />

PLCC6 SMT LEDs<br />

gives you a reliable,<br />

long life product for<br />

ease of design in full<br />

color interior and<br />

exterior signs<br />

Tri-color High Brightness SMT LEDs<br />

from Avago Technologies<br />

Avago’s PLCC-6 SMT LEDs are high<br />

brightness, high reliability, high<br />

performance, IPX6 compliant and<br />

are water and dust proof. They are<br />

designed with a separate heat path for<br />

each LED die, enabling it to be driven at<br />

higher current. They deliver super wide<br />

viewing angle at 120° together with<br />

the built in reflector pushing up the<br />

intensity of the light output.<br />

Applications<br />

• Indoor and outdoor full color display<br />

• LED advertisement panels<br />

• Decorative lighting<br />

AvagoTechnologies LED Lighting Solutions<br />

One LED. Infinite colors.<br />

World’s first waterproof package.<br />

Features<br />

• Water-resistance (IPX6*) per IEC 60529:2001<br />

• Very small PLCC6 package dimensions –<br />

3.4 x 2.8 x 1.8mm<br />

• In-line RGB dies configuration<br />

• Available inWhite Surface, Black-Surface<br />

and Full Black-Body<br />

• Wide operating temperature range:<br />

-40° to +110°<br />

For more information or to<br />

request a sample please go to:<br />

www.avagoresponsecenter.com/led


FEATURED PRODUCTS<br />

Switch Family for 24V Battery Systems<br />

New 24V eXtreme switches designed for applications such as lamps,<br />

LEDs, solenoids and motors used in trucks, buses and special engines.<br />

Fr<strong>ee</strong>scale’s intelligent, dual high-side eXtreme switches for 24V systems<br />

feature current capability ranging from 1 to 12A DC and are fully footprint-<br />

and software-compatible. Each output can be programmed to be used<br />

for most kinds of loads, including lamps, LEDs, motors or solenoids.<br />

This allows customers to design a flexible module that can be optimized<br />

for a specific application through software. Fr<strong>ee</strong>scale’s 24V eXtreme<br />

switch solution provides robust design, intelligence and safety n<strong>ee</strong>ded<br />

for truck applications. Due to increased integration, use of the switch results in lighter-weight, smaller systems and<br />

a reduced component count. For more information, click here.<br />

Automotive-Qualified Power MOSFETs<br />

International Rectifier today introduced a family of automotive-qualified<br />

power MOSFETs housed in a rugged TO-220 fullpak package for<br />

automotive applications including BLDC motors, pumps and cooling<br />

systems.The new 55V planar devices are available as standard and<br />

logic level gate drive MOSFETs in N and P channel configuration, and<br />

offer a maximum on-state resistance (Rds(on)) as low as 8mOhm. The<br />

TO-220 fullpak package eliminates the n<strong>ee</strong>d for additional insulating<br />

hardware to simplify design and improve overall system reliability. For<br />

more information, please click here.<br />

Low Loss High Bandwidth Coaxial Cables<br />

Designed for superior monitoring and control of radar, military vehicles,<br />

satellite, space, missile, RF ablation and test and measurement<br />

equipment, Temp-Flex coaxial cable solutions are insulated with a<br />

fluoropolymer dielectric. A helically wrapped silver-plated copper flat<br />

wire shield and braid are applied to all cable sizes to achieve superior<br />

shielding effectiveness. The standard solid core (low loss) construction<br />

coaxial cable delivers 70 percent velocity of propagation (VOP), while<br />

the air enhanced dual monofilament design (ultra-low loss) achieves 85<br />

to 88 percent velocity of propagation and improved insertion loss at high<br />

frequencies.For more information, click here.<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 10<br />

FEATURED PRODUCTS


4-Channel LED Driver with Independent Channel<br />

Control for Dynamic Dimming<br />

ISL97686<br />

The ISL97686 is a PWM controlled LED driver that supports<br />

4 channels of LED current, for Monitor and TV LCD backlight<br />

applications. It is capable of driving 160mA per channel from a<br />

9V to 32V input supply, with current sources rated up to 75V<br />

absolute maximum.<br />

The ISL97686’s current sources achieve typical current matching<br />

to ±1%, while dynamically maintaining the minimum required<br />

V OUT necessary for regulation. This adaptive scheme<br />

compensates for the non-uniformity of forward voltage variance<br />

in the LED strings.<br />

The ISL97686 dimming can be controlled by a high sp<strong>ee</strong>d SPI<br />

interface for independent channel control for dynamic dimming<br />

function synthesized on chip at 10-bit resolution.<br />

The ISL97686 has an advanced dynamic headroom control<br />

function, which monitors the highest LED forward voltage string,<br />

and regulates the output to the correct level to minimize power<br />

loss. This proprietary regulation scheme also allows for<br />

extremely linear PWM dimming from 0.02% to 100%. The LED<br />

current can also be switched betw<strong>ee</strong>n two current levels, giving<br />

support for 3D applications. The ISL97686 incorporates<br />

extensive protections of string open and short circuit detections,<br />

OVP, and OTP<br />

Related Literature<br />

• S<strong>ee</strong> Application note for “ISL97686IBZ_EVALZ” for SOIC<br />

Application<br />

VIN: 9V~32V<br />

April 23, 2012<br />

FN7953.0<br />

VIN<br />

VDC<br />

Fuse<br />

SLEW<br />

Q1<br />

D1<br />

160mA MAX PER STRING<br />

Features<br />

• 4 x 160mA, 75V Rated Channels with Integrated Channel<br />

Regulation FETs<br />

• Channels can be Ganged for High Current<br />

- 2 x 350mA<br />

- 1 x 700mA<br />

• 9V~32V Input Voltage<br />

• Dimming Modes:<br />

- Independent Channel Dimming Control with SPI<br />

- PWM Dimming with Adjustable Output Frequency<br />

- 10-bit Dimming Resolution<br />

- VSYNC Mode<br />

• 2 Selectable Current Levels for 3D Applications<br />

• Current Matching of ±1%<br />

• Integrated Fault Protection Features such as String Open<br />

Circuit Protection, String Short Circuit Protection, Overvoltage<br />

Protection, and Over-Temperature Protection<br />

• 28 Ld 5x5mm TQFN and 28 Ld 300mil SOIC Packages Available<br />

Applications<br />

• Monitor/TV LED Backlighting<br />

• General/Industrial/Automotive Lighting<br />

VLOGIC<br />

GD<br />

110<br />

EN<br />

CLK<br />

CS<br />

PGND<br />

RSENSE<br />

100<br />

90<br />

I_CH2<br />

I_CH3<br />

SDI<br />

SDO<br />

COMP<br />

80<br />

/CS<br />

70<br />

I_CH1<br />

EN_VSYNC OVP<br />

60<br />

I_CH4<br />

CSEL<br />

50<br />

ISET1<br />

ISET2<br />

OSC<br />

PWM_SET/PLL<br />

CH1<br />

CH2<br />

CH3<br />

CH4<br />

40<br />

30<br />

20<br />

10<br />

0<br />

0 20 40 60 80 100<br />

FIGURE 1. ISL97686 APPLICATION DIAGRAM<br />

DIMMING DUTY CYCLE (%)<br />

FIGURE 2. PWM DIMMING LINEARITY<br />

CHANNEL CURRENT (mA)<br />

Get the Datash<strong>ee</strong>t and Order Samples<br />

http://www.intersil.com<br />

Intersil (and design) is a registered trademark of Intersil Americas Inc. Copyright Intersil Americas Inc. 2012<br />

All Rights Reserved. All other trademarks mentioned are the property of their respective owners.


TECHNICAL ARTICLE<br />

Illogical Logic<br />

Part 3 - D-Type Flip-Flops<br />

Paul Clarke<br />

Electronics Design<br />

Engin<strong>ee</strong>r<br />

When it came to illogical logic circuits, I must say, I was always<br />

scratching my head at edge-triggered D-type flip-flops. These are one of the<br />

most common logic blocks in today’s computers and digital electronics. It’s<br />

a bit like saying the transistor is the most common component in modern<br />

electronics—but how many of us understand how a D-Type works?<br />

To begin the voyage to the edge-triggered D-type flip-flop, we will start with<br />

the common element that’s used inside it: the SR flip-flop.<br />

This is the simplest flip-flop to understand as it only contains two logic gates<br />

and NAND gates. It is also the easiest to s<strong>ee</strong> a common issue in digital<br />

electronics, the ‘race condition’ or a glitch. These states occur when the<br />

logic output of a circuit is undefined for a few brief microseconds. We have<br />

to remember that logic gates are, after all, analog circuits full of transistors.<br />

These circuits take time for the charge on the devices, like FETs, to rise<br />

or fall. This means that the voltage thresholds are not clear and transistors<br />

may or may not be switched on. Within the gate, this means that a clear<br />

decision about output levels has not b<strong>ee</strong>n made – hence undefined. This<br />

also happens during changes to the input as it takes time for the gate to<br />

react and generate a new output, if one is required.<br />

So in our SR flip-flop there is a race condition at switch on where the gates<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 12<br />

TECHNICAL ARTICLE


TECHNICAL ARTICLE<br />

Set<br />

H<br />

Reset<br />

H<br />

Figure 1: SR FLIP-FLOP<br />

power up and try to work out their output state. This<br />

becomes more complex as the outputs are fed back to<br />

the inputs. This means that the output is affecting the<br />

input, hence the decision making and hence the output<br />

itself. Confused? Well thats how the gate f<strong>ee</strong>ls. However<br />

after a few microseconds the gate settles and a stable<br />

state persists.<br />

S R Q<br />

0 0 !<br />

0 1 1<br />

1 0 0<br />

1 1 X<br />

Figure 2: SR TRUTH TABLE<br />

Q<br />

L<br />

Q<br />

H<br />

The truth table for the SR flip-flop is therefore as follows:<br />

The most interesting states are the Set and Reset states<br />

and the Do Nothing state—so remember these for later.<br />

The next thing to add is our clock input, which is done by<br />

adding two more NAND gates to the front end of our SR<br />

circuit. This becomes a gated SR flip-flop. The Set and<br />

Reset still work as before, but as the name suggests, it’s<br />

gated so the output only happens at certain times, when<br />

the clock input is high. This is all very good, however,<br />

it’s possible for the circuit to change its output multiple<br />

times during a clock high, which is not what we want at<br />

all. It’s also not a D-type yet. However, this is easy to fix<br />

by adding a NOT gate betw<strong>ee</strong>n the S and R inputs and<br />

renaming the S input as D (Figure 3).<br />

Our new D-Type works just like the SR flip-flop as it’s<br />

possible to change the output while the clock is high<br />

multiple times during that period. We n<strong>ee</strong>d a circuit that<br />

only latches in the D signal when the clock edge is rising.<br />

To simplify this to begin with, let’s think about the ability<br />

to generate race conditions—or in this case, a glitch.<br />

If there was only a way to make the clock <strong>pulse</strong> really<br />

really small on the positive duration, then there would<br />

not be enough time to switch back (Figure 4).<br />

L<br />

Figure 3: D-TYPE FLIP-FLOP<br />

Figure 4: GLITCH CIRCUIT<br />

This circuit uses the idea that it takes time for the gates to<br />

switch. Let’s assume for a moment that the input is LOW.<br />

One side of the AND gate is set to LOW as per the input<br />

and the other is logic HIGH because the NOT gate has<br />

inverted the input. In a perfect world, if the input changes,<br />

the NOT gate would change instantaneously and this<br />

input to the AND gate would swap and the output remain<br />

unaffected. However, because it takes time for the NOT<br />

gate to react and drive the output, there is, in fact, a small<br />

moment in time were both the inputs to the AND gate are<br />

HIGH. This sets off the chain reaction in the gate that will<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 13<br />

H<br />

D<br />

CLK<br />

Q<br />

L<br />

L<br />

TECHNICAL ARTICLE


TECHNICAL ARTICLE<br />

CLK<br />

H<br />

D<br />

Figure 5: D_TYPE EDGE TRIGGERED CIRCUIT<br />

drive the output from LOW to HIGH. Moments later, the<br />

NOT gate output changes state and the AND gate reacts<br />

to the new stimulus. However, the chain reaction is still in<br />

place and what we s<strong>ee</strong> at the output or the AND gate is<br />

a HIGH equal to the time it took the NOT gate to switch.<br />

This may look great, but it’s not a defined period of<br />

time—other gates may not even react quickly enough to<br />

it and we are relying on the analog side effects of the<br />

gates. So what we n<strong>ee</strong>d is a nice stable version of the<br />

glitch generator. We could, for example, have a much<br />

higher sp<strong>ee</strong>d clock running somewhere that could help<br />

us process the signals, but then that would n<strong>ee</strong>d higher<br />

sp<strong>ee</strong>d clocks too…<br />

The answer, however, is in our original SR flip-flops.<br />

These react to the change of input only once when the<br />

input change is applied. With both inputs at LOW, a HIGH<br />

signal on one of the inputs generates a fast reaction and<br />

latches in a new output if one is required. The interesting<br />

effect is the DO NOTHING condition where setting both<br />

inputs HIGH will not change the output. Changing an<br />

input as LOW will then either Set or Reset the SR latch.<br />

However, driving the signal up and down as much as we<br />

want will not affect the output. If we were to connect a<br />

clock input to this circuit, then Setting or Resetting the<br />

latch would happen only on the falling edge of the clock.<br />

We are now getting close, but still not quite there. We<br />

have a circuit that responds to the edge of the clock—the<br />

wrong edge—but we can only connect this circuit so that<br />

it Sets or Resets. We n<strong>ee</strong>d both.<br />

Q<br />

H<br />

In order to have both, you n<strong>ee</strong>d two SR flip-flops that act<br />

as Set and Reset circuits. By connecting these circuits in<br />

opposite modes, it’s then possible to use the data input<br />

to decide which one latches and holds and which one<br />

flips back and forth with the clock input (Figure 5).<br />

First thing to notice is that the NOT gate that was used<br />

on the SR to turn it into a D-Type is simplified by using<br />

the NOT Q output on one of the SR flip-flops (in this case<br />

the bottom one). This lower flip-flop generates this NOT<br />

signal as a f<strong>ee</strong>dback or input to the top flip-flop, which<br />

in turn generates a NOT signal back to the first. This<br />

causes the two SR flip-flops to latch in opposite modes.<br />

The clock signal is also fed to both SR flip-flops and<br />

because of this the lower flip-flop n<strong>ee</strong>d to have a thr<strong>ee</strong><br />

input NAND gate. The overall effect is that these two flipflops<br />

generate a very useful signal. One will, as I said,<br />

latch and the other flip with the clock input. These two<br />

signals can then be used to drive a third SR flip-flop that<br />

functions as before with the DO NOTHING condition,<br />

only changing its output once the D-signal has changed<br />

and when the clock edge is s<strong>ee</strong>n, in this case, on the<br />

rising edge.<br />

It’s quite a difficult circuit to put into words because<br />

of the number of states it can be in. I could post lots of<br />

pictures showing them, but nothing works better than an<br />

animation. If you have not s<strong>ee</strong>n this website before, then<br />

http://www.falstad.com is great and has a really nice<br />

little circuit simulator. Follow the link below to load the<br />

simulator and the following instruction to bring up the<br />

edge-triggered D-type flip-flop.<br />

From the menus click here, select “Circuits,” then<br />

“Sequential Logic.” Then click on “Flip-Flops” and then<br />

“Edge-Triggered D Flip-Flop.”<br />

About the Author<br />

Digital Electronics Engin<strong>ee</strong>r with strong software skills<br />

in assembly and C for embedded systems. At ebmpapst<br />

I’m developing embedded electronics for thermal<br />

management control solutions for the air movement<br />

industry. These controllers monitor environmental inputs<br />

like Temperature, Humidity and Pressure and then<br />

control the sp<strong>ee</strong>d of our fans based on various profiles.<br />

Our controls also interface with other systems over<br />

RS232/485 or TCP/IP as well as a host of other user or<br />

control interfaces. ■<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 14<br />

TECHNICAL ARTICLE


Transform Your iPhone, iPad<br />

or iPod into an Oscilloscope<br />

with the iMSO-104<br />

Begin Your Experience Now<br />

Experience the iMSO-104 as Joe<br />

Wolin, co-founder of <strong>EEWeb</strong>,<br />

gives you an in-depth look into<br />

the future of oscilloscopes.<br />

ELECTRONICS<br />

ELECTRONICS<br />

UBM UBM<br />

2012<br />

WINNER


TECHNICAL ARTICLE<br />

Disclaimer<br />

The views, opinions, positions or strategies expressed<br />

by the author and those providing comments are theirs<br />

alone, and do not necessarily reflect the views, opinions,<br />

positions or strategies of anybody else.<br />

Das Blinkenlights [1]<br />

We’ll have a closer look at the blinking LED Arduino<br />

sketch we saw last time (Figure 1).<br />

ACHTUNG!<br />

ALLES TURISTEN UND NONTEKNISCHEN LOOKEN-<br />

PEEPERS! DAS KOMPUTERMASCHINE IST NICHT<br />

F¨UR DER GEFINGERPOKEN UND MITTENGRA-<br />

BEN! ODERWISE IST EASY TO SCHNAPPEN DER<br />

SPRINGENWERK, BLOWENFUSEN UND POPPEN-<br />

CORKEN MIT SPITZENSPARKSEN. IST NICHT F¨UR<br />

GEWERKEN BEI DUMMKOPFEN. DER RUBBER-<br />

NECKEN SIGHTSEEREN KEEPEN DAS COTTON-<br />

PICKEN H¨ANDER IN DAS POCKETS MUSS. ZO RE-<br />

LAXEN UND WATSCHEN DER. BLINKENLICHTEN.<br />

Dissection of BlinkWithoutDelay [3]<br />

Sketch<br />

Programs written for the Processing [4] programming<br />

language are called sketches. These sketches are<br />

typically written using the text editor that comes with<br />

Processing. It has features for cutting/pasting and for<br />

searching/replacing text. Sketches written for Processing<br />

should have a .pde file extension, which stands for<br />

Processing Development Environment. Arduino<br />

borrowed this concept from Processing and programs<br />

that are being uploaded to and run on an Arduino board<br />

are called sketches as well. To distinguish Arduino<br />

from Processing sketches, .ino should be used as a file<br />

extension, which stands for Arduino (Figure 2).<br />

Comments<br />

Robert Berger<br />

Embedded Software Specialist<br />

Arduino<br />

for mere m0rtals - PART 4<br />

Everything betw<strong>ee</strong>n the /* (line 1) and */ (line 22) is<br />

ignored by the Arduino when it runs the sketch (the *<br />

(lines 8, 9) at the start of each line is only there to make<br />

the comment look pretty, and isn’t required). Comments<br />

are for people who read your code and for you and try<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 16<br />

TECHNICAL ARTICLE


TECHNICAL ARTICLE<br />

Figure 1: Try telnet towels.blinkenlights.nl [2]<br />

Listing 1: BlinkWithoutDelay.ino<br />

/* Blink without Delay<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

Turns on and off a light emitting diode (LED) connected to a digital<br />

pin, without using the delay() function. This means that other code<br />

can run at the same time without being interrupted by the LED code.<br />

The circuit:<br />

* LED attached from pin 13 to ground<br />

* Note: on most Arduinos, there is already an LED on the board<br />

that’s attached to pin 13, so no hardware is n<strong>ee</strong>ded for this example.<br />

created 2005<br />

by David A. Mellis<br />

modified 8 Feb 2010<br />

by Paul Stoffregen<br />

This example code is in the public domain<br />

http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay<br />

*/<br />

Figure 2<br />

to understand what you wrote a long time ago. They<br />

(hopefully) explain what the program does, how it<br />

works, or why it’s written the way it is. It’s good practice<br />

to comment on your sketches and to k<strong>ee</strong>p the comments<br />

up-to-date when you modify the code. Remember, as a<br />

good ”open-source citizen,” to share your code so others<br />

can learn from or modify/improve your code.<br />

There’s another style for short, single-line comments.<br />

These start with // (e.g on line 26) and continue to the<br />

end of the line.<br />

To delay() or not to delay()? [5]<br />

The delay() function mentioned on line 4 and the hint<br />

not to use it so other code can run already looks weird<br />

to someone who used a RTOS or Unix/Linux before.<br />

Let’s have a closer look at it. From the Fr<strong>ee</strong>RTOS call<br />

vTaskDelay(500/portTICK RATE MS) [6], you would<br />

expect to delay a task for 500 msec. The fact that this<br />

API call delays/blocks a task for 500 msec means that<br />

it allows tasks with a lower priority to run until the time<br />

expires.<br />

In Linux usl<strong>ee</strong>p(500) [7], it would block the calling<br />

process for 500 msec and allow processes with a lower<br />

priority to run until the time expires – kind of.<br />

Description<br />

The delay() function pauses the program for the amount<br />

of time (in milliseconds) specified as parameter.<br />

(Remember: there are 1000 milliseconds in a second.)<br />

Syntax<br />

delay(ms)<br />

Parameters<br />

ms: the number of milliseconds to pause (unsigned long)<br />

Returns<br />

nothing<br />

(Figure 3)<br />

Caveat<br />

While it is easy to create a blinking LED with the delay()<br />

function, and many sketches use short delays for such<br />

tasks as switch debouncing, the use of delay() in a<br />

sketch has significant drawbacks. No other reading of<br />

sensors, mathematical calculations, or pin manipulation<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 17<br />

TECHNICAL ARTICLE


TECHNICAL ARTICLE<br />

can go on during the delay function, so in effect, it brings<br />

most other activity to a halt. For alternative approaches<br />

to controlling timing, s<strong>ee</strong> the millis() function [8] used<br />

on line 49 in the sketch below. Arduino veterans usually<br />

avoid the use of delay() for timing of events longer than<br />

10’s of milliseconds unless the Arduino sketch is very<br />

simple.<br />

However, certain things do go on while the delay() function<br />

is controlling the Atmega chip because the delay function<br />

does not disable interrupts. Serial communication that<br />

appears at the RX pin is recorded, PWM (analogWrite)<br />

values and pin states are maintained, and interrupts will<br />

work as they should.<br />

Author’s Comment<br />

From what we have s<strong>ee</strong>n above, the delay()<br />

implementation behaves like a busy loop with interrupts<br />

enabled.<br />

Variables<br />

A variable is a place for storing a piece of data. It has<br />

a name, a type, and a value. For example, the line 26<br />

from the sketch above declares a variable with the name<br />

ledPin, the type int, and an initial value of 13. It’s being<br />

used to indicate which Arduino pin the LED is connected<br />

to and since it never changes, it’s declared as const,<br />

which could give the linker a hint to place it in a section<br />

other then precious RAM. Every time the name ledPin<br />

appears in the code, its value will be retrieved. In this<br />

case, the person writing the program could have chosen<br />

not to bother creating the ledPin variable and could have<br />

simply written 13 everywhere they n<strong>ee</strong>ded to specify a<br />

pin number instead. The advantage of using a variable<br />

is that it’s easier to move the LED to a different pin—you<br />

only n<strong>ee</strong>d to edit the one line that assigns the initial value<br />

to the variable.<br />

Often, however, the value of a variable will change while<br />

the sketch runs (lines 29, 34, 49). Due to the lack of<br />

insightful comments, it’s not quite obvious to me why the<br />

variable in line 30 is not defined as const as well since it<br />

does not change.<br />

Functions<br />

A function (otherwise known as a procedure or subroutine)<br />

is a named piece of code that can be used from<br />

elsewhere in a sketch. The setup() function [9] as s<strong>ee</strong>n in<br />

Listing 2: delay-example.ino<br />

int ledPin = 13; // LED connected to digital pin 13<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

void setup()<br />

{<br />

pinMode(ledPin, OUTPUT); // sets the digital pin as output<br />

}<br />

void loop()<br />

{<br />

digitalWrite(ledPin, HIGH); // sets the LED on<br />

delay(500); // waits 500 msec<br />

digitalWrite(ledPin, LOW); // sets the LED off<br />

delay(500); // waits 500 msec<br />

}<br />

Figure 3<br />

Listing 3: BlinkWithoutDelay.ino continued<br />

24 // constants won’t change. Used here to<br />

25 // set pin numbers:<br />

26<br />

27<br />

const int ledPin = 13; // the number of the LED pin<br />

28 // Variables will change:<br />

29 int ledState = LOW; // ledState used to set the LED<br />

30<br />

31<br />

long previousMillis = 0; // will store last time LED was updated<br />

32 // the following variable is a long because the time, measured in<br />

milliseconds,<br />

33 // will quickly become a bigger number than can be stored in an int.<br />

34<br />

35<br />

long interval = 1000; // interval at which to blink (milliseconds)<br />

36 void setup() {<br />

37 // set the digital pin as output;<br />

38 pinMode(ledPin, OUTPUT)<br />

39 }<br />

Figure 4<br />

Listing 4: BlinkWithoutDelay.ino continued<br />

41 void loop()<br />

42 {<br />

43<br />

44<br />

// here is where you’d put code that n<strong>ee</strong>ds to be running all the time.<br />

45 // check to s<strong>ee</strong> if it’s time to blink the LED; that is, if the<br />

46 // difference betw<strong>ee</strong>n the current time and last time you blinked<br />

47 // the LED is bigger than the interval at which you want to<br />

48 // blink the LED.<br />

49<br />

50<br />

unsigned long currentMillis = millis();<br />

51 if(currentMillis – previousMillis > interval) {<br />

52 // save the last time you blinked the LED<br />

53<br />

54<br />

previousMillis = currentMillis;<br />

55 // if the LED is off turn it on and vice-versa:<br />

56 if (ledState = LOW)<br />

57 ledState = HIGH;<br />

58 else<br />

59<br />

60<br />

ledState = LOW;<br />

61 // set the LED with the ledState of the variable:<br />

62 digitalWrite(ledPin, ledState);<br />

63 }<br />

64 }<br />

Figure 5<br />

line 36 is called once, when the sketch starts. It’s a good<br />

place to configure pin modes and to initialize libraries.<br />

The pinMode() function [10] line 38 configures a digital<br />

pin as either an input or an output. To use it, you pass the<br />

number of the pin to configure and the constant INPUT<br />

or OUTPUT. When configured as an input, a pin can<br />

detect the state of a sensor like a “Push” button. As an<br />

output, it can drive an actuator like an LED, which, in<br />

our case, utilizes the digitalWrite() function [11] line 62 to<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 18<br />

TECHNICAL ARTICLE


TECHNICAL ARTICLE<br />

change state (Figure 5).<br />

The loop() function [12] line 41 is called over and over<br />

and is the heart of most sketches. Both setup() and<br />

loop() n<strong>ee</strong>d to be included in your sketch, even if you<br />

don’t n<strong>ee</strong>d them for anything.<br />

Author’s Comment<br />

From what we have s<strong>ee</strong>n so far, it looks like an Arduino<br />

sketch behaves like a cyclic executive with interrupts.<br />

Stay tuned for more hands-on stuff in the next part of this<br />

series of articles where we’ll investigate Processing!<br />

References<br />

[1] ”Das Blinkenlights” http://en.wikipedia.org/wiki/<br />

Blinkenlights<br />

[2] ”www.blinkenlights.nl” http://www.blinkenlights.nl<br />

[3] ”First Sketch” http://arduino.cc/en/Tutorial/Sketch<br />

[4] ”Processing” http://processing.org<br />

[5] ”delay()” http://arduino.cc/en/Reference/Delay<br />

BeStar®<br />

ACOUSTICS & SENSORS<br />

PRODUCTS<br />

Speakers<br />

Buzzers<br />

Piezo Elements<br />

Back-up Alarms<br />

Horns<br />

Sirens/Bells<br />

Beacons<br />

Microphones<br />

Sensors<br />

INDUSTRIES<br />

Automotive<br />

Durables<br />

Medical<br />

Industrial<br />

Mobile<br />

Fire / Safety<br />

Security<br />

Consumer<br />

Leisure<br />

[6] ”vTaskDelay()” http://www.fr<strong>ee</strong>rtos.org/a00127.html<br />

[7] ”usl<strong>ee</strong>p()” http://pubs.opengroup.org/onlinepubs/009695399/functions/usl<strong>ee</strong>p.html<br />

[8] ”millis()” http://arduino.cc/en/Reference/millis<br />

[9] ”setup()” http://arduino.cc/hu/Reference/Setup<br />

[10] ”pinMode()” http://arduino.cc/en/Reference/pin-<br />

Mode<br />

[11] ”digitalWrite()” http://arduino.cc/en/Reference/digitalWrite<br />

[12] ”loop()” http://arduino.cc/en/Reference/loop<br />

About the Author<br />

Robert Berger is a highly respected and experienced<br />

embedded real-time expert and CEO of Reliable<br />

Embedded Systems, a leading embedded training<br />

consultancy. Robert consults and trains people all<br />

over the globe on a mission to help them create better<br />

embedded software. He specializes in training and<br />

consulting for embedded systems, from small real-time<br />

systems to multi-core embedded Linux. ■<br />

Teamwork • Technology • Invention • Listen • Hear<br />

Preferred acoustic component<br />

supplier to OEMs worldwide<br />

bestartech.com | sales@bestartech.com | 520.439.9204<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 19<br />

QS9000 • TS/ISO16949 • ISO14001 • ISO13485 • ISO9001<br />

TECHNICAL ARTICLE


RETURN TO ZERO<br />

<strong>EEWeb</strong><br />

Electrical Engin<strong>ee</strong>ring Community<br />

Join Today<br />

www.<strong>ee</strong>web.com/register<br />

<strong>EEWeb</strong> | Electrical Engin<strong>ee</strong>ring Community Visit www.<strong>ee</strong>web.com 20<br />

RETURN TO ZERO

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!