LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

communication with PS2 mouse

communication with PS2 mouse

i want to connect the PS2 mouse with the NI 6221 - 37 pins

the PS2 has 4 things:

1. data
2.Clock
3.Vcc
4.Gnd

i connect clock with PF1
data with dev 0/line 1
Gnd with DGnd
Vcc,  i can't  connect this. because  this  DAQ card hasn;t got Vcc

the problem: i want to send commands to the mouse.. how i can do this?
 but first of all, how i will get or send a byte to the PS2 mouse?

i give one attachment. in the attachment, i have the protocol of the PS2 mouse..

Anyones to gives me some advices or any ideas?

thanks very much!

andrikos
0 Kudos
Message 1 of 10
(4,929 Views)

Hi andrikos

First off I would like to thank you for using our discussion forms. 

The 37-PIN 6221 doesn’t have a Vcc, and you can’t use the analog output set to 5V to act as the Vcc, because the mouse specifications you sent tell me that the mouse may draw upto 275mA, and the NI 6221 cannot source this kind of current.  The analog output is only capable of driving 5mA of current.

If you can find a way to power the mouse then reading the output signals of the mouse is relatively easy.  Basically you would set up a continuous digital channel acquisition with external timing, and use the mouse’s clock as the clock for the digital input.  If you are using LabVIEW, then the Cont Read Dig Chan-Ext Clk.vi is well suited for this application.

You can read in the data line on Port0/Line0 (pin 37) or Port0/Line1 (pin 19), as the 6221 only has two clocked digital inputs.  You will also have to attach the clock from the mouse to any of the PFI lines (in your case PFI1) and ensure that you specific the clock for the digital input task as PFI1.

This will enable you to read in the raw data from the mouse, and it will allow you to parse the data into 11 or 12-bit chunks, and use the protocol described in your PS2 mouse document to give practical meaning to the data you obtain.

Please note that currently you will not be able to accomplish this because you have no way to provide the Vcc to the mouse with the DAQ card that you are using.

Have a great day

Chris_K       

0 Kudos
Message 2 of 10
(4,888 Views)
Just out of curiosity, what application are you currently doing that requires this extremely low-level (in terms of hierarchy) of interface? Sounds like you're trying to test mice?
Message 3 of 10
(4,876 Views)

hi all,

1.
the major objective: i want to develop one technique that i will get measurements (or show pictures..),  in regions with unknown form under the guidance of optical coder

after, i will succeed the communication with PS/2 optical mouse, i will connect this with a sensor.

that, i will show the schematics or picture in the monitor of  pc(the sensor ).

specifically, i want to get the schematic of the skin(a photo..).

i don't know any informations, right now.

the first stage of the project is to succeed to communicate with mouse...

2.
the problem with the power..

i thought to disconnect the data and clock from the PS/2 (is connected with the computer), and i will get the power from the pc.

what do you think about this? is right?

3. i knew for this example and i succeed to read the packet of bits. but, i want to write a commands to the mouse..(e.g. to initialize the mouse..)

this is the major problem..

thank you very much, for your interest!!

0 Kudos
Message 4 of 10
(4,857 Views)
hi again,

i have another one problem..

i want to set the clock LOW for 100 μs.

how i can do this?

andrikos

0 Kudos
Message 5 of 10
(4,842 Views)

The power option sounds like it should work. Have you been able to successfully read a packet of bits from the Mouse while you are powering it?

As for the clock, I was under the impression that you were going to use the clock from the mouse to time the input received. Is this correct?  I am unsure what you mean when you say that you disconnect the clock and data.  Can you explain exactly what you want to use as the clock, either the mouse’s or are you specifying your own.

Communication to the mouse is possible, but it might be difficult if you require feedback from the mouse for transmission.  If you just need to transmit bits to the mouse then it is just specific a clock, and send your data to the mouse using a digital write task.  If you need to set up some sort of handshaking, then you will have to develop your application to deal with it and there will be many things to consider which may be possible but it could be very difficult to account for everything. Also note that the card you are using only has 2 clocked DIO lines.

For the clock you can use a counter and set the high times and low times independently.  You can set it the low time to be 100 μs and use it as a clock for your application.

Chris_K

0 Kudos
Message 6 of 10
(4,818 Views)
hi!

1. i have the PS/2 mouse connected with the computer and with the DAQ card and i read the packets that the mouse send to the host.

after, i will succeed to communicate with mouse, i will disconnect only the data and clock. then, i will get power from computer!

2. if i want to send a packet to the mouse. i have to set the clock low for at least 100 μs. i will develop my own clock? or i will use the mouse's clock??

3. do you anyone, who has communicated with mouse by the Daq card?

4. why, is it very difficult?

thank for your interest

andrikos
0 Kudos
Message 7 of 10
(4,807 Views)

Have a look at the Gen Dig Pulse Train-Continuous-Pause Trigger.vi example in the LabVIEW example finder.  You can use a pulse train as your clock, and with some proper timing you might be able to get the proper clock pull-down.  The other option is to create a digital waveform and create a custom waveform that includes the 100uS low time.  You can then use the other timed DIO line on your card to send it to the mouse. 

Chris_K

0 Kudos
Message 8 of 10
(4,755 Views)

Hi all

Am new to Labview. Am using LV8.2 evaluation version.

My current project is to communicate with PS2 mouse via USB signals or even with Parallel port. My application is to give a control from LV8.2 that the device gets powered/unpowered with the click of a button.

I don't have any DAQ. Is it possible to control the mouse(Power/unpower) via system USB or parallel port + LV8.2 ?

 

Earlier reply was much appreciated.

Thanks & Regards

Mathan

0 Kudos
Message 9 of 10
(4,577 Views)
duplicate post. Don't post the same question to multiple boards.
Message 10 of 10
(4,561 Views)