![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hey we went from 3 to 4 switches
You have the basic idea.
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
|
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
||
|
|
|
|
|
(permalink) | |
|
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:
EDIT: Found this Last edited by AtomSoft; 4th March 2008 at 03:35 AM. |
||
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) |
|
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.
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
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.
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
||
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) |
![]() 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
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
|
|
|
|
|
|
(permalink) |
|
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?
|
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) |
|
Hope you get it soon, much more fun than a simulator.
|
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| 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 |