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
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);
}