18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9<br />

Figure 9-2. Two ways to read the state of a normally open switch/sensor: (A)<br />

basic input, (B) latched input.<br />

Listing 9-1 assumes that in Figure 9-1B, the Q output connects to bit 0 of an input port at<br />

E000h, and the CLR input connects to bit 0 of an output port at E400h.<strong>The</strong> program clears<br />

the flip-flop, then reads the input port continuously until the bit in question goes high. It<br />

then displays a message, clears the flip-flop, and returns to the main program.<br />

Analog Sensors<br />

<strong>The</strong> above sensors have just two states: on and off, or open and closed. This makes them<br />

easy to use in digital circuits, which recognize only two logic states.<br />

156 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

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

Saved successfully!

Ooh no, something went wrong!