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 10th August 2007, 08:41 AM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
I'm not really very clear on exactly how it's wired
Me neither but I think it's something like the attached file. The value of R1 should be calculated not "because it was there"

Don't care about the PIC type, just select first from list
Attached Images
File Type: jpg AnalogKeyPad.jpg (60.5 KB, 10 views)
mcs51mc is offline   Reply With Quote
Old 10th August 2007, 09:06 AM   (permalink)
Default

Quote:
Originally Posted by mcs51mc
Me neither but I think it's something like the attached file. The value of R1 should be calculated not "because it was there"

Don't care about the PIC type, just select first from list
Right, that's obviously much higher than the minimum 2K source impedance!, although the main effect is to slow down the reading speed (you have to wait until the internal capacitor is charge/discharged before it's accurate). You might try taking multiple readings, and seeing how many readings it takes until successive readings are the same.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 10th August 2007, 09:21 AM   (permalink)
Default

Minimum / Maximum who care's?
Quote:
Originally Posted by Nigel Goodwin
... ...than the minimum 2K source impedance!... ...
But I think here it's better maximum


Sorry sorry couldn't resist
mcs51mc is offline   Reply With Quote
Old 10th August 2007, 11:14 AM   (permalink)
Default

I will check out the datasheet on that, Nigel, thank you.

Currently, I have no complaints on how it is working -- it seems to be very consistent and reliable the way it is setup. Every once in a while, the readings will be off by a number, so last night I sat down and started to write in a high and low range (+/- 2) to deal with any noise. I have to finish the routine today. I have also added a check to make sure the button has been released.

I have not yet written a calibration routine, but will once I have everything working as intended, and I understand WHY it works. Anyway, my point is, how I got my numbers in the first place was to put a breakpoint in the ICD2, just after the ADC read -- press a button and hit run, record the ADC readings. The readings only take one button press / ADC read to get a good read. I have even added a "debouce" routine (not really sure if its needed right now or not... still have to think more about that one) to wait 20ms and then check the ADC again to make sure it's the same. If either check fails, the routine aborts.

The thing that I have noticed that is strange is the fact that I am only using the ADRESH byte for my calculations. I just got up and have not looked at the datasheet or midrange manual regarding A/D Conversion, but I was under the impression that the high byte should only contain the first 2 LSB, with the upper 6 clear. Nigels tutorial even masks the upper 6 bits to make sure they are clear. Anyway, what I am seeing is a consistent LOW byte (either C0/00 or 80/40) and a HIGH byte that is unique (but using more than the first two bits).

My ADRESH readings are as follows;

Quote:
#0 0x00 .00
#1 0x05 .05
#2 0x0A .10
#3 0x0F .15
#4 0x14 .20
#5 0x1B .27
#6 0x22 .34
#7 0x2B .43
#8 0x35 .53
#9 0x41 .65
I'll go grab the project and do up a schematic on it -- gotta do it sometime anyway!
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 12:27 PM   (permalink)
Default

Here are the schematics, as I currently have the project wired.
Attached Images
File Type: jpg keypad_lcd.jpg (326.0 KB, 13 views)
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 12:45 PM   (permalink)
Default

Finally someone using 8 bit addressing to the LCD; good point !

For the key pad I'm still convinced that we don't know how it's working; bad point!
If your absolutely sure it's only a resistor devider like the sketch I made in a hurry this morning then you should first take your Ohm meter and measure the resistance in all possible combinations.
Then and only then you can design a correct circuit toward the PIC ADC.
mcs51mc is offline   Reply With Quote
Old 10th August 2007, 12:57 PM   (permalink)
Default

Quote:
Originally Posted by mcs51mc
Finally someone using 8 bit addressing to the LCD; good point !
Why would you prefer 8 bit mode?, it's just wasteful of I/O.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 10th August 2007, 01:00 PM   (permalink)
Default

Quote:
Originally Posted by mcs51mc
Finally someone using 8 bit addressing to the LCD; good point !

For the key pad I'm still convinced that we don't know how it's working; bad point!
If your absolutely sure it's only a resistor devider like the sketch I made in a hurry this morning then you should first take your Ohm meter and measure the resistance in all possible combinations.
Then and only then you can design a correct circuit toward the PIC ADC.
Go back and re-read the thread -- this is one of the first things I did...
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 01:03 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Why would you prefer 8 bit mode?, it's just wasteful of I/O.
Why not, does it look like I'm in need of saving 4 I/O pins?

A three cylinder car will get you to where you're going -- but an 8 is just wasteful, but so much more fun to drive!

Last edited by Kyle-s4h; 10th August 2007 at 01:05 PM.
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 01:17 PM   (permalink)
Default

Quote:
Originally Posted by Kyle-s4h
Go back and re-read the thread -- this is one of the first things I did...
I never saw Ohmic values for every key pressed only some weird hex data because of a bad design

How do you expect us to help you with a good design since you don't give us the basic data needed ?
mcs51mc is offline   Reply With Quote
Old 10th August 2007, 01:36 PM   (permalink)
Default

Quote:
Originally Posted by mcs51mc
I never saw Ohmic values for every key pressed only some weird hex data because of a bad design

How do you expect us to help you with a good design since you don't give us the basic data needed ?

A few points...

1) Why would you possibly call the ADC "weird hex data"?

2) Why would you say this is a "bad design" -- please be specific.

3) I never asked for design help -- I asked specific questions regarding A/D Conversion.

4) What the specific resistance values are are irrelevant (but I will post them for you below) -- the point is to get readings from them for A/D Conversion (which is what I asked about).


Quote:
#0 R1 0
#1 R2 .527
#2 R3 .962
#3 R4 1.441
#4 R5 2.019
#5 R6 2.692
#6 R7 3.509
#7 R8 4.540
#8 R9 5.770
#9 R10 7.530
I am not concerned with dual button decoding (as mentioned in one of my earlier posts), so dual button resistance values have not been taken at the present time.

I look forward to your new and improved "good design" based on the quoted resistance values.

PS - if you want pass-thru voltage readings, I can post them as well.
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 01:42 PM   (permalink)
Default

Quote:
Originally Posted by Kyle-s4h
Why not, does it look like I'm in need of saving 4 I/O pins?

A three cylinder car will get you to where you're going -- but an 8 is just wasteful, but so much more fun to drive!
Except in this case the 3 cylinder car performs exactly the same as the 8 cylinder one, but only uses half the petrol
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 10th August 2007, 01:45 PM   (permalink)
Default

@Nigel -- page 114 of the 16f87X datasheet;

Quote:
The maximum recommended impedance for analog sources is 10Khm:
Thank you -- I will change the resistor (actually, I'll change it a couple of times... ie. 12K, 10K, 2K, 1K, just to see the results).
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 01:46 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Except in this case the 3 cylinder car performs exactly the same as the 8 cylinder one, but only uses half the petrol
Depends on what kind of a guy you are I guess... I'll be there in half the time (and a lot safer... ever seen a "big" 3 cylinder?).
Kyle-s4h is offline   Reply With Quote
Old 10th August 2007, 01:48 PM   (permalink)
Default

Quote:
Originally Posted by Kyle-s4h
@Nigel -- page 114 of the 16f87X datasheet;
It varies from PIC to PIC somewhat, the 16F819 is 2.5K, the important thing is that you are aware of the limitation!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Analog Meter windozeuser General Electronics Chat 19 3rd October 2007 02:44 PM
A/D, value for Vref on PICs for best accuracy. Odin Micro Controllers 12 19th June 2007 03:04 AM
help on A/D conversion on pic18F2620 lionman Micro Controllers 0 15th May 2007 03:28 PM
A/D problem Merkur Micro Controllers 8 3rd February 2007 10:35 AM
Specifications Applied Caltech General Electronics Chat 1 25th December 2003 05:00 PM



All times are GMT. The time now is 12:52 AM.


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