Jump to content


Photo

ADC at USB HID Custm

ADC pic18f4550 USB HID

  • Please log in to reply
1 reply to this topic

#1 omran

omran

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 13 December 2014 - 06:22 AM

Hi
I am using USB HID Custm from mla
there is one ADC at AN0...I added another one to AN1 I did the needed modification like I put  ADCON1bits.PCFG = 0b1101;
instead of  ADCON1bits.PCFG = 0b1110;
and  TRISAbits.TRISA1 = PIN_INPUT;
and add  a variable case ADC_CHANNEL_1=1; to use it in this way

uint16_t ADC_Read10bit(ADC_CHANNEL channel)
{
    uint16_t result;
    switch(channel)
    {
        case ADC_CHANNEL_0:
            break;
             case ADC_CHANNEL_1:
            break;
        default:
            return 0xFFFF;
    }
    ADCON0bits.CHS = channel;
    ADCON0bits.GO = 1;              // Start AD conversion
    while(ADCON0bits.NOT_DONE);     // Wait for conversion
    result = ADRESH;
    result <<=8;
    result |= ADRESL;
    return result;
}
and did modification in C# then I see that progress bar in the windows form get the value of ADC but actually now both AN0 and AN1 didnt receive the real value ...the number is just between 0 and2
what should I do

 


  • 0

#2 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 13 December 2014 - 12:01 PM

Hi omran,

 

I haven't used the framework in a really long time so I'm not sure on the answer to your question. Please try posting your question on the official Microchip forum, where you should be able to get an answer: http://www.microchip.com/forums/

 

Sorry I can't be of more help!


  • 1




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users