6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 19, 2024 9:16 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Mon Feb 08, 2021 3:30 pm 
Offline

Joined: Mon Feb 08, 2021 12:39 pm
Posts: 2
Hello 6502 forum! After being interested in retrocomputing for quite a long time, I finally decided to build something with 6502. With the help of 6502 datasheet and Ben Eater's video I wired some pins to VCC and GND. The reasons behind every action were pretty easy to understand despite my knowledge of electronics being pretty basic. But I didn't understand why did he use resistors when hard-wiring NOP to the data bus. How does it protect the 6502?

Can I power my computer with a 5V 1A DC charger?

Also, I would like to know things I should avoid doing to avoid damaging my ICs. Should I look for something like maximum current and voltage in the dtasheets?


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 08, 2021 3:46 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1930
Location: Sacramento, CA, USA
Jock wrote:
... But I didn't understand why did he use resistors when hard-wiring NOP to the data bus. How does it protect the 6502?

Hi, Jock. I have seen the video you reference, but I don't have time at the moment to dig up the link and re-watch it. However, I can speculate that Ben was using resistors for an extra layer of protection, even though it wasn't absolutely necessary in this particular instance. The 6502 data bus is bi-directional, and therefore capable of supplying unusually high current if it ends up accidentally attempting a write cycle on a shorted bus.

Accidents happen all the time, and it's sound engineering practice to make some effort to mitigate the negative effects when they inevitably occur.

_________________
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: Mon Feb 08, 2021 4:44 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3354
Location: Ontario, Canada
Welcome, Jock :)

Mike is right on target re those resistors -- they're a precaution. All being well (ie, as planned, you do nothing but NOP's) they're not necessary, because NOP's only read (input from) the data bus. But "stuff happens," and it's possible you might accidentally cause a write cycle, and outputting to the data bus would cause excessive current to flow were the resistors not present. The excessive current might damage the chip, but they are surprisingly robust.

To avoid damaging your ICs your biggest concern (especially in winter) is probably ESD (static electricity). Ideally you should use a wrist strap to ground yourself but the 2nd-best solution (and one I use myself) is to always touch a grounded object before handling the project. :arrow: AND!! Make sure your ambient humidity doesn't get too low. Low humidity allows static to accumulate to dangerous levels. A humidifier goes a long way toward preventing this.

Quote:
Can I power my computer with a 5V 1A DC charger?
A charger probably isn't appropriate -- its function is specific for use with a battery. But a 5V "wall wart" power supply intended for powering electronics (router, cordless phone base unit, electronic picture frame etc) will be fine.

Have fun, and keep us posted!

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 08, 2021 7:30 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1413
Location: Scotland
Jock wrote:
Can I power my computer with a 5V 1A DC charger?


One thing we learned from the early days of the Raspberry Pi is that many cheap chargers are really rubbish. Great for charging a device which expects a somewhat variable input voltage but not so great for powering electronics which expect a stable voltage over a range of currents.

Saying that, it shouldn't damage a 65C02, but may well make it unstable. If it's your only choice then put a good capacitor at the supply input (say 47µF, 25v and check polarity) and measure the voltage with a multimeter before you power the rest of the circuit with it. A modern 65C02 plus the stuff on the Ben Eater project isn't going to consume much more than a few 10's of mA at the most, anyway, so ...

Most PSUs that are designed for the Pi and other similar boards now output 5.2v which is fine. My Ruby 816 board is currently at 4.8v because it's being powered via a USB serial line and it's working fine. (Although that supply wasn't good enough when I hooked up a 20x4 line backlit LCD panel)

One other thing to check is that they're properly isolated - especially if you're going to be poking round the board, so use a multimeter on continuity setting to make sure the positive and 0v wires are not connected to the incoming mains pins. Cheap ones are often capacitor droppers and these can be dangerous. (See https://hackaday.com/2017/04/04/the-sho ... -supplies/ and "BigClive" on YouTube for more on these) although a 5v, 1A one is probably not a capacitive dropper.

Good luck with the project - do keep us informed.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 08, 2021 7:37 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
As a minor follow up to Jeff's post on powering your project....

You should provide a regulated 5-volt supply. How you do that can be one of two approaches:

1- Use a regulated wall-wart (as Jeff noted) that provides the proper current. I would recommend a supply capable of 3 amps.
2- Provide a higher, possibly unregulated, DC supply of 9-volts and use an onboard regulator to obtain the required 5-volts.

The old 7805 linear regulator has been used for decades, but there are newer switching regulator "drop-in" replacements which are more efficient.
In all cases, make sure you provide adequate bypassing for all ICs on your design, along with 2 or 3 larger value filter caps. A poly-fuse might also be a good addition for safety.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 5:29 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
Quote:
A charger probably isn't appropriate -- its function is specific for use with a battery. But a 5V "wall wart" power supply intended for powering electronics (router, cordless phone base unit, electronic picture frame etc) will be fine.

Thanks for pointing this out! I had never really thought about the difference between an adapter and charger.
Reading up, apparently there are differences such as a charger may not have noise filtering or regulation, where the adapter is designed to provide clean DC voltage to power devices.

FYI... I plan to use a modern Raspberry Pi adapter (output 5.1V, 2.5A).

_________________
Greetings Professor Falken.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 5:47 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
floobydust wrote:
As a minor follow up to Jeff's post on powering your project....

You should provide a regulated 5-volt supply. How you do that can be one of two approaches:

1- Use a regulated wall-wart (as Jeff noted) that provides the proper current. I would recommend a supply capable of 3 amps.
2- Provide a higher, possibly unregulated, DC supply of 9-volts and use an onboard regulator to obtain the required 5-volts.

The old 7805 linear regulator has been used for decades, but there are newer switching regulator "drop-in" replacements which are more efficient.
In all cases, make sure you provide adequate bypassing for all ICs on your design, along with 2 or 3 larger value filter caps. A poly-fuse might also be a good addition for safety.

If I go down the 7805 regulator path, could someone please recommend a more modern drop-in replacement?
(I wasn't aware there were other regulator options, other than a lm317.)

Also, I understand why bypass capacitors are required for each IC, e.g. an 0.1 uF ceramic cap on Power to GND, but what are these several larger value filter capacitors you are referring to and where do these go in typical circuit? Thanks.

_________________
Greetings Professor Falken.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 9:04 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1413
Location: Scotland
Firefox6502 wrote:
If I go down the 7805 regulator path, could someone please recommend a more modern drop-in replacement?
(I wasn't aware there were other regulator options, other than a lm317.)

Also, I understand why bypass capacitors are required for each IC, e.g. an 0.1 uF ceramic cap on Power to GND, but what are these several larger value filter capacitors you are referring to and where do these go in typical circuit? Thanks.


You might as well just use a 7805 here. If you ever get to the point of needing more than a few 100 mA then you can look at one of the drop-ins. I've used the TSR 1-2450 in the past but they're 5x the cost of a 7805!

You need decoupling on the output to stop oscillation with a 7805. I good (but possibly unusual) reference site for these is Wikipedia:

https://en.wikipedia.org/wiki/78xx

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 9:20 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
drogon wrote:
You need decoupling on the output to stop oscillation with a 7805. I good (but possibly unusual) reference site for these is Wikipedia: https://en.wikipedia.org/wiki/78xx

Thanks, I've heard the term "decoupling caps" often, but didn't properly understand it, reading up now...

_________________
Greetings Professor Falken.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 1:14 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3354
Location: Ontario, Canada
Firefox6502 wrote:
a charger may not have noise filtering or regulation, where the adapter is designed to provide clean DC voltage to power devices.
Yes, and indeed, not all adapters provide regulation. With an unregulated adapter the DC voltage will vary depending on how much load is applied. And that is how you can identify an unregulated adapter -- just measure the voltage with no load. In those conditions an unregulated adapter will read substantially (20-40%) above its rated voltage.

Of course you can connect an unregulated adapter to a 7805 (including capacitors, as noted). Just beware, because your logic circuits will fry if they get accidentally shorted to the comparatively high voltage at the input of the regulator. :!:

That's why I prefer to use a regulated adapter (or a bench power supply). As long as the project itself uses 5 Volts only, there's not much risk of a chip getting damaged if I make an incorrect connection or accidentally drop a metallic tool on the circuitry.... whereas accidents like that can be fatal when the board includes voltages above 5V (likewise negative voltages, as used for some asynch serial drivers). It's safer to keep everything 5V only. You need to use extra caution if other voltages are present.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 2:45 pm 
Offline

Joined: Mon Feb 08, 2021 12:39 pm
Posts: 2
Thanks for advice, everybody! I have a question about Resistor Power Rating. Is it usually safer to use a resistor with higher Power Rating, so my circuit doesn't fry itself?


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 09, 2021 3:44 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Resistor power rating is fairly simple, here's a simple example:

Take a LED that draws 1ma of current. The typical forward voltage for the LED is 1.7 volts. Using a 5.0 volt supply, you would take 5.0 volts. minus 1.7 volts and require a 3.3 volts drop across a resistor. 3.3 volts divided by 1ma = 3.3/1000 = 3300 ohms, or 3.3K ohms. Now, take the 3.3 volts drop across the resistor and multiply it by the current through the resistor (1ma) and you get 3.3 times 0.001 = 0.0033 watts of dissipation. As resistors have standard ratings for power, a 1/8-watt resistor would be easily sufficient.

Of course, as you start ramping up power dissipation for higher loads, you should size your resistors for a comfortable margin, roughly 4-5 times the dissipation under normal operating parameters. Also, look at a worse case scenario... in the above example, if the LED shorted, you would see the entire 5.0 volts across the 3.3K resistor. That would increase the dissipation to 0.0075 watts, which is still fine. In general, for the projects most of us do here (with 5.0 volts supplies and relatively low operating current), 1/8-watt, 1/4-watt and sometimes 1/2-watt resistors will be more than sufficient. Only in cases where you need to drop a fair amount of current do you need to get into large wattage values.

Hope this helps....

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 10, 2021 1:14 am 
Offline
User avatar

Joined: Thu May 14, 2015 9:20 pm
Posts: 155
Location: UK
Firefox6502 wrote:
Quote:
A charger probably isn't appropriate -- its function is specific for use with a battery. But a 5V "wall wart" power supply intended for powering electronics (router, cordless phone base unit, electronic picture frame etc) will be fine.

Thanks for pointing this out! I had never really thought about the difference between an adapter and charger.
Reading up, apparently there are differences such as a charger may not have noise filtering or regulation, where the adapter is designed to provide clean DC voltage to power devices.

The terminology around power supply units (PSUs)/ chargers / wall warts / power adapters etc is all both confusing and vague. Manufacturers of consumer products are especially bad at being vague and misleading.

There are actually more than six types of mains voltage to low voltage output power supply units / chargers / wall warts / power adapters etc...

Some even output AC rather than DC.

And don’t be fooled by a PSU having a USB socket on it. That means nothing.

I won’t describe them all here, but basically your circuit needs a nice smooth regulated DC voltage that stays noise free and within a few percent of it’s stated value. These are known as “regulated” types. The older terminology is “stabilised”. If the unit does not say it’s regulated, assume that it’s not.

Unregulated types are the equivalent of a sea with the wind behind it, lots of high waves and the height varies all the time. Whereas a regulated type is like a carefully controlled indoor fish tank, the surface is totally smooth and flat and someone maintains the water level to the correct height.

Microprocessors don’t like DC power that is choppy. The ripple messes up their operation, especially if the voltage dips too low, as then everything resets...

And with light loads, chargers and unregulated PSUs can output much higher voltages than the labelling suggests. For example a 9V nominal unregulated DC PSU can produce up to about 16V with no load or a light load.

Mark


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 10, 2021 3:40 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8190
Location: Midwestern USA
Jock wrote:
Thanks for advice, everybody! I have a question about Resistor Power Rating. Is it usually safer to use a resistor with higher Power Rating, so my circuit doesn't fry itself?

Yes. Generally speaking, the only downside to using higher wattage resistors is their larger physical size. That said, calculating the appropriate wattage rating is quite simple, so there should be no reason to go overboard.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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: