Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. //***********************************
  2. // AD変換用ソースファイル
  3. // ad_get.c
  4. // Ver.1.00
  5. // 2014/10/17
  6. //***********************************
  7.  
  8. #include <stdio.h>
  9. #include <sys/io.h>
  10. #include "kbhit_func.h"
  11. #include "ad.h"
  12.  
  13. #define CHANNEL 8
  14.  
  15. int main(void)
  16. {
  17. int ch,z;
  18. char c = '0';
  19.  
  20. iopl(3); // IOポートへのアクセスを許可(root権限必要)
  21. KB_init(); // kbhit()の初期化
  22. printf("[q] : quit\n");
  23. printf("any key : start\n");
  24. getchar();
  25.  
  26. while(c != 'q'){
  27. if(kbhit())
  28. c=linux_getch();
  29. for(ch=0;ch<CHANNEL;ch++){
  30. z=ad(ch);
  31. printf("%6.3lf[V] ", (double)(z-2048)/2048.*10.);
  32. }
  33. printf("\n");
  34. }
  35.  
  36. KB_close(); // kbhit()のクローズ
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement