필터 지우기
필터 지우기

digital to analog conversion

조회 수: 13 (최근 30일)
Danilo NASCIMENTO
Danilo NASCIMENTO 2013년 10월 25일
댓글: Walter Roberson 2013년 10월 26일
I performed a serial communication between dsPIC33F and Simulink. When I send a constant value through serial connection to microcontroller and takes it back to Simulink, the signal comes like a train of pulses with amplitude equals to the value of the one I chose to send. I was thinking of a workaround to put a Digital to Analog converter before I send the value to serial. But I did not find any block in Simulink library that can perform this, only Analog - Digital conversion, that, I guess, will not work. I'm sending the output of signal that I received from serial connection. If anyone has a workaround for me I would appreciate.

채택된 답변

Walter Roberson
Walter Roberson 2013년 10월 25일
Analog signals cannot be sent to serial ports.
Serial ports do not send constant values: the protocol is an asynch protocol with a "start bit" and a "stop bit" (one of which breaks the other portions of the protocol), and between 7 and 10 data bits (up to 12 data bits in some variations.)
  댓글 수: 4
Danilo NASCIMENTO
Danilo NASCIMENTO 2013년 10월 26일
So the PWM signal will be sent to AN0, for example, but how do I send this to Simulink Model? Wouldn't it be through serial connection?
Walter Roberson
Walter Roberson 2013년 10월 26일
편집: Walter Roberson 2013년 10월 26일
Are you asking how to return back to Simulink a simulation of you having sent the signal to AN0 ? If so then that is not something I have ever looked at.
I could imagine doing it through serial transmission, by mapping the state at a fixed time step (my "unit" above) to a bit, and transmitting groups of 8 bits, with a serial receive block converting the bits into some form appropriate for the model.
Is the idea to have Simulink plot the pulse-train? If so then that can be done by having the serial receive block pass through a logical demux block (that might be implemented as an arithmetic block or two), and then on to a scope. All done in software with digital signals. You cannot transmit an analog signal directly back into Simulink over a serial port.
Another approach would be to connect the 33f AN0 to an A/D receive block on the Simulink side (i.e., have A/D hardware there), and then connect the A/D receive block to a scope.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by