while(1) {
if(can1.read(msg)) {
/*********data.read(in1)**************************************************/
a = msg.data[0]<<8;
b = msg.data[1];
c = a + b;
/*********data.read(in2)**************************************************/
d = msg.data[2]<<8;
e = msg.data[3];
f = d + e;
/*********data.read(in3)**************************************************/
g = msg.data[4]<<8;
h = msg.data[5];
i = g + h;
/*********data.read(in4)**************************************************/
j = msg.data[6]<<8;
k = msg.data[7];
l = j + k;
/**********write file*****************************************************/
fp = fopen("/local/CAN_multiread.csv", "a");
if (fp!=NULL){
fprintf( fp, "%f,%f,%f,%f\n", (float)c*3.3/0xFFFF,(float)f*3.3/0xFFFF,(float)i*3.3/0xFFFF,(float)l*3.3/0xFFFF);
fclose( fp );
}
}
}
}