eanema
Member level 2
Hello All,
I am using the "USB Device - CDC - Basic Demo" from the new usb firmware package from microchip. I have modified the UserInit() function by adding:
TRISA=TRISA|0x0f;
ADCON0=0x01;
ADCON1=0x0b;
ADCON2=0x3e;
USB_DataCount = 0;
and the ProcessIO() function by replacing the unnecessary code with:
if(sw2 == 0) {
//start AD conversion
ADCON0 = ADCON0|0x02;
mLED_4_On();
}
if (ADCON0 & 0x02 == 0) {
ServiceAD();
mLED_4_Off();
}
This code will test a switch and then start the AD conversion and turn on led 4 when the switch is thrown.
it then tests to see if the conversion is finished, if it is it will turn off the light.
My problem is that i can't seem to get the conversion to finish. IE the light never turns off.
Any ideas what I am doing wrong would be very helpful
Thanks
I am using the "USB Device - CDC - Basic Demo" from the new usb firmware package from microchip. I have modified the UserInit() function by adding:
TRISA=TRISA|0x0f;
ADCON0=0x01;
ADCON1=0x0b;
ADCON2=0x3e;
USB_DataCount = 0;
and the ProcessIO() function by replacing the unnecessary code with:
if(sw2 == 0) {
//start AD conversion
ADCON0 = ADCON0|0x02;
mLED_4_On();
}
if (ADCON0 & 0x02 == 0) {
ServiceAD();
mLED_4_Off();
}
This code will test a switch and then start the AD conversion and turn on led 4 when the switch is thrown.
it then tests to see if the conversion is finished, if it is it will turn off the light.
My problem is that i can't seem to get the conversion to finish. IE the light never turns off.
Any ideas what I am doing wrong would be very helpful
Thanks