ss_blog_claim=726e70d7c87c20ae33aa7a61f06eb8aa

Wednesday, October 22, 2008

Code snippet for working with an ADC

We have already seen the need for an analog to digital converter and also how the conversion takes place, the below code is used to work with an ADC in my PIC development board where the PIC16F877A senses the input from an ADC through RA0 pin and displays the digital value in the LCD which is connected to PORTD and also send the converted data to PORTB.

#include<16f877a.h>
#use delay(clock=4000000)
#include

#byte portb=0x06
#byte porta=0x05
#byte portd=0x08
int16 temp;

main( )
{
lcd_init( ); //INITIALISE THE LCD ;
set_tris_b(0x00); //PORTB IS CONFIGURED AS A O/P;
set_tris_a(0x01); //PORTA IS CONFIGURED AS A I/P;
set_tris_d(0x00); //PORTD IS CONFIGURED AS A O/P;
setup_adc_ports(ra0_analog);
setup_adc(adc_clock_internal);
set_adc_channel(0);
while(1)
{
temp=read_adc(); //OUTPUT IS STORED IN TEMP;
portb=temp;
lcd_gotoxy(1,1);
printf(lcd_putc,"ADC:%4lx",temp); //DISPLAY ON LCD;
delay_ms(500);
}
}
Here you can see in the code that while configuring the pins of PORTA since we are going to sense the analog input from RA0 we hace configured it as an input (set_tris_a(0x01)).

Tuesday, October 14, 2008

Analog to digital converter module

We have already seen about the need for analog to digital converters in my previous post. Now let us look into how the analog to digital converter module actually works. The below figure represents the analog to digital converter module.


You can see the input pins where the analog data comes from, which are connected to the inputs of an analog multiplexer. The function of the analog multiplexer is to connect the selected input channel to the holding capacitor. The holding capacitor is connected to the output of the analog multiplexer and when a conversion is initiated, the analog multiplexer disconnects all inputs from the holding capacitor, and the successive approximation converter performs the conversion on the voltage stored on the holding capacitor thus providing a digital value at the output.

Sunday, October 12, 2008

The need for Analog to Digital Converters

We have seen the advantages of digital signals over the analog signals in transmission of signals. Microcontrollers are very efficient at processing digital numbers, but they cannot handle analog signals directly. An analog-to-digital converter, converts an analog voltage level to a digital number. The microcontroller can then efficiently process the digital representation of the original analog voltage. By definition, digital numbers are non-fractional whole numbers.
In this example, an input voltage of 2.343 volts is converted to 87. The user’s software can use the value 87 as the representation of the original input voltage. The analog input voltage must be within the valid input range of the A/D for accurate conversion. Hope you would have heard about the quantization process of rounding off and the quantization error. The A/D converter which is having higher resolution gives less quantization errors. Hence a 12-bit converter which has 4096 states is much efficient than a 10-bit converter that has 1024 states.

Wednesday, October 8, 2008

About 8085 simulator's

If you are a college student in your third year then you can realize how important 'Microprocessor and its Applications' subject is. If you attend any technical HR interview then there is sure questions from this subject. For this subject practical knowledge is much more important than theory knowledge. Learning 8085 microprocessor well forms a good base for learning other microprocessors and microcontrollers. So you should try to learn the instruction set and work with Assembly Language Programming of 8085. Even though you may not have a 8085 kit with you but you can download free 8085 simulators that are available in Internet and go on with writing ALP and executing them. These simulators will surely help you to gain good knowledge in 8085 microprocessor. If you get microprocessor book of Goankar then you will be getting free CD with simulator and you can even get the simulator if you get Bhakshi. Well you can have a good knowledge only if you have interest towards learning it. So create your interest towards microprocessor 8085 and it will surely help you in future while attending interviews.

Day 3 at AU PERS center

The government holidays are affecting my embedded system course at Anna University. I think that this October month is having a lot of government holidays that any other month. Even though I had joined the course at September, but because of these holidays I have completed only 3 classes at Anna University. Well the classes are going on well and my staff is concentrating much on practical knowledge apart from teaching theory well. He has completed till arrays and still there are pointers, functions, structures and unions, files and lots more to go. On day 3 he completed with single dimensional array but when he started with pre increment and post increment operators the classes deviated from arrays and he started to fully explain about those operators with practical examples. Then we came back and the class and it took additionally 20 minutes to get over but it was an interesting session. All the programs were like puzzles and I was wrong with most of my answers but at last understood to an extent. Hope when you take up any C programming classes you can be sure of getting into situations like these so don’t miss any classes.

Hurray got into Visteon!!

Hi guys I have already posted about my experience in Visteon interview process. Well I told you that I am waiting for my results and I got my results last week. I was happy to hear that I have been selected for Visteon. Now I am happy since I have got into my core field-electronics which I like the most and all my hard work has been credited. I can now quit my IT job and get into my core field and work with full satisfaction. However I am going to miss my friends. I have to miss my NIIT classes, loose my SCJP voucher. Anyway if we want to get something better we have to loose another one that's become true in my case. Hope that I will enjoy my work at Visteon.

Sunday, October 5, 2008

Get Together

It was a long time after my college days, So we planned for a get together at marina beach while chatting online. One among my friends took the responsibility of deciding the timing and told us that he would message me. Later after two days I got a call from my friend and he asked me to come to marina beach on saturday at 5PM. I was ready on that day and was at marina beach at 4.45PM itself but I couldn't find out the exact meeting place, So It took me some time to reach the correct place. I was hoping to see all of my friends when I was near to the spot, but unfortunately one nine persons were there. I thought that our friendship circle was too strong but only some think like me and they came for the get together. Others just told that they had some work with their jobs and so they can't come but all these seems to be blank reasons. I never thought even my close friends in my college would tell me the same reasons. Anyway I realized that everything would change as days passes by.

Wednesday, October 1, 2008

SimBot at NIT Trichy


SimBot is a competition for Line Follower robot. The rule is that we must build a line follower robot that must have the obstacle detection mechanism. The obstacle will be a white box of specified height and width. There will be three parallel tracks, the line follower must begin from one end that we can choose. If the Line Follower faces any white obstacles on its way then it should take the parallel path. The below picture shows three parallel tracks with obstacles.


The robot which reaches the finish line first wins the game. We used DC motors with 150 RPM but those who came for the competition used 300 RPM twice the speed of us, so we lost in timing but anyway we had a good experience out there. I couldn't take a video at the time of the race but here is the sample video where our line follower tracks the line.

The best book for C Programming

C Programming is a strong high level language invented by Dennis Ritche. It forms the base for many programming languages. Where ever you go for an interview they will test your C Programming skills and if you are strong in C then you get a job for sure. Because C being the base to learn other programming languages. Learning C is basic like learning ABC in your primary classes. Well C is that much powerful and the best book for learning C language is Let Us C by Yashvant Kanethkar. There are also other books on C written by the same author and you can get it to have a through knowledge in C Programming. The book is simple and easy to learn and there is lot of practical examples. If you are mastering the book Let Us C then you can be sure in clearing the written test for any interview which has C language. In Embedded systems also C Language forms a basic part, because most of us use Embedded C language to program the microcontrollers and ALP and BASIC are out of use. Even if you join in any Embedded Training Centers then the first module will be C Programming, so if you are a beginner please concentrate in C Programming well. Practical knowledge matters more than theoretical one.

My WaterBot drowned in Water

It was during my third year I participated in the 'Water Loo' event at Saveetha Engineering College. I and my team mate had controversy over the design of our robot because he designed a large one using Wood as shown below.


This was the first robot which we completed before time which was quite unusual to us. Then we went to the college, the day before the event for practice. But our robot started to get drown as the wood absorbed water. So the design was an entire flop and all our hard work went in vain. But we never wanted to give up, and then we designed a robot with thermocole basement so that it can float well in water. We worked the whole day without sleeping and finally completed our design. The day came for the event and we didn't even have a practice match. Who ever pushes maximum number of balls into the goal post wins the game, but unfortunately because of latch up problem our robot got drowned and all the circuits got collapsed. Our team got totally frustrated and didn't no what to do. Then finally with the help of a long stick we got our robot back, but the entire circuit got short circuited. It was the worst day and we came back sad. Here is the photo of our drowned robot.You can also see the video of the robot which took the first prize, the robot had a good simple design and turned perfectly in every directions.