matlab serial communication example
m-file
mdl-file
Make sure that you set Terminator and Baudrate correctly !!
for example (sender program) :
void UARTPrint()
{
char telegramm[20] = " ";
char buffer[3] = " ";
strcat(telegramm,"\n"); // place terminator here
itoa(SensorStruct.id,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val1,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val2,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val3,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
sendUART(telegramm,20);
}
mdl-file
Make sure that you set Terminator and Baudrate correctly !!
for example (sender program) :
void UARTPrint()
{
char telegramm[20] = " ";
char buffer[3] = " ";
strcat(telegramm,"\n"); // place terminator here
itoa(SensorStruct.id,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val1,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val2,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
itoa(SensorStruct.val3,buffer,10);
strcat(telegramm,buffer);
strcat(telegramm,"\t");
sendUART(telegramm,20);
}