Stamp PLC + MX2125 - is it possible?
Wildatheart
Posts: 195
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
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
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
·
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.·
Thanks for the consideration. -gordon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
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 Savage
Parallax Engineering
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 Savage
Parallax Engineering