CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Question about input (button) and variable resistance

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
s_mack



Joined: 04 Jun 2009
Posts: 107

View user's profile Send private message

Question about input (button) and variable resistance
PostPosted: Fri Apr 02, 2010 12:23 pm     Reply with quote

Hi.

PIC18F4480

PIN_B4 input is connected to a simple momentary pushbutton switch and our code treats it as a simple on/off. Can it be used for a variable resistance type switch? I'm not sure exactly how to describe/word my question. Basically, a customer has a different physical switch that they want to hook up to our device. They sent me the switch for testing and I see (using a simple ohmeter) that instead of going to zero ohms like our original switch, it brings it down to 85. With our setup as-is, it doesn't recognize the button push. This switch also has two other buttons on the same wires and they bring the values to 215 and 400 respectively. I'm really intrigued because if I can make 3 switches out of one, it opens up a whole world of possibilities for our device. But I don't want to change anything physically... just with firmware.

I'm sorry... I'm not the engineer that designed it and I really have very limited knowledge of the electronics side. I have modest skills with the firmware programming though. My hope here is that, with guidance, I can make the changes necessary if it is in fact possible to do what I describe with the current hardware.

I'm sure I need to post more info for you to answer but I don't know what to post.

Thanks for any guidance and pointers.

Steven
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 02, 2010 1:14 pm     Reply with quote

Right, but what's manufacturer and part number of the switch ?

Post a description of the existing external circuit used with the switch.

Does your client want some kind of 3-way switch, or is this simply
a switch that has a higher "on" resistance because it's a very low cost
switch ?
s_mack



Joined: 04 Jun 2009
Posts: 107

View user's profile Send private message

Re: Question about input (button) and variable resistance
PostPosted: Fri Apr 02, 2010 1:30 pm     Reply with quote

As stated initially:
s_mack wrote:
I'm sorry... I'm not the engineer that designed it and I really have very limited knowledge of the electronics side. I have modest skills with the firmware programming though. My hope here is that, with guidance, I can make the changes necessary if it is in fact possible to do what I describe with the current hardware.

I'm sure I need to post more info for you to answer but I don't know what to post.


So please bear with me Smile

Quote:
Right, but what's manufacturer and part number of the switch ?

This is the simple one originally designed for the device

As for the "3-way" one... proprietary. Its an automotive switch made specifically for a certain car by Delphi.

Quote:
What's the description of the existing external circuit used with the switch ?
I'm sorry, I don't really know what you're asking.

Quote:
Does your client want some kind of 3-way switch, or is this simply
a switch that has a higher "on" resistance because it's a very low cost
switch ?

Well, both... sort of. The customer has a very expensive (but free since he already has it) 3-way switch that fits his car and wants to use it for our device. He's actually wanting to ignore the other 2 buttons and just use it as a simple pushbutton in place of ours. It won't because it has a higher "on" resistance. But when I saw how it worked, and saw that there might be a possibility of having 3 buttons where we previously only had one... well, if that is possible then it opens up a world of new possibilities with how our device works. But the point of posting here is that I don't want to go back to the drawing board and redesign the unit... just if there is some way for me to "tap into" that 3-button world, then I can re-do the code with more features, functions, etc than I can with a single on/off.


So I guess I'm asking, "how do I read what the input voltage [resistance?] is to PIN_B4?". Or can I? Searching through the help files it appears like its only able to differentiate between high and low... ie. on and off. But I thought I'd ask anyway in case I'm just missing something.

- Steven
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Apr 02, 2010 1:30 pm     Reply with quote

Sometimes you put multiple switches on a single line by putting resistors in series with the switches to give different voltages against the common pull-up resistor. But this arrangement has to be read by an A/D or by careful timing measurement with a capacitor.

Is this the sort of arrangement you are looking for?
_________________
The search for better is endless. Instead simply find very good and get the job done.
s_mack



Joined: 04 Jun 2009
Posts: 107

View user's profile Send private message

PostPosted: Fri Apr 02, 2010 1:35 pm     Reply with quote

SherpaDoug wrote:
Sometimes you put multiple switches on a single line by putting resistors in series with the switches to give different voltages against the common pull-up resistor. But this arrangement has to be read by an A/D or by careful timing measurement with a capacitor.

Is this the sort of arrangement you are looking for?


It sure does!

But then I guess the million dollar questions is, "Can I?". And I'm hoping you can answer that with the info I already provided (PIC is 18F4480) but I imagine you'd need to know much more about the cicuitry in total.

I could post code and I can probably dig up diagrams if that helps. In the code, I see this about pull-up:

Code:
port_b_pullups(FALSE);  // we dont need pullups


That probably doesn't help, does it Embarassed

Sorry... I really wish I understood the electronics side of it better.

- Steven
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Apr 02, 2010 2:19 pm     Reply with quote

B4 is an analog Pin, so it can basically work. You have to connect a resistor externally (if it's not already there),
according to the switch operation mode either pull-up or pull-down, that allows to detect the different switch resistances
by a different voltage drop. You can check this with a multimeter, without writing code.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Apr 03, 2010 8:39 am     Reply with quote

This arrangement is used widely in automotive industries. The windshield wiper delay selector,
cruise speed control buttons are examples of using of this technique, where minimizing the wiring
is a must.
I do not see major problems in replacing a single pushbutton with this kind of switch in an Analog
input. Of course there are a little job to do it, it is not a matter of suppressing some pull ups resistors.

regards,

Humberto
s_mack



Joined: 04 Jun 2009
Posts: 107

View user's profile Send private message

PostPosted: Sat Apr 03, 2010 10:44 am     Reply with quote

So what I think I'm getting from the last few replies... is that it is possible (I figured that) but not without hardware modification, right?

I was hoping it could be done with the existing hardware and just access it by changing the firmware. Sort of like using the code to ask, "what is the voltage of" rather than, "is it on or off".

- Steven
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Apr 03, 2010 10:50 am     Reply with quote

Also a single on/off switch will use a pull-up or pull-down resistor. Depending on the resistance value and other
circuit details, the multi-level switch function may be implementable without hardware modifications.
s_mack



Joined: 04 Jun 2009
Posts: 107

View user's profile Send private message

PostPosted: Sat Apr 03, 2010 12:42 pm     Reply with quote

FvM wrote:
Also a single on/off switch will use a pull-up or pull-down resistor. Depending on the resistance value and other
circuit details, the multi-level switch function may be implementable without hardware modifications.


I don't suppose I could dig up schematics and post it here? I mean, I fully appreciate that this forum is about helping people to figure out stuff on their own, but I fear I'm out of my league on this entirely. Still, I don't want to overstep bounds.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group