Shop OBEX P1 Docs P2 Docs Learn Events
Stamp PLC + MX2125 - is it possible? — Parallax Forums

Stamp PLC + MX2125 - is it possible?

WildatheartWildatheart Posts: 195
edited 2009-01-07 19:03 in BASIC Stamp
It appears that 74HC165 restricts the use of the PULSIN instruction for 8 inputs of the Stamp PLC inputs but it also appears that 2 additional “direct input” bits are available outside of the ‘165, Pin 6 and Pin 7, or Din9 and Din10.
In an attempt to use Din9 and Din10 to read the output of the MX2125 ·accelerometer, I get only values of x=0 and y=0.
I am using the PLC 5 volt supply (with all grounds on the PLC tied together) as power for the MX2125 and for the 7407 hex buffer.· The output of the MX2125 is fed through the 7407 and then pulled high to 24V through a 10K resistor on each of the two PLC stamp inputs.· (I’m guessing that the level adjustment through a 7407 is necessary.)
I modified the sample code as follows:
··············· ···············' SimpleTilt.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
'
I/O definitions

Di9 PIN 6
Di10 PIN 7
'
Variables

x VAR Word
y VAR Word
'
Read the MX2125

DO
PULSIN Di9, 1, x
PULSIN Di10, 1, y
DEBUG CLS, ? X, ? Y
PAUSE 100
LOOP
Thanks in advance for taking time to offer your comments

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-30 23:11
    I've never held the Stamp PLC in my hot little hands, but I do suspect you're running into some of the PLC's hardware features.

    Do you have a plain BS2 chip you could try the circuit with? The MX2125 datasheet example is pretty simple so its probably a level-shifting issue.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • WildatheartWildatheart Posts: 195
    edited 2008-12-31 01:04
    Thanks for the suggestion, Tom.· The circuit is straight forward and similar to that which has worked for me many, many times.· The two outputs of the MX2125 are simply buffered before they're fed to the PLC (because I think the PLC wants to see 24V swings at its inputs).· The data sheet sample code is also very straight forward when used with the BS2.· Outside of the enviornment of the PLC I'd expect this to work as designed and experimentation should not be necessary.· But... it is unknown how and if the design of the PLC input scheme affects the process.

    If this can be made to work, you could put a "left to right" pivoting joint on your bucket, monitor it with a MX2125 + PLC with its outputs connected to a hydraulic cylinder -·it could programed to dig level bottomed trenches - no matter the angle your excavator sits at.·
    1154 x 638 - 66K
  • skylightskylight Posts: 1,915
    edited 2008-12-31 18:04
    Just a quick thought, are the buffers inverting your intended input?
  • WildatheartWildatheart Posts: 195
    edited 2008-12-31 18:11
    Even if they were inverting 7406 buffers, it should only make a difference of one pulse count. But no, a 7407 is a non-inverting buffer.

    Thanks for the consideration. -gordon
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-02 19:51
    I noticed you said all grounds were connected together, however the GND on the power input should not be connected to any other GND since this is an input to a DC-DC converter, thus it is isolated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • WildatheartWildatheart Posts: 195
    edited 2009-01-03 16:35
    I did separate the grounds.· The 7407 and the MAX1270 now have their own 5V power, the Stamp PLC has it’s own 24V power, and the output of the 7407 has its own 12V pull-up power (with that ground going only to the Din GND of the PLC).· …still no reading.·
    ·
    As is the case of my other forum question re the pressure transducer – I’m guessing that I’ll have to abandon the idea of using the Stamp PLC for this operation too.· Perhaps the Stamp PLC was designed for only very simple I/O.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-05 17:58
    Is the LED on the end of the PLC lighting up when you apply your inputs? If not the BASIC Stamp won’t see it anyway. The LED in the opto is in series with the LED indicator for the input. This is in series with a 4.7K resistor. So you need sufficient voltage coming in to activate the input. That would be easy to verify even without a meter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • WildatheartWildatheart Posts: 195
    edited 2009-01-06 02:26
    Yes, both corresponding green input lights indicate activity at the inputs.· And it does appear that the input is in the form of pulses because the level of brightness is not the same as a closed contact simple input.· I apologize for no longer having a scope and a freaquency meter·to confirm the input activity.

    I tried different values of pull up resistors at 12 volts - 10K causes the stamp to see a low, and as I approach 15K-20K the input causes the stamp to·suddenly jump·high.· Although I only used a 10K pullup with 24V, it too caused the stamp to see it low.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-07 19:03
    One other possibility if the pulses are visible on the LEDs is that the pulses are coming in too quick for the way the circuit is built. In other words…the LED may be toggling between brighter and dimmer values, but the internal opto’s transistor may not be fully turning on/off. Since the PLC was not designed to function in this fashion anyway I am inclined to recommend using a different interface method. Perhaps a Super Carrier Board with a BASIC Stamp 2 and the required circuitry? Not sure of the details of your system to recommend anything more specific. But if you detail what you’re doing I will try to provide more precise suggestions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.