Mini Project: Emulate a Microsoft Serial BallPoint/Mouse
John Zhong(Parallax HK)
Posts: 6
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 its 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 doesnt work if using the USBto232 to connect the board to a USB port; you must use a serial cable.
What Youll 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:
1. Connect the parts as the picture shows.
2. Download the program code into the BASIC Stamp 2.
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 doesnt know you connected a Serial BallPoint to the PC. (The windows in my computer are Simplified Chinese Edition Windows XP)
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.
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.
Step 3:Wait about 30 seconds for Windows to finish installing the driver
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
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 its 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 doesnt work if using the USBto232 to connect the board to a USB port; you must use a serial cable.
What Youll 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:
1. Connect the parts as the picture shows.
2. Download the program code into the BASIC Stamp 2.
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 doesnt know you connected a Serial BallPoint to the PC. (The windows in my computer are Simplified Chinese Edition Windows XP)
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.
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.
Step 3:Wait about 30 seconds for Windows to finish installing the driver
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
Comments
It looks much better now and the post is easier to follow.