You are on page 1of 47

# Share

0:06 Today is Jim Pytel from Columbia gorge community college Renewable energy technology program this is ET 0:11 one twenty two digital two 0:13 today we're going to have a discussion about latches 0:16 and let's take a second before we go into electronics land 0:20 And take a detour to dictionary land and just think about the word latches 0:25 um 0:26 A latche 0:27 you know if you latche door 0:30 ideally 0:30 if you latched a door 0:32 and walked away from it then came back later you'd expect it to have stayed latched

0:38 and conversely if youve unlatched a door 0:41 you could walk away from it and come back later on 0:45 and 0:45 You would expect it to be unlatched 0:47 um it's not like it's going to suddenly 0:50 Flip on you to another state 0:52 and 0:53 that's exactly what a latch is its something that is bi-stable there are two stable 0:58 states 0:59 Its latched/unlatched 1:00 A door 1:02 it's locked or unlocked there's no 1:05 in between there's nothing in between

1:07 locked and unlocked theres 1:10 Theres no nothing such as a simultaneously Locked and unlocked door 1:15 you know if you're in 1:17 Bingen or Wishram 1:19 chances are 1:20 Your door is locked at all times 1:23 Chances are in Hood River if your living in Hood River 1:25 Your doors unlocked you know 1:28 music you know theres two types of music theres country and western 1:32 beer 1:33 Bud and budlight theres 1:35 only 1:36 two

1:37 states nothing in between nothing can ever simultaneously exist 1:41 now that we've had some fun in dictionary land lets go back to electronics land 1:45 okay so 1:47 everything we've been doing up to this point in digital 1:50 has been this type 1:52 Where youve got 1:53 An input 1:55 ssss 1:56 an output lets do another gate here 1:59 Another inputs 2:01 Another combo inputs 2:03 Another output 2:04 You know this is not really hard

2:07 Given A and B and C and D you can figure out what X and Y 2:10 is 2:12 now how about this 2:15 okay still 2:17 Two two input and gates 2:23 but 2:26 That guys input is that guys output 2:31 and that guys input is that guys output 2:33 not so easy now eeh 2:36 ok 2:37 so in this configuration basically 2:39 the output from the first gate 2:43 Lets call this gate one

2:45 Is the input 2:49 To gate two 2:50 and gate twos output 2:53 Is the input to gate one 2:55 You know basically 2:56 your getting feedback from the output 2:59 it's feeding back to the input 3:01 okay 3:01 you could super easily 3:04 lose yourself in a game of 3:06 which came first the chicken or the egg here 3:08 so let's not do that let's 3:11 deal with something

3:12 we call just initial conditions so its assuming initial conditions someone 3:17 Lays a latch on your doorstep 3:19 and it has initial conditions and the initial conditions for this particular latch right here 3:24 This is an active low 3:26 SR latch so 3:28 Were just going to use the active low 3:32 SR latch 3:35 for this discussion an active low SR latch 3:40 let's draw it here 3:43 so that's what it looks like 3:45 and were going to have an input here 3:47 Called knot S 3:50 And knot R and were going to have two outputs Q

3:54 And knot Q so assuming initial conditions what we say it comes out of the package with 4:01 there's a one on both inputs 4:04 and a one on Q 4:07 Knot Q 4:08 should be a zero 4:09 So the first thing you should do right now is does this make sense 4:14 Do the even initial conditions make sense 4:15 So knowing what we know about a nan gate 4:18 it's truth table of zero zero 4:20 Zero one 4:21 one zero 4:22 one one 4:23 the only time I nan Gates low is when both inputs are high

4:28 okay so lets start at 4:31 Gate one 4:32 it's got a one for one input 4:35 it's got a zero for the other input 4:37 so one zero 4:38 Gives us a one 4:40 Good to go ok 4:43 Gate two 4:44 what's got for one input is a one 4:47 what's its other input 4:48 Its this one right here cause its traveling into there 4:52 and input 4:53 So one one

4:55 and it's output 4:57 is a zero 4:58 where good to go 5:00 okay 5:01 always check your initial conditions to make sure it makes sense ok so 5:06 these 5:07 again active low SR latches what is an active low 5:11 It requires a zero to get something done The S 5:15 stands for set 5:19 so it requires zero 5:21 A knot S because its active low to set the latch and 5:25 what we've created in our international conditions here 5:28 is a set state

5:30 A set state 5:32 Is when Q equals one 0:05:35.699,0:05:39.400 okay 5:39 So again Q 5:41 Is equal to one 5:43 Knot Q should be its compliment zero 5:47 And the set state here our initial conditions 5:50 oops 5:51 Wrong direction 5:54 This one goes to that one that guy 5:58 Oh man im messing it up goes to this one 6:05 Ok so that is our set 6:08 Condition 6:09 So now

6:11 think about active low 6:13 if I want to set 6:16 A set latch 6:19 what's going to happen 6:21 well if it's already set 6:24 it'll just stay set 6:26 okay so and just think about those dumb cops shows how many times 6:31 can you 6:33 Cock a revover 6:34 you know 6:35 Until you pull the trigger you know ideally if you 6:39 Cock it once it's going to stay cocked you know but sometimes theres dumb cops 6:42 cop shows that show ya show the guy cocking it once twice three times like come on freakin fire it but

6:49 anyway so back to our discussion here 6:51 so if a 6:53 active lows set command 6:55 comes in 6:56 On our knot S right there 6:58 what's this latch going to do 7:02 should stay 7:03 Set ok 7:04 is this true ok so lets draw a timing diagram well actually lets just use this pretty diagram right here ok 7:11 so we are in 7:13 set 7:14 Condition right here 7:17 and now

7:19 Lets go ahead and get rid of this guy 7:25 so for a long time 7:27 That active low set 7:29 has been hanging out 7:31 at one 7:35 And it's been doing one one one and all the sudden 7:38 It drops down to zero 7:41 okay 7:42 So now 7:43 suddenly this guy 7:47 changes to zero so it's a 7:50 set latch 7:51 so we shouldn't see anything happen

7:55 does that make sense 7:56 Ok so 7:58 for our gate one we got zero in 8:02 and a zero in 8:04 what's that 8:05 in nanland 8:08 Zero zero 8:09 Zero one one zero one one 8:13 that's a one 8:15 and there it is 8:17 right there 8:20 So thats the input to the first gate thats the input to the first gate 8:23 our output

8:24 Is correct it stays at one ok 8:27 so lets check the second gate cause things because there feeding back to each other 8:31 they might change things 8:33 is this correct ok 8:35 from the perspective of the second gate whats the input 8:38 Its a one 8:39 and a one 8:41 so we get 8:44 A zero 8:45 Good to go 8:46 so 8:46 what this is stating 8:48 when an active lows set comes along

8:52 On a latch thats already set 8:55 nothing should happen okay 8:56 so now that weve checked 8:58 It stays set 8:59 yes it does good to go 9:03 so now you're hanging out 9:05 in set land and 9:08 we had that transition from 9:11 a one to a zero 9:13 So its and active low set command 9:16 and that active low suddenly disappears 9:19 it goes back up to one 9:22 so

9:23 what it's stating is 9:25 That it was previously set 9:28 we sent another 9:30 command 9:30 an active low command 9:32 so it was set 9:35 already set 9:38 we sent in active low command 9:40 to set a previously set 9:43 Latch its going to stay set 9:45 now that active low disappears 9:48 What should happen well 9:50 since you're not asking it to set

9:52 it should stay in our previously set 9:56 condition 9:56 so let's check to make sure that's true 9:58 so what we're doing here all were doing is changing the input here 10:03 back to one 10:05 and again so it's 10:07 one 10:09 zero for the input for the first gate 10:12 and one zero should give us 10:14 A one 10:15 which it does 10:17 and now the input for the second gate 10:20 is

10:22 One one 10:24 Which should give us a zero 10:25 which it does 10:26 right there 10:27 okay so what we did 10:29 was this transition to 10:31 previously set and it was just hanging out in the set land 10:34 we gave it an extraneous 10:37 IE 10:38 We dont need to set a latch thats already set 10:41 zero cause its an active low set 10:43 then we went back 10:45 to a stable state

10:46 basically the latch stayed the same it was always in the set state 10:52 Where Q is equal to one 10:54 okay 10:55 so now your hanging out in set land 10:58 where if we remember right 10:59 Q is equal one and 11:01 Knot Q is its converse 11:03 and suddenly 11:05 along comes 11:06 and active low reset and that's what this R is here 11:11 so an active low reset 11:14 so it's just been hanging out here 11:16 at one

11:18 For this whole time 11:22 And sometime past here 11:24 it suddenly 11:26 drops to zero 11:27 Its an active low 11:29 reset 11:31 okay 11:32 let's walk through this in a much cleaner diagram cause youre going to need it 11:39 Ok so here is our super clean diagram and we are again hanging out 11:43 in a set state where both inputs are one 11:47 and our Q is one and our knot Q is zero 11:50 and what we're talking about here is basically 11:53 R has been hanging out this whole time

11:57 Woops one second 12:03 has been hanging out this whole time 12:05 as a one 12:09 And along comes an active low 12:13 reset 12:14 okay so 12:15 that's what the R stands for set 12:18 S set 12:19 R reset 12:21 so active low 12:23 reset ok this is where 12:24 many get confusing so 12:27 this guy

12:30 changes to a zero 12:32 okay 12:33 now from the perspective of the second gate here 12:36 we've got a one 12:38 and a zero 12:41 coming in 12:42 so one and a zero in nanland 12:45 Thats a one 12:46 so it changes 12:48 Our knot Q 12:50 to one 12:52 and now 12:55 what is the input here

12:57 for this first gate 12:59 well one and a one 13:02 but 13:04 what's coming out here 13:06 should be a zero 13:08 so it changes 13:12 That one to zero 13:14 but wait 13:16 you should be asking yourself 13:18 wont that change 13:19 this one's input here 13:22 It does 13:23 so

13:23 Now if zeros being fed in 13:26 A zero 13:28 ended with a zero 13:32 should be a one 13:34 there it is ok 13:37 so even with the zero with the feedback 13:39 we're good 13:40 and this latch has entered the 13:42 reset state 13:47 Where knot Q 13:49 is one 13:51 And Q is zero ok so 13:56 now were hanging out in reset land

13:59 and along comes or excuse me 14:03 Along disappears 14:06 that active low reset so this was our reset command our active low reset 14:13 right here 14:14 Then it suddenly disappears 14:16 So lets clean up the diagram again 14:20 okay so 14:22 now that the active low previous excuse me the active low reset 14:26 it was a zero right there but then it disappeared because the suddenly 14:30 comes back up 14:31 so it was a zero so our active low reset 14:35 suddenly becomes a one so 14:40 If were already in the reset state

14:44 ideally 14:44 an active low reset 14:47 disappears IE it goes back to one 14:49 what should happen here 14:52 Well ideally nothing 14:53 because it's already reset and its just saying okay just carry on in this stable condition 15:00 Where both inputs are one 15:01 okay so lets see if that's true now 15:03 in the reset state 15:05 what is lets do from the perspective perspective 15:08 Of gate one here 15:12 one 15:13 banded with a one

15:16 should give us 15:21 A zero right here 15:23 which it does 15:25 ok now from the perspective of the second gate 15:30 A zero 15:32 banded with a one 15:34 should give us a one 15:37 which it does okay 15:38 so once that active low reset 15:41 Disappears 15:42 it's going to stay in the stable reset 15:45 until 15:47 along comes

15:49 active low 15:50 set command 15:51 so were back up 15:52 to where we started early so 15:56 what do you think what's going to happen here 15:58 when active low 16:00 Set command 16:01 comes along 16:03 To a latch thats in a reset state 16:07 well 16:07 It should set 16:09 so let's go ahead and try that 16:14 Oops

16:15 that's clear 16:19 I need black ok 16:21 so we are in the reset state 16:24 And the reset state is again when the Q is equal to zero 16:28 Knot Q is equal to one 16:29 we want to send it 16:31 An active low 16:33 Set command 16:38 IE knot S goes down to zero so 16:43 whats it do 16:44 that's a zero 16:46 So now from the perspective of the first gate 16:50 what's our inputs well its zero

16:54 Banded with a one 16:57 that should give us a one 17:00 So that changes there 17:03 and now from the perspective of the second gate 17:09 Whats coming in is a one 17:11 and it's banding with a one 17:14 That should give us a zero 17:16 actually let's 17:17 Do that less confusing those should be blue lines 17:20 Sorry about that guys 17:31 okay so 17:33 One banded with a one 17:35 Should give us a zero

17:39 But wait you say 17:41 that feedback influences 17:43 the first gate 17:45 absolutely correct so a zero 17:48 Banded with a zero 17:49 should give us a one 17:51 which is still giving us a one 17:53 so we have entered 17:54 the set state 17:55 so we were previously in the reset state along came an active low set state uh 18:00 Excuse me an active low set command 18:03 and it sets the latch 18:05 The active low disappears

18:08 and we're back 18:10 in our initial conditions where the input are high for an active low SR latch 18:16 and we are in set state where Q is equal to one 18:18 ok 18:21 so basically 18:23 what this is saying 18:25 all you gotta do is just give it a little pulse 18:28 of zero on one input 18:31 because it's active low thats why its zero to get it to changes states 18:34 From set to reset 18:35 and you can hang out in that state indefinitely 18:39 okay so 18:40 high inputs one and one on

18:43 Knot S and knot R are always going to be 18:45 In whatever state you're previously 18:48 Set or reset 18:49 ok 18:51 notice 18:52 I did not include a case where I simultaneously am 18:56 Where Im simultaneously setting and resetting the latch 19:00 it's like I'm trying to lock and unlock a door simultaneously 19:04 it just doesn't make sense 19:06 You know why would a six-foot tall wookie live on a planet with three foot tall ewoks 19:11 It just does not make sense so dont lock or unlock does anyone get that joke 19:15 Ok so 19:17 Even though I said it doesnt make sense and dont do it don't ever simultaneously

19:22 Lock and unlock a door dont ever simultaneously set and reset a latch 19:27 Remember the first time your parents gave you your 19:29 car keys 19:30 They said dont drive fast 19:31 Your first thought as you backed her out of the drive way 19:34 Was lets see how fast moms minivan can go 19:37 Well lets try something like that I just told not to simultaneously apply a set and reset command 19:43 Lets drive fast take chances and see what happens here 19:48 so here we are hanging out in set land 19:51 and some joker 19:52 Is deciding to simultaneously send a reset command 19:59 and a set command 20:01 and so what's going to happen here

20:05 is both these inputs simultaneously 20:10 Go low 20:12 ok now let's just 20:15 At random just pick one lets start with the second gate 20:19 so what's the inputs the second gate 20:23 Its zero 20:24 coming in from this zero 20:26 And the its a one coming in here 20:29 so one 20:29 Banded with a zero 20:32 that's a one 20:34 Which changes this thing to a one 20:37 and then a one

20:38 Banded with a zero 20:41 From the perspective 20:43 Of the second gate one 20:44 Banded with a zero 20:47 that's also a one 20:50 so what we're getting is a state where Q 20:53 Is one 20:54 and knot Q is one 20:56 nope not authorized ok so this is basically an invalid condition when you're trying to 21:03 set 21:03 and reset a latch simultaneously 21:06 not only is that that 21:09 not only is it

21:10 Q and 21:11 Knot Q simultaneously one 21:14 as if that wasn't bad enough 21:17 what happens 21:17 here when you release the set 21:20 in reset simultaneously 21:22 it's where it stops nobody knows 21:26 you could end up in a set 21:28 or rest 21:30 and depending on gate propagation delays lets say 21:34 this gate is faster 21:36 Youre going to get 21:37 in one condition

21:38 but then 21:40 maybe this gates faster youre going to get in another 21:43 ah another condition 21:44 that you can't tell 21:46 So basically what Im trying to say is 21:50 simultaneously simultaneously inputing 21:53 a active low set and reset on an active low SR latch 21:58 Not good because you could end up 22:01 no no one knows you know even for the same gate for the same ship on a different day 22:07 It might have a different propagation relay because I dont know because maybe its warmer or something like that 22:12 Ok lets work with some timing diagrams for um 22:14 some SR latches here some active low SR latches 22:20

Ok so heres or basic active low SR latch 22:24 and we've got some signals here were starting out on the left side axes here with our 22:29 initial condition where both 22:31 Knot S and knot R are high 22:33 and we're in the set condition 22:35 where Q is one so 22:38 as the signals propagate 22:41 S is just going along when all of a sudden it says 22:45 set 22:45 that latch 22:49 so R doesnt do anything 22:51 R knot doesnt do anything um 22:53 so what happens 22:57

When the active low 22:59 set command 23:01 is delivered 23:02 to a latch thats already set 23:07 Nothing its already set 23:11 Active low disappears and were hanging out for a couple of seconds 23:18 And because it set 23:19 it stays set 23:21 All of a sudden 23:22 an active low reset comes along happens 23:26 the latch resets 23:32 Active low reset disappears we hang out for a couple of seconds 23:36 What does 23:38

Latch do it stays in the reset condition 23:41 until 23:44 Another set command comes along 23:47 the latch 23:49 sets 23:57 Got it and once a latch is set you can set it 24:00 set it 24:01 Set it 24:03 As many times as you want to 24:06 it's already set so its just going to stay at that way 24:08 okay 24:09 So that timing diagram for an active low 24:12 Uh SR latch there is such an animal 24:15

as an active hi 24:16 SR latch 24:19 And all that is is two cross coupled 24:22 nor Gates 24:25 I'm not going to 24:27 The detail I went into with the ah 24:30 the active low but we will do um 24:33 A timing diagram of it 24:39 Ok just think lets go ahead and just draw a timing diagram 24:45 okay so here's our timing gramm 24:48 diagram for are 24:50 active high SR latch 24:52 and we're just hanging out and set conditions lets go ahead and give us ourselves our 24:57

Initial conditions here 24:59 where Q is one 25:01 and 25:02 because this is an active high 25:04 our initial conditions are low 25:07 for the uh 25:09 For the um 25:10 S and R 25:11 and now 25:13 Were already in a set condition 25:15 and let's just say it 25:17 The set command were given another set command 25:20 So were setting a previously set latch 25:24

it stays that way 25:27 until 25:28 a rest command comes along 25:32 and it goes down 25:34 to a reset 25:38 condition 25:41 ok you can again 25:42 give as many 25:44 Active high resets as you possibly want to but as long as its reset it stays reset 25:52 until 25:53 another set command along 25:56 and you get that 25:58 okay 25:59

So uh again the dont try to set it and reset at the same time you could be in the same 26:04 State as an active low SR latchum 26:08 where 26:10 Who knows who knows whats going to happen ok 26:13 so that is about the basic SR latch 26:16 Were going to talk about some 26:18 modification to a SR latch to make it 26:21 Uh a little bit more use full and a little bit more fun