Code covered by the BSD License  

Highlights from
VU-LEGO Real Time Target

image thumbnail

VU-LEGO Real Time Target

by

 

30 Dec 2010 (Updated )

A user-friendly Blockset for embedding real time Simulink designs on the LEGO Mindstorms NXT brick.

generate_oil(modelName)
function result = generate_oil(modelName)
 % generate_oil.m
 % Generates a generic OIL file based on RTW configuration parameters.
 timerNeeded=0;
 
 fid = fopen(sprintf('%s.oil',modelName),'w+');
 if fid==-1
     error(sprintf('### Failed to open or create file: %s.oil',modelName));
 end
 
 fprintf(fid, [...
     '#include "implementation.oil"\n',...
     '\n',...
     'CPU ATMEL_AT91SAM7S256\n',...
     '{\n',...
     '\tOS LEJOS_OSEK\n',...
     '\t{\n',...
     '\t\tSTATUS = EXTENDED;\n',...
     '\t\tSTARTUPHOOK = FALSE;\n',...
     '\t\tERRORHOOK = FALSE;\n',...
     '\t\tSHUTDOWNHOOK = FALSE;\n',...
     '\t\tPRETASKHOOK = FALSE;\n',...
     '\t\tPOSTTASKHOOK = FALSE;\n',...
     '\t\tUSEGETSERVICEID = FALSE;\n',...
     '\t\tUSEPARAMETERACCESS = FALSE;\n',...
     '\t\tUSERESSCHEDULER = FALSE;\n',...
     '\t};\n',...
     '\n',...
     '\t/* Definition of application mode */\n',...
     '\tAPPMODE appmode1{};\n\n',...
     '\t/* Definition of resource */\n',...
     '\tRESOURCE RES_Rx\n',...
     '\t{\n',...
     '\t\tRESOURCEPROPERTY = STANDARD;\n',...
     '\t};\n\n',...
     '\tTASK OSEK_Task_Startup\n',...
     '\t{\n',...
     '\t\tAUTOSTART = TRUE\n',...
     '\t\t{\n',...
     '\t\t\tAPPMODE = appmode1;\n',...
     '\t\t};\n',...
     '\t\tPRIORITY = 4;\n',...
     '\t\tACTIVATION = 1;\n',...
     '\t\tSCHEDULE = FULL;\n',...
     '\t\tSTACKSIZE = 1024;\n',...
     '\t\tRESOURCE = RES_Rx;\n',...
     '\t};\n',...
     '};']);
 fclose(fid);
 
result = 1;
end

Contact us