Dan84 Posted June 5, 2018 Posted June 5, 2018 Hi, i'm trying to setup the A/D Converter following this example http://hades.mech.northwestern.edu/index.php/PIC32MX:_Analog_Inputs I've read and understood almost everything about it, except this: ADC_SAMPLE_TIME_15, where the number is a related to the TAD. The code is using the internal oscillator (8MHz, i think) so why there is this "fifteen TAD" ? In pic32mx datasheet there is a 17-1 Equation related this guy, an ADCS value and the peripheral clock. I don't think i'm using PBCLK (FRC is set) and i don't know ADCS that is necessary for obtain TAD, so i'm stuck. How can i continue ? Thanks
Dan84 Posted June 7, 2018 Author Posted June 7, 2018 After various rereading actually i've understood this: TAD is the period time respectively of FRCCLK or PBCLK. In case of FRC (8MHz), its TAD is 125ns. Instead if it is PBCLK and it is clocked at 80MHz, TAD is 12,5ns The minimun conversion time is 83,33 ns and 12 TAD are needed for a complete conversion, so in FRC case this time is 1500ns and in PBCLK case only 150ns. Both times are greater than 83,33 so why i should need to set AD1CON3.SAMS (various values from 1 to 31) and AD1CON3.ADCS (from 1 to 512) and slow down everything ? What did i miss ? Thanks Thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.