6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Jun 15, 2024 11:20 pm

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Jan 07, 2022 2:52 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
Hello everyone! I am still new to all of this, but I'm starting to get the logic and even timing side down.

But I have very little experience with "analog" circuits.

Attached is a picture of what I'm trying to accomplish. The idea is that I input a 4-bit nibble to output 16 different colors for VGA. It's fairly straight forward if that's all you are doing.

Though I had the idea to preset some color "tone" with an 8-bit latch. Thus my 16 colors possible are alterable from a bank of 256 possible colors.

So thus my input lines no longer just push color, but they select colors. To do this I put some diodes on in reverse. If the input line is high, it 'pushes' the preset color towards the monitor. If the input is low, it grounds that signal.

I also have an 'intensity' bit, which I'm not sure exactly if it's in the right spot or not.

Does that look right? If it does, what kind of diode would I use? I have used some really tiny ones for SPST switches from a VIA, and they work fine. But this seems like a different application.

Thoughts?

Thanks everyone! I appreciate your help and insight a great deal.

Chad

EDIT: I'm adding a second picture "ColorSelect2.png" with an additional diode. I think this would keep the 'intensity' bit from dragging the presets to ground if not selected. Eh?


Attachments:
ColorSelect2.png
ColorSelect2.png [ 6.52 KiB | Viewed 520 times ]
ColorSelect.png
ColorSelect.png [ 6.76 KiB | Viewed 525 times ]


Last edited by sburrow on Fri Jan 07, 2022 8:06 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 07, 2022 3:20 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1080
Location: Albuquerque NM USA
VGA active signal level is quite low; full intensity is 0.7V, so your diodes won't turned off the signal fully.

I've been thinking about the 4th bit and what to do with it. I'm thinking of 50% intensity control like this sketch. The diodes are Schottky diodes with turn-on voltage of about 0.3V
Bill

An alert reader has pointed out the diode symbol I drew are zener diodes, not shottky. My bad, I meant to use Schottky, but drew zener diode instead.


Attachments:
01072200.JPG
01072200.JPG [ 63.86 KiB | Viewed 519 times ]


Last edited by plasmo on Fri Jan 07, 2022 9:22 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 07, 2022 8:04 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
plasmo wrote:
VGA active signal level is quite low; full intensity is 0.7V, so your diodes won't turned off the signal fully.


I think we are using them for different purposes here? True, the voltage levels are low. And I'm guessing from your response that voltage levels matter for diodes, in some way or another.

Your configuration is where you are pushing past those diodes, and they yield only 0.3V out of it, right? Like, you are going against the diode and it's not perfect (on purpose) so it "leaks" 0.3V forward. Correct? [ I *really* don't know the right words to use, I'm trying to think of water here. ]

In my configuration, it's similar to when I would connect SPST buttons to a VIA. Basically some external source is pushing voltage onto the line. My diode is backwards, only allowing flow in reverse. So when I ground my input, it's like a sink, and sucks all the flow up that would have gone somewhere else. Path of lease resistance. But if my input is high, it's pushing on that diode, effectively closing it (not leaking I'm guessing), and so the external source must go somewhere else, and in this case, through some resistors into the VGA monitor.

That's how I'm seeing it.

The reasoning behind my #2 image is that the 'intensity' bit is pushing it's full voltage onto the line, but if I ground it I do NOT want it sucking up what the external source would be sending. So there it's more of a safety concern.

No? Yes? Terrible explanation? :)

Thank you.

Chad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 07, 2022 9:37 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1080
Location: Albuquerque NM USA
Diode is not quite like a switch with zero resistance forward biased and infinite resistance reverse biased. You are thinking of "perfect diode" which actually exists but takes lots of circuitries to get there. It may be perfect, but most certainly not simple. A plain old diode has negligible reverse current (basically an open switch), but some forward voltage drop (nominally 0.7 for silicon diode and 0.3V for Schottky diode) when forward biased, so think of it as a closed switched but with 0.7V (silicon diode) across the switch terminals. 0.7V happens to be the full intensity voltage level for VGA, so diode switching doesn't work too well in VGA circuit. Quite often you may see forward biased diodes from VGA inputs to ground. This is to protect VGA inputs so excessive voltage is clamped to 0.7V.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 07, 2022 10:24 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1935
Location: Sacramento, CA, USA
What Bill said. Some competent people simply don't learn well from theoretical discussions, and are better off just experimenting with different configurations. As long as you're not endangering expensive hardware or human lives, there's something to be said in favor of just hooking stuff up to see how well it works or releases the smoke.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 07, 2022 11:02 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
barrym95838 wrote:
What Bill said. Some competent people simply don't learn well from theoretical discussions, and are better off just experimenting with different configurations. As long as you're not endangering expensive hardware or human lives, there's something to be said in favor of just hooking stuff up to see how well it works or releases the smoke.


Haha ok makes sense, thanks for that.

And thank you Bill. I think I understand better now. I'll be considering, and testing.

Chad


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 9:00 am 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1395
Sorry for being late to the party.

Resistors, diodes, VGA...
Reminds me to the output section in the "VGA unit" of Dennis Kuschel's MyCPU:

Attachment:
vga_output_mycpu.png
vga_output_mycpu.png [ 43.61 KiB | Viewed 395 times ]


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 10:04 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
ttlworks wrote:
Sorry for being late to the party.

Resistors, diodes, VGA...
Reminds me to the output section in the "VGA unit" of Dennis Kuschel's MyCPU:

Attachment:
vga_output_mycpu.png


I went through his entire guide, looking for WHY he used the diodes. And I couldn't find anything. It was just assumed that that is how you do it.

My thoughts are that he is not wanting his 'intensity' bit to ground out the others somehow. Something like:

I want FULL RED, so then 1 on RED and 1 on WHITE (aka intensity). But then we also need 0 GREEN and 0 BLUE. No issues there.

I want HALF MAGENTA, so then 1 on RED 1 on BLUE, but 0 on GREEN and 0 on WHITE. Because WHITE is grounded, could it pull either/both RED and BLUE down beyond their expected range?

On any other system without an intensity bit, it seems to not need diodes. Ben Eater doesn't use any on his design (6-bit / 8-bit color, about the same thing).

But as Bill was saying, these things are not perfect anyways, so 0.7V could come back through it anyways, leaving some dip in the expected value. Heck, look at Bill's in comparison, and he basically just reversed the diodes (minus resistors also).

Well, thank you for that. It's neat to see other VGA projects and how they accomplish stuff like this.

Chad


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 12:48 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 304
sburrow wrote:
On any other system without an intensity bit, it seems to not need diodes


That's because they're doing different things. Different goals, different circuits. The original circuit is starting with a colour, adding either white or black, and trying to subtract red/green/blue from it to make other colours. The one that ttlworks posted starts with a colour and adds white to it to make a lighter version. Other circuits will be doing other things. They'll all have different sets of colours available.

It's educational to analyse what you get with this second circuit. Inputs without a diode are equivalent to either 0V or 5V connected through the resistor. Inputs with a diode are equivalent to either 4.4V (or somewhere nearby) through the resistor, or no connection. Add the 75 ohm terminating resistor to 0V on the other end of the cable, and you have a simple circuit made of resistors and voltage sources, and it's straight-forward to work out the voltage at the output node.

With both of the 'red' inputs high, and both of the white inputs low, you have 270 and 390 ohms in parallel to 5V, and 47 and 75 ohms in parallel to 0V. That works out to 0.77V on the output. You'll get red, but not the brightest red that the monitor can display.

Now, keeping the red inputs high, take both of the white inputs high as well. This adds 680 and 560 ohm resistors in parallel to approximately 4.4V. If we call that 5V to keep life simple, the output will be just over 1V, which is the maximum for a VGA signal.

With the white inputs high and the red input low, that's 270, 390, 47, and 75 ohms in parallel to 0V and 680 and 560 ohm to 4.4V. Again, call that 5V, and I get 0.37V. So with full red, no green, no blue, and full white, you'll have the red output at 1V and the other two at 0.37V. That's red, but with a little white mixed in.

This desaturation of brighter colours is probably deliberate. I find them more attractive than the fully saturated colours you get from simpler systems (I grew up with a Commodore 64, which wasn't big on saturated colours).

I was treating the diodes as perfect components when working out the values partly because I'm lazy, but also because in this case I can get away with it - 4.4V isn't very different from 5V, and that simplification doesn't change the result very much. But in the circuit in the original post, the choice is between 0V and 0.6V - and these are very different. No matter how much current it pulls through the resistor, it can't take the output below 0.6V, and that's more than half of the maximum output voltage for VGA. Rather than pulling the colour towards black, it'll be pulling it down towards a brightish red/green/blue (and won't affect anything that's already below that level).


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 12:50 pm 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1395
I would say, that the diodes are for adding a bit of voltage to the RED, GREEN, BLUE outputs if the intensity Bit is set,
and for making sure that RED, GREEN, BLUE voltage doesn't change if the intensity Bit is not set.

For simplifying things, let's just assume that the anode/cathode current through the BAT41 diode "cuts off"
if the anode/cathode voltage goes below 0.3V.
In reality, it's a bit more complicated, and we would need to take a closer look at the BAT41 datasheet...

Also, the outputs of the TTL/CMOS chips driving the voltage divider give out a bit more than 0V and a bit less than 0.5V,
depending on the output current, but that's mentioned in the datasheets of these chips.
And when building resistor DACs like that, it's better to keep an eye on the specifications about
how much current the output of a chip is supposed to be able to sink/source.

For building it "the professional way", one would have to do a bit more math,
and maybe to buffer the VGA outputs so that their impedance won't change with the DAC value... ;)
But for hobby use, things certainly don't _need_ to be perfect and complicated.

Attachment:
crude_video_dac.png
crude_video_dac.png [ 64.9 KiB | Viewed 378 times ]


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 1:13 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
I'm not sure if this is helpful, but the way I calculated resistor values and output voltages for this sort of thing was by observing that the Thevenin equivalent voltage for an output (not connected to the monitor) that comes from a parallel combination of various input voltages through resistors is the weighted average of the input voltage with each one weighted by the conductance of its resistor (1/R). This works well for multiple bits per colour, as well as for intensity bits that are shared between channels, and helped me understand networks with more than two resistors as you can easily write an expression for the output in terms of the inputs. Spreadsheets are good for experimenting with this.

There's also an effective series resistance which is the parallel combination of all the resistors, and you need to ensure this is the right magnitude compared to the receiver's 75 ohms as well - or better, buffer the output with exactly 75 ohms of impedance.

Edit: as an example, for that last case above, we have 4.7V through 560 ohms, 5V through 270 ohms, and 0V through 29 ohms. (4.7/560 + 5/270 + 0/29) / (1/560 + 1/270 + 1/29) = 0.673V and the output impedance is about 25 ohms.


Last edited by gfoot on Mon Jan 10, 2022 1:25 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 1:18 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
John West wrote:
The original circuit is starting with a colour, adding either white or black, and trying to subtract red/green/blue from it to make other colours. The one that ttlworks posted starts with a colour and adds white to it to make a lighter version.

4.4V isn't very different from 5V, and that simplification doesn't change the result very much. But in the circuit in the original post, the choice is between 0V and 0.6V - and these are very different.


Excellent reply John, thank you for this! That makes a lot more sense now, subtraction vs addition. And that seems like very good math. I will be going back over it again.

And that makes a lot of sense with the different voltage levels. That would tie up with what Bill was telling me.

ttlworks wrote:
For building it "the professional way", one would have to do a bit more math,
and maybe to buffer the VGA outputs so that their impedance won't change with the DAC value... ;)
But for hobby use, things certainly don't _need_ to be perfect and complicated.


Haha yes. I really like that attachment. It is very clear and easy to follow. Good math there!

What I'm seeing from it is that a diode in the place you put it, in the configuration you put it in, does not really change the value much. It acts kind of like a resistor basically, dropping the original 5V to 4.7V, correct? If I were to use Bill's "backwards" diodes, he's doing it so that 5V turns into 0.3V, essentially?

gfoot wrote:
the weighted average of the input voltage with each one weighted by the conductance of its resistor (1/R)


Yes exactly. Very good to remember this. It's funny, I actually used to teach "Intro to Engineering" where we'd do these huge resistor networks, kinda sorta like this. I never used diodes in the lesson though, so I guess that's why I don't quite understand them...

Ok, cool, thank you George, I'll be thinking about that as well.

Very good info here! I'll be going over all of this again for sure, thank you everyone!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 2:01 pm 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1395
gfoot wrote:
I'm not sure if this is helpful

Starting to remember, that we had a dissection of a monochrome ECL video DAC long time ago...

;---

sburrow wrote:
What I'm seeing from it is that a diode in the place you put it, in the configuration you put it in, does not really change the value much.
It acts kind of like a resistor basically, dropping the original 5V to 4.7V, correct?

I think it simplifies the math when putting the diode at the other end of the divider resistor,
and making it look a bit like "just another resistor".

sburrow wrote:
If I were to use Bill's "backwards" diodes, he's doing it so that 5V turns into 0.3V, essentially?

Well, I think it's something like that, except that it isn't exactly 0.3V:
the voltage depends on the output impedance of the IC switching to GND, on the diode characteristics, on the current and such.

Hmm... an option for getting around using diodes would be making creative use of something like 74HC125/74HC126 buffers.
For instance, one could take a 74126 buffer, tie the input to VCC, the output_enable to the Intensity Bit,
and place a resistor between the output and 'red'. It's just a thought.
But be aware that them buffers have a propagation delay, and they only can sink/source a certain amount of current.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 2:15 pm 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1395
gfoot wrote:
There's also an effective series resistance which is the parallel combination of all the resistors, and you need to ensure this is the right magnitude compared to the receiver's 75 ohms as well - or better, buffer the output with exactly 75 ohms of impedance.

//muckraking in the drawer...

Well, them professional engineers had buffered analog RGB video signals with something like that:

Attachment:
ef9369_output_buffer.png
ef9369_output_buffer.png [ 90.51 KiB | Viewed 368 times ]

But for a simple hobby project, I think that's "sort of an overkill".

//The scan isn't very readable, supply voltage is supposed to be +12V.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 10, 2022 2:43 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 707
Location: Texas
ttlworks wrote:
But for a simple hobby project, I think that's "sort of an overkill".


I'd say! Yeah, I can safely say that I will not be implementing that design exactly.

BUT it is interesting they use a polarized capacitor right up front.

Perhaps I will think more on George's suggestion on "all parallel". I mean, in theory that makes sense, but the math gets wild. [ And I'm a math teacher! ]

Thanks for that!

Chad


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: