PDA

View Full Version : high and low issues pic12F683



plyrathrt
- 15th December 2008, 23:30
I have a pin that goes high (1.5v) when a button is pressed but when it's not pressed it's at .4v which the microcontroller can't see as "low". Basicly I need the microcontroller to see this .4v as low.

The microcontroller's VCC is 3.0v. I thought there was a way to compare a pin's volatage to vcc which I thought would make this happen but I forgot how.

Any help would be appreciated.

skimask
- 15th December 2008, 23:55
I have a pin that goes high (1.5v) when a button is pressed but when it's not pressed it's at .4v which the microcontroller can't see as "low". Basicly I need the microcontroller to see this .4v as low.

The microcontroller's VCC is 3.0v. I thought there was a way to compare a pin's volatage to vcc which I thought would make this happen but I forgot how.

Any help would be appreciated.
It should...must be something else wrong...
From the 12F683 datasheet...DS41211D...page 121...parameters D030, D030A, D031.
If the pin is a TTL input, logic low is .15Vdd = 3 * .15 = .45V
If the pin is a schmitt trigger input, logic low is .2Vdd = 3 * .2 = .6V
Anything less than those two values above (i.e. your .4v) would be read as a logic low, assuming you have the ports set up correct (i.e. digital, not analog, input, not output, and so on)...
Do you know what a pulldown resistor is?

plyrathrt
- 16th December 2008, 00:12
I can't put a pull down resistor on there because grounding the contact I am trying to connect to will make it not function.

Is there any other way to make it accept .4v as low? Coding tricks or anything?

skimask
- 16th December 2008, 00:14
I can't put a pull down resistor on there because grounding the contact I am trying to connect to will make it not function.

Is there any other way to make it accept .4v as low? Coding tricks or anything?

Re-read the last post!
It already should be taking .4v as low UNLESS something else isn't set up correctly.
Increase the Vdd, double-check your config, try another chip, try another meter.
And putting in a pulldown resistor isn't grounding a contact.

plyrathrt
- 16th December 2008, 02:13
They should be correct
ANSEL = 0
ADCON0 = 0
CMCON0 = 7

I don't know what gives. It's very agrevating. I am still playing with it.

skimask
- 16th December 2008, 02:21
Well, whatever happens, whatever you do, don't show us any test code that you may have written so somebody else might be able to point out any flawed logic that you may have overlooked, however trivial or complex it may be...'cause I like guessing at things like this... :rolleyes:

plyrathrt
- 18th December 2008, 02:54
I finally figured it out. I was an idiot and had a something stupid in the code.

skimask
- 18th December 2008, 03:10
I finally figured it out. I was an idiot and had a something stupid in the code.
Good. And don't think you're so much of an idiot and did something stupid...'cause I think we've all done exactly that...some more, some less, but at least once...