6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed May 08, 2024 8:25 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Mar 09, 2023 6:42 am 
Offline

Joined: Wed Mar 01, 2023 2:33 pm
Posts: 20
Hello,

I was going through the 6502 Primer for I2C BITBANG circuit.
(I am not able to attach the circuit image here) its in the this link:
http://wilsonminesco.com/6502primer/pot ... ITBANG_I2C

Here, can understand why he choses Bit0 for clock and Bit7 for Data. But I don't understand the circuit at PB7 and also the third point. When using a microcontroller, I usually connect power directly to the I2C devices. But I don't understand this mechanism explained here.
I know that we can control PB7 through the timer rollover (setting Timer1 control to 3). But how does this apply here?

Thank you.


Last edited by claw on Thu Mar 09, 2023 9:21 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 7:21 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8432
Location: Southern California
It's to be able to use PB7 for more things, in this case for a beeper and for turning I²C power on and off.  As the third bullet point below the diagram says, you can use PB7 for something like a piezoelectric beeper, and capacitor C1 will keep feeding base current to transistor Q1 to keep the I²C powered up through the short times PB7 is high in each cycle of the frequency fed to the beeper.  When PB7 returns low between positive pulses, diode D1 will bring C1's voltage down very quickly.  Let's say you're feeding 2kHz to the beeper.  The period then is 500µs, 250µs high and 250µs low if it's symmetrical.  The combination of C1 and R2//R3 will maintain an adequate base current for Q1 to keep feeding power to the I²C long enough for a frequency that's too low for the piezoelectric beeper to reproduce; so we're fine on timing.  If you want to keep I²C powered up, you can still use PB7 for anything you want as long as it returns low at least as often as every 10 or 20ms.  If you want to keep I²C power turned off, PB7 will have to remain high for the duration; but you probably won't need to do that for any longer than just to plug in or unplug an I²C module.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 7:36 am 
Offline

Joined: Wed Mar 01, 2023 2:33 pm
Posts: 20
Well, thanks for the explanations. This clears up few things for me.
GARTHWILSON wrote:
It's to be able to use PB7 for more things, in this case for a beeper and for turning I²C power on and off. As the third bullet point below the diagram says, you can use PB7 for something like a piezoelectric beeper

This is where I missed it. I was searching for a beeper in the circuit and wondering what is the function of a beeper in I2C circuit.

I have one more question here. Why do we want to control the power to I2C devices through PB7? Why not directly connect them to positive supply? Apart from the provision to plug and play, is there any other advantages?
And the LED given in the circuit shows whether the I2C devices are powered at the moment?

Or I assume it is to save power? Power the I2C devices, get the data and power them off kind of circuit?

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 7:49 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8432
Location: Southern California
The beeper is unrelated to the I²C circuit.  It's just that I multiplex a ton of things on a VIA, and anyone wanting many kinds of I/O will probably want to do the same, so this is a place you can double up.  If everything you will ever want to put on the I²C is installed rather permanently on the CPU board, then there's no need to power down.  The powering down is only so you can plug in and unplug modules while the computer is up, without fear of harming anything (including data).  And yes, the LED is just to show when the I²C is powered up.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 8:01 am 
Offline

Joined: Wed Mar 01, 2023 2:33 pm
Posts: 20
So, if I understand correctly, all this extra circuit involving R1 to R4, D1, C1, Q1 and LED are just for the Plug and play purpose?
If you don't need plug and play of I2C (permanently connecting them to power) then this circuit can be avoided all together.

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 8:17 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8432
Location: Southern California
Right.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 09, 2023 9:16 am 
Offline

Joined: Wed Mar 01, 2023 2:33 pm
Posts: 20
Thank you very much for taking time to explain it.

And thanks very much for seeding your Passion! Not many people do that.


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

All times are UTC


Who is online

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