this is exactly the type of info that is not in any book. thanks for this. @Olin, your every point is well valid and taken. very true why should i be telling you. I just got a bit unreasonable there. Sorry to annoy. On Sun, Oct 18, 2009 at 8:52 PM, Jinx wrote: > > if you have any specific suggestions please do let me know. > > ___ ___, which PIC are you using ? The answers to your questions > will be roughly the same for most PICs but code examples will not > > > i also need to know whether this sort of an app will require the use of > > interrupt on rising edge feature only or timers as well? > > Some PICs do not have interrupts. A timer will not be of any use to > you to track an input with an output LED > > > 2. how is the ADC result is used when its finally converted? i mean, > > how to use the 10 bit result to do something? some code explanation > > will do > > An analogue reading is used to determine the state of an analogue > condition. Such as the position of a potentiometer, the output of a sensor > for temperature, pressure, light etc, the voltage on a battery. There are > countless real world applications > > Consider something like measuring a car battery. Keeping it simple, the > PIC can have 5V on an analogue input. With 0V on this input, the ADC > result will be 0. With 5V on the input the ADC result will be 1023, which > is a range of 10 bits or 2^10. 12V (nominally - it could be as high as 15V) > from a car battery is too much for the input, so you might use a couple of > resistors to attenuate the battery voltage to a maximum of 5V at the PIC > input. For argument's sake, divide by 3 > > If the battery voltage happens to be 12.76V, due to the attenuation of > the resistors, what will appear at the PIC pin is 12.76 / 3 = 4.25V > > As seen above, the expected ADC result is (4.25 / 5) * 1023 = 869. > In other words, 1023 represents 15V, therefore 869 represents 12.76V > > Working the other way, if the ADC result is 907, then the battery voltage > that represents is (907 / 1023) * 15 = 13.30V > > In a real world automotive application, the voltage range of interest would > likely be between 11V and 14V, so the PIC and associated components > would be configured to provide an output representing a 3V span over > the range of the ADC > > wbr > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist