Other Parts Discussed in Thread: MOTORWARE
I am facing some issues while plotting variables on the graph. I am using Lab11 of motorware where I have added my code to read ADC values from sin-cos encoder. The oscilloscope shows a perfect sine wave whereas the graph shows some distortion (attached image). I think it has something to do with the buffer size and acquisition rate. I am not sure though.
This is the code:
void Graph(_iq data0, _iq data1, _iq data2, _iq data3)
{
if(Buffer_Counter>=Buffer_Size)
{
Buffer_Counter = 0;
}
Buffer0[Buffer_Counter] = data0;
Buffer1[Buffer_Counter] = data1;
Buffer2[Buffer_Counter] = data2;
Buffer3[Buffer_Counter] = data3;
Buffer_Counter++;
return;
}
I have define buffer size as:
#define Buffer_Size 1000
Please let me know what is the issue.