Jump to content

[CR] Serial Mouse Driver


Recommended Posts

Note: When using a serial mouse under Windows, it is important that Windows not auto-detect the existence of the mouse (e.g. upon bootup). Otherwise, the operating system will intercept the mouse input and LabVIEW will never see it.

Just for clarity, could you provide a simple way to do this. i.e. can you just plug in the mouse into a serial port, after the computer is booted? I haven't messed with serial mice in a long time, (can you still buy one?) so my knowledge here is limited. But an example of how to do this important stipulation of your code would be in order so people can make use of it.

Link to comment
Just for clarity, could you provide a simple way to do this. i.e. can you just plug in the mouse into a serial port, after the computer is booted? I haven't messed with serial mice in a long time, (can you still buy one?) so my knowledge here is limited. But an example of how to do this important stipulation of your code would be in order so people can make use of it.

Plugging the mouse in after the computer boots is exactly how I do it. I've always had the vague impression that hot-swapping peripherals was not such a great idea (USB being an exception), but have not had any problems doing it to date.

The reason I wrote these VIs is because I wanted some user input to a program running on a PXI system running LabVIEW Real-Time. Since there is neither mouse or USB support, this was the best solution I could come up with. There, of course, leaving the mouse/trackball attached to the COM port all the time is just fine.

Serial mice are still out there, if barebones. I picked up a $4 one for testing. Most industrial trackballs seem to have a serial version available, as well.

This is my first contribution to the CR, and pretty much the first thing I've released for "public consumpton." Comments and suggestions would be greatly welcomed.

Link to comment
The reason I wrote these VIs is because I wanted some user input to a program running on a PXI system running LabVIEW Real-Time. Since there is neither mouse or USB support, this was the best solution I could come up with. There, of course, leaving the mouse/trackball attached to the COM port all the time is just fine.

That's an excellent idea - I wonder how difficult it would be to implement the same with a joystick for rough motion control?

Link to comment
That's an excellent idea - I wonder how difficult it would be to implement the same with a joystick for rough motion control?

I doubt it would be too difficult, but they're slightly different. If you think about moving something with a mouse, the intuitive way of thinking about it (in my opinion, your brain may vary) is that the object moves in the same direction as the mouse movement and when the mouse stops moving, the object stops moving. Speed of the object should be related to the speed of the mouse movement. For a joystick, the tilt direction controls the direction of the object's moton, and as you tilt the joystick it moves faster and faster. If you push the joystick all the way forward, the object moves and keeps moving until the joystick goes back to its center position. Basically, a mouse controls position; a joystick controls velocity.

The nice thing about the serial mouse is that the protocol is simple, well-documented, and implemented by a number of manufacturers. There's a three button one, as well. I don't think the same is true for joysticks.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.