Shop OBEX P1 Docs P2 Docs Learn Events
Help (SHIFTIN) — Parallax Forums

Help (SHIFTIN)

ArchiverArchiver Posts: 46,084
edited 2001-07-03 14:37 in General Discussion
Wayne-

It's possible--or likely--that the clock signal involved here is an
output from your card. In other words, the card "clocks out" the
data bits on the data line in concert with clock pulses it sends on
the clock line. In that case:

- your Stamp should sample bits when the clock is active
- the Stamp shouldn't provide the clock
- you can't use SHIFTIN

If you connect the clock line on the card to a Stamp pin configured
as an input, what does the line look like to your Stamp? Does it
have a steady logic level until a dart hits the board?

Try something like this:

clock_pin VAR IN0 ' or whatever
data_pin VAR IN1 ' or whatever
i VAR BYTE
data_byte VAR BYTE

again:
FOR i = 1 TO 8
awaitHighClock:
IF clock_pin = 0 THEN awaitHighClock
data_byte = data_byte << 1 + IN1
awaitLowClock:
IF clock_pin = 1 THEN awaitLowClock
NEXT
DEBUG BIN8 data_byte," "
GOTO again

This is sort of a manual, externally clocked version of SHIFTIN.


Regards,

Steve

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-07-02 15:50
    After having received advice from you Basic Stampers I realized I neededto get data from my dartboard interface card using shiftin.
    I guess that is used for TTL. When a player’s dart hits the dartboard,the card will send a code which identifies which segment was hit.
    I am simply trying to convert that data so it can be sent to the serialport of my PC.
    Since I don’t know when the dart will hit, my program is in a loop doingshiftin until I get data then it will send it out another pin with serout.
    ·
    Sounds simple unh? The problem I found is that it appears that shiftinwill assign bits based on the state of the datapin before/after each clock pinpulse.
    Well the datapin appears to stay high when the card is not sending data.So as my program loops it will constantly get 11111111 (how ever many bits Ishiftin).
    In other words all 1’s. The problem here is how do I determine thedifference between the constant 1’s and a 1’s from the real data being sent.
    Example: the card might send out: 10100101 when I do shiftin I might get4 bits from the constant +5v on the line so I would receive: 11111010
    Then if I shiftin the next 8 bits I would get the last 4 bits from thereal data and 4 more bits from the constant high on the line 01011111.
    Basically the real data was split across two shiftins. If I shiftin 16bits at once using the above example I might get:
    1111101001011111. Again my data is somewhere in the middle. Which meansif the card sent a different value: 01001011 it might look the same if you have1’s before and after it.
    If I received 5 constant 1’s before the real data it would appear to bethe same when in fact its different. After thinking about it, even if the linewas a constant low it would have the same problem with 0’s.
    ·
    How does shiftin suppose to separate a constant line status from “realdata” being sent?
    What am I not understanding.
    ·
    ·
    Thanks,
    Wayne Fulcher
    wayne@ddinet.com
    ·
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-02 19:21
    I wrote a sample program to monitor the clock pin and it never goes high
    even when a dart hits the board.

    I guess I am confused because would all TTL devices have the same problem I
    am having?
    Would anyone that ever uses shiftin have this same problem?
    That's why I feel like I must not understand how other TTL devices work.

    The sample code you wrote makes a lot more sense to me than shiftin.
    It seems every device would have to send a signal to what ever is
    interfacing with it to let it know when it is sending data.

    This sounds so simple, yet I am so confused.

    HELP!!! (I have a two week deadline!!!)

    Thanks,
    Wayne Fulcher
    wayne@d...

    Original Message
    From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=BOGY2bdWKQ2lb1FYcBZv3xy8NbUTzNnrXCQcnxFUSr8gz0VcKkLquG98NTv-PrkQ8f4pTfQrYhpDGS3n-vmE]parkiss@e...[/url
    Sent: Sunday, July 01, 2001 10:48 PM
    To: Wayne Fulcher; basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)

    Wayne-

    It's possible--or likely--that the clock signal involved here is an
    output from your card. In other words, the card "clocks out" the
    data bits on the data line in concert with clock pulses it sends on
    the clock line. In that case:

    - your Stamp should sample bits when the clock is active
    - the Stamp shouldn't provide the clock
    - you can't use SHIFTIN

    If you connect the clock line on the card to a Stamp pin configured
    as an input, what does the line look like to your Stamp? Does it
    have a steady logic level until a dart hits the board?

    Try something like this:

    clock_pin VAR IN0 ' or whatever
    data_pin VAR IN1 ' or whatever
    i VAR BYTE
    data_byte VAR BYTE

    again:
    FOR i = 1 TO 8
    awaitHighClock:
    IF clock_pin = 0 THEN awaitHighClock
    data_byte = data_byte << 1 + IN1
    awaitLowClock:
    IF clock_pin = 1 THEN awaitLowClock
    NEXT
    DEBUG BIN8 data_byte," "
    GOTO again

    This is sort of a manual, externally clocked version of SHIFTIN.


    Regards,

    Steve

    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 20:15
    Wayne One of the first things I would do is get the part numbers off the
    chips inside the dart board. get the data sheets for them and then you have
    something to work with, your going at this blind and just trying things (
    and what your doing is a good try ). Once you know the chips your talking
    to someone should be able to help. if your looking at only three bits of
    data you would have 8 different outputs 0 to 7 if its four bits you would
    have 16 different outputs 0 to 15. so just look at the change in output for
    maybe 4 of the inputs, again this is only a guess.

    good luck
    larry

    Wayne Fulcher wrote:
    >
    > I wrote a sample program to monitor the clock pin and it never goes high
    > even when a dart hits the board.
    >
    > I guess I am confused because would all TTL devices have the same problem I
    > am having?
    > Would anyone that ever uses shiftin have this same problem?
    > That's why I feel like I must not understand how other TTL devices work.
    >
    > The sample code you wrote makes a lot more sense to me than shiftin.
    > It seems every device would have to send a signal to what ever is
    > interfacing with it to let it know when it is sending data.
    >
    > This sounds so simple, yet I am so confused.
    >
    > HELP!!! (I have a two week deadline!!!)
    >
    > Thanks,
    > Wayne Fulcher
    > wayne@d...
    >
    >
    Original Message
    > From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ct1grjghOOnN_A6lAYVHYYqND6OD_vxba0qiadacmTysKthK_u4BLmBrlK2BeuSod51Z1qfcFNlprmFMeQ]parkiss@e...[/url
    > Sent: Sunday, July 01, 2001 10:48 PM
    > To: Wayne Fulcher; basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)
    >
    > Wayne-
    >
    > It's possible--or likely--that the clock signal involved here is an
    > output from your card. In other words, the card "clocks out" the
    > data bits on the data line in concert with clock pulses it sends on
    > the clock line. In that case:
    >
    > - your Stamp should sample bits when the clock is active
    > - the Stamp shouldn't provide the clock
    > - you can't use SHIFTIN
    >
    > If you connect the clock line on the card to a Stamp pin configured
    > as an input, what does the line look like to your Stamp? Does it
    > have a steady logic level until a dart hits the board?
    >
    > Try something like this:
    >
    > clock_pin VAR IN0 ' or whatever
    > data_pin VAR IN1 ' or whatever
    > i VAR BYTE
    > data_byte VAR BYTE
    >
    > again:
    > FOR i = 1 TO 8
    > awaitHighClock:
    > IF clock_pin = 0 THEN awaitHighClock
    > data_byte = data_byte << 1 + IN1
    > awaitLowClock:
    > IF clock_pin = 1 THEN awaitLowClock
    > NEXT
    > DEBUG BIN8 data_byte," "
    > GOTO again
    >
    > This is sort of a manual, externally clocked version of SHIFTIN.
    >
    > Regards,
    >
    > Steve
    >
    > 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/
    >
    > 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 20:26
    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.

    Speaking of other chips I know I should not be asking this question here but
    I don't know where else to get an answer.
    This project I am working on will simply read in these codes from the
    dartboard (TTL) and send it out to a PC's serial port (RS232).
    Is there another cheaper chip that has that capability?
    If so,
    $ Chip Name?
    $ Language? (Hopefully some form of Basic.)
    $ Compiler?
    $ Burner?

    The basic stamp is the only chip I have ever programmed.
    To be considerate you can just reply directly to me.

    Thanks,
    Wayne Fulcher
    wayne@d...

    Original Message
    From: L .Gaminde [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=EtLxT0JUDsYMUzHVxC7brh1KHo0o-bA6OyBb7HckNwDZzoe08MlnKkNvTp3x-Wr-BIZJCzzlEYxeqE81CagB]lgaminde@t...[/url
    Sent: Monday, July 02, 2001 3:16 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)

    Wayne One of the first things I would do is get the part numbers off the
    chips inside the dart board. get the data sheets for them and then you have
    something to work with, your going at this blind and just trying things (
    and what your doing is a good try ). Once you know the chips your talking
    to someone should be able to help. if your looking at only three bits of
    data you would have 8 different outputs 0 to 7 if its four bits you would
    have 16 different outputs 0 to 15. so just look at the change in output for
    maybe 4 of the inputs, again this is only a guess.

    good luck
    larry

    Wayne Fulcher wrote:
    >
    > I wrote a sample program to monitor the clock pin and it never goes high
    > even when a dart hits the board.
    >
    > I guess I am confused because would all TTL devices have the same problem
    I
    > am having?
    > Would anyone that ever uses shiftin have this same problem?
    > That's why I feel like I must not understand how other TTL devices work.
    >
    > The sample code you wrote makes a lot more sense to me than shiftin.
    > It seems every device would have to send a signal to what ever is
    > interfacing with it to let it know when it is sending data.
    >
    > This sounds so simple, yet I am so confused.
    >
    > HELP!!! (I have a two week deadline!!!)
    >
    > Thanks,
    > Wayne Fulcher
    > wayne@d...
    >
    >
    Original Message
    > From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=TCyp41YzNqLxhzAGXeQ0MpCwqixkL17G77dVOf3VnE5cjXeuezaI9DQYLfAx4lGEaWG_52b15LgVK08Y5z0]parkiss@e...[/url
    > Sent: Sunday, July 01, 2001 10:48 PM
    > To: Wayne Fulcher; basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)
    >
    > Wayne-
    >
    > It's possible--or likely--that the clock signal involved here is an
    > output from your card. In other words, the card "clocks out" the
    > data bits on the data line in concert with clock pulses it sends on
    > the clock line. In that case:
    >
    > - your Stamp should sample bits when the clock is active
    > - the Stamp shouldn't provide the clock
    > - you can't use SHIFTIN
    >
    > If you connect the clock line on the card to a Stamp pin configured
    > as an input, what does the line look like to your Stamp? Does it
    > have a steady logic level until a dart hits the board?
    >
    > Try something like this:
    >
    > clock_pin VAR IN0 ' or whatever
    > data_pin VAR IN1 ' or whatever
    > i VAR BYTE
    > data_byte VAR BYTE
    >
    > again:
    > FOR i = 1 TO 8
    > awaitHighClock:
    > IF clock_pin = 0 THEN awaitHighClock
    > data_byte = data_byte << 1 + IN1
    > awaitLowClock:
    > IF clock_pin = 1 THEN awaitLowClock
    > NEXT
    > DEBUG BIN8 data_byte," "
    > GOTO again
    >
    > This is sort of a manual, externally clocked version of SHIFTIN.
    >
    > Regards,
    >
    > Steve
    >
    > 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/
    >
    > 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/

    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 21:24
    Just use the stamp its getting to late to start switching now, if you find
    something later then replace the stamp with it and use the stamp for
    something else.

    send me the chip numbers I will try to look them up!

    larry gaminde

    Wayne Fulcher wrote:
    >
    > 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.
    >
    > Speaking of other chips I know I should not be asking this question here but
    > I don't know where else to get an answer.
    > This project I am working on will simply read in these codes from the
    > dartboard (TTL) and send it out to a PC's serial port (RS232).
    > Is there another cheaper chip that has that capability?
    > If so,
    > $ Chip Name?
    > $ Language? (Hopefully some form of Basic.)
    > $ Compiler?
    > $ Burner?
    >
    > The basic stamp is the only chip I have ever programmed.
    > To be considerate you can just reply directly to me.
    >
    > Thanks,
    > Wayne Fulcher
    > wayne@d...
    >
    >
    Original Message
    > From: L .Gaminde [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=9cBwTKw_0HhPzP25GR35ZA6haww1jDa4DCnH_885EzRlLLmeFhqw0Rq4O1rEqfCOvTeCYrPSvQWkXbcCzck]lgaminde@t...[/url
    > Sent: Monday, July 02, 2001 3:16 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)
    >
    > Wayne One of the first things I would do is get the part numbers off the
    > chips inside the dart board. get the data sheets for them and then you have
    > something to work with, your going at this blind and just trying things (
    > and what your doing is a good try ). Once you know the chips your talking
    > to someone should be able to help. if your looking at only three bits of
    > data you would have 8 different outputs 0 to 7 if its four bits you would
    > have 16 different outputs 0 to 15. so just look at the change in output for
    > maybe 4 of the inputs, again this is only a guess.
    >
    > good luck
    > larry
    >
    > Wayne Fulcher wrote:
    > >
    > > I wrote a sample program to monitor the clock pin and it never goes high
    > > even when a dart hits the board.
    > >
    > > I guess I am confused because would all TTL devices have the same problem
    > I
    > > am having?
    > > Would anyone that ever uses shiftin have this same problem?
    > > That's why I feel like I must not understand how other TTL devices work.
    > >
    > > The sample code you wrote makes a lot more sense to me than shiftin.
    > > It seems every device would have to send a signal to what ever is
    > > interfacing with it to let it know when it is sending data.
    > >
    > > This sounds so simple, yet I am so confused.
    > >
    > > HELP!!! (I have a two week deadline!!!)
    > >
    > > Thanks,
    > > Wayne Fulcher
    > > wayne@d...
    > >
    > >
    Original Message
    > > From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=DMwMHXRBlI2VB8cu1dhLNbBgxnX2f23eu-CXD2mlcOnX_kM-9FI9b_-fBB0lqUQHBgSoRsgAwARkXL8iAA]parkiss@e...[/url
    > > Sent: Sunday, July 01, 2001 10:48 PM
    > > To: Wayne Fulcher; basicstamps@yahoogroups.com
    > > Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)
    > >
    > > Wayne-
    > >
    > > It's possible--or likely--that the clock signal involved here is an
    > > output from your card. In other words, the card "clocks out" the
    > > data bits on the data line in concert with clock pulses it sends on
    > > the clock line. In that case:
    > >
    > > - your Stamp should sample bits when the clock is active
    > > - the Stamp shouldn't provide the clock
    > > - you can't use SHIFTIN
    > >
    > > If you connect the clock line on the card to a Stamp pin configured
    > > as an input, what does the line look like to your Stamp? Does it
    > > have a steady logic level until a dart hits the board?
    > >
    > > Try something like this:
    > >
    > > clock_pin VAR IN0 ' or whatever
    > > data_pin VAR IN1 ' or whatever
    > > i VAR BYTE
    > > data_byte VAR BYTE
    > >
    > > again:
    > > FOR i = 1 TO 8
    > > awaitHighClock:
    > > IF clock_pin = 0 THEN awaitHighClock
    > > data_byte = data_byte << 1 + IN1
    > > awaitLowClock:
    > > IF clock_pin = 1 THEN awaitLowClock
    > > NEXT
    > > DEBUG BIN8 data_byte," "
    > > GOTO again
    > >
    > > This is sort of a manual, externally clocked version of SHIFTIN.
    > >
    > > Regards,
    > >
    > > Steve
    > >
    > > 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/
    > >
    > > 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/
    >
    > 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/
    >
    > 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-03 08:11
    Steve
    I find a pity that SHIFTIN does not implement a parameter
    in order to make its clock active (as now) or passive (as you do
    with your program).
    This should ease the interfacing with many devices.
    Regards
    ECO

    Original Message
    From: S Parkis <parkiss@e...>
    To: Wayne Fulcher <wayne@d...>; <basicstamps@yahoogroups.com>
    Sent: Monday, July 02, 2001 04:47
    Subject: Re: [noparse][[/noparse]basicstamps] Help (SHIFTIN)


    > Wayne-
    >
    > It's possible--or likely--that the clock signal involved here is an
    > output from your card. In other words, the card "clocks out" the
    > data bits on the data line in concert with clock pulses it sends on
    > the clock line. In that case:
    >
    > - your Stamp should sample bits when the clock is active
    > - the Stamp shouldn't provide the clock
    > - you can't use SHIFTIN
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-03 14:01
    THANKS TO ALL OF YOU!!!!!

    I just wanted to say thanks to all of you who helped me with my dartboard
    TTL/shiftin problem.
    Hindsight this really was pretty simple but without specs on the device I
    was shooting in the dark.
    The solution was:

    The device does send a leading zero then an 8-bit code, which I tried
    checking for at first but at that time I was not using the right MSB/LSB
    PRE/POST combination so it did not appear to work.
    Peter made that suggestion again so I tried every combination and as luck
    would have it the last one worked.
    Thanks again everybody.

    Thanks,
    Wayne Fulcher
    wayne@d...
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-03 14:37
    "Well, it's always in the last place you look."
    - Homer

    --- Wayne Fulcher <wayne@d...> wrote:
    > THANKS TO ALL OF YOU!!!!!
    >
    > I just wanted to say thanks to all of you who helped
    > me with my dartboard
    > TTL/shiftin problem.
    > Hindsight this really was pretty simple but without
    > specs on the device I
    > was shooting in the dark.
    > The solution was:
    >
    > The device does send a leading zero then an 8-bit
    > code, which I tried
    > checking for at first but at that time I was not
    > using the right MSB/LSB
    > PRE/POST combination so it did not appear to work.
    > Peter made that suggestion again so I tried every
    > combination and as luck
    > would have it the last one worked.
    > Thanks again everybody.
    >
    > Thanks,
    > Wayne Fulcher
    > wayne@d...
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > 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/
    >
    >


    =====
    Regards,

    Bob Pence

    NOTE: This mail is sent using my wireless phone. Calling me at 1 (610) 563-6198
    is preferred to a reply. If replying to this email address, please do not quote
    the original message.

    __________________________________________________
    Do You Yahoo!?
    Get personalized email addresses from Yahoo! Mail
    http://personal.mail.yahoo.com/
Sign In or Register to comment.