fork download
  1. #include <stdio.h>
  2.  
  3.  
  4.  
  5. #define u8 unsigned char
  6. u8 PFC_value[2];
  7.  
  8. typedef union {
  9. //volatile union {
  10. struct
  11. {
  12. unsigned char HC1;
  13. unsigned char HC2;
  14. unsigned char CPR;
  15. unsigned char DCR;
  16. unsigned char ECH;
  17. unsigned char ECL;
  18. unsigned char EPR;
  19. unsigned char CYH;
  20. unsigned char CYL;
  21. unsigned char EBS;
  22. unsigned :16;
  23. unsigned :8;
  24. unsigned char DTI[3];
  25. unsigned char DT2[3];
  26. unsigned char PH2[3];
  27. unsigned char DR2;
  28. unsigned char DT3[3];
  29. unsigned char PH3[3];
  30. unsigned char DR3;
  31. unsigned :16; //char notused2[2];
  32. unsigned char ERC[160];
  33. unsigned char Zero12VB[2];
  34. unsigned char Zero12Is[2];
  35. unsigned char Zero12Vs[2];
  36. unsigned char Zero12VauxIs[2];
  37. float Gain12VB;
  38. float Gain12IS;
  39. float Gain12Vs;
  40. float Gain12VuaxIs;
  41. unsigned char notuse[8];
  42. unsigned char MFU[31];
  43. unsigned char VER;
  44.  
  45. };
  46. struct
  47. {
  48. unsigned char HC1;
  49. unsigned char HC2;
  50. unsigned char CPR;
  51. unsigned char DCR;
  52. unsigned char ECH;
  53. unsigned char ECL;
  54. unsigned char EPR;
  55. unsigned char CYH;
  56. unsigned char CYL;
  57. unsigned char EBS;
  58. unsigned :16;
  59. unsigned :8;
  60. unsigned char DTI[3];
  61. unsigned char DT2[3];
  62. unsigned char PH2[3];
  63. unsigned char DR2;
  64. unsigned char DT3[3];
  65. unsigned char PH3[3];
  66. unsigned char DR3;
  67. unsigned :16; //char notused2[2];
  68. unsigned char ERC[160];
  69. u16 Zero12VB;
  70. u16 Zero12Is;
  71. u16 Zero12Vs;
  72. u16 Zero12VauxIs;
  73. float Gain12VB;
  74. float Gain12IS;
  75. float Gain12Vs;
  76. float Gain12VuaxIs;
  77. unsigned char notuse[8];
  78. unsigned char MFU[31];
  79. unsigned char VER;
  80.  
  81. }calibration;
  82. struct
  83. {
  84. unsigned char EEPROM[256];
  85. }ROM;
  86. }EEPROM;
  87. EEPROM Black_BOX;
  88.  
  89.  
  90. void EEPageWriteI2C(unsigned int ControlByte, unsigned char *data,unsigned char Length)
  91. {
  92. int loop;
  93. IdleI2C(); //Ensure Module is Idle
  94. StartI2C(); //Generate Start COndition
  95. WriteI2C(ControlByte); //Write Control byte
  96. IdleI2C();
  97. tempadd1= &data;
  98. tempadd2= *data;
  99.  
  100. for(loop=0;loop<Length;loop++)
  101. {
  102. WriteI2C(&data); //Write Data
  103. IdleI2C();
  104. data++;
  105. }
  106. StopI2C(); //Initiate Stop Condition
  107. Delay_mS(5);
  108. }
  109. //=================================================================================================
  110. // Funciton : void LDByteWriteI2C(unsigned int ControlByte, unsigned int LowAdd, unsigned int data)
  111. //
  112. // input parameter:Control Byte, 8 - bit address, data.
  113. //
  114. // output parameter:NONE
  115. //
  116. // Description :Write a byte to low density device at address LowAdd
  117. //=================================================================================================
  118. void LDByteWriteI2C(unsigned int ControlByte, unsigned int LowAdd, unsigned int data)
  119. {
  120. IdleI2C(); //Ensure Module is Idle
  121. StartI2C(); //Generate Start COndition
  122. WriteI2C(ControlByte); //Write Control byte
  123. IdleI2C();
  124.  
  125.  
  126. WriteI2C(LowAdd); //Write Low Address
  127. IdleI2C();
  128.  
  129.  
  130. WriteI2C(data); //Write Data
  131. IdleI2C();
  132. StopI2C(); //Initiate Stop Condition
  133. Delay_mS(5);
  134. }
  135.  
  136.  
  137. void main(void)
  138. {
  139. LDByteReadI2C(EE_ADDR,0x0001,&PFC_value,2);
  140. EEPageWriteI2C(EE_ADDR, &Black_BOX.ROM.EEPROM, 3);
  141. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:69:3: error: unknown type name ‘u16’
   u16 Zero12VB;
   ^
prog.c:70:3: error: unknown type name ‘u16’
   u16 Zero12Is;
   ^
prog.c:71:3: error: unknown type name ‘u16’
   u16 Zero12Vs;
   ^
prog.c:72:3: error: unknown type name ‘u16’
   u16 Zero12VauxIs;
   ^
prog.c: In function ‘EEPageWriteI2C’:
prog.c:93:2: warning: implicit declaration of function ‘IdleI2C’ [-Wimplicit-function-declaration]
  IdleI2C();      //Ensure Module is Idle
  ^
prog.c:94:2: warning: implicit declaration of function ‘StartI2C’ [-Wimplicit-function-declaration]
  StartI2C();      //Generate Start COndition
  ^
prog.c:95:2: warning: implicit declaration of function ‘WriteI2C’ [-Wimplicit-function-declaration]
  WriteI2C(ControlByte);   //Write Control byte
  ^
prog.c:97:3: error: ‘tempadd1’ undeclared (first use in this function)
   tempadd1= &data;
   ^
prog.c:97:3: note: each undeclared identifier is reported only once for each function it appears in
prog.c:98:2: error: ‘tempadd2’ undeclared (first use in this function)
  tempadd2= *data;
  ^
prog.c:106:2: warning: implicit declaration of function ‘StopI2C’ [-Wimplicit-function-declaration]
  StopI2C();      //Initiate Stop Condition
  ^
prog.c:107:2: warning: implicit declaration of function ‘Delay_mS’ [-Wimplicit-function-declaration]
  Delay_mS(5);  
  ^
prog.c: At top level:
prog.c:137:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main(void) 
      ^
prog.c: In function ‘main’:
prog.c:139:5: warning: implicit declaration of function ‘LDByteReadI2C’ [-Wimplicit-function-declaration]
     LDByteReadI2C(EE_ADDR,0x0001,&PFC_value,2);
     ^
prog.c:139:19: error: ‘EE_ADDR’ undeclared (first use in this function)
     LDByteReadI2C(EE_ADDR,0x0001,&PFC_value,2);
                   ^
prog.c:140:2: warning: passing argument 2 of ‘EEPageWriteI2C’ from incompatible pointer type [enabled by default]
  EEPageWriteI2C(EE_ADDR, &Black_BOX.ROM.EEPROM, 3);
  ^
prog.c:90:6: note: expected ‘unsigned char *’ but argument is of type ‘unsigned char (*)[256]’
 void EEPageWriteI2C(unsigned int ControlByte,  unsigned char *data,unsigned char Length)
      ^
stdout
Standard output is empty