The document discusses various aspects of programming timers and counters in the 8051 microcontroller. It explains that the 8051 has two timers/counters that can be used for time delay or counting external events. It describes the timer registers TH0, TL0, TH1 and TL1 and how to access them. It also explains the TMOD register used to set the timer modes, and the different modes like 16-bit, 8-bit auto reload and split timer modes. Finally, it provides examples of programming the timers for different applications like time delay, pulse generation, frequency measurement etc.
Timer programming for 8051 using embedded cVikas Dongre
The document discusses the timers and counters of the 8051 microcontroller. It describes that the 8051 has two 16-bit timers/counters that can be used as timers to generate delays or as event counters. These timers are accessed as two 8-bit registers - a low byte register (TL0/TL1) and high byte register (TH0/TH1). It also explains the timer mode register TMOD and provides code examples to use the timers for generating delays and frequencies.
The document discusses the timers and timer modes of the 8051 microcontroller. It has two 16-bit timers, Timer 0 and Timer 1, each made up of two 8-bit registers TH and TL. The TMOD register sets the timer modes and operations, while TCON controls the timer run/stop bits. There are four timer modes - mode 0 is a 13-bit timer, mode 1 is a 16-bit timer, mode 2 is an 8-bit auto-reload timer, and mode 3 splits timer 0 into two 8-bit timers using TH0 and TL0.
The document discusses using timers on the 8051 microcontroller to generate square waves and delays. It covers the registers used to control the timers, such as TMOD and TCON. It provides pseudocode for generating delays using Timer 1 in mode 1 and mode 2. It also discusses how to use the timers to generate frequencies by outputting square waves and producing PWM signals. The document explains how the timers can be used to count external events. Finally, it lists the Proteus devices needed for the lab and outlines the tasks to be completed, which include generating a frequency and submitting a lab manual.
The document discusses the timers/counters of the 8051 microcontroller. It describes:
1) The two timers/counters - timer/counter 0 and timer/counter 1 that can be used as timers or event counters.
2) How the timers work using internal clock pulses to count up and trigger interrupts when they overflow.
3) The timer mode and control registers that are used to configure the timers for different modes and start/stop them.
4) Examples of using the timers to generate delays and square waves for applications like measuring wheel rotations.
The document discusses timers and counters on the MCS-51 microcontroller. It describes the timer registers TMOD, TCON, THx and TLx. It explains the four modes of the timers and how to set the mode using the TMOD register. Examples are provided to calculate delays generated by timers based on settings of the THx and TLx registers. Programming techniques like DJNZ are also demonstrated for repeated timing loops.
The document discusses different approaches to using timers/counters in 8051 microcontrollers. It describes software-based, hardware-based, and combined approaches. It provides details on registers used for timers like TH0, TL0, TMOD, and TCON. It explains how to use these registers to initialize and control timers, and provides examples of generating square waves using timers.
The document discusses timer programming for the 8051 microcontroller. It contains the following information:
- The 8051 has two timers/counters that can be used as timers to generate time delays or as event counters.
- Timers use 1/12 of the crystal frequency as the input clock. Registers like TH0, TL0, TMOD, and TCON are used to program and control the timers.
- Timer Mode 1 is a 16-bit timer mode where the TH and TL registers increment continuously until they roll over, setting the timer flag. Programming involves initializing the registers, starting the timer, and monitoring the flag.
Here is the program to generate a 50 Hz square wave on P2.3:
```
MOV TMOD, #01H ; Timer 1, mode 1
MOV TH1, #DCH
MOV TL1, #00H
SETB TR1 ; Start timer 1
AGAIN:
JNB TF1, AGAIN; Wait for overflow
CPL P2.3 ; Toggle P2.3
CLR TF1 ; Clear overflow flag
SJMP AGAIN ; Repeat
```
This program uses Timer 1 in mode 1 (16-bit auto-reload) with TH1=DC00h and TL1=00h to generate a 10 ms delay
Timer programming for 8051 using embedded cVikas Dongre
The document discusses the timers and counters of the 8051 microcontroller. It describes that the 8051 has two 16-bit timers/counters that can be used as timers to generate delays or as event counters. These timers are accessed as two 8-bit registers - a low byte register (TL0/TL1) and high byte register (TH0/TH1). It also explains the timer mode register TMOD and provides code examples to use the timers for generating delays and frequencies.
The document discusses the timers and timer modes of the 8051 microcontroller. It has two 16-bit timers, Timer 0 and Timer 1, each made up of two 8-bit registers TH and TL. The TMOD register sets the timer modes and operations, while TCON controls the timer run/stop bits. There are four timer modes - mode 0 is a 13-bit timer, mode 1 is a 16-bit timer, mode 2 is an 8-bit auto-reload timer, and mode 3 splits timer 0 into two 8-bit timers using TH0 and TL0.
The document discusses using timers on the 8051 microcontroller to generate square waves and delays. It covers the registers used to control the timers, such as TMOD and TCON. It provides pseudocode for generating delays using Timer 1 in mode 1 and mode 2. It also discusses how to use the timers to generate frequencies by outputting square waves and producing PWM signals. The document explains how the timers can be used to count external events. Finally, it lists the Proteus devices needed for the lab and outlines the tasks to be completed, which include generating a frequency and submitting a lab manual.
The document discusses the timers/counters of the 8051 microcontroller. It describes:
1) The two timers/counters - timer/counter 0 and timer/counter 1 that can be used as timers or event counters.
2) How the timers work using internal clock pulses to count up and trigger interrupts when they overflow.
3) The timer mode and control registers that are used to configure the timers for different modes and start/stop them.
4) Examples of using the timers to generate delays and square waves for applications like measuring wheel rotations.
The document discusses timers and counters on the MCS-51 microcontroller. It describes the timer registers TMOD, TCON, THx and TLx. It explains the four modes of the timers and how to set the mode using the TMOD register. Examples are provided to calculate delays generated by timers based on settings of the THx and TLx registers. Programming techniques like DJNZ are also demonstrated for repeated timing loops.
The document discusses different approaches to using timers/counters in 8051 microcontrollers. It describes software-based, hardware-based, and combined approaches. It provides details on registers used for timers like TH0, TL0, TMOD, and TCON. It explains how to use these registers to initialize and control timers, and provides examples of generating square waves using timers.
The document discusses timer programming for the 8051 microcontroller. It contains the following information:
- The 8051 has two timers/counters that can be used as timers to generate time delays or as event counters.
- Timers use 1/12 of the crystal frequency as the input clock. Registers like TH0, TL0, TMOD, and TCON are used to program and control the timers.
- Timer Mode 1 is a 16-bit timer mode where the TH and TL registers increment continuously until they roll over, setting the timer flag. Programming involves initializing the registers, starting the timer, and monitoring the flag.
Here is the program to generate a 50 Hz square wave on P2.3:
```
MOV TMOD, #01H ; Timer 1, mode 1
MOV TH1, #DCH
MOV TL1, #00H
SETB TR1 ; Start timer 1
AGAIN:
JNB TF1, AGAIN; Wait for overflow
CPL P2.3 ; Toggle P2.3
CLR TF1 ; Clear overflow flag
SJMP AGAIN ; Repeat
```
This program uses Timer 1 in mode 1 (16-bit auto-reload) with TH1=DC00h and TL1=00h to generate a 10 ms delay
- The document discusses timer programming for the 8051 microcontroller.
- It describes the two timers, Timer 0 and Timer 1, which are each 16-bit timers that are accessed as two 8-bit registers - a low byte (TLx) and high byte (THx).
- The TMOD register is used to set the operating mode of the timers, with the lower 4 bits for Timer 0 and upper 4 bits for Timer 1. The modes include 16-bit, 13-bit, split timer, and 8-bit auto-reload.
The document discusses the timers of the Intel 8051 microcontroller. It describes that the 8051 has two 16-bit timers, Timer 0 and Timer 1, that are located in Special Function Registers. The timers can be configured and operated individually. They can be used to generate time intervals, count external events, and generate baud rates. The document explains how the timers work, including how they increment each machine cycle and overflow after reaching their maximum value of FFFF hexadecimal. It also covers the Timer Mode Register (TMOD) and Timer Control Register (TCON) that are used to configure the operating modes and control the timers.
The document discusses the timers and counters of the 8051 microcontroller. It describes the registers used including TMOD and TCON. TMOD is used to select the mode of operation for timers 0 and 1. TCON controls the running of the timers using TR bits and indicates overflow using TF bits. Four modes of operation are described for the timers - 13-bit, 16-bit, 8-bit auto reload, and split timer. The timers can also be used as event counters by connecting an external signal to the T0 and T1 pins and setting the appropriate bits in TMOD.
The document discusses programming timers and counters in the 8051 microcontroller. It describes the two timers/counters in the 8051, timer 0 and timer 1. It explains how to use the timers as timers or counters through settings in the TMOD register. The basic registers for the timers like TH0, TL0, TH1, TL1 are described. Programming examples are provided to illustrate how to set the timer values, start and stop the timers, and generate delays.
8051 timer counter
Introduction
TMOD Register
TCON Register
Modes of Operation
Counters
The microcontroller 8051 has two 16 bit Timer/ Counter registers namely Timer 0 (T0) and Timer 1 (T1) .
When used as a “Timer” the microcontroller is programmed to count the internal clock pulse.
When used as a “Counter” the microcontroller is programmed to count external pulses.
Maximum count rate is 1/24 of the oscillator frequency.
The document discusses timers and counters in 8051 microcontrollers. It describes the two timers, T0 and T1, which consist of register pairs that can count pulses from the microcontroller's oscillator or external sources. The TMOD register selects the operational mode for each timer, including modes that configure the timers as 8-bit, 13-bit, or 16-bit counters. The document explains how the timers count pulses and overflow values in each register. It also discusses the TCON register which controls enabling and disabling the timers.
The document discusses timer programming on 8-bit microcontrollers. It describes the different timer modes, how to program timer 1 in 16-bit mode, how the timer clock frequency is related to the crystal oscillator frequency, examples of generating delays and square waves using timers, and calculating timer values for desired delays. Assignments are provided to write C programs using timers to toggle pins with different delays.
The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate.
The presentation explain about the timers and associated registers in 8051
The document describes the timers/counters functionality of the 8051 microcontroller. It contains the following key details:
- The 8051 has two 16-bit timer/counters that can be independently programmed as timers or event counters.
- There are four special function registers (SFRs) associated with timer/counter operation: TMOD for timer mode control, TCON for timer control, and TH0/TL0 and TH1/TL1 for Timer 0 and Timer 1 values.
- The timers can be configured into four modes using the M1 and M0 bits in TMOD: 13-bit counter, 16-bit counter, 8-bit counter with auto-reload, and split operation
The document discusses timer operation on the 8051 microcontroller. It describes how timers work using divide-by-2 flip flops to divide the clock frequency. There are two 16-bit timers on the 8051 and an additional 16-bit timer on the 8052. Timers can be used for interval timing, event counting, or baud rate generation. Various timer modes and registers for controlling and accessing the timers are also described.
This document contains lecture notes on timers for microcontroller systems. It discusses interval timing, event counting, and baud rate generation using two 16-bit timers. It provides details on the four operating modes of the timers and examples of calculating reload values needed to generate delays of 20ms under different oscillator frequencies. Maximum delay times for each timer in mode 1 are also calculated. An example assembly language program to generate a 20ms delay using Timer 0 is given. Feedback is requested to improve the course.
Timers and counters in a PLC are made up of three 16-bit words for the preset value, accumulated value, and status bits. Timers include on-delay, off-delay, and retentive timers, while counters include up and down counters. The various timer and counter instructions are used to control the timers and counters.
The document discusses timers/counters in 8051 microcontrollers. It describes their main applications as time-based functions like delays and event counting. The 8051 has two 16-bit timers/counters (Timer 0 and Timer 1) that can be configured through the TMOD and TCON registers. Timer 0 and Timer 1 can each operate in one of four modes that determine how the TH and TL registers are used to time or count events. The document provides steps for programming the timers in each of the four modes.
The document describes an 8051-based digital clock application that uses timers and interrupts. It configures Timer 0 to generate interrupts every 50ms by overflowing every 46080 cycles. Timer 1 is used to generate a 19200 baud rate for a serial port. On each Timer 0 interrupt, the clock display is updated. By generating interrupts every 50ms and counting 20 of them for 1 second, the timer configuration provides an approximate 1 second timer without exceeding the 8051's 65536 cycle limit.
Timer And Counter in 8051 MicrocontrollerJay Makwana
This document describes timers and counters in the 8051 microcontroller. It discusses the two timers/counters - Timer/Counter 0 and Timer/Counter 1. It explains the registers used - the 16-bit Timer registers TH0, TL0, TH1, TL1, the 8-bit mode register TMOD, and the 8-bit control register TCON. It provides details on how to select the timer modes using TMOD and how to use the timers, including setting initial values, starting the timer, and responding when registers equal 0. Application examples for the 8051 microcontroller are also given such as in embedded systems, industrial equipment, and computer networking.
PIC18 TIMER PROGRAMMING IN ASSEMBLY AND Craosandy11
The document discusses timer programming for PIC18 microcontrollers. It explains that PIC18 families have 2-5 timers that can be used to generate time delays or count external events. Each timer is accessed through low and high byte registers and has a control register. The document provides details on programming and using timers 0-3 in both assembly and C, including how to set modes, load values, and respond to overflow flags. It describes using timers as both clocks and counters, with options to select clock sources and apply prescaling.
Timers in microcontrollers can serve three main functions: keeping time, counting events, and generating baud rates for serial communication. The 89C51 microcontroller has two timers, Timer 0 and Timer 1, which can be configured to operate in different modes like 16-bit or 8-bit auto-reload. These timers keep time based on the microcontroller's crystal oscillator frequency and increment with each machine cycle. Their values can be read from special function registers to measure time intervals or count events.
The document discusses the CCP (Capture/Compare/PWM) modules on the PIC18F452 microcontroller. It describes that there are two CCP modules, CCP1 and CCP2, each with their own control register. It also describes the compare mode operation where the CCPRx registers are constantly compared against the timer registers to control the state of the CCP pins. The document provides details on the timer selection, special event triggering, and register configuration for capture, compare, and timer modes. It includes code examples to configure compare mode for toggling an LED and capture mode to measure pulse widths.
This document discusses timers, the CCP module, ADC, and serial communication in PIC microcontrollers. It provides details on the different timer modules including Timer 0, Timer 1, and Timer 2, and describes their control and count registers. It also summarizes the functions of the CCP module, ADC module, and components used for serial communication like TXSTA, RCSTA, and related registers.
The document analyzes the design elements of a music magazine cover and contents page. It discusses how the masthead, images, text, and color scheme are used to attract the target audience of teenage music fans. Elements like the cover stars, headline, and price make the magazine appealing to buyers. The contents page then lists the articles in an easy-to-read format to encourage readers to explore the issues.
The document describes the process of designing the front cover of a magazine. The designer experimented with different fonts, colors, and images before settling on a design featuring a picture of a guitarist holding an acoustic guitar and microphone, with large cover lines advertising stories and a free CD being offered. Additional elements like issue details and price were added to clearly communicate key information to potential buyers and help attract consumers. The final design is intended to convey that this is a pop genre magazine appealing to both genders with interesting content to entice readers to purchase the first issue.
- The document discusses timer programming for the 8051 microcontroller.
- It describes the two timers, Timer 0 and Timer 1, which are each 16-bit timers that are accessed as two 8-bit registers - a low byte (TLx) and high byte (THx).
- The TMOD register is used to set the operating mode of the timers, with the lower 4 bits for Timer 0 and upper 4 bits for Timer 1. The modes include 16-bit, 13-bit, split timer, and 8-bit auto-reload.
The document discusses the timers of the Intel 8051 microcontroller. It describes that the 8051 has two 16-bit timers, Timer 0 and Timer 1, that are located in Special Function Registers. The timers can be configured and operated individually. They can be used to generate time intervals, count external events, and generate baud rates. The document explains how the timers work, including how they increment each machine cycle and overflow after reaching their maximum value of FFFF hexadecimal. It also covers the Timer Mode Register (TMOD) and Timer Control Register (TCON) that are used to configure the operating modes and control the timers.
The document discusses the timers and counters of the 8051 microcontroller. It describes the registers used including TMOD and TCON. TMOD is used to select the mode of operation for timers 0 and 1. TCON controls the running of the timers using TR bits and indicates overflow using TF bits. Four modes of operation are described for the timers - 13-bit, 16-bit, 8-bit auto reload, and split timer. The timers can also be used as event counters by connecting an external signal to the T0 and T1 pins and setting the appropriate bits in TMOD.
The document discusses programming timers and counters in the 8051 microcontroller. It describes the two timers/counters in the 8051, timer 0 and timer 1. It explains how to use the timers as timers or counters through settings in the TMOD register. The basic registers for the timers like TH0, TL0, TH1, TL1 are described. Programming examples are provided to illustrate how to set the timer values, start and stop the timers, and generate delays.
8051 timer counter
Introduction
TMOD Register
TCON Register
Modes of Operation
Counters
The microcontroller 8051 has two 16 bit Timer/ Counter registers namely Timer 0 (T0) and Timer 1 (T1) .
When used as a “Timer” the microcontroller is programmed to count the internal clock pulse.
When used as a “Counter” the microcontroller is programmed to count external pulses.
Maximum count rate is 1/24 of the oscillator frequency.
The document discusses timers and counters in 8051 microcontrollers. It describes the two timers, T0 and T1, which consist of register pairs that can count pulses from the microcontroller's oscillator or external sources. The TMOD register selects the operational mode for each timer, including modes that configure the timers as 8-bit, 13-bit, or 16-bit counters. The document explains how the timers count pulses and overflow values in each register. It also discusses the TCON register which controls enabling and disabling the timers.
The document discusses timer programming on 8-bit microcontrollers. It describes the different timer modes, how to program timer 1 in 16-bit mode, how the timer clock frequency is related to the crystal oscillator frequency, examples of generating delays and square waves using timers, and calculating timer values for desired delays. Assignments are provided to write C programs using timers to toggle pins with different delays.
The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate.
The presentation explain about the timers and associated registers in 8051
The document describes the timers/counters functionality of the 8051 microcontroller. It contains the following key details:
- The 8051 has two 16-bit timer/counters that can be independently programmed as timers or event counters.
- There are four special function registers (SFRs) associated with timer/counter operation: TMOD for timer mode control, TCON for timer control, and TH0/TL0 and TH1/TL1 for Timer 0 and Timer 1 values.
- The timers can be configured into four modes using the M1 and M0 bits in TMOD: 13-bit counter, 16-bit counter, 8-bit counter with auto-reload, and split operation
The document discusses timer operation on the 8051 microcontroller. It describes how timers work using divide-by-2 flip flops to divide the clock frequency. There are two 16-bit timers on the 8051 and an additional 16-bit timer on the 8052. Timers can be used for interval timing, event counting, or baud rate generation. Various timer modes and registers for controlling and accessing the timers are also described.
This document contains lecture notes on timers for microcontroller systems. It discusses interval timing, event counting, and baud rate generation using two 16-bit timers. It provides details on the four operating modes of the timers and examples of calculating reload values needed to generate delays of 20ms under different oscillator frequencies. Maximum delay times for each timer in mode 1 are also calculated. An example assembly language program to generate a 20ms delay using Timer 0 is given. Feedback is requested to improve the course.
Timers and counters in a PLC are made up of three 16-bit words for the preset value, accumulated value, and status bits. Timers include on-delay, off-delay, and retentive timers, while counters include up and down counters. The various timer and counter instructions are used to control the timers and counters.
The document discusses timers/counters in 8051 microcontrollers. It describes their main applications as time-based functions like delays and event counting. The 8051 has two 16-bit timers/counters (Timer 0 and Timer 1) that can be configured through the TMOD and TCON registers. Timer 0 and Timer 1 can each operate in one of four modes that determine how the TH and TL registers are used to time or count events. The document provides steps for programming the timers in each of the four modes.
The document describes an 8051-based digital clock application that uses timers and interrupts. It configures Timer 0 to generate interrupts every 50ms by overflowing every 46080 cycles. Timer 1 is used to generate a 19200 baud rate for a serial port. On each Timer 0 interrupt, the clock display is updated. By generating interrupts every 50ms and counting 20 of them for 1 second, the timer configuration provides an approximate 1 second timer without exceeding the 8051's 65536 cycle limit.
Timer And Counter in 8051 MicrocontrollerJay Makwana
This document describes timers and counters in the 8051 microcontroller. It discusses the two timers/counters - Timer/Counter 0 and Timer/Counter 1. It explains the registers used - the 16-bit Timer registers TH0, TL0, TH1, TL1, the 8-bit mode register TMOD, and the 8-bit control register TCON. It provides details on how to select the timer modes using TMOD and how to use the timers, including setting initial values, starting the timer, and responding when registers equal 0. Application examples for the 8051 microcontroller are also given such as in embedded systems, industrial equipment, and computer networking.
PIC18 TIMER PROGRAMMING IN ASSEMBLY AND Craosandy11
The document discusses timer programming for PIC18 microcontrollers. It explains that PIC18 families have 2-5 timers that can be used to generate time delays or count external events. Each timer is accessed through low and high byte registers and has a control register. The document provides details on programming and using timers 0-3 in both assembly and C, including how to set modes, load values, and respond to overflow flags. It describes using timers as both clocks and counters, with options to select clock sources and apply prescaling.
Timers in microcontrollers can serve three main functions: keeping time, counting events, and generating baud rates for serial communication. The 89C51 microcontroller has two timers, Timer 0 and Timer 1, which can be configured to operate in different modes like 16-bit or 8-bit auto-reload. These timers keep time based on the microcontroller's crystal oscillator frequency and increment with each machine cycle. Their values can be read from special function registers to measure time intervals or count events.
The document discusses the CCP (Capture/Compare/PWM) modules on the PIC18F452 microcontroller. It describes that there are two CCP modules, CCP1 and CCP2, each with their own control register. It also describes the compare mode operation where the CCPRx registers are constantly compared against the timer registers to control the state of the CCP pins. The document provides details on the timer selection, special event triggering, and register configuration for capture, compare, and timer modes. It includes code examples to configure compare mode for toggling an LED and capture mode to measure pulse widths.
This document discusses timers, the CCP module, ADC, and serial communication in PIC microcontrollers. It provides details on the different timer modules including Timer 0, Timer 1, and Timer 2, and describes their control and count registers. It also summarizes the functions of the CCP module, ADC module, and components used for serial communication like TXSTA, RCSTA, and related registers.
The document analyzes the design elements of a music magazine cover and contents page. It discusses how the masthead, images, text, and color scheme are used to attract the target audience of teenage music fans. Elements like the cover stars, headline, and price make the magazine appealing to buyers. The contents page then lists the articles in an easy-to-read format to encourage readers to explore the issues.
The document describes the process of designing the front cover of a magazine. The designer experimented with different fonts, colors, and images before settling on a design featuring a picture of a guitarist holding an acoustic guitar and microphone, with large cover lines advertising stories and a free CD being offered. Additional elements like issue details and price were added to clearly communicate key information to potential buyers and help attract consumers. The final design is intended to convey that this is a pop genre magazine appealing to both genders with interesting content to entice readers to purchase the first issue.
Applications of microcontroller(8051) vijaydeepakg
The document discusses various applications of microcontrollers including the 8051 microcontroller. It describes how microcontrollers can be used in mobile phones, automobiles, consumer electronics and more. It also provides examples of using microcontrollers to interface with displays like 7-segment LEDs and LCDs. Circuit diagrams and code are given to illustrate controlling stepper motors and reading input pins to control stepper motor direction.
This document provides an overview of dividends from Kaviattu College of Education. It defines dividends as the profits of a company distributed to shareholders. There are different types of dividends including cash, stock, and property dividends. The document also discusses factors that affect dividend decisions, including internal factors like legal issues and external factors like the state of the economy. Dividend decisions balance returning profits to shareholders with retaining earnings for company needs.
This document provides an overview of dividends from Kaviattu College of Education. It defines dividends as the profits of a company distributed to shareholders. There are different types of dividends including cash, stock, and property dividends. The document also discusses factors that affect dividend decisions, separating them into internal factors like legal issues and external factors like the state of the economy. Overall, the document outlines what dividends are and lists some of the considerations that go into setting a company's dividend policy.
The document provides an introduction to the TMS320F2812 digital signal controller. It begins with definitions of common computing terms like microprocessor, microcontroller, digital signal processor, and digital signal controller. It then compares these terms. The document discusses the architecture of microprocessors, microcontrollers, and digital signal processors. It provides details on the features and architecture of the TMS320F2812, including its CPU, memory, peripherals, math units, and internal bus structure. It describes how the TMS320F2812 combines the processing power of a digital signal processor with memory and peripherals on a single chip.
The document describes various data transfer and branching instructions in 8051 assembly language. It explains instructions like MOV, MOVC, MOVX that transfer data between registers and memory. It also covers conditional and unconditional jump instructions like JZ, JNZ, DJNZ, JNC that control program flow. Examples are given to illustrate the use of these instructions for operations like loading values, complementing data, and creating time delays.
This document discusses several teen pop magazines, including their target demographics, typical content, and branding strategies. Smash Hits and Pop Up magazines aimed at 13-15 year old girls and included celebrity interviews, quizzes, posters and free gifts. Billboard focuses on music charts and news for a broader audience. The document examines magazine covers, finding they feature instantly recognizable pop stars to attract readers, both male and female. Front covers promote exclusive interviews and gifts to entice purchases.
This document provides an overview of memory and registers in the 8051 microcontroller. It discusses the on-chip ROM and RAM memory, as well as the various registers including the 8-bit registers (A, B, R0-R7) and 16-bit registers (DPTR, PC). It also covers the register banks and stack area in RAM, as well as data types and directives like DB and EQU that can be used to define data. Finally, it discusses addressing modes and instruction formats for the 8051 assembly language.
The document discusses interfacing a keyboard and DC motor to an 8051 microcontroller. It describes using a keyboard scanning technique to identify pressed keys using a row and column arrangement. It also discusses issues with keyboard interfacing like debouncing and multiple key presses. The document provides code to interface a 4x4 keyboard and read the pressed key. It also discusses using a DC motor interface for unidirectional and bidirectional control based on the status of a switch.
The document discusses the architecture of the 8085 microprocessor. It describes that the 8085 is an 8-bit microprocessor introduced by Intel in the mid-1970s. It has 40 pins and can address up to 64KB of memory. The 8085 uses three buses - address bus, data bus, and control/status bus - to perform memory read, memory write, I/O read, and I/O write operations. It has registers like accumulator, flags, program counter, stack pointer and temporary registers. The arithmetic logic unit performs arithmetic and logic operations. It also describes the address buffer, interrupt control, and serial I/O capabilities of the 8085 microprocessor.
This document contains information about programming microcontrollers using C language including Keil and Proteus software. It provides examples of programs to generate square waves with varying frequency and duty cycle and sense analog signals using an ADC. The programs demonstrate using timers to create delays, interrupts for inputs, and reading analog sensor values to display on ports. The document discusses requirements for microcontroller applications and solutions for meeting needs like providing gate signals, sensing voltage, current, and speed.
This document discusses interrupt programming on the 8051 microcontroller. It covers interrupt basics like interrupt service routines and interrupt priority. It then discusses programming different interrupt sources on the 8051 including timer interrupts, external hardware interrupts, and serial communication interrupts. Code examples are provided to demonstrate how to program each interrupt. The document also discusses interrupt programming in C for the 8051.
La pandemia de COVID-19 ha tenido un impacto significativo en la economía mundial. Muchos países experimentaron fuertes caídas en el PIB y aumentos en el desempleo debido a los cierres generalizados. Ahora, a medida que se levantan las restricciones, la recuperación económica será gradual a medida que los consumidores y las empresas se readaptan a la nueva normalidad.
This document discusses methods of wage payment, focusing on the time rate system. It explains that under the time rate system, wages are paid based on the time a worker spends on the job. The total wages equal the time spent multiplied by the hourly or other time-based rate. Key advantages of the time rate system are that it is simple to calculate, guarantees workers a minimum wage, and pays all workers in the same category equally for their time.
This document discusses deploying Django apps using Docker. Docker allows encapsulating apps from the host system in "containers" to make deployment repeatable without interfering with other host configurations. Key Docker terms include Dockerfile (commands to build images), images (snapshots of lightweight VMs), and containers (running instances of images). The document provides commands for building/running images and entering containers. It recommends getting a cheap VM from Digital Ocean with Docker preinstalled to easily test and use Docker.
Brand content et evenementiel : pari gagnantLabCom
Conférence LabCom du 22/11 sur la thématique "Brand content et évènementiel : pari gagnant?" avec les intervenants suivants:
- Jeanne Bordeau, Présidente de l’Institut de la qualité de l’expression,
- Cyril Paglino, Digital entrepreneur et Fondateur de l’agence Wizee,
- Georges Mohammed-Chérif, Fondateur et CEO de l’agence Buzzman,
- Charlotte, Chargée des relations consommateurs, réseaux sociaux et médias chez Michel & Augustin.
Cinéma - Les bonnes pratiques pour promouvoir un film sur FacebookBenjamin Martin
J’ai réalisé ce document afin de vous permettre de comprendre les principes de base d’une communication réussie sur Facebook. Il n’y a pas de stratégie miracle, chaque stratégie adoptée doit correspondre parfaitement à l’identité du film promu, et ce, de façon créative afin de vous démarquer.
The document provides an overview of timer programming and serial communication interfacing with the 8051 microcontroller. It discusses the different timer modes, how to program the timers, and how to calculate timer delays. It also covers the basics of serial communication including synchronous and asynchronous transmission, start/stop bits, and data rates. The key registers for timer and serial port control on the 8051 are described, including TMOD, TCON, SBUF and SCON. Programming examples are provided to generate waveforms and delays using the timers.
The document discusses timer/counter programming in the 8051 microcontroller. It describes that the 8051 has two timers/counters that can be used as timers to generate time delays or as counters to count external events. It explains how the timers are programmed, including the different modes of the two 16-bit registers T0 and T1. It provides examples of using the timers in modes 0, 1, and 2 to generate delays or count external pulses. It also discusses using the gate bit in the TMOD register to externally control the timers through pins P3.2 and P3.3.
Timer/counters on the 8051 microcontroller can be used for time delay generation, event counting, and baud rate generation. The 8051 has two timers/counters: timer/counter 0 and timer/counter 1. They can operate in different modes like 13-bit timer, 16-bit timer, 8-bit auto reload, and split timer. Special function registers like TMOD, TCON, TH0, TL0, TH1, TL1 are used to control the timers. The timers can be clocked from the internal oscillator or an external source and generate interrupts on overflow. Programs examples are shown to generate square waves and interface with a buzzer using timers.
This document discusses programming timers on the 8051 microcontroller. It describes the basic timer registers for Timer 0 and Timer 1, and the TMOD register used to set the timer modes. It explains how to program the timers in modes 1 and 2, including the steps to load values into the timer registers, start the timer, and monitor the timer flag. Examples are provided to generate delays and square waves using timer programming. Counter programming using the timers is also covered briefly.
This document discusses timers on the 8051 microcontroller. It covers:
1. The 8051 has two 16-bit timers, T0 and T1, that can operate in different modes set by the TMOD register to function as timers or counters.
2. The timers use two 8-bit registers each, TL and TH, to store the 16-bit timer value. They are clocked by the system clock divided by 12.
3. Timer mode 1 is a 16-bit timer where the TF flag is set when the timer rolls over from 0xFFFF to 0x0000, which can trigger an interrupt. Timers can generate waveforms and measure time intervals.
The document discusses interfacing a microcontroller with various peripherals including timers, serial communication, interrupts, LCDs, and keyboards. It provides details on:
- Programming timers in 8051 microcontrollers for time delays and waveform generation.
- Serial communication protocols including asynchronous communication and RS-232 standards.
- Configuring and handling interrupts from different sources and writing interrupt service routines.
- Interfacing 8051 with LCDs for display and matrix keyboards for input using specific I/O ports for scanning rows and columns.
This document discusses timer programming in assembly for PIC microcontrollers. It covers the basic registers and operation of timers, including the clock source, prescaler options, and example code to generate delays and square waves using Timer0. Specific topics covered include the TMRxL and TMRxH registers used for 16-bit timers, the T0CON control register, calculating delay times based on crystal frequency and prescaler settings, and programming steps to generate delays and toggle outputs.
Timer programming in assembly and C is discussed. Timers can be used to generate time delays or count external events by incrementing an internal counter register. Programs are provided to toggle ports with delays using Timer0 in normal mode, toggle a pin every 70us using Timer0 and 1:8 prescaler, and extend Timer1 to a 16-bit counter to count external pulses. Assembly code is given to generate a 12.5us square wave on a pin using Timer0 delays.
Addressing mode and instruction set using 8051logesh waran
Here are the key steps for programming timer 0 in mode 2:
1. Select mode 2 for timer 0 by writing to the TMOD register:
MOV TMOD,#02h
2. Write the initial count value to TH0:
MOV TH0,#0FCh
3. Clear the timer flag TF0:
CLR TF0
4. Start the timer by setting TR0:
SETB TR0
5. The timer will now count down from the value in TH0 (0FCh) to 0 in TL0.
6. When TL0 underflows to 0, TF0 will be set.
7. Check TF0 to detect overflow:
This document discusses different methods for implementing counters and time delays using an 8085 microprocessor. It provides examples of using a single register, register pair, and nested loops to create time delays. Calculations are shown for determining the delay based on the clock frequency, number of clock cycles in the loop, and value loaded into the delay register. An illustrative problem is presented to count from 0 to 9 with a one second delay between each count using modulo 10 counting.
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2KanchanPatil34
2015 course SPPU SEIT syllabus of subject Processor Architecture and Interfacing (PAI) This covers Mode 1 and Mode 2 programming of timers, Counters and Counter Programming
The document discusses timers in the 8051 microcontroller. It notes that the 8051 has two 16-bit timers that can be individually configured and controlled. The timers can operate in four different modes: 13-bit timer mode, 16-bit timer mode, 8-bit auto-reload mode, and split timer mode. Special function registers like TMOD, TCON, TH0/TL0 and TH1/TL1 are used to configure and control the timers. The timers can generate interrupts on overflow and be used for tasks like timing functions and baud rate generation.
The document discusses the timer/counter modes of the 8051 microcontroller. It explains that timers generate time delays while counters count external events. The 8051 has a 16-bit timer/counter that can be configured as a timer or counter using a mode bit. There are four modes - Mode 0 uses TL0/TH0 as a 13-bit counter, Mode 1 uses the full 16 bits, Mode 2 uses TL0/TH1 as an 8-bit auto-reload counter, and Mode 3 splits Timer 0 into two 8-bit counters. The modes are selected using bits in the TMOD register and affect how the timer/counter registers are used for counting.
Timers on PIC18 microcontrollers can be used to generate time delays. The PIC18 has 2-5 timers that are each 16-bits wide and accessed through two 8-bit registers. Timers can be programmed in assembly to count the internal clock or external pulses. Common steps to program Timer0 as a 16-bit timer include loading the registers, starting the timer, monitoring the overflow flag, stopping the timer, and clearing the flag. Examples are provided to toggle a port pin with a delay using Timer0 and Timer1 in different modes.
The document discusses timers and counters in PIC microcontrollers. It describes Timer 0, Timer 1, and Timer 2. Timer 0 is an 8-bit timer, Timer 1 is a 16-bit timer, and Timer 2 is also 8-bit. All have associated registers for configuration and counting. Timer 0 and Timer 1 can be used in timer or counter modes, while Timer 2 increments until it matches a preset value. The document provides examples of initializing and using the timers with interrupts to generate precise time delays.
3. TIMERS
• 2 timers/counters
• Could be used for
– Time delay
– Counters for external events
• Timer 0 and Timer 1 registers
– 16bit
– 8051 can handle only 8 bit
– Each timer has 2 registers
4. TIMER 0 & 1
• ‘H’ is for high byte and ‘L’ stands for low byte
• Altogether they are TH0, TL0, TH1 & TL1
• Could be accessed as normal registers
– MOV TL0,#4BH
– MOV R3,TH0
THx
D15 D14 D13 D12 D11 D10 D9 D8
TLx
D7 D6 D5 D4 D3 D2 D1 D0
5. TMOD
• Single register for both timers
• Set various timer modes
• Upper nibble -> Timer 1
• Lower nibble -> Timer 0
• Two lower bits of each nibble for mode
GATE C/T M1 M0 GATE C/T M1 M0
Timer 1 Timer 0
6. GATE
• Start and stop of timers can be controlled using software or
hardware
• If GATE bit is 0, software programming
– SETB TRx
– CLR TRx
• If GATE bit is 1, external hardware source
C/T
• To decide on delay generator or event counter
• C/T=0 -> timer C/T=1 -> counter
7. M1, M0
M1 M0 Mode Operation
0 0 0 13 bit mode; TLx has 5bit
prescaler
0 1 1 16 bit mode; THx and TLx are
cascaded, no prescaler
1 0 2 8 bit mode; auto reload of TLx
to THx on every overflow
1 1 3 Split timer mode
8. Mode Setting
• MOV TMOD, #01H
– TMOD = 00000001, mode 1 of timer 0 is selected
• MOV TMOD, #20H
– TMOD = 00100000, mode 2 of timer 1 is selected
• MOV TMOD, #12H
– TMOD = 00010010, mode 2 of timer 0, and mode
1 of timer 1 are selected
9. Frequency of clock pulse
• To speed up the 8051, many recent versions of the 8051
have reduced the number of clocks per machine cycle from 12
to 4, or even 1
• The frequency for the timer is always 1/12th the frequency of
the crystal attached to the 8051, regardless of the 8051
version
• C/T=0; Crystal frequency of 8051 is the source for clock pulse
of timers
• XTAL frequency range 10MHz to 40MHz
• 11.0592MHz is commonly used because it communicates with
the IBM PC with no errors
– (11.0592/12)MHz = 921.6KHz
– T = (1/0.9216)s = 1.085s
10. TCON
• Timer control; 8 bit register
• Upper nibble holds TR(timer start)
and TF(timer overflow flag)
• Lower nibble is for controlling
interrupts
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
12. MODE 1
• 16 bit timer; values 0000H to FFFFH
in TH TL pair
• Timer counts up from the value
already set in TH TL pair
• After FFFFH, it rolls over to 0000H
by setting the timer flag (TF) high
13. Steps to program in mode 1
1. Load value to TMOD register to indicate which timer is
to be used and its mode as 1
2. Load TL and TH with initial count values
3. Start the timer
4. Wait until TF becomes 1 eg: JNB TFx, HERE
5. Stop the timer
6. Clear TF for next round
7. Goto step 2
14. Time delay calculation for mode 1
• In hex,
– (FFFF – YYXX + 1) x 1.085 s
– YY & XX represents value in TH & TL
respectively
• In decimal,
– Convert YYXX of TH TL pair into a decimal
NNNNN
– (65536 – NNNNN) x 1.085 s
15. Calculating value for TH TL pair
• Method 1
– Find YY and XX by converting NNNNN into hex
– TL=XX, TH=YY
• Method 2
– Using calculator
– Convert the value of –NNNNN into hex and take
the last 4 digits as YYXX
• MOV TLx, XX; MOV THx, YY
16. Example 1
Q. Find the delay generated by timer 0 in the following code, using both Methods. Do
not include the overhead due to instruction.
CLR P2.3 ;Clear P2.3
MOV TMOD,#01 ;Timer 0, 16-bitmode
HERE: MOV TL0,#3EH ;TL0=3Eh, the low byte
MOV TH0,#0B8H ;TH0=B8H, the high byte
SETB P2.3 ;SET high timer 0
SETB TR0 ;Start the timer 0
AGAIN: JNB TF0,AGAIN ;Monitor timer flag 0
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear TF0 for next round
CLR P2.3
Solution:
(a) (FFFFH – B83E + 1) = 47C2H = 18370 in decimal and 18370 × 1.085 us = 19.93145 ms
(b) Since TH – TL = B83EH = 47166 (in decimal) we have 65536 – 47166 = 18370. This
means that the timer counts from B38EH to FFFF. This plus Rolling over to 0 goes
through a total of 18370 clock cycles, where each clock is 1.085 us in duration.
Therefore, we have 18370 × 1.085 us = 19.93145 ms as the width of the pulse.
17. Example 2
Q. Modify TL and TH in Example 1 to get the largest time delay possible. Find the delay
in ms. In your calculation, exclude the overhead due to the instructions in the loop.
Solution:
To get the largest delay we make TL and TH both 0. This will count up from 0000 to
FFFFH and then roll over to zero.
CLR P2.3 ;Clear P2.3
MOV TMOD,#01 ;Timer 0, 16-bitmode
HERE: MOV TL0,#0 ;TL0=0, the low byte
MOV TH0,#0 ;TH0=0, the high byte
SETB P2.3 ;SET high P2.3
SETB TR0 ;Start timer 0
AGAIN: JNB TF0,AGAIN ;Monitor timer flag 0
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
CLR P2.3
Making TH and TL both zero means that the timer will count from 0000 to FFFF, and
then roll over to raise the TF flag. As a result, it goes through a total Of 65536 states.
Therefore, we have delay = (65536 - 0) × 1.085 us = 71.1065ms.
18. Example 3
Q. The following program generates a square wave on P1.5 continuously using timer 1 for
a time delay. Find the frequency of the square wave if XTAL = 11.0592 MHz. In your
calculation do not include the overhead due to Instructions in the loop.
MOV TMOD,#10 ;Timer 1, mod 1 (16-bitmode)
AGAIN: MOV TL1,#34H ;TL1=34H, low byte of timer
MOV TH1,#76H ;TH1=76H, high byte timer
SETB TR1 ;start the timer 1
BACK: JNB TF1,BACK ;till timer rolls over
CLR TR1 ;stop the timer 1
CPL P1.5 ;comp. p1. to get hi, lo
CLR TF1 ;clear timer flag 1
SJMP AGAIN ;is not auto-reload
Solution:
Since FFFFH – 7634H = 89CBH + 1 = 89CCH and 89CCH = 35276
clock count and 35276 × 1.085 us = 38.274 ms for half of the square wave.
The frequency = 13.064Hz.
Also notice that the high portion and low portion of the square wave pulse are equal. In
the above calculation, the overhead due to all the instruction in the loop is not included.
19. Example 4
Q. Assume that XTAL = 11.0592 MHz. What value do we need to load the timer’s
register if we want to have a time delay of 5 ms (milliseconds)? Show the program for
timer 0 to create a pulse width of 5 ms on P2.3.
Solution:
Since XTAL = 11.0592MHz, the counter counts up every 1.085us.
This means that out of many 1.085us intervals we must make a 5 ms pulse. To get that,
we divide one by the other. We need 5ms / 1.085us = 4608 clocks. To Achieve that we
need to load into TL and TH the value 65536 – 4608 = EE00H. Therefore, we have
TH = EE and TL = 00.
CLR P2.3 ;Clear P2.3
MOV TMOD,#01 ;Timer 0, 16-bitmode
HERE: MOV TL0,#0 ;TL0=0, the low byte
MOV TH0,#0EEH ;TH0=EE, the high byte
SETB P2.3 ;SET high P2.3
SETB TR0 ;Start timer 0
AGAIN: JNB TF0,AGAIN ;Monitor timer flag 0
CLR TR0 ;Stop the timer 0
CLR P2.3 ;Clear P2.3
20. Example 5
Q. Assume that XTAL = 11.0592 MHz, write a program to generate a square
wave of 2 kHz frequency on pin P1.5.
Solution:
(a) T = 1 / f = 1 / 2 kHz = 500 us the period of square wave.
(b) 1 / 2 of it for the high and low portion of the pulse is 250 us.
(c) 250 us / 1.085 us = 230 and 65536 – 230 = 65306 which in hex is FF1AH.
(d) TL = 1A and TH = FF, all in hex. The program is as follow.
MOV TMOD,#01 ;Timer 0, 16-bitmode
AGAIN: MOV TL1,#1AH ;TL1=1A, low byte of timer
MOV TH1,#0FFH ;TH1=FF, the high byte
SETB TR1 ;Start timer 1
BACK: JNB TF1,BACK ;until timer rolls over
CLR TR1 ;Stop the timer 1
CPL P1.5 ;Toggle output
CLR TF1 ;Clear timer 1 flag
SJMP AGAIN ;Reload timer
21. Example 6
Q. Examine the following program and find the time delay in seconds. Exclude the
overhead due to the instructions in the loop.
MOV TMOD,#10H ;Timer 1, mod 1
MOV R3,#200 ;cnter for multiple delay
AGAIN: MOV TL1,#08H ;TL1=08,low byte of timer
MOV TH1,#01H ;TH1=01,high byte
SETB TR1 ;Start timer 1
BACK: JNB TF1,BACK ;until timer rolls over
CLR TR1 ;Stop the timer 1
CLR TF1 ;clear Timer 1 flag
DJNZ R3,AGAIN ;if R3 not zero then reload timer
Solution:
TH-TL = 0108H = 264 in decimal and 65536 – 264 = 65272.
Now 65272 × 1.085 μs = 70.820 ms, and for 200 of them we have
200 ×70.820 ms = 14.164024 seconds.
22. MODE 2
• 8 bit timer; values 00H to FFH into THx
• When TH is loaded with a value, it keeps a
copy of it in TL
• Timer counts up from the value in TH
• After FFH, it copies(reloads) the value in TL
to TH and sets the timer flag (TF) high
23. Steps to program in mode 2
1. Load value to TMOD register to indicate which
timer is to be used and its mode as 2
2. Load TH with initial count values
3. Start the timer
4. Wait until TF becomes 1 eg: JNB TFx, HERE
5. Clear TF for next round
6. Goto step 4
24. Assemblers and negative values
• Suppose we need delay of 100 cycles
– 256-100=156
– 156=9CH
– MOV TH1, 9CH
• But mode 2 is 8 bit timer and uses 1 register for
its 8 bits, so we can also do the same task as
– MOV TH1, -100
• -100 in hex is 9C
25. Example 7
Q. Assume XTAL = 11.0592 MHz, find the frequency of the square wave
generated on pin P1.0 in the following program
MOV TMOD,#20H ;T1/8-bit/auto reload
MOV TH1,#5 ;TH1 = 5
SETB TR1 ;start the timer 1
BACK: JNB TF1,BACK ;till timer rolls over
CPL P1.0 ;P1.0 to hi, lo
CLR TF1 ;clear Timer 1 flag
SJMP BACK ;mode 2 is auto-reload
Solution:
First notice the target address of SJMP. In mode 2 we do not need to reload
TH since it is auto-reload. Now (256 - 05) × 1.085 us = 251 × 1.085 us = 272.33
us is the high portion of the pulse. Sinceit is a 50% duty cycle square wave,
the period T is twice that; as a result T = 2 × 272.33 us = 544.67 us and the
frequency = 1.83597 kHz
26. Example 8
Q. Find the frequency of a square wave generated on pin P1.0.
MOV TMOD,#2H ;Timer 0, mod 2 (8-bit, auto reload)
MOV TH0,#0
AGAIN: MOV R5,#250 ;multiple delay count
ACALL DELAY
CPL P1.0
SJMP AGAIN
DELAY: SETB TR0 ;start the timer 0
BACK: JNB TF0,BACK ;stay timer rolls over
CLR TR0 ;stop timer
CLR TF0 ;clear TF for next round
DJNZ R5,DELAY
RET
Solution:
T = 2 ( 250 × 256 × 1.085 us ) = 138.88ms, and frequency = 72 Hz
27. Example 9
Q. Assuming that we are programming the timers for mode 2, find the value (in hex)
loaded into TH for each of the following cases.
(a) MOV TH1,#-200 (b) MOV TH0,#-60 (c) MOV TH1,#-3 (d) MOV TH1,#-12
(e) MOV TH0,#-48
Solution:
You can use the scientific calculator to verify the result provided by the assembler. In
calculator, select decimal and enter 200. Then select hex, then +/- to get the TH value.
Remember that we only use the right two digits and ignore the rest since our data is
an 8-bit data.
Decimal 2’s complement (TH value)
-3 FDH
-12 F4H
-48 D0H
-60 C4H
-200 38H
28. Counter programming
• Counts events happening outside 8051
• It could be programmed similar to timers
• But, source frequency comes externally
• For every pulse, timer registers (TH,TL)
increments
• Everything else happens just like timer
29. C/T bit for counter
• C/T = 1
• Pins 14 and 15 act as input
• Based on port bits; P3.4 and P3.5
• They are called T0(timer 0 input) and
T1(timer 1 input)
• If C/T of timer 1 is ‘1’ -> pulses from P3.5
makes the counter count up
30. Example 10
Q. Assuming that clock pulses are fed into pin T1, write a program for counter 1 in
mode 2 to count the pulses and display the state of the TL1 count on P2, which
connects to 8 LEDs.
Solution:
MOV TM0D,#01100000B ;counter 1, mode 2, C/T=1 external pulses
MOV TH1,#0 ;clear TH1
SETB P3.5 ;make T1 input
AGAIN: SETB TR1 ;start the counter
BACK: MOV A,TL1 ;get copy of TL
MOV P2,A ;display it on port 2
JNB TF1,Back ;keep doing, if TF = 0
CLR TR1 ;stop the counter 1
CLR TF1 ;make TF=0
SJMP AGAIN ;keep doing it
Notice in the above program the role of the instruction SETB P3.5. Since ports are set
up for output when the 8051 is powered up, we make P3.5 an input port by making it
high. In other words, we must configure (set high) the T1 pin (pin P3.5) to allow pulses
to be fed into it.
31. GATE=1
• Start and stop of timer can be controlled through
P3.2 and P3.3 for Timers 0 and 1 respectively
• First the SETB TRx instruction needs to be
executed. Only then will this work
• Start or stop can be controlled using external
switch
• Eg; Alarm to repeat every 1 second after TR1 is
executed can be switched externally through P3.3
for longer durations