Anda di halaman 1dari 1

#include <33FJ16GS504.

h> #FUSES #FUSES #FUSES #FUSES #FUSES #FUSES #FUSES #FUSES #FUSES NOWDT NOPUT NOPROTECT FRC_PLL NOOSCIO ICSP1 CKSFSM NOJTAG PR //No Watch Dog Timer //No Power Up Timer //Code not protected from reading //Internal Fast RC Oscillator //OSC2 is clock output //ICD uses PGC1/PGD1 pins

#device adc=10 #use delay(clock=7370000) void main() { int16 value; SETUP_WDT(WDT_OFF); setup_oscillator(OSC_INTERNAL); setup_high_speed_adc( ADC_CLOCK_DIV_1 ); setup_high_speed_adc_pair(0,INDIVIDUAL_SOFTWARE_TRIGGER); while(TRUE) { delay_ms( 1 ); read_high_speed_adc(0,ADC_START_AND_READ,&value); if (value > 512) output_high(PIN_B3); else output_low(PIN_B3); } }

Anda mungkin juga menyukai