# Microcontrollers

## Logic Instructions (Microcontrollers)

2.3 Logic instructions (see Table 2.6) are used to set and clear individual bits in A, B, and CCR. They are used by compilers, programs that translate high-level languages to machine code, to manipulate bits to generate machine code. They are used by controllers of machinery because bits are used to turn things on and […]

## Edit Instructions (Microcontrollers)

2.4 Edit instructions (see Table 2.7) rearrange bits of data without generating new bits as an ADD does. Large machines have complex edit instructions, but microcomputers have simple ones. For example, the arithmetic shift-left instructions shift all the bits left, putting the most significant bit into the carry bit of the condition code register and […]

## Input-Output Instructions (Microcontrollers)

2.6 The last class of instructions for the 6812, the input-output or I/O class, is easy to describe because there aren’t any! With the 6812 a byte is transferred between an accumulator and a register in an I/O device through a memory location chosen by hardware. The ldaa instruction with that location then inputs a […]

## Control Instructions (Microcontrollers)

2.5 The next class of instructions, the control instructions, are those that affect the program counter PC. After the MOVE class, this class composes the most-often-used instructions. Control instructions are divided into conditional branching instructions and other control instructions. We discuss conditional branching first and then the others. The bra instruction loads the PC with […]

## Special Instructions (Microcontrollers)

2.7 Table 2.10 lists 6812′s special instructions, which are arithmetic instructions of primary interest in fuzzy logic. They use index addressing, which is discussed in the next topic. Fuzzy logic uses minimum and maximum functions to logically AND and OR fuzzy variables. The 6812 has instructions max a, maxm, mina, minm, emaxd, emaxm. emind, and […]

## Remarks (Microcontrollers)

2.8 One might wonder why some move instructions, such as LDAA, TSTA, and STAA, always put V = 0 rather than leaving V unchanged as they do C. The reason is that doing so allows all of the signed branches to work after these instructions as well as after the arithmetic type of instruction. For […]

In the past two topics, we have introduced the instruction cycle and the instruction set. We have used a few addressing modes in order to understand those ideas. However, we did not attempt to convey the principles of addressing modes. We now complete our understanding of the instruction by describing the addressing modes used in […]

## OP Code Byte Addressing Modes (Microcontrollers)

3.1 This section discusses addressing that is selected in the opcode byte, which is generally the first byte of the instruction. We have already introduced this idea in an ad hoc manner in topic 1 when we discussed implied, immediate, and direct addressing. Now we add page zero addressing and explain when each address mode […]

## Post-Byte Index Addressing Modes (Microcontrollers)

3.2 This section introduces a collection of addressing modes that are encoded in a post byte and that use index registers in the address calculation. To improve efficiency, the controller is often provided with a few registers that could be used to obtain the effective address. These registers are called pointer or index registers. Obtaining […]

## Relative Addressing and Position Independence (Microcontrollers)

3.3 The microcomputer is very much like any other computer; however, the use of ROMs in microcomputers raises an interesting problem that is met by the last mode of addressing that we discuss. The problem is that a program may be put in a ROM such that the Figure 3.8. Simplified Control Hardware for Relative […]