Correct SampleTime for PacketOutput to Virtual COM-Port

I'm using a packet output block in a rtwt simulink model to send data via an usb-to-uart interface to my target hardware. The detail I'm a bit confused about is which is the correct sample time. After experimenting a bit with packet input I figured out to use sendrate/packetsize in order to receive my data correctly (more precisely to detect the startflag). On the other hand all inputs of my packet output block are set with most recent data at all time so it could send them out all at once. I want to send 54 bytes 50 times per second Which is the correct sampletime for my packet output block and why: sendrate or sendrate/packetsize?
Thank you all in advance

 채택된 답변

Jan Houska
Jan Houska 2013년 1월 14일

1 개 추천

If you want to send out 54 bytes 50 times per seconds, then it is best to send one packet consisting of those 54 bytes with a sample rate of 0.02. This way, there's minimum load on the CPU and as much work as possible is offloaded to the serial port hardware.
Also, please ensure that your serial port baud rate is sufficiently high. To be able to send 27000 (54*10*50) bits of data per second, your baud rate should be at least 38400, but even higher would be better.

댓글 수: 1

S
S 2013년 1월 20일
Thanks a lot for your answer, its working perfectly now. Maybe the expression "...and interact with the I/O hardware" in the docs was a bit too confusing here.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기

질문:

S
S
2013년 1월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by