PicoMite - Strange PIN behavior


Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 891
Posted: 09:31pm 31 Dec 2021      

Hi,
Happy New Year to you all.
I am struggling to understand some strange PIN output on my PicoMite (ver 5.0701).
I have cleared the Pico and loaded everything from scratch several times.
I'm running the following code via MMEdit v5 and have pin GP6 connected to pin GP7.
The connections are sound and not intermittent.
I can make/break the pin GP6 to GP7 connection.
I expect the print statement to show GP6 as '0' when it is broken and '1' when it is made.

It intermittently:
- fails to change from 0 to 1 and vice versa
- works properly
- starts with the wrong value even when started from a powerdown/up or re-load of the code.

Is it me or something else?

Cheers, Andrew



 'PinTest.BAS
 
 SETPIN GP6, DIN
 SETPIN GP7, DOUT : PIN(GP7)=1
 Do
   PRINT "GP6= ";PIN(GP6), "   GP7= "; PIN(GP7)
   PAUSE 1000
 LOOP


TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6603
Posted: 09:39pm 31 Dec 2021      

with the link between 6 and 7 broken, there would be a high impedance input on 6. That would be unstable.

Jim

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 891
Posted: 09:50pm 31 Dec 2021      

Thanks Jim.
How then can I test if a pin is high or low?

(I'm trying here to to get I2C comms to a Laser Distance sensor (for a water tank) to work. I think it relies on a pin being held high and I want to test that it is.)

Cheers,

Andrew

phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3378
Posted: 10:11pm 31 Dec 2021      

Hi Andrew,
Make your input pin analogue and put a 10k to Gnd and another 10k to 3.3V.
You can then see if the output pin is high, low or off.

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 891
Posted: 10:14pm 31 Dec 2021      

Thanks Phil.
Will do.

Andrew