Folks,
Here is what I am trying to do. I am going to have a PS/2 Mouse input its movement bytes into a 877A. Then have the 877A output a signal to a 12-bit DAC (MCP4922). Before I get into the my question Im going to explain the PS/2 mouse and 877A interaction. (FYI... I am using EPE magazines John Becker PS/2 host code)
When a ps/2 mouse is sending movements to a host (a 877A pic in my case) it sends 3 8-bit bytes. The first byte contains information about the button states (pressed or unpressed), the sign of the X and Y movement and X & Y overflow flags. Bytes 2 carries the movement bits for the X-direction and Byte 3 for Y-Direction. So Bytes 2 & 3 represent the mouse movement with 8-bits. (example: move up one = 00000001, move down one = 11111111
So my problem is mouse movements are represented by 8-bits while the DAC inputs are represeted by 12-bits... The equation for the DAC is:
where G is Gain which = 1 or 2 and it is up to the user which one to use.
So here are the voltages that I want, the fastest mouse movement up or right will need to generate 1.6v the fastest movement down or left 0.0v and when the mouse is idle 0.8v.
I began to write a program, using assembly, that would translate 8bits to 12bits by using a scaler to so but it seems like a hard way to do this...
I hate making things harder then they are. If this post wasn't clear ask me for further explaination and I will, Thank you.
Here is what I am trying to do. I am going to have a PS/2 Mouse input its movement bytes into a 877A. Then have the 877A output a signal to a 12-bit DAC (MCP4922). Before I get into the my question Im going to explain the PS/2 mouse and 877A interaction. (FYI... I am using EPE magazines John Becker PS/2 host code)
When a ps/2 mouse is sending movements to a host (a 877A pic in my case) it sends 3 8-bit bytes. The first byte contains information about the button states (pressed or unpressed), the sign of the X and Y movement and X & Y overflow flags. Bytes 2 carries the movement bits for the X-direction and Byte 3 for Y-Direction. So Bytes 2 & 3 represent the mouse movement with 8-bits. (example: move up one = 00000001, move down one = 11111111
So my problem is mouse movements are represented by 8-bits while the DAC inputs are represeted by 12-bits... The equation for the DAC is:
Vout=Vref*G*D/4096
where G is Gain which = 1 or 2 and it is up to the user which one to use.
So here are the voltages that I want, the fastest mouse movement up or right will need to generate 1.6v the fastest movement down or left 0.0v and when the mouse is idle 0.8v.
I began to write a program, using assembly, that would translate 8bits to 12bits by using a scaler to so but it seems like a hard way to do this...
- I figure this must be a common problem with alot of other projects and I am hoping there is an easier way to deal with it.
- Could anyone help me? Any ideas?
I hate making things harder then they are. If this post wasn't clear ask me for further explaination and I will, Thank you.
Last edited: