Salah Mohammed wrote: > I am reading the voltage on a specific pin by using the A/D(10 > bits) ,but the value in these 10 bits are not the actual value of > the applied voltage so who can I converet it to the real value, > > A/D(10 bits) value voltage > _______________________________________________________________ > > 0000000000 0v > ....................... ? > ....................... ? > ....................... ? > 1111111111 5v Salah: There are 1023 steps between zero and 5V, so each step is equal to 5V/1023, or 0.0049V. 5/1023 can be approximated by 5/1024, so to convert from A/D value to voltage, just multiply by 5 (by left-shifting twice and adding the original value) then divide by 1024 (by right-shifting 10 times, or by discarding the low byte and right-shifting the rest twice). -Andrew === Andrew Warren --- aiw@cypress.com === IPD Systems Engineering, CYSD === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads