โปรแกรมการทำงาน
//////////////////// โปรแกรมการทำงาน //////////////////////////
/**/#include <16F877A.h>
/**/#FUSES NOWDT,HS,NOPROTECT,NODEBUG,NOLVP,NOWRT
/**/#use delay(clock=20000000)
/**/#use fast_io(B)
/**/#use fast_io(D)
/**/#define INPUT_B0 PIN_B0
/**/#define LED PIN_D0
/**/void main()
/**/{
/**/ set_tris_B(0b11111111);
/**/ set_tris_D(0b00000000);
/**/ setup_comparator(NC_NC_NC_NC);
/**/ SETUP_ADC_PORTS(NO_ANALOGS);
/**/ output_d(0b00000000);
/**/ while(true)
/**/ {
/**/ if(input(INPUT_B0)==0)
/**/ {
/**/ output_high(LED);
/**/ }
/**/ else
/**/ {
/**/ output_low(LED);
/**/ }
/**/ }
/**/}
////////////////////// END ///////////////////////////////////
ที่
มา : อ. กิตติศักดิ์ แสนประสิทธิ์ ไมโครคอนโทรลเลอร์ เบอร์ PIC18F4550
ฟังก์ชันยูเอสบีการประยุกต์ใช้งาน
สาขาเทคโนโลยีอิเล็กทรอนิกส์และคอมพิวเตอร์ คณะเทคโนโลยีอุดสาหกรรม 2555
แสดงความคิดเห็น
Click to see the code!
To insert emoticon you must added at least one space before the code.