Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Is this an R/2R ladder, and will it work?

Status
Not open for further replies.

weegee

New Member
Hi

I have been told that my attempt to read a 6way DIP switch through ADC on a pic was wrong ( https://www.electro-tech-online.com/threads/digital-dashboard-circuit-review.26954/ ), so i have been googling away, and i have attached a schematic of what i have made based on my findings.

Can anyone confirm that this is an 2/r2 ladder, if it will work going from the out straight to the input on the pic.

Are there better or worse values to use for 'R' and i assume the 2R is quite literal

should these be high value, low value, or it makes no odds?

thanks again

graham
 

Attachments

  • R2R.pdf
    12.5 KB · Views: 343
weegee said:
Hi

I have been told that my attempt to read a 6way DIP switch through ADC on a pic was wrong ( https://www.electro-tech-online.com/threads/digital-dashboard-circuit-review.26954/ ), so i have been googling away, and i have attached a schematic of what i have made based on my findings.

Can anyone confirm that this is an 2/r2 ladder, if it will work going from the out straight to the input on the pic.

Looks fine, but are you wanting to read 64 individual positions?.

Are there better or worse values to use for 'R' and i assume the 2R is quite literal

should these be high value, low value, or it makes no odds?

High enough not to take too much current, but low enough to meet the requirements of the A2D.
 
Hi Nigel,

thanks for your prompt response.

6 switches = 32 potential values (would need 7 switches for 64)

would 10K for R and 20K for 2R be ok

thanks

graham

(ps - im trying to find some FREE simulation software to save me having to ask soo many questions - any suggestions??)
 
I think your switches need to be double-throw, i.e, the switched (2R) legs always need to be the same resistance.
Why can't you get 64 levels with 6 switches?
2^6=64.
 
my appologies nigel, and thanks ron

your right, and im tired lol

64 from 6 switches is right, im just not thinking straight, this is starting to get on top of me now.

thanks guys, i'll go away and see what i need to revise and get back to you.

thanks

graham
 
weegee said:
my appologies nigel, and thanks ron

your right, and im tired lol

64 from 6 switches is right, im just not thinking straight, this is starting to get on top of me now.

thanks guys, i'll go away and see what i need to revise and get back to you.

thanks

graham
Did you understand my comments about the switches? You might have to drive the ladder with CMOS logic (inverters, gates, FFs, whatever). Switching from +5V to OPEN won't work.
 
this is where i got the info on the r/2r

but i cant afford the space on my board for the op amp, (plus i dont have any)



thanks

graham
 
weegee said:
this is where i got the info on the r/2r

but i cant afford the space on my board for the op amp, (plus i dont have any)



thanks

graham
You don't need an op amp, but you do need low resistance (relative to R) for the switches in both logic states.
 
does this mean that my design is totally unworkable?? if so can you suggest any way of reading 6 dip switches using 1 pin on a pic (digital or analog)?

Thanks

Graham
 
For simulation, I use Linear Technology's SwitcherCAD III, which is free, uncastrated, and fully functional. The learning curve is a little steep and a little long. I have been using it for years.
I simulated your ladder to be certain I wasn't wrong about the switches.
 
weegee said:
does this mean that my design is totally unworkable?? if so can you suggest any way of reading 6 dip switches using 1 pin on a pic (digital or analog)?

Try telling us exactly what you're trying to do for a start!.

BTW Ron, I assumed he WAS using double throw switches on his R2R ladder!.
 
ok- ill start over.

I have designed the circit for my project (a digital dashboard), once the design was completed, i had one spare pin on my pic - which can be used as analogue or digital.

my project requires 2 dip switches (or jumpers)

When i looked through my parts boxes i dicovered that i had 50 or so 8 way dip switches, so i thought id use them.

So i figured that if i could find a way of reading 6 dip swiches using one pin on the pic, then i would be able to use the 6 spare dip switches as options for future use (save me making new board - only need to re-burn pic).

I bought surplus stock, so i have boxes of resistors from ebay (all values), i had read a long time ago about how to read differnt values (binary) on 1 pin of a pic (using resistors). My first attempt was in the initial schematic on the other post. I was told that this wouldnt work, because there wasnt a dividong restistor (i think thats what was said), so i went away and googled, and found info on a 2/2R ladder.

I made the schematic (attached to the first post of this topic) from what i had seen on R/2R ladders, but Ron stated that i needed double throw dip switches (i dont have any of those)

I downloaded the simulator that was suggested (very good - thanks) still a lot to learn, but from what i found - i was only using half of the 5v range, eg all switches off = 0v at output, then after one switch went on it went to 2.5v (ish) then the other switches made it vary up to approx 5v. I was hoping for a wider sweep - all the way from 0v all switches off, to 5v all switches on, so that it was easier to pick out distinct switch settings.

I dont have room on my board for additional logic, so thats why i hoped to use only resistors.

If my simulation had produced the desired results for me (with double throw switches) then i would have just used jumpers instead of the double throw switches.

It didnt though, so i have just removed all 6 dip switches off my board and left the spare pin on the pic unconnected - as i need to get these boards made asap.

I would still love to know how to do this properly (read a bank of dip switches with 1 pin), but it will need to be for another project, as it is just adding complexity to this project, and still might not work.

hope you can assisst me, as you guys obviously know your stuff

thanks

graham
 
Here's how I would do the 6 bit D/A.
 

Attachments

  • 6 bit D-A.PNG
    6 bit D-A.PNG
    26.3 KB · Views: 319
Nigel Goodwin said:
As you only need two switches at the moment, why not just use two switches? - easy to do, and will solve your problem?.

I was looking to the future, these products would hopefully be installed for the remaining life of a car, so that could be 10 year plus.

hopefully in that time i would have evolved my software a bit - and the extra switches would play a part then.

because for every option not stored on a dip switch/jumper will require me to add menu options and related code in the limited storage i have in the pic.

(and i cant bring myself to put on 8 switches and only use 2 - lol )

Ron H said:
Here's how I would do the 6 bit D/A.

thanks - i'll look at that, and depending on how well i get on with my currnt design - i'll try building this into my next one -(im hoping to make a SMT version once my first 50 of this design are done, and i'll have money to buy new parts then, like the logic chips)

Thanks

Graham
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top