Society of Robots - Robot Forum

Software => Software => Topic started by: junior000 on January 27, 2008, 11:28:06 AM

Title: value after sampling
Post by: junior000 on January 27, 2008, 11:28:06 AM
i am really feeling stupid asking this question. :-[
if analog signal is 4v.
After sampling and storing it in some integer
what will the value in result be???
will it be 4v or some other value???i am using pic18f4550 and c18 compiler
 
Title: Re: value after sampling
Post by: paulstreats on January 27, 2008, 11:48:21 AM
it depends what type of bit conversion you are doing.

if its an 8  bit conversion, the port can sample between 0 and 256.

if 5v is the max then 5v will convert to the number 256 and 0v will convert to 0

 4v will convert to either 204 or 205 because of dp
Title: Re: value after sampling
Post by: junior000 on January 27, 2008, 12:24:13 PM
understood.
mine is 10 bit conversion so the value will be ((4V / 5V) * 1024) = 819.

thank you.
Title: Re: value after sampling
Post by: airman00 on January 27, 2008, 05:13:11 PM
question: what would happen if the signal was 7V

im guessing it would just be the maximum value , right?

also would it damage the micrcontroller in any way , even if it is low current

My guess is that the answer to my two questions are Yes , but i just want to make sure
Title: Re: value after sampling
Post by: paulstreats on January 27, 2008, 07:10:17 PM
The a/d modules usually have a reference voltage of the vdd so its usually 5v, If your mcu could handle higher and 7v was put into the a/d port but not the vcc I should think that it would be read as the max value.

Some mcu's allow you to use 1 seperate pin as a reference pin, so if i put 3v into the reference pin, the a/d modules would register its max value at 3v, anything above this scope would be treat as 3v
Title: Re: value after sampling
Post by: airman00 on January 27, 2008, 07:23:40 PM
The a/d modules usually have a reference voltage of the vdd so its usually 5v, If your mcu could handle higher and 7v was put into the a/d port but not the vcc I should think that it would be read as the max value.

Some mcu's allow you to use 1 seperate pin as a reference pin, so if i put 3v into the reference pin, the a/d modules would register its max value at 3v, anything above this scope would be treat as 3v
\

Thank you for clarifying  ;)
Title: Re: value after sampling
Post by: Admin on February 16, 2008, 05:37:58 PM
Quote
if its an 8  bit conversion, the port can sample between 0 and 256.
I think you meant 0 to 255, for a total of 256 ;)