PROGRAMMABLE COUNTER ARRAY

9.3.2Compare Modes

The compare function provides the capability for operating the five modules as timers, event counters, or pulse width modulators. Four modes employ the compare function: 16-bit software timer mode, high-speed output mode, WDT mode, and PWM mode. In the first three of these, the compare/capture module continuously compares the 16-bit PCA timer/counter value with the 16- bit value pre-loaded into the module’s CCAPxH/CCAPxL register pair. In the PWM mode, the module continuously compares the value in the low-byte PCA timer/counter register (CL) with an 8-bit value in the CCAPxL module register. Comparisons are made three times per peripheral cycle to match the fastest PCA timer/counter clocking rate (FOSC/4). For a description of periph- eral cycle timing, see section 2.2.2, “Clock and Reset Unit.”

Setting the ECOMx bit in a module’s mode register (CCAPMx) selects the compare function for that module (Figure 9-9 on page 9-15). To use the modules in the compare modes, observe the following general procedure:

1.Select the module’s mode of operation.

2.Select the input signal for the PCA timer/counter.

3.Load the comparison value into the module’s compare/capture register pair.

4.Set the PCA timer/counter run control bit.

5.After a match causes an interrupt, clear the module’s compare/capture flag.

9.3.316-bit Software Timer Mode

To program a compare/capture module for the 16-bit software timer mode (Figure 9-3), set the ECOMx and MATx bits in the module’s CCAPM x register. Table 9-3 lists the bit combinations for selecting module modes.

Amatch between the PCA timer/counter and the compare/capture registers (CCAPxH/CCAPxL) sets the module’s compare/capture flag (CCFx in the CCON register). This generates an interrupt request if the corresponding interrupt enable bit (ECCFx in the CCAPMx register) is set. Since hardware does not clear the compare/capture flag when the interrupt is processed, the user must clear the flag in software. During the interrupt routine, a new 16-bit compare value can be written to the compare/capture registers (CCAPxH/CCAPxL).

NOTE

To prevent an invalid match while updating these registers, user software should write to CCAPxL first, then CCAPxH. A write to CCAPxL clears the ECOMx bit disabling the compare function, while a write to CCAPxH sets the ECOMx bit re-enabling the compare function.

9-7

Page 161
Image 161
Intel 8XC251SP, 8XC251SA, 8XC251SQ, 8XC251SB, Embedded Microcontroller manual Compare Modes, 3 16-bit Software Timer Mode

Embedded Microcontroller, 8XC251SP, 8XC251SA, 8XC251SQ, 8XC251SB specifications

The Intel 8XC251 series of embedded microcontrollers is a family of versatile and powerful devices, designed to meet the demands of a wide range of applications. With models such as the 8XC251SB, 8XC251SQ, 8XC251SA, and 8XC251SP, this series offers unique features while maintaining a high level of performance and reliability.

At the heart of the 8XC251 microcontrollers is the 8051 architecture, which provides a 16-bit processor capable of executing complex instructions efficiently. This architecture not only allows for a rich instruction set but also facilitates programming in assembly language and higher-level languages like C, which are essential for developing sophisticated embedded systems.

One of the significant features of the 8XC251 family is its integrated peripherals, including timer/counters, serial communication interfaces, and interrupt systems. These peripherals enable developers to implement timing functions, data communication, and real-time processing, all of which are crucial in modern embedded applications. The 8XC251SB and 8XC251SQ models, for instance, come equipped with multiple I/O ports that allow for interfacing with other devices and systems, enhancing their functionality in various environments.

The memory architecture of the 8XC251 devices is noteworthy, featuring on-chip ROM, RAM, and EEPROM. The on-chip memory allows for fast access times, which is essential for executing programs efficiently. Moreover, the EEPROM serves as non-volatile memory, enabling the storage of configuration settings and important data that must be retained even when power is lost.

In terms of operating voltage, the 8XC251 devices are designed to operate in a wide range, typically between 4.0V and 6.0V. This flexibility makes them suitable for battery-powered applications, where energy efficiency is critical. The power management features, including reduced power modes, further enhance their suitability for portable devices.

Lastly, the 8XC251 series is supported by a wide range of development tools and resources, allowing engineers and developers to streamline the development process. This support, combined with the microcontrollers' robust features, makes the Intel 8XC251 family a reliable choice for various embedded applications, such as industrial automation, automotive systems, and consumer electronics.

Overall, the Intel 8XC251SB, 8XC251SQ, 8XC251SA, and 8XC251SP deliver high performance, versatility, and ease of use, making them a preferred choice for embedded system designers looking to develop efficient and effective solutions.