How add interrupt function to c file
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
During creating Device Drivers for the Embedded Target for Motorola HC12,I want to add interrupt function to c file by TLC file.In TLC file,I don't want to use "Start" function or "Outputs" function.I want that the interrupt function independents of void task_step() and void task_initialize(). How to achieve it? thank you .
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 21 Nov. 2011
I don't know what the "proper" way to do this is, but here's a quick-and-dirty way that I can think of:
%openfile tmpBuf
void interruptFunction()
{
/* do something here */
}
%closefile tmpBuf
%assign modelSrc = LibGetModelDotCFile()
%<LibSetSourceFileSection(modelSrc,"Functions",tmpBuf)>
You can also add a declaration to model.h if you like:
%openfile tmpBuf
void interruptFunction();
%closefile tmpBuf
%assign modelH = LibGetModelDotHFile()
%<LibSetSourceFileSection(modelH,"FcnPrototypes",tmpBuf)>
You should be able to use this in any part of your TLC file (since you are reaching into specific portions of the generated code), I don't think it should matter whether you call it from Start or Output or any other method.
I haven't tried this out, so please post back if you run into issues with this solution. Typically this type of thing can be done in the custom file processing template, but my guess is that you can do it from an S-function TLC as well.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!