|
XTargets Embedded Blockset is an assistant for integrating automatically generated code from Real Time Workshop with your handwritten code and device drivers. Case Study : Developing device drivers for Real Time Workshop targets. I want to call a function that reads data from a hardware buffer and provides the data to a Simulink Signal. I also want the error code generated by that function. My function prototype is word read_buffer(byte * data, unsigned int data_length)
and I want a block that looks like the diagram below to interface to it. 
|
The traditional Simulink solution to this is to become very familiar with three different programming languages with at least two complex API's to master. When and if you succeed you will have 50 to 100 lines of code written, spread over several programming languages. The XTargets Solution
To integrate the above function into your model you drop the XTargets XCode block into your model and type
y0 = read_buffer( &y1, 8)
into the block dialog. The XCode block understands what you write and generates two output ports. The error code is returned in port 0 and the data in the wide port 1. Build your model and the above function is inlined into the code. The input ports and output ports are correctly matched up to Simulink signals attached to your model. An exerpt from the generated code shows that you get exactly what you ask for. 29 30 31 uint16_T rtb_errorcode; 32 uint8_T rtb_data[8]; 33 34 35 36 rtb_errorcode = read_buffer( rtb_data, 8);
Time Saved After becoming briefly familiar with the block you can generate calls to external functions in less than a minute and create yourself a library of blocks in 5 minutes. Licensing The licensing is GPL which means you can distribute it with your own models if they too are GPL or compatible. For other license types please contact us for further information. Detailed Product Information
click for product documentation
Downloads Please goto the downloads section.
|