EasyManuals Logo

STMicroelectronics STM8 User Manual

STMicroelectronics STM8
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #124 background imageLoading...
Page #124 background image
Bitwise and logic operations are useful. Not only they are fast, they just deal with the
designated bits only. SPL has support for such operations but it is still better to know them.
Here are some common operations:
#define bit_set(reg, bit_val) reg |= (1 << bit_val) //For setting a bit of a register
#define bit_clr(reg, bit_val) reg &= (~(1 << bit_val)) //For clearing a bit of a register
#define bit_tgl(reg, bit_val) reg ^= (1 << bit_val) //For toggling a bit of a register
#define get_bit(reg, bit_val) (reg & (1 << bit_val)) //For extracting the bit state of a register
#define get_reg(reg, msk) (reg & msk) //For extracting the states of masked bits of a register
Unlocking a Locked STM8 Chip
If you have accidentally locked a STM8 chip by setting the Readout Protection configuration bit and
no longer able to use it, you can unlock it easily.
When you lock a chip, the programmer interface will give you a warning notification. If you retry to
reprogram/erase a locked chip you’ll get an error like this:
No matter what you do, you won’t be able to use it.

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM8 and is the answer not in the manual?

STMicroelectronics STM8 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM8
CategoryMicrocontrollers
LanguageEnglish

Related product manuals