- #1
digitalblggr
- 42
- 0
Hi,
I am trying to use digital temperature sensor DS18S20(http://datasheets.maxim-ic.com/en/ds/DS18S20.pdf) with Atmega16(http://www.atmel.com/dyn/resources/prod_documents/2466S.pdf). I am using it in a non-parasite mode i.e. Vdd is connected to external power source(Vcc) and Data pin is pulled high to Vcc using 4.7kohm resistor.
Data pin is connected to pin0 on PORTD (PD0) of Atmega16. To reset the DS18S20 I need to pull it low for at least 480 us or more. However , when I define my pin on PORTD as output and pull it low and check it with the scope the data pin still stay high.
Code:
...
DDRD |= (1<<0) //define PD0 as output
PORTD &= ~(1<<0) // pull PD0 low
..
What am I doing wrong? Why is the PDO pin of Atmega not driving the data pin low? Am I not supposed to see data pin go low? Does it happen internally or something?
P.S. I have checked with the scope that I can output high(1) and low(0) on the PORTD, and also tried driving the data pin on DS18S20 with pins of other ports(PORTA etc.) but no success so far.
I am trying to use digital temperature sensor DS18S20(http://datasheets.maxim-ic.com/en/ds/DS18S20.pdf) with Atmega16(http://www.atmel.com/dyn/resources/prod_documents/2466S.pdf). I am using it in a non-parasite mode i.e. Vdd is connected to external power source(Vcc) and Data pin is pulled high to Vcc using 4.7kohm resistor.
Data pin is connected to pin0 on PORTD (PD0) of Atmega16. To reset the DS18S20 I need to pull it low for at least 480 us or more. However , when I define my pin on PORTD as output and pull it low and check it with the scope the data pin still stay high.
Code:
...
DDRD |= (1<<0) //define PD0 as output
PORTD &= ~(1<<0) // pull PD0 low
..
What am I doing wrong? Why is the PDO pin of Atmega not driving the data pin low? Am I not supposed to see data pin go low? Does it happen internally or something?
P.S. I have checked with the scope that I can output high(1) and low(0) on the PORTD, and also tried driving the data pin on DS18S20 with pins of other ports(PORTA etc.) but no success so far.