วงจรที่ใช้ในการทดลอง
/*2*/ #device adc=16
/*3*/ #FUSES NOWDT,WDT128,CPUDIV4,XT,NOBROWNOUT, NOLVP ,NOXINST
/*4*/ #use delay(crystal=20000000, clock=5000000)
/*5*/ #define LED1 PIN_B0
/*6*/ #define LED2 PIN_B1
/*7*/ #use fast_io(B)
/*8*/ void main()
/*9*/ {
/*10*/ set_tris_b(0x00);
/*11*/
/*12*/ while(TRUE)
/*13*/ {
/*14*/ output_high(LED1);
/*15*/ output_low(LED2);
/*16*/ delay_ms(500);
/*17*/ output_low(LED1);
/*18*/ output_high(LED2);
/*19*/ delay_ms(500);
/*20*/ }
/*21*/ }
ที่มา : อ. กิตติศักดิ์ แสนประสิทธิ์ ไมโครคอนโทรลเลอร์ เบอร์ PIC18F4550 ฟังก์ชันยูเอสบีการประยุกต์ใช้งาน สาขาเทคโนโลยีอิเล็กทรอนิกส์และคอมพิวเตอร์ คณะเทคโนโลยีอุดสาหกรรม 2555
แสดงความคิดเห็น
Click to see the code!
To insert emoticon you must added at least one space before the code.