← All tools
general

8051 PIC Microcontroller Time Delay

Calculate timer TIC durations, max run-times, and reload values for 8051 PIC microcontrollers.

The 8051 PIC microcontroller's time delay feature makes it possible to integrate precise timing intervals into electronic circuits. It provides exact control over timing operations within the circuit by generating precise delays using the internal clock and software programming of the microcontroller.

To introduce controlled pauses or gaps in program execution, the time delay feature of the 8051 PIC microcontroller is primarily used for this purpose. It makes it possible to synchronize several processes, start certain operations after a predetermined amount of time, and precisely time tasks in applications that include time-sensitive tasks.

The 8051 microcontroller, unveiled by Intel in 1981, represents an 8-bit computing marvel. Renowned for its versatility and ubiquity, it finds extensive application across diverse sectors. Below are salient features of the 8051 microcontroller:

Features

FeatureDescription
Architecture8-bit device adopting Harvard architecture, with distinct buses for program and data transmission
Instruction Set33 single-byte and 7 multi-byte instructions
Memory4KB total — 128 bytes internal RAM and 4KB EPROM
PortsThree 8-bit ports (P0, P1, P2) and one 16-bit port (P3)
Timers/CountersTwo 16-bit timers/counters (Timer 0 and Timer 1)
Serial CommunicationFeatures a Serial Communication Interface (SCI)
Power ConsumptionLow power design, operates at around 10mA

Methods to Generate Time Delay

Method 1: Using the DELAY Subroutine

The DELAY subroutine offers a basic means of creating time delays. Nonetheless, its reliability is limited, as it relies on the count of machine cycles and clock periods per machine cycle — variables that may differ across various 8051 microcontrollers.

Method 2: Using Timers

Timers offer greater precision compared to the DELAY subroutine. Employing timers involves configuring them to produce a set number of clock cycles and subsequently assessing the timer value to ascertain the completion of the delay.

Method 3: Using a Loop

Another approach is employing a loop for creating a time delay. In this method, a counter is decremented within the loop, and the loop continues until the counter reaches zero. While considered more dependable than the DELAY subroutine, it remains reliant on the machine's cycle count per instruction.

Applications

  • Embedded Systems
  • Automation and Control Systems
  • Instrumentation and Measurement
  • Communication Systems
  • Consumer Electronics

Conclusion

When contrasting the PIC microcontroller with the 8051 microcontroller, it's evident that the latter is strictly an 8-bit microcontroller, whereas the PIC microcontroller comes in both 8-bit and 16-bit variants, contingent on the particular model. While renowned for its simplicity and versatility across various applications, the PIC microcontroller boasts a more intricate instruction set and offers advanced functionalities not found in the 8051 microcontroller.

Make use of this online tool to determine your 8051 PIC microcontroller's time delay. To precisely calculate the time delay, simply input the intended run time and the clock frequency.

Formulas

TIC12=1MHz/12T_{IC12} = \frac{1}{MHz / 12}

TIC6=1MHz/6T_{IC6} = \frac{1}{MHz / 6}

8-bit Timer Max Run-Time (12 clock)=TIC12×2561000\text{8-bit Timer Max Run-Time (12 clock)} = \frac{T_{IC12} \times 256}{1000}

8-bit Timer Max Run-Time (6 clock)=TIC6×2561000\text{8-bit Timer Max Run-Time (6 clock)} = \frac{T_{IC6} \times 256}{1000}

16-bit Timer Max Run-Time (12 clock)=TIC12×655361000\text{16-bit Timer Max Run-Time (12 clock)} = \frac{T_{IC12} \times 65536}{1000}

16-bit Timer Max Run-Time (6 clock)=TIC6×655361000\text{16-bit Timer Max Run-Time (6 clock)} = \frac{T_{IC6} \times 65536}{1000}

8-bit DRT Reload Value (12 clock)=256DRTTIC12×1000\text{8-bit DRT Reload Value (12 clock)} = 256 - \frac{DRT}{T_{IC12} \times 1000}

8-bit DRT Reload Value (6 clock)=256DRTTIC6×1000\text{8-bit DRT Reload Value (6 clock)} = 256 - \frac{DRT}{T_{IC6} \times 1000}

16-bit DRT Reload Value (12 clock)=65536DRTTIC12×1000\text{16-bit DRT Reload Value (12 clock)} = 65536 - \frac{DRT}{T_{IC12} \times 1000}

16-bit DRT Reload Value (6 clock)=65536DRTTIC6×1000\text{16-bit DRT Reload Value (6 clock)} = 65536 - \frac{DRT}{T_{IC6} \times 1000}

where:

  • MHzMHz = Clock Frequency in Megahertz
  • DRTDRT = Desired Run Time
  • TIC12T_{IC12} = Time per instruction cycle (12 clock)
  • TIC6T_{IC6} = Time per instruction cycle (6 clock)

Inputs

Operating clock frequency of the microcontroller

Desired duration for the timer to run

Results

Single Timer TIC Duration — Standard 12-Clock Parts0.3750µsTIC duration for standard 12-clock cycle parts
Single Timer TIC Duration — Enhanced 6-Clock Parts0.1880µsTIC duration for enhanced 6-clock cycle parts
8-bit Timer Counter Max Run-Time — Standard 12-Clock Parts0.0960µsMaximum run-time for 8-bit timer with standard 12-clock parts
8-bit Timer Counter Max Run-Time — Enhanced 6-Clock Parts0.0480µsMaximum run-time for 8-bit timer with enhanced 6-clock parts
16-bit Timer Counter Max Run-Time — Standard 12-Clock Parts24.58µsMaximum run-time for 16-bit timer with standard 12-clock parts
16-bit Timer Counter Max Run-Time — Enhanced 6-Clock Parts12.32µsMaximum run-time for 16-bit timer with enhanced 6-clock parts
8-bit DRT Reload Value — Standard 12-Clock Parts-149077.3µs8-bit timer reload value for desired run-time with standard 12-clock parts
8-bit DRT Reload Value — Enhanced 6-Clock Parts-297616.3µs8-bit timer reload value for desired run-time with enhanced 6-clock parts
16-bit DRT Reload Value — Standard 12-Clock Parts-83797.3µs16-bit timer reload value for desired run-time with standard 12-clock parts
16-bit DRT Reload Value — Enhanced 6-Clock Parts-232336.3µs16-bit timer reload value for desired run-time with enhanced 6-clock parts