Shop OBEX P1 Docs P2 Docs Learn Events
BS2 parallel comms — Parallax Forums

BS2 parallel comms

ArchiverArchiver Posts: 46,084
edited 2001-07-04 22:51 in General Discussion
Thomas-

Asynchronous serial communication--SERIN, SEROUT e.g.--through
a (PC, right?) parallel port would be very problematic. The parallel
port doesn't have the supporting hardware to do the timing and
parallel <--> serial conversion functions.

I'd search for a synchronous serial solution using clock, TX and RX
as you said, but using SHIFTIN and SHIFTOUT on the Stamp side.

See http://www.lvr.com/parport.htm for loads of good parallel port
info.


Regards,

Steve

On 4 Jul 01 at 2:42, thomas_seeker@y... wrote:

> ...I'd like to use a parallel port to do SERIAL comms with my BS2.
> If I recall correctly, I've seen someone else do this by bit
> banging the parallel port to provide clock, TX and RX. I figure I
> can use SERIN / SEROUT on the stamp side...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-07-04 03:42
    Greetings,
    I've lurked on the list a long while, and learned alot.
    But now a question for you gurus:
    I'd like to use a parallel port to do SERIAL comms with my BS2.
    If I recall correctly, I've seen someone else do this by bit
    banging the parallel port to provide clock, TX and RX. I figure
    I can use SERIN / SEROUT on the stamp side (and TTL inversion),
    but maybe some of you have seen something like this and could
    provide a URL for the parallel port side of it?
    Thanks,
    Thomas
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-04 06:57
    If you want the PC to clock the data, you'll have to do your own
    shifting in/out, but that's not hard:

    DATAIN:
    FOR n = 1 TO 8
    awaitHighClock: IF CLK = 0 THEN awaitHighClock
    in_byte = in_byte << 1 + TX_pin ' assumes MSB first
    awaitLowClock: IF CLK = 1 THEN awaitLowClock
    NEXT
    LOW ACK
    RETURN

    Oughta work...

    On 4 Jul 01 at 17:40, thomas_seeker@y... wrote:
    > ...(Here's where I'm unclear on Stamp program flow) DATAIN: for n = 1
    > to 8 wait for CLK LO '** Anybody have an elegant way to do this? get
    > bit from (PCs TX)RX pin wait for CLK HI next 'loop until byte full
    > low ACK 'Flow Control pin return 'to main program
    >
    > So perhaps I'm not looking for SERIN/OUT or SHIFTIN/OUT.
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-04 18:40
    --- In basicstamps@y..., "S Parkis" <parkiss@e...> wrote:
    > Thomas-
    >
    > Asynchronous serial communication--SERIN, SEROUT e.g.--through
    > a (PC, right?) parallel port would be very problematic. The
    parallel
    > port doesn't have the supporting hardware to do the timing and
    > parallel <--> serial conversion functions.
    >
    > I'd search for a synchronous serial solution using clock, TX and RX
    > as you said, but using SHIFTIN and SHIFTOUT on the Stamp side.
    >
    > See http://www.lvr.com/parport.htm for loads of good parallel port
    > info.
    >
    >
    > Regards,
    >
    > Steve
    Steve,
    Thanks for the quick reply.
    The problem I have with the SHIFTIN / SHIFTOUT commands is that they
    expect CLK to be a stamp output - I want to control CLK from the PCs
    parallel port.
    Example:
    (PC program flow)
    Bring CLK line HI 'Request Stamps attention
    Wait for Flow Control to go HI 'Stamp response
    Put first of 8 bits on TX line
    Bring CLK LO
    Delay
    Bring CLK HI
    Loop 'Until all data clocked out
    Wait for Flow Control to go LO 'Stamp ACK
    Bring CLK LO 'Idle State
    etc.
    (Stamp program flow)
    If CLK = 1 then COMM
    return 'to main program
    COMM:
    high ACK 'Flow Control pin
    (Here's where I'm unclear on Stamp program flow)
    DATAIN:
    for n = 1 to 8
    wait for CLK LO '** Anybody have an elegant way to do this?
    get bit from (PCs TX)RX pin
    wait for CLK HI
    next 'loop until byte full
    low ACK 'Flow Control pin
    return 'to main program

    So perhaps I'm not looking for SERIN/OUT or SHIFTIN/OUT.
    Anyway, thats my general idea, feel free to laugh at it if you must.
    I just didn't want to get into the serial port programming on the PC
    (I only have one that I don't want to use for the BS2, but I HAVE got
    some unused I/O bits on the 3 parallel ports I'm using)
    Thanks,
    Thomas
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-04 19:04
    check www.elabinc.com for serial to parallel converter.


    Original Message
    From: <thomas_seeker@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, July 04, 2001 13:40
    Subject: [noparse][[/noparse]basicstamps] Re: BS2 parallel comms


    > --- In basicstamps@y..., "S Parkis" <parkiss@e...> wrote:
    > > Thomas-
    > >
    > > Asynchronous serial communication--SERIN, SEROUT e.g.--through
    > > a (PC, right?) parallel port would be very problematic. The
    > parallel
    > > port doesn't have the supporting hardware to do the timing and
    > > parallel <--> serial conversion functions.
    > >
    > > I'd search for a synchronous serial solution using clock, TX and RX
    > > as you said, but using SHIFTIN and SHIFTOUT on the Stamp side.
    > >
    > > See http://www.lvr.com/parport.htm for loads of good parallel port
    > > info.
    > >
    > >
    > > Regards,
    > >
    > > Steve
    > Steve,
    > Thanks for the quick reply.
    > The problem I have with the SHIFTIN / SHIFTOUT commands is that they
    > expect CLK to be a stamp output - I want to control CLK from the PCs
    > parallel port.
    > Example:
    > (PC program flow)
    > Bring CLK line HI 'Request Stamps attention
    > Wait for Flow Control to go HI 'Stamp response
    > Put first of 8 bits on TX line
    > Bring CLK LO
    > Delay
    > Bring CLK HI
    > Loop 'Until all data clocked out
    > Wait for Flow Control to go LO 'Stamp ACK
    > Bring CLK LO 'Idle State
    > etc.
    > (Stamp program flow)
    > If CLK = 1 then COMM
    > return 'to main program
    > COMM:
    > high ACK 'Flow Control pin
    > (Here's where I'm unclear on Stamp program flow)
    > DATAIN:
    > for n = 1 to 8
    > wait for CLK LO '** Anybody have an elegant way to do this?
    > get bit from (PCs TX)RX pin
    > wait for CLK HI
    > next 'loop until byte full
    > low ACK 'Flow Control pin
    > return 'to main program
    >
    > So perhaps I'm not looking for SERIN/OUT or SHIFTIN/OUT.
    > Anyway, thats my general idea, feel free to laugh at it if you must.
    > I just didn't want to get into the serial port programming on the PC
    > (I only have one that I don't want to use for the BS2, but I HAVE got
    > some unused I/O bits on the 3 parallel ports I'm using)
    > Thanks,
    > Thomas
    >
    >
    > 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/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-07-04 22:51
    I'm late on this thread, but are you trying to get a PC to do
    SHIFTIN/SHIFTOUT?

    If so, look at http://www.al-williams.com/awce/pak4pc.htm

    Regards,

    Al Williams
    AWC
    * 8 channels of PWM: http://www.al-williams.com/awce/pak5.htm


    >
    Original Message
    > From: S Parkis [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Bxeq7Kz6RPmytCPwECuRNiNIIfh21QzpUQjpxAUILA353ApJohCZmXMCi1pm8MQrJIO0uOctu7tYkbMh-A2W]parkiss@e...[/url
    > Sent: Wednesday, July 04, 2001 12:58 AM
    > To: thomas_seeker@y...; basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: BS2 parallel comms
    >
    >
    > If you want the PC to clock the data, you'll have to do your own
    > shifting in/out, but that's not hard:
    >
    > DATAIN:
    > FOR n = 1 TO 8
    > awaitHighClock: IF CLK = 0 THEN awaitHighClock
    > in_byte = in_byte << 1 + TX_pin ' assumes MSB first
    > awaitLowClock: IF CLK = 1 THEN awaitLowClock
    > NEXT
    > LOW ACK
    > RETURN
    >
    > Oughta work...
Sign In or Register to comment.