boolean 8051

3,161 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,161
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
53
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

boolean 8051

  1. 1.
  2. 2. BOOLEAN INSTRUCTIONS<br />CLR,CPL,SETB,AND,OR<br />
  3. 3. BOOLEAN INSTRUCTIONS<br />This group of instructions is associated with the single-bit operations of the 8051.<br />This group allows manipulating the individual bits of bit addressable registers and memory locations as well as the CY flag.<br />The P, OV, and AC flags cannot be directly altered.<br />This group includes:<br />Set, clear, and, or complement, move.<br />Conditional jumps.<br />
  4. 4. CLR &lt;bit&gt;<br />CLR C<br />CLR instruction can operate on the carry flag<br />CLR C<br /> The CARRY flag is set to 0<br />CLR bit<br />CLR instruction can operate on any directly addressable<br /> bit<br />CLR P2.7<br />If Port 2 has been previously written with DCH (11011100),<br />then the operation leaves the port set to 5CH (01011100)<br />
  5. 5. SETB &lt;bit&gt;<br />SETB C<br />SETB instruction operates on the carry flag and sets the specified bit to 1<br />SETB C<br />sets the carry flag to 1 <br />SETB bit<br />SETB instruction operates on any<br /> directly-addressable bit and sets the specified bit to 1<br />SETB P2.0<br />Port 2 has the value of 24H (00100100), the Port 2 value changes to 25H (00100101)<br />
  6. 6. CPL &lt;bit&gt;<br />CPL C<br />This operation complements the carry flag<br />CPL C<br />CPL bit<br />CPL instruction complements any directly addressable Bit<br />CPL P2.2<br />If Port 2 has the value of 53H (01010011) then after the execution the port set to 55H (01010101)<br />
  7. 7. ANL<br />ANL C, &lt;source-bit&gt;<br />This instruction ANDs the bit addressed with the carry bit and stores the result in the carry bit itself<br />ANL C,P2.7 ;AND carry flag with bit 7 of P2<br />ANL C, /&lt;source-bit&gt;<br />If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affected<br />ANL C,/OV ;AND with inverse of OV flag<br />
  8. 8. ORL<br />ORL C, &lt;source-bit&gt;<br />This instruction ORs the bit addressed with the carry bit and stores the result in the carry bit itself<br />ORL C,P2.5 ;OR carry flag with bit 5 of P2<br />ORL C, /&lt;source-bit&gt;<br />If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affected<br />ORL C,/OV ;OR with inverse of OV flag<br />
  9. 9. MOV &lt;dest-bit&gt;,&lt;source-bit&gt;<br />One of the operands must be the carry flag; the other may be any directly-addressable bit<br />MOV C,P3.3<br />MOV P2.0,C<br />If P2=C5H (11000101), P3.3=0 and CY=1 initially, after instructions, P2=C4H (11000100) and CY=0<br />
  10. 10. JC / JNC addr<br />Jump to a relative address if CY is set / cleared.<br />
  11. 11. JB / JNB &lt;bit&gt;,addr<br />Jump to a relative address if a bit is set / cleared.<br />
  12. 12. JBC &lt;bit&gt;,addr<br />Jump to a relative address if a bit is set and clear the bit.<br /> JBC P1.3,ARRAY1<br />If P1=56H (01010110), the above instruction sequence will cause the program to branch to the instruction at ARRAY1, modifying P1 to 52H (01010010)<br />

×