Continue to Site

# Writing USB Joystick for PIC18F using MikroC

Status
Not open for further replies.

#### ahmedragia21

##### Member
Nigel Goodwin
Can you show me a pseudo code please, I'm so confused

#### ahmedragia21

##### Member
Code:
void select_channel(int channel)
{
if ( channel == 1 )
{
}
else if (channel == 8)
{
}
else
{
}

}

ADCON2.B7 = 1; //results right justified

}

select_channel(1)
Delay_ms(5);
select_channel(8)
Delay_ms(5);

select_channel(9)
Delay_ms(5);
usb[2] = (char)ADC_read_implementation();

#### Nigel Goodwin

##### Super Moderator
That's the right sort of thing - but as I've as I've said, the delay required is dependent on the source impedance.

I'd be inclinded to start high (100mS?), and make sure that the controls don't affect each other - then reduce the delay until they start affecting each other, then increase it again.

#### ahmedragia21

##### Member
Nigel Goodwin
Nothing changed with adding 100mS even 500mS, still One Input affects other channels, I'm so upset and don't know a solution

#### ahmedragia21

##### Member
Very strange problem, I disabled all ADC things, and I still use the POT and I still get values on the USB device Joystick, any idea about that problem ?

Status
Not open for further replies.

Replies
1
Views
772
Replies
12
Views
1K
Replies
15
Views
3K
Replies
11
Views
1K
Replies
5
Views
2K