Proteus Model:
Youtube link of the lecture:
Source file:
#include
#device ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=40000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include “lcd.c”
void main (void)
{
long m_Adc_Value=0;
long int value;
float m_Voltages=0.0;
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);
setup_adc(ADC_CLOCK_INTERNAL );
lcd_init();
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_4, 249, 1); //
while(1)//
{
value=read_adc();
set_pwm1_duty((int16)value);
printf(lcd_putc,”\fduty cycle= %Ld “,value);
delay_ms(200);
}
}
thank you guys: