Shop OBEX P1 Docs P2 Docs Learn Events
help shiftin — Parallax Forums

help shiftin

ArchiverArchiver Posts: 46,084
edited 2001-07-02 20:38 in General Discussion
Hi Wayne,

>How does shiftin suppose to separate a constant line status from "real
data" being sent?

It doesn't. It pulses a clockline and reads a datapin. It is up to the user
to keep the datawords synchronized.
If you use the command with a HC597 (an 8-bit parallel-in serial-out
shiftregister) you should always shift in
8 bits at a time (or multiple of 8 bits if you feed the QH output to the SI
serial input). If you shift in any other
number of bits you have to keep track of where you are. The HC597 has an
escape though. After the latching
the serial register is loaded with fresh data.

What you should figure out is: is your data fixed-length (7 bits, 8 bits, 16
bits ??), starts each dataword with a leading
zero bit?? Is the data coded in some special way to mark the end (perhaps 3
trailing zero bits)?? The variations are numerous.

Have you tried hooking up a datalogger to the data and clock to see what
happens when you hit the board?

Hope this helps.

Greetings peter

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-07-02 19:36
    I tried checking for a leading zero bit at one time but maybe I didn't know
    what I was doing at that time. (Sorry I am learning as I go.)
    Come to think of it, after series of test I noticed there were never more
    than a total of 9 bits between and including the 1st 0 and the last 0.
    But when doing my test back then I think I was loading the bits MSB/LSB in
    the wrong order.

    Could you tell me if you see anything wrong with this code example?

    mybit var bit
    mydata var byte

    Loop:
    Shiftin <datapin>, <clkpin>, MSBPOST, [noparse][[/noparse]mybit\1]
    If mybit = 1 then Loop
    Shiftin <datapin>, <clkpin>, MSBPOST, [noparse][[/noparse]mydata\8]
    <do what ever with the data>
    goto Loop


    Thanks,
    Wayne Fulcher
    wayne@d...

    Original Message
    From: Peter Verkaik [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=BfKSKmuvfgrlQwWrp3l0WPuMxtJtOpXxG5-6UuiS4Styb4uidkPW5veFg5HhClUE0hLAqOSkGqqyKIIlw0a9IbKcUnM]peterverkaik@b...[/url
    Sent: Monday, July 02, 2001 2:14 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] RE: help shiftin

    Hi Wayne,

    >How does shiftin suppose to separate a constant line status from "real
    data" being sent?

    It doesn't. It pulses a clockline and reads a datapin. It is up to the user
    to keep the datawords synchronized.
    If you use the command with a HC597 (an 8-bit parallel-in serial-out
    shiftregister) you should always shift in
    8 bits at a time (or multiple of 8 bits if you feed the QH output to the SI
    serial input). If you shift in any other
    number of bits you have to keep track of where you are. The HC597 has an
    escape though. After the latching
    the serial register is loaded with fresh data.

    What you should figure out is: is your data fixed-length (7 bits, 8 bits, 16
    bits ??), starts each dataword with a leading
    zero bit?? Is the data coded in some special way to mark the end (perhaps 3
    trailing zero bits)?? The variations are numerous.

    Have you tried hooking up a datalogger to the data and clock to see what
    happens when you hit the board?

    Hope this helps.

    Greetings peter



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed with. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-02 19:58
    Hi Wayne,

    As your clockline never changes we can safely assume it is an input.

    mybit var bit
    mydata var byte
    Loop:
    Shiftin <datapin>, <clkpin>, MSBPOST, [noparse][[/noparse]mybit\1]
    If mybit = 1 then Loop
    Why not just wait for the dataline to get low? Sounds likely that the board
    pulls the dataline low
    to notify the presence of data.
    Assuming P0 is your dataline:
    Loop:
    If in0=1 then loop
    Now you can use shiftin to read data.
    It is likely though you now have to pulse the clockline BEFORE you get the
    real data
    As you mentioned that the clockline stayed low, the clockpulse should
    start with a rising edge.
    Low <clkpin>
    Shiftin <datapin>, <clkpin>, MSBPOST, [noparse][[/noparse]mydata\8]
    Debug bin data,cr
    goto Loop
    Or you can use a manual loop setting the clockline low and high yourself to
    have control
    over what happens and figure out exactly when to shift the data in.
    The 8 bits seems reasonable though.

    This might help

    Greetings peter
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-02 20:38
    Hi Wayne,
    >Good point but where do I find the data sheet for a Motorola chip? The card
    >has 2 - 20 pin Motorola chips on it. (I don't have the part number with
    me.)
    >Do they have some type of web site that has the specs for all their chips?
    >The manufactures of the dartboard of course don't want to help me because
    >they feel it's their proprietary technology.

    Try http://www.motorola.com
    and use their search function.

    Changes are however that those chips are specially programmed
    (like GAL's) in which case you must proceed your current quest.
    Hopefully one of those chips is a serial out chip.


    Greetings peter.
Sign In or Register to comment.