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 6<br />

Figure 6-8. With bit 7=0, writing to the 8255’s control register will set or clear<br />

individual bits in Port C.<br />

Bit Control<br />

Another useful feature of the 8255 is the ability to set and clear individual bits on Port C.<br />

You do so again by writing to the control register, as Figure 6-8 shows. Bit 7 must be 0. Bit<br />

0 selects set or reset (clear) for the bit, and bits 1-3 select the bit to set or clear. For example,<br />

this BASIC-52 statement sets bit 7 of Port C:<br />

XBY(0FC03h)=0Fh<br />

To clear bit 7, use this statement:<br />

XBY(0FC03h)=0Eh<br />

106 <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!