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 support@ccsinfo.com

Help with reading analog value
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sat Oct 15, 2005 9:47 am     Reply with quote

Here is a quickie on reading data sheets.

If you look on the third page or so of the data sheet for the part you're interested in you'll find all the features of the part. Below you'll see examples of the 2 parts we're tossing around.

Here is the 16F628:




You'll notice there is no mention of an A/D, only comparators. Not good for your application.


Next is the 16F88:




You'll notice that they list 1 10-bit A/D....Good! But, me being new to all this just like you, I said to myself "He needs two A/Ds (ADCs) for his keyboard, what's up with this?" So I went to the parametric search page on Microchip.com and searched on 18 pin, 16F parts with >2 ADCs. The 16F88 came up with 7ADCs! So, I said to myself again "what's up with that?" Then it becomes a trip back to the data sheet for some more reading. I went to the I/O ports section of the datasheet and read about portA's ADC and the pins associated with portA. Ahhhhh, there is one ADC but is available at all seven pins of portA. Bingo, you're in business.

Short explanation:

Twisted Evil 16F628: no, no, no, no...... no.
Very Happy 16F88: yes.

My God, I've sunk to using smilies.....(but maybe Tim is a visual learner..)

I may have confused you when I use the annotation "AN" on a pin to indicate that it has an ADC available. I learned (just as you should be learning) that that is not necessarily true. "AN" only means that there is some form of analog feature available at that pin....and I need to read more about it to derive its true meaning.

Let me know if you have any questions about all this. Be careful, the experts have A LOT of fantastic ideas about how to do things. But I'm afraid they're are confusing you and the true issue here.... a simple solution to a problem for an absolute beginner. I think my in-experience lends itself to dumbing things down to your level (not intended to offend). I hope I have been a little help, and please, experts don't take offense I truly respect your knowledge and selfless efforts you put forth to help all of us great un-washed.....

Questions?


Good luck,

John
timtalk



Joined: 14 Oct 2005
Posts: 10

View user's profile Send private message

PostPosted: Sat Oct 15, 2005 11:41 am     Reply with quote

Ok I think I fully understand it all now.. Not going to school for any of this and trying to learn by reading books and posts sometimes is difficult when there is not a live person to say HEY what about this or that... I think i've figured out a way to fix my problem using the 628 chip. I've decided that I'm going to try and double use one of the pins for my shift controller (for the lcd). that gives me a total of 5 pins that I can use for the keys and with 5 pins I can get a reading from 6 keys (which is what I'm needing). I wanted to use as few pins as possible to allow this project to be expanded later on, but I think for now i'll stick with the 628 chip, get my LCD and KEY pad intergrated into it and once I know that all works and i've learned what I can from it, then i'll start the same project over again only this time using the F88 or maybe even a chip with a few more pins on it for later growth. So far the project drives 6 relays and turns them on and off at desired times defined in the eeprom. My goal is to add the keypad and lcd to allow the eeprom times to be adjusted and the chip reset without having to unplug the chip from the board and program it via a PC. So far the relay part works great. I've got the LCD and keypad design set up on a wirewrap board and the LCD with shift register is working fine. Now all that is left is to get the keypad working and to set up a menu system that can be controlled by the keypad. Hopefully i'll get this all working. Much thanks to you guys for the great ideas. As was expected by this project I've learned a bunch from my first 2 projects with Pics. Again Thanks to all.
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sat Oct 15, 2005 1:24 pm     Reply with quote

I would highly recommend this book:

"Practical Electronics for Inventors"

http://www.amazon.com/exec/obidos/tg/detail/-/0070580782/qid=1129403434/sr=2-1/ref=pd_bbs_b_2_1/103-5704688-9894240?v=glance&s=books

I tried Horowitz & Hill and they left me in the dirt about the second paragrph.

Also, you may want to post your entire pin-out scheme. The experts will probably have some slick way of multiplexing functions on a single pin. I don't have any need to reduce pins/save money in the stuff I do so I typically oversize the part for future expansion. The pros around here are interested in shaving pennies so they should be able to help.

Good Luck,

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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