Reading the status of Line Wire.

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

A wire coming out of the device after sensing some data and giving me the output in 0/1 format. I mean if particular condition is matched it gives some current/voltage as output. Otherwire its giving 0 voltage/current.

Now, my issue is to read the status of that wire. I am using stk500v2 and avr mega16 micro. How is it possible to interface it both in terms of hardwae/software.

Moreover , if I have to read the voltage on that wire. How can I read this one. Actually I never did such type of task and having no options from where or how to start. Even during googling I am unable to find the search patterns to be entered. Sorry for this one . !! Really a newbie !!

What precautions should i take to proceed. Any links/help highly appreciated.

Thanks,

Anmol Kumar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no idea of what you're talking about! What wire? What device? What sensor? Give us some web links to the device you're referring to. Then we might be able to help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to determine the "format" of the data coming out of the device. It is very likely I2C (also known as TWI) or SPI. You will need to read the data sheet of the device to determine this.

If you tell us what the device is (manufacturer and device number), we might be able to help.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it's a 0/1 signal (ie Gnd/Vcc) then any port pin will do. You don't even have to set the DDR register (it defaults to input) and then you just read PIN and mask out the bit your are interested in.

If you want to read a voltage level that is somewhere between Gnd and Vcc then bring it to one of the ADC pins. Enable the ADC, set the ADSC bit and wait for it to return to zero then read the ADCH/ADCL registers and you have a number between 0 and 1023 whish represents 1024 fractional steps between Gnd and Vcc (actually other references besides Vcc for the top end of the range are available to you)