Subtitles section Play video Print subtitles For many years the most common way computers displayed information on a monitor who has through this ubiquitous VGA interface But how does it work what electrical signals does a computer need to send into this thing in order to get a picture to show? Up. Now this connector has 15 pins, but aside from some grounds here actually a bunch of these pins are ground There's only five signals that we really care about. There's red green blue horizontal sync and vertical sync some of these other pins are sometimes used in different ways for the computer and monitor to communicate about what Resolutions the monitor supports things like that, but those are all optional. It's been just ignore everything but those five pins anyway This works is pretty closely tied to the way old-school CRT monitors worked and those old monitors you had an electron gun pointed at the screen with Electromagnets around here that could deflect the electrons to different parts of the screen Then to paint an image the electron beam just scans across the screen from left to right and top to bottom or so That's not actually how it works in a modern flat panel monitor but the timing of that electron beam physically sweeping across a screen is still what defines the timing of when we need to send each pixel and we don't just need to Worry about the order of the pixels and the time from one pixel the next there are also these margins on the top and bottom left and right For the electron beam to to sort of have a chance to stabilize or you can think of it coming up to speed Before it paints the next scan line Then it blanks and has a little extra room on the right here before the beam swings back to the left Which also takes time for the beam to swing back to the left? To start the next scanline and then same thing at the bottom of the image There's some blank scan lines down here before the beam gets sent back up to the top left for the next frame And so there's this physical process that the timing is based on So even though a more modern monitor doesn't use the same physical process We've got to follow the same timing in order to get an image to show up And so this diagram shows the detail of what that timing looks like The visible part of each scanline takes some amount of time and that's followed by what's called the front porch Which is just a blank time on the right side of the image Then you get the sync pulse which is a separate signal line this horizontal sync signal That tells the electron beam to swing back to the left side of the image And then the back porch is the blank time on the left side of the image before the next scanline starts And then it's the same at the end of the entire frame. So you get to the end of the frame. There's a front porch Which is the time to account for blank scanlines down at the bottom of the image and then a vertical sync pulse Which is the signal and on also the time that it takes for the electron beam to get sent back up to the top left Of the display and then there's a back porch which accounts for blank scan lines that are at the top of the next frame But what matters here is that for any particular display resolution the monitor supports we've got to get these timings right So the horizontal sync and vertical sync signals are the are pins 13 and 14 on our connector here We've got to get the timings of those signals right in order for the image to show up properly And in fact with older CRT monitors if you didn't get the timing right you could actually damage the monitor because you could get the electron gun pointing somewhere where it shouldn't be pointing and I don't think it's Possible to damage newer flat panel monitors, but if you do end up damaging your monitor I don't wanna hear about don't blame me. Actually, I do want to hear about it, but don't blame me Okay, so getting the timing right is important, but what are the exact timing requirements? Well, if we look out VGA signal timing you can see in this first link there's a whole bunch of different resolutions and different modes and A good video card would support a bunch of these resolutions and maybe even communicate with the monitor over some of those data pins I said to ignore to pick the best mode, but my goal is not to make a good video card My goal is just to get something working So, you know, I'm looking for one of these modes You know any mode that I think's gonna be easiest to build hardware for and you know, there's a bunch of trade-offs So depending how you think about it. You might come up with a different choice and that's fine But you know I figure I want to avoid the larger resolutions here because it's just a lot more image data to worry about and you know Then I'm just looking at the different pixel clock frequencies here Since I'm going to need to build a clock that runs at one of these frequencies And these are all in the tens of megahertz So that probably means using a crystal oscillator of some sort and I've got a bunch of crystals with different frequencies and of course None of them are any of the frequencies we want And I also have some of these integrated crystal oscillators can things that you can just hook 5 volts up to and it spits Out a nice clock, in this case, this one's 10 megahertz But unfortunately, nothing I have matches any of these clock frequencies. However, I can actually use a slower pixel clock As long as I compensate by sending fewer pixels So for example, I could use that 10 megahertz oscillator here instead of the 40 megahertz pixel clock But of course, you know timing is still critical, you know I can't change the overall timing But the times that matter here are these times here and there based on the pixel frequency But they're also based on the number of pixels Right, what really matters is how long does it take to draw each scanline. How much time do we spend in the display How long is this front porch, how long is this sync pulse in terms of time and so forth So that's what matters and that's what these times are here So this 20 microseconds of how long it takes to draw the visible area of one scanline is based on having 800 pixels Divided by 40 million pixels per second, and that's 20 microseconds But if instead of a 40 megahertz clock we're using a 10 megahertz clock Well, 200 pixels divided by 10 million pixels per second is still 20 microseconds And so the timing will still work out and then same thing with the front porch the sync pulse in the back porch right is If our front porch we get to 200 pixels here and we keep going another 10 pixels Well 10 pixels divided by 10 million pixels per second is 1 microsecond And so that that front porch will take the right amount of time And then same thing with the sync pulse if we just keep counting another 32 pixel times 32 pixel times divided by 10 million per second is 3.2 microseconds. And so our sync pulse will be exactly the right length And so as long as we divide all these pixel numbers by 4 and conveniently, they're all divisible by 4 We use these numbers. Our overall scanline is still going to take 26.4 microseconds even with this 10 megahertz clock So that's what I'm going to do. So I guess to start out What I'm going to do is build a circuit that's going to count pixels because we need to know where we are We need to know, you know, are we at pixel 0 or we at pixel 50? When do we get to pixel 200? When when are we in this range here where the sync pulse needs to be below? So to do that I'm going to build a counter that will just count pixels and then when it gets to 264 We'll reset it and that will count the pixels horizontally And then we'll end up building another one to count where we are in terms of which line we're on And so to count the pixels, I'm going to use the 74LS161 And because we've got to be able to count all the way up to 264 That's going to take nine bits and the 74LS161 is a 4-bit counter So in order to get at least nine bits, I'm going to need three of them I'll start by connecting the power and ground pins for each one So I'll just kind of go through each of the pins and hook them up So the clear pin is what's going to reset all of our counters to zero So we want to be able to clear all of them at the same time once we get to 264 So I'm just gonna tie the clear pins together for now and then the clock pin is kind of the same way that they're all gonna use the same clock So I'm just gonna tie the clock pins together for now And eventually I want to connect that clock pin to our 10 megahertz oscillator But I'm gonna leave it out for now Just because in order to test it I wanna be able to run it at a slower speed to start with so next we have our data inputs And we're not gonna use that because we're never gonna load a value into this. We just want this to count So I'm just gonna leave all those disconnected, but the enable pins, we do want to be connected So I'm gonna connect them all high so that the chips are always enabled Then again because we're not using these inputs for anything the load pin over here. We we don't want to use that either That's an active low. So I'm going to tie them all high and then this other enable pin and this enable T I'm going to enable the first one But the other two I'm not going to always have enabled because this is actually how the ripple-carry works So we're going to count the first four bits on the left here and then we want it to roll over and count the next Four bits here and then roll over and so forth And so the way that works is we connect the ripple-carry output of the first chip to the enable of the second chip and then the ripple-carry out but if the second chip will connect To the enable of the third chip and that way we've cascaded these together So that we will be able to count actually 12 bits because there's you know four there four bits each But we really only care about the first nine bits And so that should be all we need in order to get a counter going So what I'll do is connect the outputs up to some LEDs so we can see if it works. So there we go I've got the first 10 bits, even though we only really care about the first 9 bits got the first 10 But it's hooked up to those LEDs if we power this up. Well, nothing happens because we don't have our clock yet And we just hook our 10 megahertz clock up. We're not going to see anything This is just gonna be counting so fast that just looks like all the LEDs are on Now for a slower clock I could use a 555 circuit like I've shown in a previous video But actually what I'm going to do is use this fancy signal generator since it'll give me a lot more control over the exact frequency And so we want to set this up for a square wave and then the high level will be 5 volts and Then we need to set the low level and that'll be 0 volts so that way we'll get a square wave that goes from 0 volts to 5 volts and then the frequency here is 1 kilohertz and you know, that seems fine We'll start there and so I'll hook the output of the signal generator up to our clock input here That'll go right into our clock for all 3 chips and so now if I turn on the signal generator And there we go, it looks like it's counting but it's counting pretty fast now we can slow it down let's try 100 Hertz and That's not working as well, but you know what Our clear is not actually they're hooked together, but they're not actually hooked to ground or 5 volts So I think ground ground clears it but if we look at the 5 volts, there we go So it was just sort of clearing itself because that was floating But now you can see it's counting in binary Which is what we want and we can slow it down even more if we want to But really what we want to be able to do is we want to be able to know when we get to these different time points here So we want to start counting at 0 But then we want to know when we get to 200 if we want to know when we get to 210 When we get to 242 and when we get to 264 And then actually 264 we want to reset it back to zero. Well, how can we tell that? Well to figure out when the counter gets to 200, you know, we're counting in binary So this is going to be the the binary equivalent here for 200 So all of the bits are zeros except for these 3, right? We've got the 128 place the 64s place in the eights place and net that makes 200 So we have these signals That look like this those 3 ones that are set and we want to be able to detect when we get here what we can do is we can actually Invert all the bits that are supposed to be zeros and not invert the bits that are ones and then over here on the right All of these are going to be ones when we get to 200 Then what we can do is we can just feed all of that into a NAND gate and the output of that NAND gate will go low only when all of the inputs are high and all those inputs are going to be high or all of those inputs could Be ones only when our counter over here is actually at 200 and you may noticed. I only hooked up eight of the bits There's this ninth bit who's kind of hanging out up here Well, that's because we can use the 74LS30 which is an 8 input NAND gate But it's it's only 8 inputs. And as far as I know they don't make a 9 input NAND gate that's actually ok because looking at these 8 bits is actually enough to know that we've gotten to 200 because this 9th bit up here is the 256s place So if that actually were a 1 and the rest of these bits were Set the way they are. Then the overall value would be you know, 200 plus the 256 place would be 456 Remember when we get to 264 we're gonna reset our counter back to zero So, you know, our counter is never going to get up to 456 So we don't have to worry about this being a 1 if the rest of these are set the way that they are then We know this is going to be a 0 since we're never going to go over to 64 So it's fine to just ignore that one So this will detect when we get to 200 and we can do a similar thing to detect when we get to 210 We just have to look at different bits Right, so to match the value to 10 that we're looking for and then same for 242 as well. Same basic idea, right? we just have the bits that we're looking for and we just put the inverters where we need them in order to detect that with The NAND gate and then finally, this is what it looks like for 264 but now in this case we do need to look at that first bit to make sure it's actually a 1 because if this were A 0 you know the rest of these bits this is the only other bit set and that's the eights place So if this were a 0 up here the overall counter value would be an 8 which you know We're gonna get to 8 long before we get to 264 and so we would detect this this early so that's no good We've got to make sure that first bit is a 1 but in this case it's actually okay to ignore the last bit here at this last zero because if this value here is 264 and we change that to a 1 then it's going to be 265 but of course when we get to 264 we reset back to zero, so it's never going to get to 265 So whenever these first eight bits are set like this We know the last one can't be a 1 so we don't have to check if it's a 0 So in all of these cases, we got lucky that we can kind of cheat and only look at eight of the bits Now obviously we've got a lot of inverters here, but a lot of them are duplicates We really just need one per bit like this so we've got the nine bits coming in and Then we invert all of them and something we've got the inverted and non inverted version of each bit And then when we decode each of the numbers were interested and we can just kind of pick off the inverted or non inverted copy Of each bit that we need and depending on whatever number we're trying to to decode So this is what we need to build and I'm going to start off with nine inverters So to invert each of the signals. I'm going to use the 74LS04 which has six inverters We need nine of them So I'm gonna have two of these chips and so now we just hook up each output to the input of an inverter Okay, and so now we have all of our outputs for a counter all nine bits any way that we care about hooked up to inverters Which means now we've got inverted and non-inverted copies of all of our counter signals over here that we can use to detect those four values we're looking for So next we need to add those NAND gates. So I'll add another breadboard here where we can do that And then here's the first 74LS30, which is an 8 input NAND gate That'll let us decode one of those values And the first one I'll do is 264 because that's the one that also resets us back to zero So that'll be a good one to have So let's try to detect the number 264. So starting on the right here. The first bit is a zero We're actually don't care about that because remember we're gonna look at just the top eight bits. So we're just ignore the first bit So the next bits gonna be a zero So we'll hook up one of the inputs here to the inverted output If not the first one but the second one so that's our second bit is 0 and the third bit from the right is also zero so hook that one up to our Inverted output of our third bit here and the next bit is gonna be a 1 so I'm gonna hock that not to the output But to the input of this inverter here So that's just going to be the same as the output of our counter and I'll hook that up to another input And what I'll do is the inverted Lines, I'll use blue. And then for the non inverted ones, I'll use green So it's sort of easier to tell what's what that's a 1 and so then we've got 4 more zeros So hook that to the inverter output of the next bit Then another 0 will go to the inverted output of the next bit and then another 0 going to the inverted output of the next bit and then one more 0 followed by that 9th bit is gonna be a 1 so I can just hook that directly to the input of this last inverter because that's connected directly over to this 9th bit of our counter Alright, so we've got all the inputs of our and gate hooked up there I suppose I should also connect power and ground for a new chip over here. And then the output is pin 8 here Let me just hook on led to that. See what's going on and if I connect power that's on and of course that's on because this is a NAND gate so the outputs inverted. So that's going to be on unless we've got exactly The value 264 in our counter So if we reset our counter here by tying our reset here to low and then back to high we should have a zero in Our counter so not to 64. But if we send 264 pulses that led should go out and It's sending it and hey, it went out. So there we go. We've detected our 264 pulses and if we send one more pulse, so let's see one more pulse And we need to trigger it. So there we go trigger and it's still off Oh because now we've sent 265 and remember we're ignoring that last bit So we actually need to send one more pulse and there we go So now we're 266 and the LED has come back on again Alright so we're able to detect that 264 Now we just need to do the same thing for these other three numbers 242 210 and 200 as long as I add another NAND gate and let's hook up for 242. So remember for this one. We were just looking at the top eight bits here We're just gonna look at the bottom eight bits, and that should be enough to be able to detect 242 Ok, that first bit is a 0 so that's going to be the inverted output of our first bit down here It's going to go to one of our inputs up here then our next bits going to be a 1 so we actually want to Go from the non inverted as the input of our converter for the next bit and bring that up there Ok, so 0 1 the next is going to be a 0 and that's the third bit So that's this third inverter down here, which we've already got coming up to here Really? What we need to do is just bring that same inverted bit down and use that as an input Ok, so we have 0 1 0 0 1 0 the next is gonna be a 0 so that's our fourth bit It's gonna be a 0 so that fourth bit comes over here and then an output is there a 0 so you got 0 1 0 0 and then 1 1 1 1 so the next 4 inputs are all going to be Ones so this is going to go to input there and then the next one's going to go to the next input There and then the next two, we're gonna go to the next two inputs over here Okay, so we got 0 1 0 0 1 1 1 1 so 0 1 0 0 1 1 1 1 I hope I hooked that up right, of course we need to add power and ground. Now. This should be able to detect 242 So we're not at 242 now. That's a good sign Alright, so we've got the first two we've got the 264 and 242 So now we just need to do the same thing for 210 and 200 And so this is basically the same exercise. We're gonna add another 8 input NAND gate and hook up all of the appropriate inputs So that it detects the the you know the number to 10 and then again We'll do the same thing With another NAND gate and hook up all the inputs for that so that we're able to detect the number 200 Ok, so now we should be able to detect all 4 of these numbers So let's test it out if I reset. We aren't on any of these numbers We're hopefully at 0 cuz I just reset it and now I'll send 200 pulses Yeah, and there we go we got our 200 And now we'll send another 10 to get to 210 And now we're at 210 So I'll send another 32 to get to 240 - that's 240 - and I'll send another 22 to get to 264 And there we are 264 And actually when we get to 264 What we want to do is we reset our counter so that we start back at 0 again What I'll do is just hook the output of that over around to our reset signal So now if I just let the clock run continuously, I don't know if you can see it But these LEDs are flicking out very briefly There they go. I'm not sure if you can tell on camera but they're but you know, it's going through the cycle so at 200, 210, 242 and 264 These LEDs are going off very briefly just for one clock cycle But what we really want is we want to be able to tell when we're in the different sections of this signal So, for example, we want to know should we be displaying pixels or not, or should we be sending the sync pulse or not? and so for that what we really want is we want to know are we between pixel zero and pixel 200 or are we between pixel 210 and pixel 242 right now All we have is just a pulse when we get to each of those points but what we can use is we can use an SR latch and this is actually an inverted SR latch because Our outputs here are active low So we want the inverted set and the inverted reset and if you want to know more about the SR latch I've got a video on that so you can check that out up there but what we want to do is we want to be able to say ok when we get to 0 or actually Which is the same as 264 because when we get to 264, we're going to reset and be at 0 right away Anyway, so when we get to 264, we want to set this latch and then when we get to 200 We want to reset it and then our output Q will be high if we should be displaying pixels and low if we're in the blanking section over here and then we can use another SR latch for our Hsync or horizontal sync signal and in that case at 210, which is that guy we'll set the latch and Then at 242 will reset the latch and then the Q will indicate whether our horizontal sync should be active or not or actually since this is a low going pulse we can just use the Inverted Q for that and that'll actually be our Hsync signal so to build this SR latch. We're using two NAND gates And so it gives a 74LS00 which actually has four NAND gates on it So I'll hook up power and ground and then I'll hook up the two cross-connects for the first SR latch so that's just these two connections here from the outputs back around to the inputs And so for the first SR latch, we want to set it when we get to zero, but also when we get to 264 So we get to the end I want to set this so that'll be this signal here Which actually is already kind of sneaking around here hook that up So we'll set this latch when we get to 264 And then we want to reset it when we get to 200 which is this guy here It'll take the output there for 200 and that's where we'll reset. And then if we look at the output of this What we see is that when it's on that's when we should be sending pixels and then it goes off That's our blanking interval All right So that should be on from 0 to 200 and then it goes off from 200 to 264 And then it comes back on again. So now let's do the same thing for our sync pulse I'll hook up those cross-connects. That's our second SR latch and this one is gonna be set at 210 and then reset at 242 and I'll grab another these LEDs and look at the output of this one And so that's our sync pulse so we have our display when that's on and then we get here to our blanking and then in our blanking you see the sync pulse Okay, so we know in our display interval is we know when our blanking interval is and we've also got our horizontal sync pulse But the whole purpose of setting all this up is so that we get the timing right down to these Microsecond values for each of these intervals but that assumes that we're using a 10 megahertz clock So let's get our signal generator out of here and actually set up our 10 megahertz clock So this is the 10 megahertz oscillator And I'm just going to hook this up and these are pretty easy to use basically You just hook up power and ground So power is this pin up here on the top left and ground is the pin over on the bottom right And as long as you've got power and ground hooked up like that, you'll get a 10 megahertz signal coming out of this top Right pin here that we can feed into our clock And it's kind of hard to tell if that actually did anything because our LEDs just appear to be on but of course if we're going at 10 megahertz, these intervals are gonna be so fast that you know, These are in microseconds the whole line it takes 26.4 microseconds, so we're not really gonna see the LEDs doing anything So what I really need to do is get these LEDs out of here and hook up an oscilloscope where we can measure the times exactly So I'll hook up one oscilloscope probe here to our display interval and then I'll hook another here over to the sync pulse And now if we look at the oscilloscope, we'll see both of those signals here So this is the display interval and then during that blank period there we see the sync pulse and you know Actually, we want the sync pulse to be high and then it goes low for that sync pulse Instead of the other way around so instead of looking at the Q output of our SR latch We can just pop over here to the NOT Q output the inverted output We should see the sync pulse that looks the right way. So this looks right but let's actually verify each of these times So the visible area should be 20 microseconds so if I want to measure that positive going part of this signal we can use this option here just to look at that width and then shows 19.9 about 20 microseconds So that's exactly what we would expect here is 20 microseconds And then we can look at the sync pulse as well. So that should be 23.2 microseconds so in this case, we need to go to channel 2 and then we want to look at the Negative going width. So let's bring that up and that's 3.2 microseconds And so that's the negative going time of our sync pulse is 3.2 microseconds So so far it looks like we've got these these timings perfect If we want we can even measure the front porch and back porch times if we zoom in here a little bit We can bring up the cursors. Here we go So we can move cursor A over here to the start of the blanking interval and then cursor B we can move over to the start of the sync pulse and then cursor A minus cursor B is about 1 microsecond Which is exactly what the front porch ought to be 1 microsecond and then we can do the same thing for the back porch So move cursor B over to the end of the blanking interval and then cursor A we can bring over To the end of the sync pulse and then B minus a is 2.1 microseconds, and it's supposed to be 2.2 although maybe that's close enough or well, I guess it says 2.1 6. So that's even even closer So that takes care of a horizontal sync signal we're generating this perfectly So next we need to generate the vertical sync signal and it's going to work pretty much the same way It's just instead of counting pixels across the screen. We're gonna count scan lines down the screen so every time we go through this 264 pixels across we're going to count one line down and then we need to know when we're between 0 and 600 so we can display stuff and then we need to know when we're between 601 and 605 so we can output the vertical sync signal to the monitor and if we look at the timing requirements here These times are just based on the times up here So with our 10 megahertz clock, you know We're generating these times correctly now and because each whole scan line is going to take 26.4 microseconds All of these times are going to work out as long as we just count the number of lines correctly So really we just need to build a circuit identical to what we just built that counts up to 628 and detects 600, 601, 605 and 628 And so just like before we can take the number 600 and Feed that into some inverters and a NAND gate and detect when we get there Now one difference is this time around, you know to be able to count up to 628. It's going to take 10 bits So we've got a couple extra inputs here, but we're still able to cheat a little bit We don't need to we don't actually need to check either of these 2 bits because again, this is though This is the 128ths place So if this were a 1 then this would be 728 and because we're only counting to 628 we never need to check if though if these are ones as long as the other 8 bits that we are checking are correct and Then here's how we would check for 601 basically the same except that last bit is now a 1 instead of a 0 and then 605 is just a little bit different and finally 628 and you notice with all of these That these two bits here that we don't have ever have to check So in all of these cases just like before we can get away with that 8 input NAND gate Which is very convenient the other thing that's kind of convenient here Is that some of these bits like this one and the first one are always one At least in the cases that we want to check and so we can save ourselves an inverter there because we Never need to check if that particular bit is zero So overall, this is what we're going to need to build and you can see we only need five inverter for this to work These two bits. We never need to check and then these bits whenever we check them We're only checking if they're ever a 1 but otherwise this circuits going to be very similar to what we just built We're just gonna have 10 bits for our counter and we're checking now for 600, 601, 605 and 628 This is our horizontal timing circuit and I'm just gonna add a few more bread boards here where we can build our vertical timing circuit So I'll start by building the counter that'll let us count up to 628 and to count up to 628 we need 10 bits instead of the 9 bits we needed before but 3 74LS160's gonna give us 12 bits to count with so that's still more than enough and I'll add the inverters that'll help us decode the different values that we're looking for. And then hook the outputs of the counter up to the inputs of those inverters Then I'll add the 4 NAND gates that we're going to use to decode the 4 different values that we're looking for. So three of the bits are always ones I can just hook all three of them up to all four of the NAND gates and then I'll just hook the rest of the counter bits up either inverted or not inverted to the 4 NAND gates to detect the 600, 601, 605 and 628 that we're looking for. And so that should detect 600, 601, 605 and 628 and when we get to 628 we want to reset our counter It's all hook 628 up to the reset signal for our counter and then we want the SR latch so that when we reset at 628 we set the latch and then reset it when we get to 600 So we have a signal that will tell us if we're in our display area and then the other latch Which will set on 601 and reset on 605. So we'll add a quad NAND gate and build our two SR latches So the bottom one's going to keep track of when we're displaying our image So we want to reset that or we want to set that rather when we reset the counter and we want to clear it when we get to line 600 and Then the top SR latch is going to generate our vertical sync pulse. So we want to set that when we get to 601 and Reset it when we get to 605 and so now we've got two timing circuits We've got a horizontal timing circuit that counts pixels across the screen. So this is sort of a column. We're on that This is counting and then it generates our horizontal sync pulse and then the vertical timing circuit counts, which line on the screen We're on and generates our vertical sync pulse now for our horizontal timing We're using a 10 megahertz crystal because we're essentially putting out 10 million pixels per second as we scan across the line But for a vertical timing, we don't want that to count every time we put out a pixel We want that to count for each line that we put out So in other words when we're done drawing a horizontal line, so we in other words would get to 264 with a horizontal counter That's when we want to increment our vertical counter and go to the next line So the reset signal down here for a horizontal counter we can use that as the clock for the vertical counter so let's power this up and reconnect the oscilloscope to make sure our horizontal timing is still working correctly and So this still looks pretty good Yep, that looks like about what we would expect So now let's also hook the oscilloscope up to take a look at the vertical timing and see what that looks like And so let me turn on these other two channels here so we can see that And I have to move things around a little bit and change the scale here So let's try to try to fit everything on the screen here Okay so here we are and it looks like something is happening with our vertical timing But of course the vertical timing is much slower than the horizontal Timing since there's going to be six hundred and twenty eight of these pulses for every vertical frame so we're going to need to zoom out a bit and Then I can also set this to trigger on that channel three So, there we go And if we zoom out a little bit more we should start to see the vertical timing and so just like before we can take a couple measurements just to make sure this is working right so If we want to look at the width of the visible area, that should be 15.84 milliseconds So that's going to be this right here. And there we go 15.8 milliseconds. So that seems pretty close And then the sync pulse here should be 0.1056 milliseconds So no, we should be able to measure that as well So let's go to channel 4 and then we want to see that negative pulse width And we may need to zoom in to get a better measurement of this. So there we go so that's saying it's a 108 microseconds And 108 microseconds is going to be 0.108 milliseconds So that's probably pretty close If I zoom in even more you can see the Precision's even better So here I'm even closer to that 0.1056 And the other thing you can see is that when the visible area ends There's one horizontal sync pulse before we get to the vertical sync pulse and then the vertical sync pulse so you can see is 1, 2, 3, 4 horizontal sync pulses. And so all of that matches after our visible area We've got one line followed by our sync pulse, which is four lines long So it looks like we're generating all of this timing properly. So let's go ahead and actually try cooking up a VGA monitor So a VGA uses this 15 pin connector and actually five of those pins are grounds So there's the ground and then a separate ground for red green and blue and a sync ground Plus the outer shell is actually a ground. So I've hooked all of those grounds together And so I've got a ground connection here and then pin 13 is horizontal sync And pin 14 is vertical sync So let's actually try hooking this up to our circuit so hook the ground up and Then our horizontal sync I'll hook up here and Then vertical sync. I'll hook up to our vertical sync And so now if we actually plug a monitor into this You can see the monitor comes out of standby And of course the display itself is blank because we're not sending any picture to it yet but if we go into the menu here we can actually see what mode it's in and You can see it it thinks it's in 800 by 600 mode and it says the horizontal frequency is 38 kilohertz and the vertical frequency Is 60 Hertz and that all matches what we're trying to do here 800 by 600 at 60 Hertz timing and the vertical refresh rate is 37.8 kilohertz and so with our two sync signals here. We've managed to fool the monitor into thinking that it's in this mode So now what we need to do is send the actual pixels the red green and blue signals You know in the right order to draw a picture and that's what I'm going to tackle in the next video So make sure you subscribe to the channel and click that bell to turn on the notifications So you'll be sure to know when the next video comes out and if you feel like supporting the creation of more content like this Head on over to my patreon page and sign up at whatever level feels comfortable I really do appreciate everyone who helps make these videos possible
B1 sync pulse hook timing counter inverted The world's worst video card? 10 0 林宜悉 posted on 2020/03/27 More Share Save Report Video vocabulary