{"id":235,"date":"2024-06-19T15:26:38","date_gmt":"2024-06-19T15:26:38","guid":{"rendered":"https:\/\/iotthinghub.com\/?p=235"},"modified":"2024-06-19T17:31:38","modified_gmt":"2024-06-19T17:31:38","slug":"register-bitwise-operator","status":"publish","type":"post","link":"https:\/\/iotthinghub.com\/?p=235","title":{"rendered":"Register &amp; Bitwise Operator"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"235\" class=\"elementor elementor-235\">\n\t\t\t\t<div class=\"elementor-element elementor-element-dae7871 e-flex e-con-boxed e-con e-parent\" data-id=\"dae7871\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-0795986 elementor-widget elementor-widget-text-editor\" data-id=\"0795986\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>Numbering System<\/strong><\/h5><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignright wp-image-239\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Number-System.jpg\" alt=\"\" width=\"680\" height=\"396\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Number-System.jpg 1297w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Number-System-300x175.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Number-System-1024x597.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Number-System-768x448.jpg 768w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b5fe12 elementor-widget elementor-widget-text-editor\" data-id=\"5b5fe12\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>Bit Pattern<\/strong><\/h5><p><img decoding=\"async\" class=\"aligncenter wp-image-243\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Bit.jpg\" alt=\"\" width=\"680\" height=\"195\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Bit.jpg 1021w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Bit-300x86.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/Bit-768x220.jpg 768w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p><h5><strong>Bitwise Operators<\/strong><\/h5><p><img decoding=\"async\" class=\"aligncenter wp-image-244\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bit-Operator-300x93.jpg\" alt=\"\" width=\"680\" height=\"211\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bit-Operator-300x93.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bit-Operator-1024x318.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bit-Operator-768x238.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/bit-Operator.jpg 1124w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-cf57a15 e-grid e-con-boxed e-con e-parent\" data-id=\"cf57a15\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1c7a43d elementor-widget__width-initial elementor-widget elementor-widget-text-editor\" data-id=\"1c7a43d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>AND Operation<\/strong><\/h5><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-252 size-full\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and.jpg\" alt=\"\" width=\"1293\" height=\"178\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and.jpg 1293w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-300x41.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-1024x141.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-768x106.jpg 768w\" sizes=\"(max-width: 1293px) 100vw, 1293px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c1f21ee elementor-widget__width-initial elementor-widget elementor-widget-text-editor\" data-id=\"c1f21ee\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Example:-<\/p><p>uint8_t sample=0x04; <span style=\"color: #339966;\">\/\/ Binary 0b0000 0100<\/span><\/p><p>sample &amp;=8; <span style=\"color: #339966;\">\/\/ The value will be zero<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b705979 elementor-widget elementor-widget-image\" data-id=\"b705979\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"497\" height=\"213\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-operation.jpg\" class=\"attachment-large size-large wp-image-253\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-operation.jpg 497w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/and-operation-300x129.jpg 300w\" sizes=\"(max-width: 497px) 100vw, 497px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-96db045 elementor-widget elementor-widget-text-editor\" data-id=\"96db045\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>OR Operation<\/strong><\/h5><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-261\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-300x58.jpg\" alt=\"\" width=\"300\" height=\"58\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-300x58.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-1024x199.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-768x149.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or.jpg 1312w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f2f6a47 elementor-widget elementor-widget-text-editor\" data-id=\"f2f6a47\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Example:-<\/p><p>uint8_t sample=0x04; <span style=\"color: #339966;\">\/\/ Binary 0b0000 0100<\/span><\/p><p>sample |=8; <span style=\"color: #339966;\">\/\/ The value will be 12<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1592617 elementor-widget elementor-widget-image\" data-id=\"1592617\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"248\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-operation.jpg\" class=\"attachment-large size-large wp-image-262\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-operation.jpg 558w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/or-operation-300x133.jpg 300w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b1af02e elementor-widget elementor-widget-text-editor\" data-id=\"b1af02e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>Ex-OR Operation<\/strong><\/h5><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-267\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-300x51.jpg\" alt=\"\" width=\"300\" height=\"51\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-300x51.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-1024x175.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-768x131.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor.jpg 1306w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-29294e3 elementor-widget elementor-widget-text-editor\" data-id=\"29294e3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Example:-<\/p><p>uint8_t sample=0x04; <span style=\"color: #339966;\">\/\/ Binary 0b0000 0100<\/span><\/p><p>sample ^=12; <span style=\"color: #339966;\">\/\/ The value will be 8<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5de0cc5 elementor-widget elementor-widget-image\" data-id=\"5de0cc5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"557\" height=\"238\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-operation.jpg\" class=\"attachment-large size-large wp-image-268\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-operation.jpg 557w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/exor-operation-300x128.jpg 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-3a9173d e-grid e-con-boxed e-con e-parent\" data-id=\"3a9173d\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-911bc39 elementor-widget elementor-widget-text-editor\" data-id=\"911bc39\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>NOT Operator<\/strong><\/h5><p>It reverses all the bits\u00a0<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-275\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/not-300x71.jpg\" alt=\"\" width=\"300\" height=\"71\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/not-300x71.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/not.jpg 757w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\u00a0\u00a0\u00a0\u00a0 <\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0af79fd elementor-widget elementor-widget-text-editor\" data-id=\"0af79fd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Example:-<\/p><p>uint8_t sample=~4; <span style=\"color: #339966;\">\/\/ The value should be 251\u00a0\u00a0\u00a0<\/span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p><p>i.e. 0000 0100 ~ = 1111 1011 = 251<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-b4ce7bb e-flex e-con-boxed e-con e-parent\" data-id=\"b4ce7bb\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a780412 elementor-widget elementor-widget-text-editor\" data-id=\"a780412\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Rules :- The bit patterns should be represent as<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 byte= 8 bit = 2 nibble<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 nibble = 4 bit<\/p><p>So each byte can be represented as upper nibble and lower nibble.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3b54b93 elementor-widget elementor-widget-image\" data-id=\"3b54b93\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"193\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/nabil-300x193.jpg\" class=\"attachment-medium size-medium wp-image-280\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/nabil-300x193.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/nabil.jpg 522w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-1bb7bef e-grid e-con-boxed e-con e-parent\" data-id=\"1bb7bef\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-7605543 elementor-widget elementor-widget-text-editor\" data-id=\"7605543\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>\u00a0 \u00a0 \u00a0 &gt;&gt; and &lt;&lt; operators :-<\/strong><\/h5><h6>\u00a0In general from\u00a0 \u00a0 \u00a0\u00a0Value &gt;&gt; num<\/h6><p>Here, num specifies the number of position to right shift the Value in value.\u00a0Example :-<\/p><p>uint8_t a=32; \/\/ Binary representation 0b0010 0000\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/p><p>a=a&gt;&gt;2;<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-38532f8 elementor-widget elementor-widget-image\" data-id=\"38532f8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"225\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/right-shift.jpg\" class=\"attachment-large size-large wp-image-285\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/right-shift.jpg 981w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/right-shift-300x106.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/right-shift-768x270.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c3107c7 elementor-widget elementor-widget-text-editor\" data-id=\"c3107c7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5>In general from \u00a0Value &lt;&lt; num<\/h5><p>Here, num specifies the number of position to left shift the Value in value. Example :-<\/p><p>uint8_t a=1; \/\/ Binary representation 0b0000 0001<\/p><p>a&lt;&lt;=3;<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e6426ae elementor-widget elementor-widget-image\" data-id=\"e6426ae\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"218\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/left-shifting.jpg\" class=\"attachment-large size-large wp-image-290\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/left-shifting.jpg 958w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/left-shifting-300x102.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/left-shifting-768x261.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-725284a e-flex e-con-boxed e-con e-parent\" data-id=\"725284a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3d8affc elementor-widget elementor-widget-text-editor\" data-id=\"3d8affc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Now execute the following instruction and find what happen<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t sample=4;<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sample | =(1&lt;&lt;3);<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-297 size-full\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/set-bit.jpg\" alt=\"\" width=\"882\" height=\"246\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/set-bit.jpg 882w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/set-bit-300x84.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/set-bit-768x214.jpg 768w\" sizes=\"(max-width: 882px) 100vw, 882px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8599cec elementor-widget elementor-widget-text-editor\" data-id=\"8599cec\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Thus the particular bit is set and it put on effect on other bits. So that the formula to set a particular bit without effecting other bits is-<\/p><h6>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>variable_name |=(1&lt;&lt;Bit_position);<\/strong><\/h6><p>Similarly to set multiple bit at the same time<\/p><h6><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 variable_name |=(1&lt;&lt;Bit_position1)| (1&lt;&lt;Bit_position2)| (1&lt;&lt;Bit_positionN);<\/strong><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-45985cc e-grid e-con-boxed e-con e-parent\" data-id=\"45985cc\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-94e54a0 elementor-widget elementor-widget-text-editor\" data-id=\"94e54a0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To clear a particular bit<\/p><h6>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>variable_name &amp;=~(1&lt;&lt;Bit_position);<\/strong><\/h6><p>Exapmle:-<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t sample=0b00011111;<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sample &amp;=~(1&lt;&lt;3);<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b0c2cfe elementor-widget elementor-widget-text-editor\" data-id=\"b0c2cfe\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-303 size-large\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/clear-bit-1024x205.jpg\" alt=\"\" width=\"640\" height=\"128\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/clear-bit-1024x205.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/clear-bit-300x60.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/clear-bit-768x154.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/clear-bit.jpg 1212w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>Similarly to clear multiple bit at a time<\/p><h6><strong>\u00a0 variable_name &amp;=~((1&lt;&lt;Bit_position1)| (1&lt;&lt;Bit_position2)| (1&lt;&lt;Bit_positionN));<\/strong><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9324683 elementor-widget elementor-widget-text-editor\" data-id=\"9324683\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To toggle a particular bit ^ is used<\/p><p>In general from\u00a0 <strong>variable_name ^=(1&lt;&lt;Bit_position);<\/strong><\/p><p>Exapmle:-<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t sample=4;<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sample ^=(1&lt;&lt;3);<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sample ^=(1&lt;&lt;3);<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-683ebb7 elementor-widget elementor-widget-image\" data-id=\"683ebb7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"256\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/toggle-bit-768x307.jpg\" class=\"attachment-medium_large size-medium_large wp-image-310\" alt=\"\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/toggle-bit-768x307.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/toggle-bit-300x120.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/toggle-bit-1024x410.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/toggle-bit.jpg 1069w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">variable_name ^=(1&lt;&lt;Bit_position);<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-c81855f e-grid e-con-boxed e-con e-parent\" data-id=\"c81855f\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e9c8345 elementor-widget elementor-widget-text-editor\" data-id=\"e9c8345\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5><strong>Register Assign<\/strong>:<\/h5><p>In all our discussion we learn how to set and clear a particular bit in byte. Let look at the following example \u2013<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-317 size-full\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/PORTB.jpg\" alt=\"\" width=\"1434\" height=\"113\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/PORTB.jpg 1434w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/PORTB-300x24.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/PORTB-1024x81.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2024\/06\/PORTB-768x61.jpg 768w\" sizes=\"(max-width: 1434px) 100vw, 1434px\" \/><\/p><h6>PORTB|=(1&lt;&lt;PORTB7)|(1&lt;&lt;PORTB6); <span style=\"color: #339966;\">\/\/ Set PORTB7 &amp; PORTB6<\/span><\/h6><h6>PORTB&amp;=~((1&lt;&lt;PORTB5)|(1&lt;&lt;PORTB4)); <span style=\"color: #339966;\">\/\/ Clear PORTB7 &amp; PORTB6<\/span><\/h6><p>Here the Register is PORTB and in this register we can set and clear any bit at any time.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Numbering System Bit Pattern Bitwise Operators AND Operation Example:- uint8_t sample=0x04; \/\/ Binary 0b0000 0100 sample &amp;=8; \/\/ The value will be zero OR Operation Example:- uint8_t sample=0x04; \/\/ Binary 0b0000 0100 sample |=8; \/\/ The value will be 12 Ex-OR Operation Example:- uint8_t sample=0x04; \/\/ Binary 0b0000 0100 sample ^=12; \/\/ The value will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-235","post","type-post","status-publish","format-standard","hentry","category-basic-interface"],"_links":{"self":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=235"}],"version-history":[{"count":67,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/235\/revisions"}],"predecessor-version":[{"id":329,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/235\/revisions\/329"}],"wp:attachment":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}