English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

1 answers

Just read the present port value and OR in the bit you want to set.

For example we want to set bit 2, and bits 0 & 1 are set:

A=port value ' bit 0 and 1 are set.
B=A OR 4 ' we add in 4 to set bit 2
port value=b ' b=7, bits 0,1,2 are set

To reset bits without affecting others, it's basically the same thing with an AND mask.

2007-02-27 00:46:34 · answer #1 · answered by steve.c_50 6 · 0 0

fedest.com, questions and answers