Shop OBEX P1 Docs P2 Docs Learn Events
Mouse into BS2??? — Parallax Forums

Mouse into BS2???

ArchiverArchiver Posts: 46,084
edited 2001-05-06 08:00 in General Discussion
Aaron-

FWIW (not much), here's a BS2 version of the PIC subroutines you
referred to:


CLOCK VAR IN0 ' or whatever I/O pin
DATA VAR IN1 ' "
i VAR NIB
temp VAR BYTE
PS2_byte VAR BYTE

PS2get:
GOSUB PS2getBit ' Get/ignore the start bit
FOR i = 1 TO 8
PS2_byte = PS2_byte >> 1 + temp
NEXT
GOSUB PS2getBit ' Get/ignore parity bit
GOSUB PS2getBit ' Get/ignore stop bit
RETURN

PS2getBit:
IF CLOCK = 0 THEN PS2getBit
awaitLowClock:
IF CLOCK = 1 THEN awaitLowClock
temp = DATA << 7
RETURN

The bad news: a Stamp can't communicate (directly) with a PS/2
mouse's synchronous serial data stream because:

- You can't use discrete statements as shown above because they take
too long--the clock pulses and data levels have come and gone by the
time the Stamp realizes something is happening...

- You can't use SHIFTIN/SHIFTOUT because the mouse must supply the
clock pulses rather than using Stamp-generated clock pulses

If you're determined to use a mouse with your Stamp all the same:

- Good for you

- You can buy Al's chip

- You can build your own Stamp-optimized PS/2 interface chip--see
Jan-Mar 2000 Nuts & Volts

Regards,

Steve

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-05-06 07:30
    Hello;

    I'm wishing to be able to attach a standard ps/2 mouse into my BS2
    and read the movement and buttons etc. Searching the internet I found
    a bunch of links which talk about interfacing a mouse with a pic
    microcontroller

    (the most informative of
    http://panda.cs.ndsu.nodak.edu/~achapwes/PICmicro/mouse/mouse.html)

    I was wondering if anybody might be able to give me some tips as to
    how I might (or if it's possible) to adjust his code for it to work
    on a BS2.

    Thank You
    Any ideas would be greatly appreciated

    Aaron Nielsen
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-06 08:00
    At 5/6/2001 Sunday 02:30 AM, Aaron Nielsen promulgated:
    >Hello;
    >
    >I'm wishing to be able to attach a standard ps/2 mouse into my BS2
    >and read the movement and buttons etc. Searching the internet I found
    >a bunch of links which talk about interfacing a mouse with a pic
    >microcontroller
    >
    >(the most informative of
    >http://panda.cs.ndsu.nodak.edu/~achapwes/PICmicro/mouse/mouse.html)
    >
    >I was wondering if anybody might be able to give me some tips as to
    >how I might (or if it's possible) to adjust his code for it to work
    >on a BS2.
    Hi Aaron -

    You may want to look at the PAK-VI co-processor which Al WIlliams offers
    here: http://www.al-williams.com/awce/pak6.htm

    This is a pre-programmed PIC which can interface with a keyboard or PS/2
    mouse. Al is a regular here on the list, and he'd be happy to help if you
    have any questions.

    >Thank You
    >Any ideas would be greatly appreciated
    >
    >Aaron Nielsen
    >
    >Regards,

    Bruce Bates



    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.