/*コンフィグを書きます。*/ #asm config PWRTE=ON,WDT=OFF,OSC=HS #endasm #include "pic_io.c" main() { char out; SetP_A(0x01);/*PortAはRA0を入力に*/ SetP_B(0x00);/*PortBは全て出力に*/ out=0; WrPortB(out);/*出力用の関数*/ while(1){ while((RdPortA()&0x01)==0x01);/*入力待ち*/ out=out+1; WrPortB(out); while((RdPortA()&0x01)==0x00); } }