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?

Simultaneous output from Simulink on Arduino Uno

Asked by Katherine

Katherine (view profile)

on 28 Jun 2013

I am using this Simulink code to try to output data to multiple pins on an Arduino Uno. I am wondering if the Simulink compiler is smart enough to output all of the pins simultaneously.

The other option is to write an S-function that uses the port commands (DDR and PORT).

Here's a picture of the Simulink code. <www.sos.siena.edu/~mmccolgan/beacon/output.png>

0 Comments

Katherine

Katherine (view profile)

Products

1 Answer

Answer by Kaustubha Govind

Kaustubha Govind (view profile)

on 28 Jun 2013

The model that you have is already writing to multiple pins simultaneously. Unless, you mean that since the writes happens in a sequence in the generated code, you cannot disregard the small delay that occurs between executing each write statement? I'm not sure how you would achieve such a simultaneous write in C code, since the Arduino DigitalWrite function also only writes to only one port at a time. But if you do know how to implement this in C, then yes, writing a S-function is the right way to go.

1 Comment

Katherine

Katherine (view profile)

on 28 Jun 2013

Yes I am trying to avoid those small delay steps. I know how to write the C-code but am having trouble getting any S-function to work on the Arduino. Do you have any examples of S-functions for arduinos that you could send me or post?

Kaustubha Govind

Kaustubha Govind (view profile)

Contact us