How can I send data to a different serial port when a callback event occurs on another serial port?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to send data via USB serial port when an event occurs on another serial port.
I am getting the following warning:
Warning: The BytesAvailableFcn is being disabled. To enable the callback property either connect to the hardware with FOPEN or set the BytesAvailableFcn property.
댓글 수: 0
답변 (1개)
Walter Roberson
2014년 3월 24일
s1 = serial('COM1', .....);
s2 = serial('COM7', .....);
set(s1, 'BytesAvailableFcn', @(src, evt) fwrite(s2, fread(s1, s1.BytesAvailable)) );
fopen(s2);
fopen(s1);
댓글 수: 2
Kevin Hajek
2015년 9월 2일
I'm seeing the same error message, but I am trying to use the serial object in the callback. If you happened to find a solution, please share it here. I'll keep looking around.
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!