Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Simulink, RTWEC and a Microcontroller

Subject: Simulink, RTWEC and a Microcontroller

From: ranjit

Date: 11 Dec, 2012 16:45:08

Message: 1 of 2

Hello Everyone!

So I wanted to know if this is possible and if yes, how it could be done.

I have been working on microcontrollers (AtMega8/16) for hobby purposes. I have been writing C codes for simple stuff like running a motor etc. Then I came across RTWEC feature in Simulink and was wondering that if I make a simulink model and use the RTWEC feature, I will not have to write a C code manually.

Basic question I face is - I specify the pin I want to drive the motor by in the C code. How can I specify an output pin/input pin for the microcontroller in Simulink?



Subject: Simulink, RTWEC and a Microcontroller

From: Phil Goddard

Date: 12 Dec, 2012 04:44:14

Message: 2 of 2

You typically have to encapsulate your device drivers (i.e. the C-code that you have) into c-mex S-functions, and since you're using ERT you'll also want to write associated TLC files for them.
Neither are trivial, but they are (moderately well) documented.

Also, depending on how far you want to go, you could consider writing a custom target:


Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us