Shop OBEX P1 Docs P2 Docs Learn Events
Shiftout — Parallax Forums

Shiftout

leshea2leshea2 Posts: 83
edited 2005-10-04 23:07 in BASIC Stamp
Would this command work ?


' {$STAMP BS2sx}
' {$PBASIC 2.5}

AIB· DATA "Hello World", 0
KIB· VAR· Word
LIB· VAR· Byte
Main:
KIB = AIB
GOSUB Send_Msg
END

Send_Msg:
DO
READ KIB, LIB
LIB = LIB + 1
IF (LIB = 0) THEN EXIT
SHIFTOUT 3, 4, MSBFIRST, [noparse][[/noparse]LIB]····· ' send byte to device
LOOP
HIGH 3
PAUSE 1000
LOW 3
PAUSE 1000
RETURN
END

or

This one ?

' {$STAMP BS2sx}
' {$PBASIC 2.5}

AIB· DATA "Hello World", 0

Main:
SHIFTOUT 3, 4, MSBFIRST, [noparse][[/noparse]AIB]····· ' send byte to device
END

Thanks !


·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-04 22:31
    The first part looks functional -- does it run on your Stamp and connect to the mystery device in question? Sometimes learning by doing is more effecting than learning by asking....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • leshea2leshea2 Posts: 83
    edited 2005-10-04 22:41
    The mystery device is a 24LC256 EEPROM. I just want to know if either of the above commands would make the BS2sx load "Hello World" to the 24LC256 EEPROM, so I won't risk breaking it.

    Thanks !
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-04 23:07
    No, it won't work -- that was spelled out quite clearly in another thread -- the 24LC256 is an I2C device and simple SHIFTOUT commands will not work. That same thread does in fact include a working program for the 24LC256 as you previously asked. Please go back to that thread and review the responses carefully; the information you need is there. Answers are not always neatly packaged and if you want to communicate with an I2C device with a stock BS2, you're going to have to accept that it takes a bit of code to do it (but I've already provided that part, so that hard work is done).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.