#include <reg52.h>
unsigned char data[8]_at_0x30;
data[8] = {0x22, 0x89, 0x18, 0x33, 0xF6, 0x52, 0x92, 0x05};
unsigned char max, min;
unsigned int sum;
unsigned char avg;
void main() {
int i;
char max = data[0];
char min = data[0];
int sum = 0;
for (i = 0; i < 8; i++) {
if (data[ i] > max) {
max = data[ i];
}
if (data[ i] < min) {
min = data[ i];
}
sum += data[ i];[ i]
}
avg = sum / 8;
*((unsigned char *)0x40) = max;
*((unsigned char *)0x41) = min;
*((unsigned char *)0x42) = avg;
while (1){
};
}
main.c(21): error C141: syntax error near 'data'
main.c(24): error C141: syntax error near 'data'
Target not created.
Build Time Elapsed: 00:00:01
哪里错了啊
|