Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Using I/O pins
Author | Message | ||||
Maniccyberdog Newbie Joined: 19/02/2018 Location: United KingdomPosts: 10 |
Dear fellow MM users, I'm just working on my first project and have a small problem (using a PIC32MX170). I have a ILI9341 working ok, and a DS18B20 sensor all ok. I'm adding a another sensor that gives a logic 0/1 at 3.3v but have been unable to get this to work. So far I have tried 3 different pins 4,5,17 code used; SETPIN 17,DIN PRINT PIN(17) I have also changed the option to pullup and pulldown both show the correct values with the print statement and nothing connected to the pin. If I set the option to pullup and ground the pin, the resulting output is 1 from PRINT PIN(17) What I'm I missing? |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8578 |
Either you are not connected to pin 17 properly - check continuity, or you don't have a common ground. The pullup/down shows the pin is measuring properly |
||||
Maniccyberdog Newbie Joined: 19/02/2018 Location: United KingdomPosts: 10 |
Grounds all good etc. The ds18b20 is ok and on the same ground |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1593 |
Are you using a backpack? Sorry but Matherp is correct. Unless you have a faulty chip - check continuity. Power down the unit, remove the display and use a multimeter to check continuity from the pin of the '170 to the connector. Maybe the IC pin is bent under? Bill Keep safe. Live long and prosper. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5900 |
Check that your sensor is really going to zero volts. If the zero reading works without the sensor connected but not when it is connected, your external sensor is holding the input too high. Jim VK7JH MMedit MMBasic Help |
||||
PeterB Guru Joined: 05/02/2015 Location: AustraliaPosts: 639 |
If you are getting this strange thing on pins 4,5 & 17 then it can't be a bent pin 17. The common elements are your ground and software. Could there be something in your software? Other than that, check the actual pin voltage as they are read. Good luck Peter |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1593 |
Sorry, ignore the bent pin idea. I didn't note that you had tried other pins. If you are grounding the pin with your sensor and still reading a logic '1' on the pin, it could be that the 'ground' you are using is elevated above the true 0 volts. Maybe the sensor is drawing a lot of current through the ground? Have you disconnected the sensor and tried shorting to ground with a piece of wire or a clip lead. You may need to use a different ground point. As others have said, check the logic '0' input when using the sensor with a meter - it should be less than 0.65v Bill Keep safe. Live long and prosper. |
||||
Quazee137 Guru Joined: 07/08/2016 Location: United StatesPosts: 522 |
You said you have a working DS18B20 on a different pin. Try it on the other pins and try the DS18B20 in question on the working pin. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3517 |
In post #1 I read: with internal pulldown enabled, the input pin reads 0 with internal pullup enabled, the input pin reads 1 with internal pullup enabled, and pin wired to ground, it reads 1 check the wire... Volhout PicomiteVGA PETSCII ROBOTS |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Hi Maniccyberdog, What is the sensor you are trying to read? It is possible that the sensor is either open collector or open drain? Try a 4k7 resistor pulled to 3v3 . Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Maniccyberdog Newbie Joined: 19/02/2018 Location: United KingdomPosts: 10 |
I found it! I made a short cable between the sensor pin header on my own design backpack. When a probe from my multi-meter was against it made perfect contact, I soon as I moved it away it was very intermittent. I guess thats what you get with parts from Ebay lol. Thanks for all you help, loving my MM :-) |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1593 |
That's good! Thank you for letting us know. Bill Keep safe. Live long and prosper. |
||||
PeterB Guru Joined: 05/02/2015 Location: AustraliaPosts: 639 |
G'Day Manic & Bill Good point Bill, It's nice to know when advice helps or in this case, he/she worked it out for him/her self. Peter |
||||
Print this page |