Page 160 - C Programming
P. 160
ตัวอย่างที่12-1 โปรแกรมแสดงค่าการกดสวิตซ์ sw0 ถึง sw4
#include<stdio.h>
main()
{ char chk_sw;
clrscr();
printf(“*******************\n”);
printf("Program Check Switch\n");
printf(“*******************\n”);
do{ chk_sw=inport(0x379);
gotoxy(1,4); printf("Data inport[0x379] = %.3d \n",chk_sw);
}while(!kbhit());
getch();
}