timer 11

Upload: annusha

Post on 30-May-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Timer 11

    1/26

  • 8/14/2019 Timer 11

    2/26

  • 8/14/2019 Timer 11

    3/26

  • 8/14/2019 Timer 11

    4/26

  • 8/14/2019 Timer 11

    5/26

  • 8/14/2019 Timer 11

    6/26

  • 8/14/2019 Timer 11

    7/26

    CS RD WR A1 A0 OPERATION

    0 1 0 0 0 WRITE COUNTER 0

    0 1 0 0 1 WRITE COUNTER 1

    0 1 0 1 0 WRITE COUNTER 2

    0 1 0 1 1 WRITE CONTROL WORD

    0 0 1 0 0 READ COUNTER 0

    0 0 1 0 1 READ COUNTER 1

    0 0 1 1 0 READ COUNTER 2

    0 0 1 1 1 NO OPERATION ( TRISTATED )

    0 1 1 X X NO OPERATION ( TRISTATED )

    1 X X X X 8254 NOT SELECTED

  • 8/14/2019 Timer 11

    8/26

  • 8/14/2019 Timer 11

    9/26

  • 8/14/2019 Timer 11

    10/26

  • 8/14/2019 Timer 11

    11/26

    Mode 0: INTERRUPT ON TERMINAL COUNT

    The output becomes a logic 0 when the controlword is written

    Remains low even after count value loaded incounter

    Counter starts decrementing after falling edge ofclock

    The OUT goes high upon reaching the terminalcount & remains high till reloading

    OUT can be used as interrupt

    Writing a count register , when previous countingis in process first byte when loaded stops theprevious count, second byte when loaded startsnew count

  • 8/14/2019 Timer 11

    12/26

  • 8/14/2019 Timer 11

    13/26

    Mode 1: One-shot mode.

    monostable multivibrator

    gate input is used as trigger input

    output remains high till the count is

    loaded

    After application of trigger, output goeslow and remains low till count becomes zero

    Another count loaded, when outputalready low it does not disturb countinguntil a new trigger is applied at the gate

    New counting starts after new trigger

  • 8/14/2019 Timer 11

    14/26

  • 8/14/2019 Timer 11

    15/26

    Mode 2: RATE GENERATOR / DIVIDE BY NCOUNTER

    When N is loaded as count after N pulses OUT goes low for only one clock cycle then, countN is reloaded OUT becomes high for N clockpulses

    The number of clock pulses between the two lowpulses is equal to the count loaded

    gate logic 0 no countingGate logic 1 normal counting

  • 8/14/2019 Timer 11

    16/26

    Mode 3: SQUARE WAVE RATE

    GENERATORWhen count N loaded is even outputremains HIGH for half the count and LOW for

    the rest half of the countWhen count N loaded is odd outputremains HIGH for (N+1)/2 and low for (N-1)/2.

    Repeated operation gives square wave

    Generates a continuous square-wave with Gset to 1.

    If count is even, 50% duty cycle otherwise

  • 8/14/2019 Timer 11

    17/26

  • 8/14/2019 Timer 11

    18/26

    Mode 4: Software triggered Strobe

    After mode is set output goes high

    When count is loaded counting downstartsOn reaching terminal count outputgoes low for only one clock cycle, andthen again output goes HIGHThe above said low pulse can be usedas a strobe for interfacing MP with

    peripheralsWhen GATE is LOW counting isinhibited and count is latchedIf a new count is loaded while

    counting, previous counting stops and

  • 8/14/2019 Timer 11

    19/26

  • 8/14/2019 Timer 11

    20/26

    20

    Mode 5: Hardware triggered Strobe

    This mode generates a strobe in response to therising edge at the triggerMode is used to generate a delayed strobe inresponse to an externally generated signalOnce mode is programmed and counter loaded,

    OUT goes HIGHCounter starts counting after the rising edge of thetrigger (GATE)The OUTPUT goes LOW for one clock period, when

    the terminal count is reachedOutput will not go LOW until the counter contentbecomes zero after the rising edge of any triggerGATE is used as trigger input

  • 8/14/2019 Timer 11

    21/26

  • 8/14/2019 Timer 11

    22/26

  • 8/14/2019 Timer 11

    23/26

    Read Operations

    There are three possible methods forreading the counters:

    a simple read operation

    the Counter Latch Command

    the Read-Back Command

    Simple read operation :

    The Counter which is selected with the A1,A0 inputs, the CLK input of the selectedCounter must be inhibited by using either theGATE input or external logic.

    Otherwise, the count may be in the processof changing when it is read, giving an

  • 8/14/2019 Timer 11

    24/26

  • 8/14/2019 Timer 11

    25/26

    ead-back control command:

    The read-back control,word is used, when it isnecessary for thecontents of more thanone counter to be readat a same time.

    Count : logic 0, selectone of theCounter to be latched

    Status : logic 0, Statusmust be latched to beread status of a counterand is accessed by a readfrom that counter

  • 8/14/2019 Timer 11

    26/26

    Status register:

    shows the state of the outputpincheck the counter is in NULLstate (0) or not

    how the counter is programmed