Author Topic: value after sampling  (Read 4689 times)

0 Members and 1 Guest are viewing this topic.

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
value after sampling
« 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
 
« Last Edit: January 27, 2008, 11:34:08 AM by junior000 »
view my tutorials at


www.myfirstbot.blogspot.com

paulstreats

  • Guest
Re: value after sampling
« Reply #1 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

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: value after sampling
« Reply #2 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.
view my tutorials at


www.myfirstbot.blogspot.com

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: value after sampling
« Reply #3 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
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: value after sampling
« Reply #4 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

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: value after sampling
« Reply #5 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  ;)
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: value after sampling
« Reply #6 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 ;)

 

SMF spam blocked by CleanTalk