8XC251SA, SB, SP, SQ USER’S MANUAL

3.Enter an eight-bit reload value (nR) in register TH0. This can be the same as n0 or different, depending on the application.

4.Set the TR0 bit in the TCON register (Figure 8-6) to start the timer. Timer overflow occurs

after FFH + 1 - n0 peripheral cycles, setting the TF0 flag and loading nR into TL0 from TH0. When the interrupt is serviced, hardware clears TF0.

5.The timer continues to overflow and generate interrupt requests every FFH + 1 - nR peripheral cycles.

6.To halt the timer, clear the TR0 bit.

8.5.2Pulse Width Measurements

For timer 0 and timer 1, setting GATEx and TRx allows an external waveform at pin INTx# to turn the timer on and off. This setup can be used to measure the width of a positive-going pulse present at pin INTx#. Pulse width measurements using timer 0 in mode 1 can be made as follows:

1.Program the four low-order bits of the TMOD register (Figure 8-5) to specify: mode 1 for

timer 0, C/T0# = 0 to select FOSC/12 as the timer input, and GATE0 = 1 to select INT0 as timer run control.

2.Enter an initial value of all zeros in the 16-bit timer register TH0/TL0, or read and store the current contents of the register.

3.Set the TR0 bit in the TCON register (Figure 8-6) to enable INT0.

4.Apply the pulse to be measured to pin INT0. The timer runs when the waveform is high.

5.Clear the TR0 bit to disable INT0.

6.Read timer register TH0/TL0 to obtain the new value.

7.Calculate pulse width = 12 TOSC × (new value - initial value).

8.Example: FOSC = 16 MHz and 12TOSC = 750 ns. If the new value = 10,00010 and the initial value = 0, the pulse width = 750 ns × 10,000 = 7.5 ms.

8.6TIMER 2

Timer 2 is a 16-bit timer/counter. The count is maintained by two eight-bit timer registers, TH2 and TL2, connected in cascade. The timer/counter 2 mode control register (T2MOD, as shown in Figure 8-11 on page 8-16) and the timer/counter 2 control register (T2CON, as shown in Figure 8-12 on page 8-17) control the operation of timer 2.

8-10

Page 144
Image 144
Intel Embedded Microcontroller, 8XC251SA, 8XC251SP, 8XC251SQ, 8XC251SB manual Pulse Width Measurements, Timer

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.