ABSTRACT

This chapter examines the fundamental arithmetic and logical operations of digital machines. It explores a background for developing processing routines which involve decisions, data filtering and processing, and number crunching. The chapter discusses logical and arithmetic operations in general, that is, without reference to any individual processor. It outlines the material related to data type conversions since these operations are closely related to the other material. All microcontrollers contain instructions to perform arithmetic and logic transformations on binary or decimal operands. In the context of digital arithmetic and logic the data word-size determines the processing capabilities of each device. Although microcontrollers are binary devices, the instruction set often includes operations for performing arithmetic on binary coded decimal numbers. Some high-end microcontrollers contain a primitive instruction that executes the decimal adjustment automatically, that is, without having to test the sum. Many microcontrollers are one-byte machines, so operands and results for arithmetic operations must be contained within eight bits.