Sunday, January 21, 2007

Embedded C

I just attended a three day workshop on Microcontrollers and embedded C programming. The workshop was organised by IEEE Students Branch of my institute and professionals from Eureka Electrosoft Solutions Pvt Ltd were invited to deliver the workshop. It was an excellent learning experience, trying to program an Atmel 89C52 microcontroller using embedded C using the Keil Compiler. We also interfaced LCDs, stepmotors and Analog to Digital converter with the microcontroller. Here is my first embedded C program....


#include <reg51.h>
#include <intrins.h>
#include <math.h>

void move(unsigned char x)
{
P1=255-pow(2,x);
}

void ms_delay(unsigned char del)
{
unsigned char dt;

while(del>0)
{
for(dt=0; dt<=160; dt++)
_nop_();
del--;
}

}

void secdelay(unsigned char del)
{


while(del>0)
{
ms_delay(250);
ms_delay(250);
ms_delay(250);
ms_delay(250);
del--;
}

}

void main()
{

while(1)
{

char i;
for(i=7;i>0;i--)
{
move(i);
secdelay(2);
}
for(i=0;i<7;i++)
{
move(i);
secdelay(2);
}

}

}


A simple program in which 8 LEDs are connected to the IC and they blink one after another and back repetitively. It was my first exposure to hardware programming and robotics and really it has impressed me.

Friday, January 05, 2007

Is it really a 'Happy' New Year?

Most of my time in the past few days was spent watching television. And on television I generally watch the news channel. If you have been following the news bulletins recently, it must have left you dejected. It is so disturbing to watch the news channel these days. Innocent kids are killed by serial killers, Haj committees asking for bribes, Saddam was hanged... and it was unfortunately video graphed. And it has left the stupid people and parties protesting. I was really left speechless when I saw the news that one guy had climbed a high voltage line in Delhi, trying to do a Sholay. He was apparently protesting against the capital punishment of Saddam. What was his demand? Not Basanti, in this case he wanted the Indian Govt to break all ties with the US government. How stupid can people be? With a very heavy heart, I wish you all a Happy New Year. Hopefully the next year will be better. God only knows when I will see the ‘OTHER-SIDE’ of MyWorld.

And yesterday afternoon my mom taught me how to cook Chicken Biryani. It was a wonderful experience and I found out what an excellent cook she is. She doesn’t even taste the food while it is being prepared; still the food that she cooks is awesome. And, it feels good to know how to prepare something you love to eat.