How to write Driver Blocks for Arduino on the new 2012b Version?

2 views (last 30 days)
Following the guide "Writing a Simulink Device Driver block: a step by step guide" by Campa I have not been able to successfully write my own driver blocks.
Following this manual to the letter and it appears that at the final step when uploading to the board with "Run On Target Hardware" there are compiler issues....which warn about "redefining" certain functions which causes an abort.
I have installed the target support with targetinstaller and I am able to run the standard in/out/servo blocks with no issue. Also my s functions compile with no problems!
opening a model from the examples gives the following... however s functions will still compile fine. Warning: File I/O error on file 'arduino.tlc' Operation that caused an error: find In general\private\openmdl at 13 In open at 159 In uiopen at 196
I can only reason that there is a new method implemented on the R2012b version and I can not find any documentation for it. :( I am using the "realtime.tlc" in the Target selection but some documents mention "arduino tlc"....
Really stuck here any help would be appreciated :)
Ryan G
Ryan G on 13 Mar 2013
Have you tried using the standard arduino blocks first and running on target hardware? You can do a quick setup to make the 13 pin blink and the LED on the hardware should blink. You can do this without changing your hardware setup on the arduino.
phil on 16 Mar 2013
Hi Ryan,
Thank you for your answer. I can run any of the standard blocks with no problem...! serial read/write digital pins, pwm's etc... there is no issue.
The issue really just arises when trying to create my own driver block from the manual!... :(
The author is also running 2012b so I am a little confused as to why this is happening...
Maybe the author is not using the rtw.tlc but rather the arduino.tlc in code generation... im stuck :(
Is it also possible that when you create your own driver blocks you can NOT use the arduino blocks from the library?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!