Shop OBEX P1 Docs P2 Docs Learn Events
output switching an input — Parallax Forums

output switching an input

Jeff RegesterJeff Regester Posts: 3
edited 2009-08-06 23:51 in Propeller 1
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

Comments

  • CassLanCassLan Posts: 586
    edited 2009-08-06 02:58
    Jeff,

    Welcome. Go ahead and post some of that code up.

    Rick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    NYC Area Prop Club

    Prop Forum Search (Via Google)

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-06 03:18
    It could be something wrong with your code. It could be a short circuit around the affected pins. It could also be a damaged Propeller. Can't tell without more information ... at the very least attach your code to a message (do not cut and paste ... the formatting gets messed up). You might also attach a circuit diagram and maybe a closeup picture of the Protoboard.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-08-06 05:49
    Welcome to the forums Jeff and to the Propeller!

    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
  • Jeff RegesterJeff Regester Posts: 3
    edited 2009-08-06 16:02
    Rick, Mike and Tim,

    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 Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-06 16:28
    It looks like your limit switches are wired incorrectly. You've got series resistors on the inputs, but unless your limit switches are SPDT (switching alternately between Vdd and Vss) you won't be able to present both logic states to the inputs. What you need to do is pull the inputs up to Vdd through the 10K resistors; then, using 330R series resistors, pull them down to Vss via the limit switches.

    -Phil
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-08-06 17:08
    propeller inputs have a high impedance.
    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
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-06 17:29
    Jeff,

    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
  • Jeff RegesterJeff Regester Posts: 3
    edited 2009-08-06 18:14
    Phil and Stefan,
    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
  • photomankcphotomankc Posts: 943
    edited 2009-08-06 19:07
    I believe you will need a 1K resistor to interface to the TTL devices from what I have read.
  • CassLanCassLan Posts: 586
    edited 2009-08-06 23:51
    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)
    476 x 681 - 22K
Sign In or Register to comment.