This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

communication with matlab instead of using Keil

our board controls a cnc machine that has ability to move in three axises. ın z axis it can drill pcb cards. and we have programs that are written in C language. And these C programs are loaded to keil. So for example when we write a command "circle" with its parameters(i.e centre and radius) the cnc machine draws a circle with the given centre and radius. Here we want to do this by using Matlab.So we want our running 8051 program to communicate with Matlab over an RS232 link.The data is the commands like circle,line,freemotion etc.. that is written on Matlab as a string.
I wrote a matlab code to transmit the data to the board like this:

s = serial('COM1')
fopen(s)
fprintf(s,'freemotion')
fclose(s)
delete(s)
clear s

By running this code we expect to run the cnc machine properly.
When only matlab program is running(Keil is inactive) we measured the data from serial port by using an oscilloscope,we saw that an information transmitted but we don't know if it is the real command or not.
But if we run the Keil we don't know if Matlab transmits the data or not.

Parents
  • I think you need to make sure you have set up your baud rate properly in matlab and in your keil program. You can use the set() function in matlab to set the baud rate as well as other parameters like parity, etc. The parameters you set up in matlab should match the ones you have setup in keil. The matlab script you provided does not do this.

Reply
  • I think you need to make sure you have set up your baud rate properly in matlab and in your keil program. You can use the set() function in matlab to set the baud rate as well as other parameters like parity, etc. The parameters you set up in matlab should match the ones you have setup in keil. The matlab script you provided does not do this.

Children