Info

This question is closed. Reopen it to edit or answer.

Getting data from 4 channels ADC and from socket

1 view (last 30 days)
Ahmed Tolba
Ahmed Tolba on 23 May 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
I have ADC data from socket, 4 channels. I would like to read the data from the sockets based on whichSignal variable.
What I read is the header which is 1 byte, then I need to read whichSignal variable. But currently, I just get the header correct and the debug break point is triggered, but it never goes into whichSignal == 0, however the followed header byte is 0.
The head that's sent from the microcontroller is 0x35
here is a snippet
function localReadAndPlot(ropaRadarReceive,~,figureHandle,bytesToRead)
header = fread(ropaRadarReceive,1);
header = uint8(header);
dataI1=[];
r = getGlobalx;
fileData = fread(ropaRadarReceive,bytesToRead);
fprintf(r,' %d \r\n',fileData);
if ( isequal(header(1), 53) )
whichSignal = fread(ropaRadarReceive,1);
if(isequal(whichSignal(1),0))
dataI1= fread(ropaRadarReceive, bytesToRead);
disp(dataI1);
elseif(isequal(whichSignal(1), 1))
elseif(isequal(whichSignal(1), 2))
elseif(isequal(whichSignal(1), 3))
end
end

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!