output switching an input
Jeff Regester
Posts: 3
Hi, I'm new to the forums and relatively new to the propeller. I've been beating my head about this issue:
I have a Proto Board, interfaced to a number of inputs and outputs, as part of a telescope mount. I'm testing now, in the shop not on the telescope. P22 is configured as an output; P23 is an input. When I change the state of the output (P22), the P23 input also changes state, as sensed by the INA[noparse]/noparse command. This happens, EVEN IF the P23 input is tied directly to ground or 3.3V. In fact, I can't get a set of 4 inputs to read (on P23, P24, P25 and P28), but P23 is the only one that flips state when a different OUTPUT is flipped. Other inputs, on P9 and P10 work fine, and my code is the same reading the inputs.
Any thoughts? Is this behavior indicative of fried inputs, or perhaps some coding errors you've seen before?
Thanks!
Jeff Regester
I have a Proto Board, interfaced to a number of inputs and outputs, as part of a telescope mount. I'm testing now, in the shop not on the telescope. P22 is configured as an output; P23 is an input. When I change the state of the output (P22), the P23 input also changes state, as sensed by the INA[noparse]/noparse command. This happens, EVEN IF the P23 input is tied directly to ground or 3.3V. In fact, I can't get a set of 4 inputs to read (on P23, P24, P25 and P28), but P23 is the only one that flips state when a different OUTPUT is flipped. Other inputs, on P9 and P10 work fine, and my code is the same reading the inputs.
Any thoughts? Is this behavior indicative of fried inputs, or perhaps some coding errors you've seen before?
Thanks!
Jeff Regester
Comments
Welcome. Go ahead and post some of that code up.
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·
Attaching code/schematics is the best way to help us gain insight into what you are struggling with. Also, depending on your approach to coding, it might help to back off from creating a massive program at once and to instead write several smaller programs and blocks to work out the techniques and to learn.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
Thanks for helping out a newbie! Here are the code and schematic. The project is a telescope control system, with steppers controlling the two axes of the telescope movement, and some solid-state relays controlling another motor that opens the telescope cover. I've got the motor working, and the outputs to the SSRs (DOOROPENCMD and DOORCLOSECMD, P21 and P22) and inputs of the cover limit switches (DOOROPEN and DOORCLOSED, P9 and P10, respectively) all work.
What's not working is the sensing of the telescope position limit switches, LIMITN, LIMITS, LIMITE, LIMITW (north, south, east and west, P23, P24, P25 and P28, respectively. That, and the weird interaction between the state of DOORCLOSECMD output and LIMITN input.
The relevant sections of the code are the methods init and checkstatus. The main method polls the keyboard, updates the TV status screen based on the results of checkstatus.
Thanks again for any advice you might have.
Jeff
-Phil
and of the input is not connect to Vss and not to Vdd it is "free floating"
2 inches of cable might be enough to work as an antenna to make the input jump for and back between high and low
in a completely unpredictable way.
Pull-up OR pull-down-resistors give the input a clear state. Even if the switch is opened through the pull-up resistor the input is tied to +3.3V
through a pull-down-resistor the input is tied to ground when the switch is opened.
for further advice it would be good to have information about the details and the schematic what is on the other end of ypur connector
- mechanical switches ?
- TTL-logic gates ? (3.3V or 5V ?
- open-collectors ?
what is it ?
another hint you should NOT use coginit !
you should use cognew. Of course the cog ID will varying with each each bootup of the prop but
as long as you use cognew EVERYTHING about managing to do a cogstop or find a new unused cog is
done by the propeller itself. Look through all the object-soucecode how many coginits you will find
almost no coginit almost every time cognew.
if you are using coginit and start a certain cog it is up to YOU to manage the right cogstop coginits etc.
you can leave this in control of the propellerhardware
best regards
Stefan
Post Edited (StefanL38) : 8/6/2009 5:19:42 PM GMT
I hadn't looked at your code, but I'll second Stefan's admonition never to use coginit. Always use cognew instead. cognew returns the number of the cog assigned, so you can use it with cogstop later, if you want to.
-Phil
Thanks for the help! Looks like I've got some hardware and software revisions to make. As for the question...
<quote>
for further advice it would be good to have information about the details and the schematic what is on the other end of ypur connector
- mechanical switches ?
- TTL-logic gates ? (3.3V or 5V ?
- open-collectors ?
</quote>
At the moment, there's nothing on the other side of the connector, as this hw is not attached to the telescope at the moment. I've just testing by hand tying inputs to 3.3V or ground. The limit switches on the telescope itself are mechanical, switching 5V, because the old control system was TTL 5V. (The old system was several racks of electronics, controlled by a 1982 Heathkit H89).
The reading I had done indicated there wasn't a problem interfacing the prop directly to 5V. Is that correct?
Jeff
I think you want something like this for the limit switch inputs. I had similar issues with an alarm circuit that had multiple inputs
You prob want to switch the value of the resistor connected to the PIN to account for the 5V as mentioned earlier.
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)