|
|
|
USB mouse connections 18F
|
|
Date: 2006/07/19 09:18
|
By: Chib
|
Status: Visitor
|
|
|
|
|
|
|
Hello everybody!!
I just want to know were I must plug the axis X and Y of the mouse to my PIC in the example of microchip for a PIC 18F series.
thanks a lot !
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/19 09:44
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
If your talking about the mouse in a circle example, you do not need to connect a mouse to the PIC. The pic simulates a mouse (moving in a circle) for you and transmits the appropiate data back to the pc.
Mat
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/19 10:02
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
Yes I am talkin about that !
Hum okay so how can i changed the code to use really that ?
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/19 10:05
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
What are you trying to do, convert a PS2 mouse into a usb one?
Mat
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/19 10:09
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
Not exactly, i am trying to make a joystick with to axis and one button fot USB
i wanted to made that with the example of the mouse, because the axis X and Y are on the same working
have you some advices ?
(i think I must do an CAN fot that what are you thinking about ?)
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/19 10:17
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
You may want to have a look at this thread
Hope that helps,
Mat
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/20 06:24
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
Yes I know this thread I have already posted something but nobody is answering me ....
Do you know where I could find a convertor A/D 8bit software for my PIC please ?
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/20 13:09
|
By: dariog
|
Status: User
|
|
|
Karma: 6  
|
|
| Posts: 107 |   | |
|
Hi, you don't need any software, if you're working in C (as i suppose).
Just include #include <adc.h>
at the beginning, then
OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_0_TAD, ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, ADC_4ANA & 0xf /*patch di g.dar*/);
(4 ana input, RA0-RA3)
and then
SetChanADC(ADC_CH0); Delay_uS(5); ConvertADC(); while(BusyADC()); ClrWdt(); YVel=ReadADC();
in YVel you get the converted value from Channel 0 (usually RA0)
Then , you just have to exapnd on this )
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/20 13:42
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
Hello,
Thanks a lot ! that's very helpful !!
yes I am working in C I have just only 2 analog input so I suppose I must put : ADC_2ANA & 0xf
If I plug the analog input in RA0 and RA1 (because RA2 and 3 are the Vref + and - on my PIC) to have my two values converted should I put :
SetChanADC(ADC_CH0); Delay_uS(5); ConvertADC(); while(BusyADC()); ClrWdt(); YVel=ReadADC();
SetChanADC(ADC_CH1); Delay_uS(5); ConvertADC(); while(BusyADC()); ClrWdt(); XVel=ReadADC();
my values will be YVel and XVel ?
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/20 13:44
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
I missed something ...
Your code is for 8 or 10 bits ?
|
|
|
|
|
|
Re:USB mouse connections 18F
|
|
Date: 2006/07/24 12:07
|
By: chib
|
Status: Visitor
|
|
|
|
|
|
|
|
hello , how do you build Delay_uS(5); ? (5 ms ?) because the compilator don't find this function.
|
|
|
|