From Microprocessors: From Assembly Language to C Using thePIC18Fxx2
This chapter examines additional features of the PIC18Fxx2 instruction set architecture in the context of unsigned 8bit arithmetic, bitwise logical, and shift operations. These operations are used to implement equality, inequality, and comparison tests for conditional code execution and loop control.
4.1 LEARNING OBJECTIVES
After reading this chapter, you will be able to:

Describe the operation of the bit manipulation instructions of the PIC18 instruction set.

Translate C language statements that perform 8bit addition, subtraction, bitwise logical, and shift operations into PIC18 instruction sequences.

Translate C language statements that perform 8bit zero, nonzero, equality, inequality, and unsigned comparison operations into PIC18 instruction sequences.

Translate C conditional statements and loop structures such as dowhile, whiledo, and for{} into PIC18 instruction sequences.
4.2 BITWISE LOGICAL OPERATIONS, BIT OPERATIONS
Table 4.1 lists the C language arithmetic and logical operators discussed in this book. As seen in the previous chapter, the arithmetic/logic unit (ALU) implements these operations in the processor data path. The previous chapter covered some of the arithmetic capabilities of the ALU such as addition, subtraction, increment, and decrement. The bitwise logical operators & (AND), (OR), ^ (XOR), and ~ (complement) comprise the logical operations performed by the ALU.
Operator  Description 

+,   (+) addition, () subtraction 
++,   (++) increment, () decrement 
*, /  (*) multiplication, (/) division 
>>, <<  right shift (>>), left shift (<<) 
&, , ^  bitwise AND (&), OR (),... 
Products & Services
Topics of Interest
This chapter applies the arithmetic, logical, and shift operations discussed in the previous chapter to extended precision operands; that is, operands that are larger than 8 bits. Furthermore, signed...
Bit manipulation is an important aspect of many highlevel languages. This chapter discusses the logical and bit manipulation instructions supported by the assembly language. Assembly language...
This chapter examines various higher math topics such as multiplication and division operations for unsigned and signed integers, floatingpoint number representation, saturating arithmetic, BCD...
This chapter introduces the hardware side of the PIC18Fxx2 by exploring reset behavior and parallel port IO. In addition, the nuances of writing C code for PIC18Fxx2 applications are examined. 8.1...
VeSPA Instruction Set Mnemonic Opcode Operation Decimal Binary NOP 0 00000 No operation ADD 1 00001 Addition SUB 2 00010 Subtraction OR 3 00011 Bitwise logical OR AND 4 00100 Bitwise logical AND NOT...