Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***********************************
- // AD変換用ソースファイル
- // ad_get.c
- // Ver.1.00
- // 2014/10/17
- //***********************************
- #include <stdio.h>
- #include <sys/io.h>
- #include "kbhit_func.h"
- #include "ad.h"
- #define CHANNEL 8
- int main(void)
- {
- int ch,z;
- char c = '0';
- iopl(3); // IOポートへのアクセスを許可(root権限必要)
- KB_init(); // kbhit()の初期化
- printf("[q] : quit\n");
- printf("any key : start\n");
- getchar();
- while(c != 'q'){
- if(kbhit())
- c=linux_getch();
- for(ch=0;ch<CHANNEL;ch++){
- z=ad(ch);
- printf("%6.3lf[V] ", (double)(z-2048)/2048.*10.);
- }
- printf("\n");
- }
- KB_close(); // kbhit()のクローズ
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement