I needed to write a entire account of the last 6 months that I started into ATmega8535. Then I was aware of nothing in electronics except basics upto transistors. Comparing that today, the things I learned is avery long list. these 6 months therefore I term as my first semester. Just for you all readers knowledge, Im not at all from science background. So lets get started.
The Preface
Im a geek in software programming. I have interests in many areas outside my professional skills. I used to go to Ramkrishna Mission, Institure of Culture, Library, Gol Park, Calcutta. It was my first experiance with library and till date, the best! I’ve even seen the Brist Council ones but there are no match to a grand reading space, silence and service you get here.

You can read more about this library from this blog. I read many books of programming and one of electronics. That was which brought my interest in electronics and taught me the basic of circuits. Those days were between 1994 to 1997 while I was doing my 10th and 12th. After 1997 I lost tough completly for all these years untill the urge rose again. This time i came by Electronics For You, October 2005 Issue talking about AVR Microcontrollers.
I was already trying to get into circuits again so it just was on the right time!
Chapter 1 - It got to be a saturday
Only on saturdays can I go to old delhi’s electonics market and get all the equipments. The components at the first trip was huge! I even had to buy a soldering iron. So you can guess, i even need to learn soldering.
Anyway, only after 2 trips could i buy all of the components. That market is not a newbie playground. You should know where to go for what. Otherwise you would be lost as I usually get every other trip searching for something different or something cheaper.
Chapter 2 - The Programmer
Before we could try any of the circuits mentioned a programmer was required. The page 2 had a parellel port programmer which was really simple to be built. On trip #2 to old delhi, i had got all the components mentioned in this programmer including the HiFi ZIF (Zero Insertion Force) socket. The CD had the software for compiling and programming the microcontroller. Now came the first disappointment. Making the circuit exactly as illustrated took 2 days and when it got done, it never ran. All power pins were checked and tried to run AVR-Prog several times trying to make it detect the atmega8535 chip with failure.
My to-become B.Tech in computer science bro was also here in gurgaon then and fixed the programmer the next day. I hate a minor error in the circuit. The sample program was simply to play with 8 LEDs connected to a port. That ran with suceess!
Chapter 3 - Eight Knights
Those 8 LEDs were the first output devices for the microcontroller. The first sample that was done was simply turning all 8 LEDs on and off at loop-delayed intervals. Now, i wanted to play much more than this. I researched for any C compiler that could compile in intel hex that microcontroller can accept. WinAVR was the discovery.
It allows C and so i can have complex algorithms in my code. Im not good in Assembly Language though I can manage to read and write basic code like inlines sometimes. There were lots of experiments done with these knights. All this made me learn the physics of signals , the highs and lows and that 1 actually was turning the LED off. Also that the pins never gave a positive voltage, instead gave a GND connection.
First was to blink them independently. As in playing with my entire byte and starting the counter from 0 to 255. It would represent the entire binary form of the current counter. The speed at first was so fast that I had to slow it down using some dead loops.
Second attempt was to move a glowing LED from right to left. this was alittle complicated cause just counting numbers is not going to help. This is only achieved by bit shifting. The way i did it was not even that. I used calc to make a static array with all 8 short ints. That also was running good and again only a dead loop made the display BEAutifull!
After I saw that the glow was shifting from right to left and right all the time, the time came to learn EPROM. The only solution to acheive to resume from the point which was there just before power off. The loop started saving the current position in EPROM at every iteration and then loation the number from EPROM at startup. After a few attempts on how to use points and addressess of variables in EPROM, this job was solved. The trcik was fantastic since a reset would also not harm the position.
The last in this cahpter was to attempt random numbers. This attempt made me realize how functions could increase your compiled hex file size. Just using the random number function in code increased the code by 2K. The technique was known to me since at the link time the linker only loads those components in the final binary which have actually been used by the application. The random experiment was to make a strange pattern in the glow. Rather than just going from one direction to another all the time, the glow was shifting directions at will. the look of the glow was still very interesting. A simulation of AI i could say. The flaw in the random function in AVR is that there is no lock to seed a new value everytime. therefore, after every reset, the pattern would always be same though look random otherwise. If I saved the random number as seedin EPROM and use it for next startup, this issue could solve.


