Society of Robots - Robot Forum

Software => Software => Topic started by: TheDarkLord on August 18, 2011, 10:06:44 AM

Title: Help understanding how to use C to program ICs
Post by: TheDarkLord on August 18, 2011, 10:06:44 AM
Hello all,
A few weeks ago, I wanted to program an ATMega8 using C, but I had absolutely no experience in programming, in any language. So I went online and did a few (okay, I did LOADS) of beginner tutorials in C, and I think I've grasped the basics now. The program I want to write is a fairly simple one; it involves taking in just one sensor input and using that to output a signal for a few seconds. I don't want to have anybody else program it for me, so my question is: Are there any microcontroller-programming tutorials out there? I've googled for hours but can't find any. Or, could one of you point me to an easy-to-follow code with comments, which could help a beginner like me understand it? I can't seem to understand how to program which port the IC should take in input from, or give output to.

Any and all help will be greatly appreciated.
Title: Re: Help understanding how to use C to program ICs
Post by: rbtying on August 18, 2011, 10:54:22 AM
How about this one (http://www.micahcarrick.com/avr-tutorial-digital-output.html)?

Also, what kind of sensor input?
Title: Re: Help understanding how to C to program ICs
Post by: newInRobotics on August 18, 2011, 11:05:54 AM
Well, to start with there is $50 Robot Tutorial (http://www.societyofrobots.com/step_by_step_robot.shtml),

and then there is AVR Tutorial: Introduction and Digital Output (http://www.micahcarrick.com/avr-tutorial-digital-output.html).

Good luck.
Title: Re: Help understanding how to use C to program ICs
Post by: TheDarkLord on August 18, 2011, 04:18:44 PM
Thank you to both of you for that AVR tutorial. I just finished reading through it, and feel a bit smarter  :)
Would you happen to know of any tutorials similar to that one? Because that served to be quite useful. Thank you once again.

And, to rbtying, the sensor input will be an amplified one from a condenser microphone. It will basically be the "Output to next stage" mentioned in this diagram: http://www.reconnsworld.com/audio/simplepreamp.gif (http://www.reconnsworld.com/audio/simplepreamp.gif)
Title: Re: Help understanding how to use C to program ICs
Post by: newInRobotics on August 19, 2011, 12:50:50 AM
Hi again,

here's another one: Atmega32 from AVR - a beginner's guide to microcontrollers (http://shashank-kulkarni.blogspot.com/2011/06/atmega32-from-avr-beginners-guide-to.html).

I just finished reading through it, and feel a bit smarter  :)
If You had completed tutorial, not only read it, You would feel even smarter that You felt after reading it.  ;D

EDIT: And also there's this one: AVR GCC Tutorial (1) – Basic I/O Operations
 (http://iamsuhasm.wordpress.com/tutsproj/avr-gcc-tutorial/)
Title: Re: Help understanding how to use C to program ICs
Post by: rbtying on August 19, 2011, 10:36:37 AM
For reading the sensor, you'll need to interface with the ADC: this (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=56429) should help.

But first, make the LED blink =).