fork download
  1. // 函數原型態
  2. bit Sensor_read(unsigned char read[5]);
  3.  
  4. // int to Hex
  5. void Data_TX(unsigned int Y) // 使用int,程式初始化後讀不到數據,改unsigned char,讀取到數字 '0'。
  6. {
  7. unsigned int Buff_Y[3];
  8.  
  9. Buff_Y[2] = (Y / 100) + 0x30;
  10. Buff_Y[1] = (Y / 10) % 10+0x30;
  11. Buff_Y[0] = (Y % 10) + 0x30;
  12.  
  13. SBUF = *Buff_Y;
  14. while (TI == 0);
  15. TI = 0;
  16. }
  17.  
  18. // 副程式讀值
  19. Data_TX(read[2]);
  20. Data_TX((int)read[2]);
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: unknown type name 'bit'
bit Sensor_read(unsigned char read[5]);
^
prog.cpp:13:5: error: use of undeclared identifier 'SBUF'
    SBUF = *Buff_Y;
    ^
prog.cpp:14:12: error: use of undeclared identifier 'TI'
    while (TI == 0);
           ^
prog.cpp:15:5: error: use of undeclared identifier 'TI'
    TI = 0;
    ^
prog.cpp:19:1: error: unknown type name 'Data_TX'
Data_TX(read[2]);
^
prog.cpp:20:1: error: C++ requires a type specifier for all declarations
Data_TX((int)read[2]); 
^
6 errors generated.
stdout
Standard output is empty