Proteus Error "ADC conversion clock period (4e-07) is less than min TAd=1.6us..."

Status
Not open for further replies.

armghan11

Member level 1
Joined
Oct 9, 2012
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,557
Proteus Error "ADC conversion clock period (4e-07) is less than min TAd=1.6us..."

Hey guys i am working on a load monitoring system that identify different loads... i am experimenting right now... i made a c code for ccs c compiler and when i run the simulation on proteus i got the error "ADC conversion clock period (4e-07) is less than min TAd=1.6us and is possible invalid for device clock frequency"... I attached the code and proteus simulation file also... Please help

Code:
#include <16F877a.H> 
#device adc=10 
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)

#include <lcd2.c>

int16 first_adcreading;

char look(int a)
{
switch(a)
{
case 0:
return '0';
case 1:
return '1';
case 2:
return '2';
case 3:
return '3';
case 4:
return '4';
case 5:
return '5';
case 6:
return '6';
case 7:
return '7';
case 8:
return '8';
case 9:
return '9';
default:
return '.';
}
}

void main()
{
setup_adc_ports(ALL_Analog); 
setup_adc(ADC_CLOCK_DIV_8); 
set_adc_channel(3);
delay_us(20);
first_adcreading= read_ADC();
first_adcreading = (first_adcreading * 4.89)/0.47;
unsigned int16 v,vp,ip,i;
Char *volt = "00.0";
Char *current = "0.00";
Char *current1= "0.00";
lcd_init(); 
do
{
set_adc_channel(2); 
delay_us(20);  
v = read_ADC();
set_adc_channel(3);
delay_us(20);
i= read_ADC();
i = (i*4.89)/0.47;
v = ((v*4.89)/20)*120;
if(v!=vp || i!=ip )
lcd_putc("\f");
vp = v;
ip = i;
volt[0] = look(v/10000);
volt[1] = look((v/1000)%10);
volt[3] = look((v/100)%10);
lcd_gotoxy(1,1);
printf(lcd_putc,"Voltage = %sV",volt);

if ( i  <= first_adcreading) {
current[0] = look(i/1000);
current[2] = look((i/100)%10);
current[3] = look((i/10)%10);
lcd_gotoxy(1,2);
printf(LCD_PUTC, "L1 = %sA",current);
        }
else
        {
int16 k;
k = i - first_adcreading;
current1[0] = look(k/1000);
current1[2] = look((k/100)%10);
current1[3] = look((k/10)%10);
lcd_gotoxy(1,2);
printf(LCD_PUTC,"L1=%s",current);
lcd_gotoxy(9,2);
printf(LCD_PUTC,"L2=%s",current1);
        }
Delay_ms(250);
} while(1);
}
 

Attachments

  • Load identification.rar
    59.8 KB · Views: 96

Re: Proteus Error "ADC conversion clock period (4e-07) is less than min TAd=1.6us..."

Please mention which MCU you are using. You TAD values must be above the minimum required TAD for A2D Conversion. I have to check the datasheet,so, mention your MCU.

I havent used CCS C Compiler but your ADCON1 setting might be wrong. Mention your Fosc.
 

Re: Proteus Error "ADC conversion clock period (4e-07) is less than min TAd=1.6us..."


I am using pic16f877a with 20Mhz.... when i change freq to 4mhz... the proteus simulation works fine without any error.... but i dont know the reason or logic
 

Re: Proteus Error "ADC conversion clock period (4e-07) is less than min TAd=1.6us..."

ADCON1 settings and hence TAD settings change with change in Fosc.

Fosc = 20 MHz
Tosc = 1/Fosc = 0.05us = 50ns

The A/D conversion requires a minimum 12 TAD per 10-bit
conversion.

For correct A/D conversions, the A/D conversion clock
(TAD) must be selected to ensure a minimum TAD time
of 1.6 μs.


TAD values

2 * Tosc = 0.1us
4 * Tosc = 0.2us
8 * Tosc = 0.4us
16 * Tosc = 0.8us
32 * Tosc = 1.6us
64 * Tosc = 3.2us

Min TAD is 1.6us, So you cannot use 2Tosc, 4Tosc, 8Tosc, 16Tosc, 32Tosc.

You have to use 64Tosc for 20 MHz

so, your TAD is 3.2us

For 64Tosc ADCS2:ADCS1:ADCS0 is 110

So, ADCON0 = 10xxx000

ADCON1 = 1100xxxx
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…