Shop OBEX P1 Docs P2 Docs Learn Events
Mini Project: Emulate a Microsoft Serial BallPoint/Mouse — Parallax Forums

Mini Project: Emulate a Microsoft Serial BallPoint/Mouse

edited 2011-02-22 09:35 in Robotics
Mini Project:
Emulate a Microsoft Serial BallPoint/Mouse
With BASIC Stamp 2 and OFN Module (#27903)

Background:When I tried to connect a GPS module (USB version, and I know there is a USB to Serial chip inside the module) to my computer, I found that Windows would recognize it as a Microsoft Serial BallPoint component. So I did some research on the Internet, and found that it’s possible and easy to emulate a Serial BallPoint or Serial Mouse by using a BASIC Stamp 2 and the OFN Module from Parallax.

Today, I will show you how to emulate a Microsoft Serial BallPoint with a Parallax OFN Module on the BASIC Stamp 2 platform.

Mouse hardware programming
 Baud rate 1200bps, 7-bit, 1 stop bit
 On power up, the mouse sends a "B" to the PC
 The Ballpoint protocol is the same as the Microsoft Mode protocol (above) except there is an extra byte appended to the packet, in the following format:
 Byte 0: 1// LB// RB// Y7// Y6// X7// X6 (MSB/...../LSB)
 Byte 1: 0// X5// X4/ /X3// X2// X1// X0
 Byte 2: 0// Y5// Y4// Y3// Y2// Y1// Y0
 Byte 3: 0// -// -// sw2// sw4// Y8// X8 (LB=sw1, RB=sw3)

The MSB of the first byte is used as synchronization failure protection (so driver software stays in sync with hardware). X7-0 are the X delta value (that is, the amount of movement since the last packet was sent), Y7-0 are the Y delta, LB = left button state (1=pushed), RB = right button state

For more detailed information about the Serial Mouse Protocol, please visit:
http://davmac.org/davpage/mousehw.html#intro#intro

Notice:
The code was written for a PC with Serial Port only.
The code doesn’t work if using the USBto232 to connect the board to a USB port; you must use a serial cable.


What You’ll Need to Build a “Serial Mouse”:

(1) Board of Education (#28150)
(1) BASIC Stamp 2
(1) Parallax OFN Module (#27903)
(1) Push Button
(1) 220 ohm resistance
(1) 10k ohm resistance
(9 ) Wire

Schematic:

Schemtic.JPG


1. Connect the parts as the picture shows.

STP627642.jpg


2. Download the program code into the BASIC Stamp 2.

DwnLd.JPG


Now your BOE Serial can become a Microsoft Serial BallPoint


3. Let Windows can recognize your BOE Serial as a Serial BallPoint.
At present, your still can not use the OFN Module as a Serial BallPoint. The picture below shows the Windows still doesn’t know you connected a “Serial BallPoint” to the PC. (The windows in my computer are Simplified Chinese Edition Windows XP)

0000.JPG


There are two way to let Windows recognize the “Serial BallPoint”
1) Reset your Computer, while keeping your BOE Serial powered on.
2) Disable the Serial Port, and then Enable it again without resetting the PC(We will discuss this step-by-step)

Step 1:Disable COM1, the port you connected the BOE Serial to.

0001.JPG


Step 2: Important
Hold the Reset button, while enabling the COM1 in Windows. You have to release the Reset button at the same time, or at least within 1 second.

0002.JPG


Step 3:Wait about 30 seconds for Windows to finish installing the driver

0003.JPG


Now you can enjoy using your OFN Module as a “mouse” made by yourself!






Here is the document---> Mini Project.doc
And here is the code ---> OFN_BallPoint2.bs2
866 x 488 - 54K
1024 x 786 - 118K
761 x 411 - 47K
633 x 469 - 60K
746 x 551 - 71K
797 x 595 - 81K
636 x 485 - 63K

Comments

Sign In or Register to comment.