-->
Page 1 of 1

Reading status of pin D3 turns the pin ON

PostPosted: Mon Jan 29, 2018 4:11 pm
by Alberto_2
I am facing the following problem: Pin D3 is set low with istruction "io(po,0,0)" and it does switch to low.
Then I want to read the pin status using instruction "VV = io(pi,0)" and VV is equal to 1 and the pin is ON as well. Readind status of pin D7 the pin remains stable and the logic value reported by "io(pi,13)" is correct.

At the moment I must avoid to read status of the pin D3 to avoid to turn on the pin when it should not.

Re: Reading status of pin D3 turns the pin ON

PostPosted: Thu Feb 01, 2018 4:24 am
by Alberto_2
OK! Understood the problem. Reading the input with instruction "io(pi,d3)" make the pin an input pin, so the pullup resistor switch the pin to logic 1. This means I have to take track of the output status using a status variable and refer to this variable all the time I need to know the logic status of my output.
I have also learned that d3 is critical when used as an output! So I will swap pins and use d3 as imput and d6 as output.