Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp/memsic sensor — Parallax Forums

basic stamp/memsic sensor

lighting ladylighting lady Posts: 7
edited 2009-12-29 05:39 in BASIC Stamp
i have used this code before with four shift registers, a memsic sensor and basic stamp. i am only using three shift registers now. that means I am using 8 pins but cannot change the code to get all of this working. Can anyone help? Please, I am desperate.

' {$STAMP BS2}
' {$PBASIC 2.5}

Clock PIN 0
SerData PIN 1
Latch PIN 2
Clock2 PIN 3
SerData2 PIN 4
Latch2 PIN 5
Clock3 PIN 6
SerData3 PIN 7
Latch3 PIN 8
Clock4 PIN 9
SerData4 PIN 10
Latch4 PIN 11

Delaytime CON 100

pattern VAR BYTE


x VAR WORD

y VAR WORD


Reset:
LOW Latch
pattern = %00000001

Main:
DO
GOSUB Out_595
PAUSE DelayTime
pattern = pattern << 1
LOOP UNTIL (pattern = %10000000)
DO
GOSUB Out_595
PAUSE Delaytime
pattern = pattern >> 1
LOOP UNTIL (pattern = %00000001)

GOTO main

Out_595:
SHIFTOUT SerData, Clock, MSBFIRST, [noparse][[/noparse]pattern]
SHIFTOUT SerData2, Clock2, MSBFIRST, [noparse][[/noparse]pattern]
SHIFTOUT SerData3, Clock3, MSBFIRST, [noparse][[/noparse]pattern]
SHIFTOUT SerData4, Clock4, MSBFIRST, [noparse][[/noparse]pattern]
PULSIN 14, 1, x
PULSIN 15, 1, y
IF x < 2300 THEN PULSOUT Latch, 5
IF x > 2800 THEN PULSOUT Latch2, 5
IF y < 2300 THEN PULSOUT Latch3, 5
IF Y > 2800 THEN PULSOUT Latch4, 5
RETURN

END

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-29 05:33
    1) It is against forum rules to post the same message on more than one forum. It doesn't get you a better or faster answer either.

    2) You haven't explained very well what you want. What you posted is obviously something for 4 shift registers. Explain what you're trying to change and what does or doesn't work in the 3 shift register version.

    3) You might post what you've got for a 3 shift register version
  • lighting ladylighting lady Posts: 7
    edited 2009-12-29 05:39
    sorry. i will try again.
Sign In or Register to comment.