Taking data received from serial port as single element
이전 댓글 표시
Hi all,
i am receiving the ASCII values of some data say (*12) through serial port, then after that i am eliminating first character i.e(*)Then i am converting this ASCII values to Decimal values using 'char'. Later i need to process remaining data '12' as single element for giving it as an input to some other function. But problem is my function is taking '1' and '2' as separate values instead of one single value '12'. please give some suggestions in a way such that i should give '12' as input to my function.
Sample Code
ser1 = serial('COM27', 'BaudRate', 9600,'Terminator','*');
fopen(ser1);
while(1)
input3=fread(ser1);
input1=input3(2:end)
input2=char(input1)
input3=input2
output=input3+1;
end
If input is *12 expected output is 13. But i am getting output as 2(1+1),3(2+1)
Thanks in advance
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!