Execute The execution circuitry is centered


Bit 1 of the Status register is the DC flag



Yüklə 284,18 Kb.
səhifə2/5
tarix11.05.2023
ölçüsü284,18 Kb.
#111328
1   2   3   4   5
The PIC16F84 Microcontroller Part 2

Bit 1 of the Status register is the DC flag. This operates in the same manner as the standard C flag but holds the Carry out from the lower nybble to the upper nybble; that is from bit 3 to bit 4. In the same manner DC holds the complement of the Borrow out from bit 3 to bit 4. Knowledge of the Carry activity between the lower and upper halves of the byte is useful where binary coded decimal data is being manipulated. Here each nybble holds a 4-bit representation of the decimal digits 0.9 and the half carry then indicates carries between decimal decades.

Zero flag


Bit 2 of the Status register is the Z flag. This is set whenever the outcome of the instruction is zero, otherwise it is cleared.

Fig. 4.5 The PIC16F84 Status register
Unlike most MCUs, there are no instructions to specifically clear or set a flag, such as sec for SEt Carry.17 However, as the Status register is accessible as a file in the Data store, then any instruction that can alter the contents of a file can potentially change the state of a flag. There is a potential problem in that many of these instructions affect one or more flags (see Table 3.1) as part of their execution logic and this overrides any change that would result from the outcome of the instruction’s execution. For example, clrf 3 actually sets the Z flag to 1 . The Bit Clear File and Bit Set File instructions are recommended where an individual bit in the Status register needs to be altered, as these instructions do not inherently affect these flags. For instance, bsf 3,0 (Set Bit 0 in File 3) is equivalent to sec and bcf 3,2 (Clear Bit 2 in File 3) is equivalent to clz.
STATUS also holds the RP0 bank switching bit. The TO and PD readonly bits shown in Fig. 4.5 give information on what type of reset last occurred (Power-Up when power was applied to the device, Watchdog when the Watchdog timer timed out or External by bringing the MCLR pin low) or if awakened from the sleep instruction. As these are designated as read-only, they cannot be altered as part of the software, only monitored. These status bits will be discussed in Part 3 of the topic.

Yüklə 284,18 Kb.

Dostları ilə paylaş:
1   2   3   4   5




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin