7 Şubat 2021 Pazar

ADC pwm gibi kullanma ccs compiler

 ADC pwm gibi kullanma ccs compiler

#include <16F883.h>

#device adc=8

#FUSES NOWDT

#FUSES INTRC_IO

#FUSES NOPUT

#FUSES NOMCLR

#FUSES NOPROTECT

#FUSES NOCPD

#FUSES NOBROWNOUT

#FUSES IESO

#FUSES FCMEN

#FUSES NOLVP

#FUSES NODEBUG

#FUSES NOWRT

#FUSES BORV40

#use delay(int=8000000)

void main()

{

   setup_adc_ports(sAN0|VSS_VDD);

   setup_adc(ADC_CLOCK_DIV_2);

   int8 tOFF, tON;

   while(1){

      set_adc_channel(0);

      tOFF = read_adc();

      tON = 255 - tOFF;

      delay_us(tOFF);     

      output_low(PIN_C0);

      delay_us(tON);

      output_high(PIN_C0);

      }

}



Hiç yorum yok:

Yorum Gönder

Her yorum bilgidir. Araştırmaya devam...