Free Essay

Timers and Counters

In:

Submitted By robt00
Words 575
Pages 3
Timers and Counters
Exercise 2.2 1. Define the following timer bits: timer enable, timer timing, and timer done.
ANSWER: Timer enable bit: The enable bit is true when the rung input logic is true, and the enable bit is false when the rung input logic is false. When the EN bit is true the timer accumulator is incrementing at the rate set by the timer time base.
Timer timing bit: indicates when timing action is occurring and can be used to control timed events in automation applications.
Timer done bit: the end of the timing process by changing states from false to true or from true to false depending on the type of timer instruction used. 2. Compare and contrast the true and false states of the timer timing bit for the on-delay timer, the off-delay timer, and the retentive timer.
ANSWER: In the true states for all three have the accumulator value is less than the preset value, but for off-delay timer the timer rung is false unlike the retentive timer and on-delay that the timer rung is true.
In the false states for all three have the accumulator is equal to or greater than the preset value. Like the true state retentive timer and on-delay timer both have the same condition and that are false if the timer rung is false, but the on-delay timer has other condition that are false if the timer done bit is true. The off-delay has a condition that are false if the timer done is false. 3. What is the difference between a retentive timer and a non-retentive timer?
ANSWER: A non-retentive timer's accumulator will reset when the enabling input is reset but the retentive will not reset when the enabling bit is reset, only when the timer's reset input is enabled, or when the timer is done. 4. Explain why the counters in PLC applications are typically retentive.
ANSWER: The counter instructions of a PLC are normally retentive. The counter will either increment or decrement whenever the count input transfers from an off state to an on state 5. What is the difference between the overflow bit and the underflow bit?
ANSWER: The overflow bit is true whenever the counter counts past its maximum value. The underflow bit will go true when the counter counts below the preset. 6. In an application that requires an up/down counter, why must the counters be located at the same address?
ANSWER: So that the up, down, and reset actions can be performed on the same counter if desired. 7. Identify the type of counter you would choose for each of the following applications. a. Accumulate the total number of components made during the night shift.
ANSWER: Up counter b. Keep track of the number of parts remaining in a bin as parts are extracted. Assume that a full bin contains 24 parts.
ANSWER: down counter c. Keep track of the current number of parts at the first stage of a process as they enter and exit.
ANSWER: Up/down counter 8. Compare and contrast the true and false states of the overflow and underflow bits for the up counter and the down counter.
ANSWER: True states: The overflow bit is true whenever the counter Counts past its maximum value. The underflow bit will go true when the counter counts below the preset. False states: False states the opposite

Similar Documents

Free Essay

¬Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt Handling

...------------------------------------------------- Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt Handling Compiled by: Sivaranjan Goswami, Pursuing M. Tech. (2013-15 batch) Dept. of ECE, Gauhati University, Guwahati, India Contact: sivgos@gmail.com ------------------------------------------------- Note: It is a practical guide in which it is presumed that the reader has already learned about the hardware architecture, programming model, and assembly language programming of 8051 microcontroller. In case you are totally new to 8051 microcontroller I recommend you to read the “8051 Tutorial” available at: https://sites.google.com/site/enggprojectece/my-reading-list It has also been presumed that the reader has at least the beginner level knowledge of computer programming in C language (user defined functions, data types, header files, loops and the flow of a C program). In this tutorial first an introduction to Embedded C is given. A few examples are shown. Then the implementation of timer and interrupt are discussed. (All programs shown here are compiled and executed using Keil µVision 3) Pin Diagram of 8051 (please note the pins used for external interrupts – INT0 & INT1, Serial Port Transmitter – TxD, Serial Port Receiver – RxD, Counter input for Timer-0 – T0 and Counter input for Timer-1 – T1) Embedded C The syntax of embedded C is the same as the C language that we use for writing computer programs. The only difference...

Words: 3118 - Pages: 13

Free Essay

Tone Acivated Robot

...CHAPTER 2 2.1 GENERATION OF BLOCK DIAGRAM 2.1.1 TRANSMITTER SECTION In the transmitter end power supply is used to supply suitable power to the Microcontroller. A keypad is interfaced to the controller to send signals for the movement of the robot in four directions. A buzzer is also interfaced as an indicator so that we can have a buzz whenever a signal is sent. The output from the controller is given to the FM transmitter where it is modulated and sent. 2.1.2 RECEIVER SECTION Here in the receiver section, the FM signal sent from the transmitter section is received by the FM receiver and fed to the controller and a battery is used to supply power to the controller. The output from the controller is fed to the motor driver circuit which intern is connected to the motor. 2.2 BLOCK DIAGRAM RECEIVER SECTION 2.3 Hardware Description The hardware part mainly consists of the components that are used in designing the vehicle i.e., a prototype model which moves in four directions. The major sections in this hardware part are the transmitter section and the receiver section; in both of these sections a microcontroller called AT89S52 is incorporated. 2.4 Software Description Keil Micro Vision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller). It allows for such software to be written either in assembly or C programming languages and for that software...

Words: 4350 - Pages: 18

Free Essay

Lab Report 6

...Introduction/Background/Theory:     When  designing  and  creating  things  sometimes  the  materials  needed  are  not  always  readily   available  to  use,  for  example  a  function  wave  generator  to  generate  the  clock  input  needed  for  the  flip   flops.  In  this  lab  the  555  timer  will  be  used  to  supply  the  clocking  mechanism  that  is  needed.  Looking  at   the  data  sheets  and  reading  them  is  very  helpful  in  understanding  what  it  is  that  is  given,  from  there   arrangements  to  the  design  can  be  made  to  make  what  is  needed  using  the  supplied  materials.     In  the  555  timer:       Figure  1:  555  timer  schematics  info.     Reading  the  data  sheet  schematic  for  the  555  timer,  equations  are  given  to  calculate  the  frequency.  In   this  way  one  can  calculate  how  fast  the  pulse  is  generated  and  supplied  as  a  clock.  From  the  equations...

Words: 1066 - Pages: 5

Free Essay

Ecet 340 Week 6 Homework 6

...Product Description 1. What are the four main functions of the HC12 Timer unit? 2. Two input capture events occur at counts 0x1037 and 0xFF20 of the free-running counter. How many counts (in decimal) have transpired between these two events? 3. What is the maximum time possible before the free-running counter overflows when the e MHz? 4. Two input capture events occur at 0x1037 and 0x002A. If the prescaler bits PR[2:1:0] are set to 101 and the e clock is 24 MHz, how much time as transpired between the two events? 5. Calculate the count that should appear in the timer capture register TC0 if a 125 kHz rectangular wave is inputted on timer pin PT0 while TCTL4 is preset for falling edge detection. Assume a 24 MHz e-clock, TMSK2 was programmed with the value $02, and the count of the 1st edge event has already been subtracted off from TC0. 6. Write down the name of the HC12 timer register that should be polled through software to determine whether or not an active input edge has been captured on one of the port T pins. 7. What is the duty cycle of a signal produced by the PWM when and ? a. 28.0% b. 29.8% c. 50.0% d. 72.0% 8. What values are required for period and duty cycle to generate a 6.0 kHz, 95% duty cycle waveform using the PWM function? Assume e-clock frequency is 24 MHz. 9. What is the slowest clock signal that can be generated from the PWM output using the 16-bit counter mode with pre-scaling and scaling? Assume e-clock frequency is 24 MHz. 10...

Words: 1661 - Pages: 7

Free Essay

Micro

...MHz) 80C31/80C32 DESCRIPTION The Philips 80C31/32 is a high-performance static 80C51 design fabricated with Philips high-density CMOS technology with operation from 2.7 V to 5.5 V. The 80C31/32 ROMless devices contain a 128 × 8 RAM/256 × 8 RAM, 32 I/O lines, three 16-bit counter/timers, a six-source, four-priority level nested interrupt structure, a serial I/O port for either multi-processor communications, I/O expansion or full duplex UART, and on-chip oscillator and clock circuits. In addition, the device is a low power static design which offers a wide range of operating frequencies down to zero. Two software selectable modes of power reduction—idle mode and power-down mode are available. The idle mode freezes the CPU while allowing the RAM, timers, serial port, and interrupt system to continue functioning. The power-down mode saves the RAM contents but freezes the oscillator, causing all other chip functions to be inoperative. Since the design is static, the clock can be stopped without loss of user data and then the execution resumed from the point the clock was stopped. FEATURES • 8051 Central Processing Unit – 128 × 8 RAM (80C31) – 256 × 8 RAM (80C32) – Three 16-bit counter/timers – Boolean processor – Full static operation – Low voltage (2.7 V to 5.5 V@ 16 MHz) operation • Memory addressing capability – 64k ROM and 64k RAM • Power control modes: – Clock can be stopped and resumed – Idle mode – Power-down mode • CMOS and TTL compatible • TWO...

Words: 12804 - Pages: 52

Free Essay

Essay

...10ms and a high portion for 5ms.Use timer 0 in mode 1 for generating delay. PROGRAM COMMENTS org 00h ; originate the code from memory location 00h main: ;main label here: setb p1.1 ;here label, making p1.1 high acall delay ;calling delay subroutine clr p1.1 ;making p1.1 low acall delay ;calling delay subroutine acall delay ;calling delay subroutine sjmp here ;unconditional jump tohere label delay: ;delay subroutine mov TMOD,#01h ;Selecting timer 0 mode 1 mov Th0,#0eeh ;Th0 = EEH mov Tl0,#00h ;Tlo = 00h setb tr0 ;Starting timer 0 h1:jnb Tf0,h1 ;jump to label h1 until Tf0 becomes high, H1 label clr tr0 ;Stopping timer 0 clr tf0 ;clearing TF0 flag ret ; return back to normal routine end ;end directive, to end program DELAY CALCULATION For 5 ms 5x10^(-3)/1.085x10^(-6) = 4608 65536-4608=60927 60927 = EE00H RESULT [pic] Task # 2 OBJECT Repeat task # 1 using timer 0 in mode 2. PROGRAM COMMENTS org 00h ; originate the code from memory location 00h main: ;main label here:setb p1.2 ;here label, making p1.2 high acall delay ;calling delay subroutine clr p1.2 ;making p1.2 low acall delay ;calling delay subroutine acall delay ;calling delay subroutine sjmp here ;unconditional jump to here label delay: ;delay subroutine mov TMOD,#02h ; Selecting timer 0 mode 2 mov R0,#20 ;Moving value...

Words: 676 - Pages: 3

Premium Essay

R1 Case Study Summary: Three Phase Motors Protection

...Abstract-This paper is based on the “Three phase motors protection” from various faults. This paper emphalis on various difficulties such as phase reversal in single and three phase systems, dropout of line, damage due to overload, failure of single phase there will be usually recommended to perform in complex environmental conditions. This includes in built cut-off frequency having several facilities together with timer in off condition and a starter which is automatic. This main circuit of this controllercompraises of a circuit with power supply, a latch and a counter which is used for phase sequence, timer of a motor with on and off conditions. There is a special provisions for checknhase sequence and is modified with decade counter and IC timer which simultaneously check the phase and allows the phase only if its frequency is 42Hz to 50 Hz. The dropping of line and overload which harms the motor is protected by next essential part. By using the objectives of a supply power, this controller controls the timer in on and off condition of a circuit motor and also the counter. The motor...

Words: 2844 - Pages: 12

Free Essay

Hsc12

...the HC12 timer system. Port T is the IC/OC external register and TIOS is the Timer Input Capture/Output Compare Select register. The input capture generates an interrupt on a rising or falling edge of an input signal and captures the current value of TCNT on this event. Examples of uses of the IC function include counting events and timing events. The output compare generates an interrupt when the free-running counter (TCNT) is equal to a 16 bit value stored in one of the Timer Output Compare Register. In addition to generating the interrupt, the state of the associated output pin can be controlled to go low, high or toggle. Examples of uses of the OC function include generating a wave form with desired frequency and duty cycle or making precise timing applications. Output Compare: When a pin on Port T is programmed as an output compare pin, a value is loaded into the corresponding Timer Input Capture/Output Compare register (TCn) for comparison with TCNT. When a successful comparison is made (between TCn and TCNT), one of four actions may occur at the output pin in Port T. It can be disconnected, toggled, cleared or set. In addition, an interrupt request is generated which may be serviced in an ISR (refer to discussion on interrupts). The output compare function has several associated registers. Each is listed with its function in the following section. Note that these registers apply to both the input capture and output compare functions. Timer Count Register...

Words: 1595 - Pages: 7

Free Essay

Ttttt

...Theory : The 555 timer IC is an integrated circuit (chip) used in a variety of timer, pulse generation, and oscillator applications. The 555 can be used to provide time delays, as an oscillator, and as a flip-flop element. Derivatives provide up to four timing circuits in one package. The 4017 is an integrated circuit which has been designed to count pulses. It has 16 pins and looks like any other 16 pin integrated circuit. They can be used in timing circuits and are often used to switch on and off LEDs or motors or other circuits. They are versatile and relatively simple to put together. Counters such as the 4017B are cheap and yet surprisingly useful. The 4017 is most useful when combined with a timer such as a 555 based circuit. The pulse from the 555 timer can be used to activate the 4017B circuit. A 555 a stable circuit is used to pulse the 4017B at regular intervals. The pulse from the 555 IC is generated from pin 3. In the circuit seen below, pin 3 of the 555 IC feeds into pin 14 of the 4017B (called ‘clock in’). When this occurs pin ‘A’ of the 4017B emits current, lighting its LED. The next pulse from the 555 IC results in pin ‘B’ of the 4018B IC emitting current and lighting its LED. Description of Design: In our project we aimed to display a simple design to clear the Idea of our circuit . We made a white and rectangular shape box, and put the LEDs with the push and switch at its flat. That will make it easy to turn On and off without seeing the...

Words: 394 - Pages: 2

Free Essay

Benc

...BENU 2002 ELECTRONIC ENGINEERING PRACTICE MODULE: MINI PROJECT (BENC) TIMER & COUNTER FOR LIGHT EMITTING DIODES PREPARED BY: COMPUTER ENGINEERING DEPARTMENT, FKEKK SEMESTER 3 SESSION 2012/2013 1.0 OBJECTIVE * To study the structure of the basic electronic components and functionality of the timer 555 with some basic application in electronics circuit. * To provide practical experience in PCB making, soldering, trouble-shooting and applying the components. 2.0 COMPONENTS/MATERIALS * Soldering Tools-(Solder iron, solder wire, sucker) * Power supply DC 9V (or batteries) * Oscilloscope * Digital Multimeter * Resistors: 4.7 Ω, 2 Unit * Resistor 1K Ω, 2 Unit * Resistor 390 Ω, 1 Unit * Variable resistor: 500k Ω to 2MΩ, 1 Unit (Preset) * Capacitors : 10nF ceramic, 1 Unit * Capacitors: 10μF , 25 volt Electrolytes, 1 Unit * Light Emitting Diodes 8 Units * CMOS 4017, 1 Unit * 555 timer 1C, 1 Unit * 8-pin DIL socket for 1C, 1 Unit * 16-pin DIL socket for 1C, 1 Unit * ON/OFF switch, 1 Unit * Printed Circuit Board, 1 Unit 3.0 THEORY The Light Emitting Diodes circuit in Figure 1, controls 8 Light Emitting Diodes. The timing sequence is generated using a CMOS 4017 decade counter and a 555 timer. The Light Emitting Diodes will be on. The complete cycle time can be adjusted with variable resistor. The 555/556 timer is one of the most versatile and popular chips made. It is very inexpensive...

Words: 1303 - Pages: 6

Free Essay

Ic 555 Timer

...Integrated Circuits Project Report 555 Timer as a Voltage Controlled Oscillator (VCO) Student: Earl Ebbert Student ID: 18970599 ITEM | PAGE | Title Page | 1 | Contents | 2 | Introduction | 2 | Circuit Schematic Diagram: (Fig. 1) | 3 | 555 Timer as a Voltage Controlled Oscillator (VCO) Parts List: (Fig.2) | 3 | LM555CM Datasheet Information: (Fig 3.) | 4 & 5 | 741 Op amp Information: (Fig 4.) | 6 | Formula List: (Fig 5) | 7 | Data Table: Measurements and Calculations (Fig 6) | 7 | Frequency Counter Simulation Readings: (Fig. 7) | 8 | Oscilloscope - XSC1 Measurement Diagrams: (Fig. 9): | 8 | Conclusion and Recommendations: | 9 | References and Citations: | 9 | Introduction: Oscillators are circuits that generate a periodic waveform to perform timing, control, or communication functions. Oscillators require a form of positive feedback, where a portion of the output signal is fed back to the input in a way that causes it to reinforce itself and thus sustain a continuous output signal. This voltage-controlled oscillator (VCO) Circuit uses the 555 timer as the main component and is configured as an astable multivibrator, switch is able to serve as a free-running nonsinusoidal oscillator that produces a pulse waveform on its output. An astable multivibrator is just a timing circuit whose output oscillates between 'low' and 'high' continuously, in effect generating a train of pulses. The 555 timer is a versatile integrated circuit with...

Words: 866 - Pages: 4

Free Essay

Ecet 340 Week 6 Homework 6

...com/ecet-340-devry/ecet-340-week-6-homework-6 1. What are the four main functions of the HC12 Timer unit? 2. Two input capture events occur at counts 0×1037 and 0xFF20 of the free-running counter. How many counts (in decimal) have transpired between these two events? 3. What is the maximum time possible before the free-running counter overflows when the e MHz? 4. Two input capture events occur at 0×1037 and 0x002A. If the prescaler bits PR[2:1:0] are set to 101 and the e clock is 24 MHz, how much time as transpired between the two events? 5. Calculate the count that should appear in the timer capture register TC0 if a 125 kHz rectangular wave is inputted on timer pin PT0 while TCTL4 is preset for falling edge detection. Assume a 24 MHz e-clock, TMSK2 was programmed with the value $02, and the count of the 1st edge event has already been subtracted off from TC0. 6. Write down the name of the HC12 timer register that should be polled through software to determine whether or not an active input edge has been captured on one of the port T pins. 7. What is the duty cycle of a signal produced by the PWM when and ? a. 28.0% b. 29.8% c. 50.0% d. 72.0% 8. What values are required for period and duty cycle to generate a 6.0 kHz, 95% duty cycle waveform using the PWM function? Assume e-clock frequency is 24 MHz. 9. What is the slowest clock signal that can be generated from the PWM output using the 16-bit counter mode with pre-scaling and scaling? Assume e-clock frequency is 24 MHz. 10. Write...

Words: 349 - Pages: 2

Free Essay

A Document in Need

...Zelio Logic 2 Smart Relay User Manual SR2MAN01 11/2007 Table of Contents Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Part I Initial Power up and Discovering . . . . . . . . . . . . . . . . . . 11 Chapter 1 Initial Power up and Discovering . . . . . . . . . . . . . . . . . . . . . . . 13 Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Presentation of the Smart Relay Front Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . Characteristics and Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control Keys on the Front Panel of the Smart Relay . . . . . . . . . . . . . . . . . . . . . Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 17 19 20 23 Part II Functions Accessible from the Front Panel . . . . . . . . . 29 Chapter 2 Chapter 3 Chapter 4 Overview of the Functions Accessible from the Front Panel. . . . 31 Functions Accessible from the Front Panel of the Smart Relay . . . . . . . . . . . . . 31 Input/Output Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Inputs-Outputs Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 TEXT and DISPLAY screen . . . . ....

Words: 15155 - Pages: 61

Free Essay

Business Model

...512/1K/1K/2KBytes Internal SRAM – Write/Erase Cycles: 10,000 Flash/100,000 EEPROM – Data retention: 20 years at 85°C/100 years at 25°C(1) – Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation – Programming Lock for Software Security Atmel® QTouch® library support – Capacitive touch buttons, sliders and wheels – QTouch and QMatrix® acquisition – Up to 64 sense channels Peripheral Features – Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode – Real Time Counter with Separate Oscillator – Six PWM Channels – 8-channel 10-bit ADC in TQFP and QFN/MLF package Temperature Measurement – 6-channel 10-bit ADC in PDIP Package Temperature Measurement – Programmable Serial USART – Master/Slave SPI Serial Interface – Byte-oriented 2-wire Serial Interface (Philips I2C compatible) – Programmable Watchdog Timer with Separate On-chip Oscillator – On-chip Analog Comparator – Interrupt and Wake-up on Pin Change Special Microcontroller Features – Power-on Reset and Programmable Brown-out Detection – Internal Calibrated Oscillator – External and Internal Interrupt Sources – Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby, and Extended Standby I/O and Packages – 23...

Words: 4689 - Pages: 19

Free Essay

All About Counter

...COUNTERS A counter is simply a device that counts. Counters may be used to count operations, quantities, or periods of time. They may also be used for dividing frequencies, for addressing information in storage, or for temporary storage. Counters are a series of FFs wired together to perform the type of counting desired. They will count up or down by ones, twos, or more. In electronics, counters can be implemented quite easily using register-type circuits such as the flip-flop, and a wide variety of classifications exist: • Asynchronous (ripple) counter – changing state bits are used as clocks to subsequent state flip-flops • Synchronous counter – all state bits change under control of a single clock • Decade counter – counts through ten states per stage • Up/down counter – counts both up and down, under command of a control inputMontgomery • Ring counter – formed by a shift register with feedback connection in a ring • Johnson counter – a twisted ring counter • Cascaded counter • modulas counter. Each is useful for different applications. Usually, counter circuits are digital in nature, and count in natural binary. Many types of counter circuits are available as digital building blocks, for example a number of chips in the 4000 series implement different counters. Occasionally there are advantages to using a counting sequence other than the natural binary sequence—such as the binary coded decimal counter, a linear feedback shift register counter, or aGray-code...

Words: 1093 - Pages: 5