/Tag: c language

Bit Manipulation in C

Writing programs for embedded systems often requires the manipulation of individual bits. Below is a list of the most common operations. In the examples we are performing them on an unsigned long variable called ctrl_reg. Setting a bit We can set a bit using the bitwise OR operator (|): ctrl_reg |= 1UL << n; The [...]

By |2018-08-17T22:57:56+00:00February 2nd, 2018|Categories: Explained Simply|Tags: , , |0 Comments