Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 4th March 2008, 03:27 AM   (permalink)
3v0
Default

Hey we went from 3 to 4 switches

You have the basic idea.
3v0 is offline   Reply With Quote
Old 4th March 2008, 03:29 AM   (permalink)
3v0
Default

Quote:
Originally Posted by IČR
Sort of. A pullup resistor is used to maintain a small, stable voltage on an input pin. If you left it off, your circuit MIGHT work correctly, but the pin's voltage may fluctuate, causing unwanted false inputs.
I am not an EE. But I would have said steady voltage and small current?
3v0 is offline   Reply With Quote
Old 4th March 2008, 03:32 AM   (permalink)
Default

ok cool. So there is no definite way to calculate the divided voltages right? Like i would have to place resistors and manually check each one to determine drop ?
All i know in ohms law is how to get 1 value from 2 others. I don't know how to subtract like 100k ohms from 5v to determine the drop on the resistor.

Quote:
Hey we went from 3 to 4 switches

You have the basic idea.
yeah the concept is in the head but the head doesnt know how to draw lol

EDIT: Found this

Last edited by AtomSoft; 4th March 2008 at 03:35 AM.
AtomSoft is offline   Reply With Quote
Old 4th March 2008, 03:41 AM   (permalink)
Default

It's simple. Consider a 20 kOhm resistor in series with a 5 kOhm resistor, with 10 V applied across them. You want to determine the voltage at the point between them. First thing you do is calculate the current through the resistors:

I = V / R

I = 10 / (15 k + 5 k)

I = .5 mA

Now that you know that, you can calculate the voltage drop across each resistor:

V = I x R

V1 = .5 mA x 15 k

V1 = 7.5 V

V2 = .5 mA x 5 k

V2 = 2.5 V

Reality check: the two voltages should sum to the total supply voltage. 7.5 + 2.5 = 10. If you have more than two resistors, you can just extend this process. Now, work out your voltage drops.
IČR is offline   Reply With Quote
Old 4th March 2008, 03:44 AM   (permalink)
Default

Quote:
Originally Posted by 3v0
I am not an EE. But I would have said steady voltage and small current?
A negligible current. The inputs are high impedance and measure voltage, not current.
IČR is offline   Reply With Quote
Old 4th March 2008, 03:44 AM   (permalink)
Default

Quote:
We know:
# The total voltage
# The individual resistor values

We can calculate the current flow and then the voltage drop across the individual resistors. From the Ohm's law page, we will use the formula:
I = V/R
I = 12/3000 ohms
I = 0.004 amps or 4 milliamps

The current flow through the resistors is 4 milliamps. Since the resistors are in series, we know that the current flow through each resistor is the same.

Then, to find the voltage drop across the 1000 ohm resistor, we can use the formula:
V = I*R
V = .004*1000
V = 4 volts across the 1000 ohm resistor

And to find the voltage drop across the 2000 ohm resistor, we can use the formula:
V = I*R
V = .004*2000
V = 8 volts across the 2000 ohm resistor
Quoted from : http://www.bcae1.com/resistrs.htm
Around the middle of page

so i got to :
I = V/R
then
V = I*R

This would sum out to be 5volts / 4 resistors regardless since all resistor values are equal.

I = 5 / 4000 = 0.00125
then
V1 = 0.00125*1000 = 1.25V
V2 = 0.00125*1000 = 1.25V
V3 = 0.00125*1000 = 1.25V
V4 = 0.00125*1000 = 1.25V

Now if i had
R1 = 1k
R2 = 1.5k
R3 = 2k
R4 = 2.5k

1 + 1.5 + 2 + 2.5 = 7k

I = 5 / 7000 = 5.5555555555555555555555555555556e-4
then
V1 = 5.5555555555555555555555555555556e-4*1000 = 0.55555555555555555555555555555556v
V2 = 5.5555555555555555555555555555556e-4*1500 = 0.83333333333333333333333333333325v
V3 = 5.5555555555555555555555555555556e-4*2000 = 1.111111111111111111111111111111v
V4 = 5.5555555555555555555555555555556e-4*2500 = 1.3888888888888888888888888888888
would this mean i need more power?

how the hell would this work ?

Tried in a ohms law calc and got

0.00071 A over 7K

so
V1 = 0.00071 * 1000 = 0.71
V2 = 0.00071 * 1500 = 1.065
V3 = 0.00071 * 2000 = 1.42
V4 = 0.00071 * 2500 = 1.775
=4.97V

why not 5V ? Will it still work due to the +/-5% thing on resistors?

Last edited by AtomSoft; 4th March 2008 at 04:09 AM.
AtomSoft is offline   Reply With Quote
Old 4th March 2008, 03:50 AM   (permalink)
Default

No they can be the same value. In fact, this simplifies the equation since once you know the voltage drop across one, you know the drop across all of them. To determine the voltage applied by each keypress, you simply add up the voltage drops connected to that key.
IČR is offline   Reply With Quote
Old 4th March 2008, 03:53 AM   (permalink)
3v0
Default

Quote:
Originally Posted by AtomSoft
ok cool. So there is no definite way to calculate the divided voltages right? Like i would have to place resistors and manually check each one to determine drop ?
All i know in ohms law is how to get 1 value from 2 others. I don't know how to subtract like 100k ohms from 5v to determine the drop on the resistor.


yeah the concept is in the head but the head doesn't know how to draw lol

EDIT: Found this
Little current flow into the analog port pin. It contains a capacitor that charges to whatever voltage is on the pin. After that no current flows.

So in the all open case the analog port see 5V.

When you close S1 the 100K is in parallel with the 1st 1K so it becomes 990.1 Ohm
(look up parallel resistance calculator)

Which is close enough for government work to still call it 1K

The point is that by making the 100K resistor a large value it has little effect on the voltage divider.
3v0 is offline   Reply With Quote
Old 4th March 2008, 04:13 AM   (permalink)
Default

ok cool:

So it
V1:V4 = 1.25

then:
button 1 = 1.25v
button 2 = 2.50v
button 3 = 3.75v
button 4 = 5.00v

right?
wait wait:
3960.4 is the total ohms then?
you guys just confused me lol let me figure it out 1 min

Last edited by AtomSoft; 4th March 2008 at 04:26 AM.
AtomSoft is offline   Reply With Quote
Old 4th March 2008, 04:21 AM   (permalink)
Default

Close. Take a close look at your schematic and think about what the voltage with respect to ground is going to be for each key.

I'll be back tomorrow. Goodnight.
IČR is offline   Reply With Quote
Old 4th March 2008, 04:25 AM   (permalink)
3v0
Default



With VCC=VDD=5V

All open will be 5V
S1 closed will be 3.75V
S2 closed will be 2.5V
S3 closed will be 1.25V
S4 closed will be 0V
3v0 is offline   Reply With Quote
Old 4th March 2008, 04:41 AM   (permalink)
Default

Dam i c it now i think i need a vacation lol. I forgot the resistors add up hence smaller voltage towards end and 4 = 0v because it closes gnd and connects straight right?
AtomSoft is offline   Reply With Quote
Old 4th March 2008, 05:00 AM   (permalink)
Default

So now for the software part:

In the data sheet :

Code:
To do an A/D Conversion:
1. Configure the A/D module:
• Configure analog pins, voltage reference and
digital I/O (ADCON1)
• Select A/D input channel (ADCON0)
• Select A/D acquisition time (ADCON2)
• Select A/D conversion clock (ADCON2)
• Turn on A/D module (ADCON0)
2. Configure A/D interrupt (if desired):
• Clear ADIF bit
• Set ADIE bit
• Set GIE bit
3. Wait the required acquisition time (if required).
4. Start conversion:
• Set GO/DONE bit (ADCON0 register)
5. Wait for A/D conversion to complete, by either:
• Polling for the GO/DONE bit to be cleared
OR
• Waiting for the A/D interrupt
6. Read A/D Result registers (ADRESH:ADRESL);
clear bit, ADIF, if required.
7. For the next conversion, go to step 1 or step 2,
as required. The A/D conversion time per bit is
defined as TAD. A minimum wait of 2 TAD is
required before the next acquisition starts.
Its like 12am here so im going to relax now and try this tommorow. I should have my junebug by like thursday and hope to have something to make by then and thanks to you all so far so good. So i want to thank you all and wish you a good night (morning for some)
AtomSoft is offline   Reply With Quote
Old 4th March 2008, 05:12 AM   (permalink)
Default

Hope you get it soon, much more fun than a simulator.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 4th March 2008, 05:16 AM   (permalink)
Default

i cant wait. Oh yeah i made my first 555 timer(blinker) today. would be my 3rd project so far. Im going to post it and put it in my sig. (its a video (youtube))

Last edited by AtomSoft; 4th March 2008 at 05:49 AM.
AtomSoft is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Good Electronic Supply's Sites, Everyone Come On In! :P Electric Rain General Electronics Chat 44 27th August 2007 11:05 PM
6 momentary switches 6 LEDs Digger7 Electronic Projects Design/Ideas/Reviews 20 22nd February 2007 12:16 PM
PIC Switch Management Techniques Mike, K8LH Micro Controllers 2 28th September 2006 12:33 PM
Analog Switches v Relays for EPROM programmer Tickled_Pink Electronic Projects Design/Ideas/Reviews 0 12th March 2004 10:13 AM
Multiplex circuit question... Rescue1 Electronic Projects Design/Ideas/Reviews 3 9th November 2003 09:28 AM



All times are GMT. The time now is 05:34 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.