欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 6528|回復: 1
收起左側

在proteus里運行報錯 'TMOD': can't initialize, bad type or class

[復制鏈接]
ID:796820 發表于 2020-7-3 21:39 | 顯示全部樓層 |閱讀模式
  1. #include "regx51.h"
  2. unsigned char a,b,c,d;
  3. unsigned char code disaplay []= {0x3f, 0x06, 0x5b, 0x4f, 0x66,0x6d, 0x7d, 0x07, 0x7f, 0x6f} ;
  4. long counter=0; //旋轉編碼 器的脈沖
  5. long position=0; //旋轉 編碼器的當前位置
  6. long degree=0;
  7. void main()
  8. TMOD=0x06;
  9. TH0=0xff;
  10. TL0=0xff;
  11. TH1= (65536-1000)/256;
  12. TL1= (65536-1000)%256;
  13. IE=0x0f;
  14. EA = 1; //開總中斷
  15. r=0;
  16. while(1)  //主程序循環顯示位置
  17. {
  18. a=degree%10;  //計算參數的個十百千位
  19. b= (degree/10)%10; .
  20. c= (degree/100)%10;
  21. d= (degree/1000)%10;
  22. p2_3=0;//顯示position值
  23. p0=diaplay[a];
  24. p2_3=1;
  25. p2_2=0;
  26. p0=diaplay[b];
  27. p2_ 2=1;
  28. p2_ 1=0;
  29. p0=diaplay[c];
  30. p2_1=1;
  31. p2_0=0;
  32. p0=diaplay[d];
  33. p2_0=1;
  34. }
  35. }
  36. void int0() interrupt 0   //A 相中斷
  37. if(p2_7)position++;         //判斷2_7 為高則正向,為低則反向
  38. else position;
  39. counte++ ;      //累計脈沖
  40. }
  41. void int1()
  42. interrupt 1   //Z相中斷
  43. {
  44. position=0;   //使位置參數置零
  45. void tl_ () interrupt 2    //定時0. ls刷新一次轉速和角
  46. //度參數
  47. THO= (65536-1000) /256;
  48. TL0= (65536-1000) %256;
  49. r=600*counter/ 300;   //假設編碼器每轉300個脈沖
  50. degree=1. 2*position; //把脈沖數轉換為 角度數
  51. if(! degree)  //角度為負時加360度轉為正
  52. degree+=360}
  53. void t0_ () interrupt 3  //計數器T0中斷顯示速度
  54. {
  55. unsigned char i
  56. i=100;
  57. a=r%10;
  58. b=(r/10)%10;
  59. c=(r/100)%10;
  60. d= (r/1000)%10;
  61. while(i)
  62. {
  63. p2_ 3=0;
  64. p0=diaplay[a];
  65. p2_ 3=1;
  66. p2_ 2=0;
  67. p0=diaplay[b];
  68. p2_ 2=1;
  69. p2_ 1=0;
  70. p0=diap1ay[c];
  71. p2_ 1=1;
  72. p2_ _0=0;
  73. p0=diaplay[d];
  74. p2_ 0=1;
  75. i-- ;
  76. }
  77. }
復制代碼

*** WARNING C318 IN LINE 1 OF ..\main.c: can't open file 'regx51.h'
*** ERROR C244 IN LINE 8 OF ..\main.c: 'TMOD': can't initialize, bad type or class
*** ERROR C132 IN LINE 8 OF ..\main.c: 'TMOD': not in formal parameter list
回復

使用道具 舉報

ID:452950 發表于 2020-7-3 22:47 | 顯示全部樓層
regx51.h可能沒有,改成
#include "reg51.h"應該就可以了
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表