NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Programming the micro-controller

July 23, 2011
by codenamejupiterx
codenamejupiterx's Avatar

I am trying to understand how programming this chip works. I really want to understand exactly what is happening in the tempsensor.c code. I now understand the concept of bit shifting, I am now at the how and why things work stage.
Are ADMUX, ADCSRA, ADEN registers in the micro-controller? I looked in the data sheet and i did not see them . If they are in the data sheet could someone tell me the page number. Thanks!!!!

July 23, 2011
by Rick_S
Rick_S's Avatar

Go to the section of the Datasheet (in mine it's section 23) for Analog-to-Digital Converter.

You'll see all the answers there. Yes ADMUX and ADCSRA are registers are in the micro. ADEN is a bit for the ADC Enable in the ADCSRA Register.

23.9.1 ADMUX – ADC Multiplexer Selection Register
23.9.2 ADCSRA – ADC Control and Status Register A
            Bit 7 – ADEN: ADC Enable

There are a lot of different settings for the ADC all of which are described in the datasheet. It can be a bit confusing at times but a lot of it has been covered here.

Try changing it up after you've read about it. Then if you come back with non-working code and questions, either myself or someone could probably help you figure it out.

This is also, this is another good forum search topic Wink

Rick

July 23, 2011
by codenamejupiterx
codenamejupiterx's Avatar

Thanks again Rick!!! Hope all is well....

July 24, 2011
by Rick_S
Rick_S's Avatar

No problem, and I hope I'm not coming off too harshly. However, the forum has been up for some time now and many, of the answers to the questions the new and eager have, are readily available if you just do a simple search. Wink

The datasheet - will become your friend if you give it a chance. Believe me, I know, it is a foreboding document for the beginner. It definately was - and still is at times - for me. However, the more you read and familiarize yourself with it, the more the light will begin to turn on.Idea

I started reading the datasheet to just find out where all the stuff in the programs I was using came from. Your ADC questions are a prime example of that. If you look through the datasheet, you'll find all the information to answer the questions pertaining to the tempsensor program and more.

The NerdKit community is built upon Humberto and Mike's premise of learn by doing. That is why the guide breifly covers some basics then dives into building a circuit. I know I didn't come from any formal electronics background other than 1 semester at DeVry university in an EET program in 1984. (Yeah, go ahead and make fun of the old guy)BigGrin_Green Most of what I know is self taught through reading, online research, and experimentation. All of my programming is self taught. That's why I'm sure that most of the code I post could be improved upon, but it works for my purpose. That's why I call myself a slightly advanced beginner. Wink

Rick

July 24, 2011
by mongo
mongo's Avatar

Old guy huh? I have been on the job since 1977. Same here, being self-taught but I am now in school to get my degree after 35 years. With my background, the classes have been a snap so far but I am wondering now, as a new term starts tomorrow, why I am in a psychology class... I didn't think artificial intelligence has gotten to the point where psychologists are now needed.

July 25, 2011
by Hexorg
Hexorg's Avatar

Haha mongo! )) But what if you make an AI robot, and it falls into depression from being the only AI robot, and commits a suicide?!

July 25, 2011
by mongo
mongo's Avatar

Ever see the movie "Ice Pirates"? there was a depressed robot in that one. Funny flik. Then there is the one with Robin Williams, "Bicentennial Man"; A whole different approach.

July 25, 2011
by killercow
killercow's Avatar

How about the one from "The Hitchhikers Giude To the Galaxy".....Marvin I think his name was.

July 26, 2011
by Rick_S
Rick_S's Avatar

Mongo, you have a lot more courage than me. At my age (which is obviously much younger than you Tongue in Cheek ), I'm so set in my ways, I'd probably just get peeved at some "I'm so educated my crap don't stink" professor that I'd not do well.

Plus there is the fact that this is just my hobby. My real job is programming CNC metal cutting machines using CAM (Computer Aided Machining) software. Electronics could have, at one time, been my career, but I'm afraid that time has past. At this point I couldn't see making a large scale career change, nor do I have the money to invest in the "formal" education it would require. So for now I am just content to learn a little each time I "Play" and build fun little gadjets.

Rick

Post a Reply

Please log in to post a reply.

Did you know that multiple MOSFETs can be used in parallel to switch bigger currents on and off? Learn more...