<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A.Quarter.To.Seven</title>
	<atom:link href="http://www.stefanocottafavi.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.stefanocottafavi.com</link>
	<description></description>
	<lastBuildDate>Wed, 09 May 2012 11:48:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>EAGLE Libraries</title>
		<link>http://www.stefanocottafavi.com/?p=657&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=eagle-libraries</link>
		<comments>http://www.stefanocottafavi.com/?p=657#comments</comments>
		<pubDate>Wed, 25 Apr 2012 22:49:33 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=657</guid>
		<description><![CDATA[This is a small CadSoft EAGLE libraries collection of the following manufacturers: muRata : capacitors, buzzers [...]]]></description>
			<content:encoded><![CDATA[<p><!--
<form class="searchform" method="get" action=""> <input type="text" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" size="18" maxlength="50" name="wpfb_s" class="wpfb_s" /> <input type="hidden" name="feed" value="rss2" /></form> 
-->
<div class="filebase-table">
<table>
<thead>
	<tr><th class="th60" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_name">File</a></th><th class="th25" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_size">Size</a></th><th class="th15" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_downloads">Hits</a></th></tr>
</thead>
<!--<tfoot>
	<tr><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_name">Name</a></th><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_size">Size</a></th><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_downloads">Hits</a></th></tr>
</tfoot>-->
<tbody><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=63"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />LairdTechnologies.lbr</a></td><td>17.7 KiB</td><td>12</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=68"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />MAXIM.lbr</a></td><td>57.1 KiB</td><td>12</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=65"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />Microchip.lbr</a></td><td>4.0 KiB</td><td>13</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=64"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />muRata-cap.lbr</a></td><td>11.2 KiB</td><td>12</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=67"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />muRata-piezo.lbr</a></td><td>5.7 KiB</td><td>12</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=66"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/lbr.png" />ROHM.lbr</a></td><td>13.1 KiB</td><td>14</td></tr></tbody>
</table>
</div>
<!--<div class="tablenav-pages"></div>--><br />
This is a small CadSoft EAGLE libraries collection of the following manufacturers:</p>
<ul>
<li><a href="http://www.murata.com/">muRata</a> : capacitors, buzzers</li>
<li><a href="http://www.lairdtech.com/">Laird Technologies</a> : Bluetooth modules</li>
<li><a href="http://www.maxim-ic.com/">MAXIM</a> : IC, semiconductors</li>
<li><a href="http://www.microchip.com/">Microchip</a> : IC, semiconductor devices</li>
<li><a href="http://www.rohm.com/index.html">ROHM Semiconductor</a> : resistors, tantalum capacitors</li>
</ul>
<p>These come from the net:</p>
<ul>
<li><a href="http://www.st.com">ST Microelectronics</a> : <a href="http://blog.tkjelectronics.dk/2010/06/stm32-library-for-eagle/">STM32</a></li>
<li><a href="http://www.tribbeck.com/electronics/eagle/">various</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=657</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BMP085 Pressure Sensor</title>
		<link>http://www.stefanocottafavi.com/?p=447&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bmp085-pressure-sensor</link>
		<comments>http://www.stefanocottafavi.com/?p=447#comments</comments>
		<pubDate>Sun, 25 Dec 2011 23:08:52 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[prototyping]]></category>
		<category><![CDATA[sensors]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=447</guid>
		<description><![CDATA[I&#8217;m working on a project involving real-time measure of atmospheric pressure with Bosch-Sensortec BMP085 Barometric [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://www.stefanocottafavi.com/wp-content/uploads/2011/12/DSCN7917-002.jpg"><img class="alignright full-size wp-image-462" style="margin: 0pt 0pt 10px 10px; width: 50%;" title="DSCN7917-002" src="http://www.stefanocottafavi.com/wp-content/uploads/2011/12/DSCN7917-002.jpg" alt="" /></a>I&#8217;m working on a project involving real-time measure of atmospheric pressure with <a href="http://www.bosch-sensortec.com/content/language1/html/3477.htm" target="_blank">Bosch-Sensortec BMP085 Barometric Pressure Sensors</a>.<br />
<span id="more-447"></span>This is a new generation high precision digital pressure sensor for consumer application. The low-power, low-voltage electronics of the BMP085 is optimized for use in mobile phones, PDAs and GPS navigation devices.</p>
<p style="text-align: justify;">Following the rich documentation available on the internet I set up a test bench composed by<br />
• <a href="http://www.sparkfun.com/products/9694" target="_blank">SparkFun BMP085 Breakout board</a><br />
• <a href="http://arduino.cc/en/Main/arduinoBoardDuemilanove" target="_blank">Arduino 2009 board</a><br />
• <a href="http://www.ni.com/labview/">NI LabVIEW 2011 software</a></p>
<p>The main objective of the test is the <em>assessment of sensor&#8217;s noise</em>; then I would like to evaluate the<em> impact of different environment conditions</em>, in particular the room temperature. Finally a <em>floating point math</em> will be used to process sensor data (<a href="http://wmrx00.sourceforge.net/Arduino/arduino.html" target="_blank">Weather Station Data Logger for Arduino</a> uses a floating point math along with BMP085 sensor, read the <a href="http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf" target="_blank">dissertation</a>).</p>
<p>Further details on how to wire SparkFun board to the Arduino 2009 can be found in the link below. <a href="https://github.com/adafruit/BMP085-Library" target="_blank">BMP085 library for Arduino</a> (with sample .pde) is available for downloaded from Adafruit GitHub. More details about the process and math involved in the library can be found in the <a href="http://www.bosch-sensortec.com/content/language1/downloads/BST-BMP085-DS000-06.pdf" target="_blank">BMP085 datasheet</a>.</p>
<p>GENERAL REFERENCE<br />
<a href="http://wiring.org.co/learning/libraries/bmp085.html" target="_blank">BMP085 \ Learning \ Wiring</a><br />
<a href="http://interactive-matter.eu/2009/12/arduino-barometric-pressure-sensor-bmp085/">Interactive Matter &#8211; Arduino &amp; Barometric Pressure Sensor BMP085</a><br />
<a href="http://bildr.org/2011/06/bmp085-arduino/" target="_blank">bildr &#8211; Sensing Barometric Pressure | BMP085 + Arduino</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=447</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LabVIEW + Arduino, Reading float variables</title>
		<link>http://www.stefanocottafavi.com/?p=412&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=labview-interface-for-arduino-read-float-1</link>
		<comments>http://www.stefanocottafavi.com/?p=412#comments</comments>
		<pubDate>Sun, 25 Dec 2011 15:19:36 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=412</guid>
		<description><![CDATA[I was looking for a way to plot real-time Arduino data and after a bit [...]]]></description>
			<content:encoded><![CDATA[<!--
<form class="searchform" method="get" action=""> <input type="text" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" size="18" maxlength="50" name="wpfb_s" class="wpfb_s" /> <input type="hidden" name="feed" value="rss2" /></form> 
-->
<div class="filebase-table">
<table>
<thead>
	<tr><th class="th60" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_name">File</a></th><th class="th25" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_size">Size</a></th><th class="th15" scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_downloads">Hits</a></th></tr>
</thead>
<!--<tfoot>
	<tr><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_name">Name</a></th><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_size">Size</a></th><th scope="col"><a href="http://www.stefanocottafavi.com/?feed=rss2&wpfb_file_sort=&lt;file_downloads">Hits</a></th></tr>
</tfoot>-->
<tbody><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=47"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/zip.png" />LIFA_test_1.zip</a></td><td>5.7 KiB</td><td>164</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=48"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/vi.png" />LIFA_test_1.vi</a></td><td>16.5 KiB</td><td>163</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=45"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/vi.png" />LIFA_test_2.vi</a></td><td>19.1 KiB</td><td>169</td></tr><tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=46"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/zip.png" />LIFA_test_2.zip</a></td><td>5.8 KiB</td><td>267</td></tr></tbody>
</table>
</div>
<!--<div class="tablenav-pages"></div>-->
<p style="text-align: justify;">I was looking for a way to plot real-time Arduino data and after a bit of search I decided to couple it with LabVIEW; but among all the documentation and references I found on the internet about the topic none of them suited exactly my needs.</p>
<p>The documents from NI provides useful information to directly access read/write Arduino pins both analog and digital, but no further details are given to transfer variables back and forth.</p>
<p>If you don&#8217;t have Arduino IDE or LabVIEW installed, please follow the instructions from NI page on how to <a href="https://decibel.ni.com/content/docs/DOC-15971">setup the environment</a>.</p>
<p><strong>METHOD 1</strong>: SEQUENCE OF CHARS<br />
Common practice when it comes to transfer data over a serial line is to send them as sequence of ASCII characters. The following example show how to send a float variable from Arduino as fixed 4 characters, and read it in LabVIEW using the &#8220;Send Receive&#8221; utility block.</p>
<p><a href="http://www.stefanocottafavi.com/wp-content/uploads/2011/12/lifa_test_1_bk.png"><img class="alignnone size-full wp-image-422" style="width: 100%;" title="lifa_test_1_bk" src="http://www.stefanocottafavi.com/wp-content/uploads/2011/12/lifa_test_1_bk.png" alt="" /></a></p>
<p>The trick here is to send a dummy flush command to Arduino, which otherwise respond with a &#8220;sync&#8221; signal that mess up with actual data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=412</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>LabVIEW Resources</title>
		<link>http://www.stefanocottafavi.com/?p=417&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=labview-resources</link>
		<comments>http://www.stefanocottafavi.com/?p=417#comments</comments>
		<pubDate>Sun, 25 Dec 2011 15:10:49 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LabVIEW]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=417</guid>
		<description><![CDATA[NI LabVIEW Home Page JKI VI Package Manager LabVIEW + Arduino LabVIEW Interface for Arduino [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ni.com/labview/">NI LabVIEW Home Page</a><br />
<a href="http://jki.net/vipm">JKI VI Package Manager</a></p>
<p>LabVIEW + Arduino</p>
<p><a href="https://decibel.ni.com/content/groups/labview-interface-for-arduino">LabVIEW Interface for Arduino (LIFA) Community</a><br />
<a href="http://vishots.com/getting-started-with-the-labview-interface-for-arduino/">007 VISV Getting Started With the LabVIEW Interface for Arduino</a><br />
<a href="http://arduino.cc/blog/2010/09/29/arduino-and-labview/">Arduino and LabVIEW</a><br />
<a href="http://web.me.com/iklln6/automation/LabVIEW.html">LabVIEW + Arduino Serial Communication</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=417</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build STM32 library in Eclipse</title>
		<link>http://www.stefanocottafavi.com/?p=404&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=build-stm32-library-in-eclipse</link>
		<comments>http://www.stefanocottafavi.com/?p=404#comments</comments>
		<pubDate>Wed, 07 Dec 2011 07:34:57 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Cortex]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[STM32]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=404</guid>
		<description><![CDATA[Lately I approached the world of 32bit MCU and started exploring the features and capabilities [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://arm.com/products/processors/cortex-m/cortex-m3.php"><img class="alignright" title="ARM Architecture" src="http://www.arm.com/images/pro-CM3.gif" alt="" width="203" height="203" /></a>Lately I approached the world of 32bit MCU and started exploring the features and capabilities of the various <a href="http://www.arm.com/" target="_blank">ARM</a> microprocessor families. I&#8217;ve been attracted by the <a href="http://www.st.com/internet/com/home/home.jsp" target="_blank">STMicroelectronics</a> products, the <a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">STM32 32bit ARM Cortex MCUs</a>, and I decided to got myself an entry level evaluation board: the <a href="http://www.st.com/internet/evalboard/product/250863.jsp" target="_blank">STM32VLDISCOVERY</a>.</p>
<p style="text-align: justify;">I&#8217;ve been programming software and firmware for about 15 years, and over the time I found that the learning curve changed a lot. Nowadays the availability of informations, cheap hardware and open-source code lead to very short development time compared to a decade ago. But most of the time faster accomplishments are not supported by a deep understanding of &#8220;what&#8217;s going on behind&#8221;</p>
<p style="text-align: justify;">So I&#8217;ve been able to make a LED blinking (the equivalent Hello World for MCUs) on my eval board without even write a line of code.</p>
<p style="text-align: justify;">Then I decided to start learn something! &#8230;and as I found that most of the example and tutorial programs use the <a href="http://62.193.238.133/inchtml.php?fdir=pages&amp;fnam=stm32lib" target="_blank">STM32 Standard Peripheral Library</a> as an abstraction layer to access the MCU resources, I fine-tuned my own Eclipse project to build different version of such library.</p>
<p><strong>DEVELOPMENT ENVIRONMENT SETUP</strong><br />
I followed a step-by-step guide to setup the Eclipse IDE, C/C++ plugin for embedded devices and the toolchain of choice: <a href="https://sites.google.com/site/stm32discovery/open-source-development-with-the-stm32-discovery/setting-up-eclipse-for-stm32-discovery-development" target="_blank">Setting up Eclipse and Code Sourcery lite for STM32 Discovery Development</a><br />
This guide give now sort of outdated information and links, but keep it as a trace of the steps required.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=404</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTC development</title>
		<link>http://www.stefanocottafavi.com/?p=394&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=htc-development</link>
		<comments>http://www.stefanocottafavi.com/?p=394#comments</comments>
		<pubDate>Tue, 23 Aug 2011 12:59:26 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=394</guid>
		<description><![CDATA[An index of resources I stumble upon while developing on HTC and Android. HTC http://htcdev.com/ [...]]]></description>
			<content:encoded><![CDATA[<p>An index of resources I stumble upon while developing on HTC and Android.<span id="more-394"></span></p>
<p>HTC</p>
<p><a href="http://htcdev.com/">http://htcdev.com/</a></p>
<p>BOOT / ROOT / UNLOCK</p>
<p><a href="http://revolutionary.io/">http://revolutionary.io/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=394</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FAST BladedInterface</title>
		<link>http://www.stefanocottafavi.com/?p=360&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fast-bladedinterface</link>
		<comments>http://www.stefanocottafavi.com/?p=360#comments</comments>
		<pubDate>Thu, 21 Jul 2011 07:55:17 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[FORTRAN-FASTmexing]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=360</guid>
		<description><![CDATA[This is the source code of the FAST interface I use to dinamically link external [...]]]></description>
			<content:encoded><![CDATA[<p><div class="filebase-table">
<table>
<thead>
	<tr><th class="th60" scope="col"><a href="%sortlink:file_name%">File</a></th><th class="th25" scope="col"><a href="%sortlink:file_size%">Size</a></th><th class="th15" scope="col"><a href="%sortlink:file_downloads%">Hits</a></th></tr>
</thead>

<tbody>

<tr><td><a href="http://www.stefanocottafavi.com/?wpfb_dl=44"><img width="16px" height="16px" align="middle" src="http://www.stefanocottafavi.com/wp-content/plugins/wp-filebase/images/zip.png" />BladedInterface.zip</a></td><td>20.8 KiB</td><td>95</td></tr>
</tbody>
</table>
</div> This is the source code of the FAST interface I use to dinamically link external wind turbine controller in the Garrad-Hassan Bladed style. This solution take advantage of the FORTRAN ISO_C_BINDING module (standard since 2003).</p>
<p>This code would also be a step toward a more flexible and cross-platform/cross-compiler integration between FAST and external control routines.</p>
<p>In detail, the most significant changes come into <strong>MODULE DLL_Interface</strong>. Hope you&#8217;ll find it useful.</p>
<p>WINDOWS</p>
<pre class="brush: cpp; title: ; notranslate">
 !=======================================================================
 MODULE DLL_Interface

USE ISO_C_BINDING

IMPLICIT NONE

! define some function binded to kernel32.dll exports
 INTERFACE
 FUNCTION LoadLibraryA(lpFileName) BIND(C,NAME='LoadLibraryA')
 USE ISO_C_BINDING
 IMPLICIT NONE
 INTEGER(C_INTPTR_T) LoadLibraryA
 CHARACTER(KIND=C_CHAR) lpFileName
 END FUNCTION LoadLibraryA

FUNCTION GetProcAddress(hModule, lpProcName) BIND(C,NAME='GetProcAddress')
 USE ISO_C_BINDING
 IMPLICIT NONE
 TYPE(C_FUNPTR) GetProcAddress
 INTEGER(C_INTPTR_T), VALUE :: hModule
 CHARACTER(KIND=C_CHAR) lpProcName
 END FUNCTION GetProcAddress

FUNCTION FreeLibrary(hModule) BIND(C,NAME='FreeLibrary')
 USE ISO_C_BINDING
 IMPLICIT NONE
 INTEGER(C_INTPTR_T), VALUE :: hModule
 INTEGER(C_INT) FreeLibrary
 END FUNCTION FreeLibrary

FUNCTION GetLastError() BIND(C,NAME='GetLastError')
 USE ISO_C_BINDING
 IMPLICIT NONE
 INTEGER(C_INT32_T) GetLastError
 END FUNCTION GetLastError
 END INTERFACE

! Defined TYPEs:

TYPE DLL_Type

INTEGER(C_INTPTR_T) :: FileAddr = 0
 TYPE(C_FUNPTR) :: ProcAddr = C_NULL_FUNPTR ! The address of procedure ProcName.

CHARACTER(1024) :: FileName ! The name of the DLL file including the full path to the current working directory.
 CHARACTER(1024) :: ProcName ! The name of the procedure in the DLL that will be called.

END TYPE DLL_Type

! DLL Interface:

ABSTRACT INTERFACE
 SUBROUTINE DLL_Procedure ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )
 REAL(4) :: avrSWAP (*)
 INTEGER(4) :: aviFAIL
 INTEGER(1) :: accINFILE (*)
 INTEGER(1) :: avcMSG (*)
 INTEGER(1) :: avcOUTNAME(*)
 END SUBROUTINE DLL_Procedure
 END INTERFACE

CONTAINS
 !=======================================================================
 SUBROUTINE LoadDLL ( DLL )

! This SUBROUTINE is used to load the DLL.

!bjj start of proposed change
 USE NWTC_LIBRARY, ONLY: ProgAbort, Int2LStr
 !bjj end of proposed change

IMPLICIT NONE

! Passed Variables:

TYPE (DLL_Type), POINTER :: DLL ! The DLL to be loaded.

DLL%FileAddr = LoadLibraryA( TRIM(DLL%FileName)//C_NULL_CHAR)
 IF(DLL%FileAddr == 0) THEN
 CALL ProgAbort(' The DLL '//TRIM(DLL%FileName)//' could not be loaded. Error: '//TRIM(Int2LStr(GetLastError())))
 ENDIF

DLL%ProcAddr = GetProcAddress( DLL%FileAddr, TRIM(DLL%ProcName)//C_NULL_CHAR )
 IF(.NOT. C_ASSOCIATED(DLL%ProcAddr)) THEN
 CALL ProgAbort( ' The procedure '//TRIM(DLL%ProcName)//' could not be loaded. Error: '//TRIM(Int2LStr(GetLastError())) )
 ENDIF

RETURN
 END SUBROUTINE LoadDLL
 !=======================================================================
 SUBROUTINE CallDLL ( DLL, avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )

! This SUBROUTINE is used to call the DLL.

IMPLICIT NONE

! Passed Variables:

REAL(4), INTENT(INOUT) :: avrSWAP (*) ! The swap array, used to pass data to, and receive data from, the DLL controller.

INTEGER(4), INTENT( OUT) :: aviFAIL ! A flag used to indicate the success of this DLL call set as follows: 0 if the DLL call was successful, &gt;0 if the DLL call was successful but cMessage should be issued as a warning messsage,

INTEGER(1), INTENT(IN ) :: accINFILE (*) ! The address of the first record of an array of 1-byte CHARACTERs giving the name of the parameter input file, 'DISCON.IN'.
 INTEGER(1), INTENT( OUT) :: avcMSG (*) ! The address of the first record of an array of 1-byte CHARACTERS giving the message contained in cMessage, which will be displayed by the calling program if aviFAIL &lt;&gt; 0.
 INTEGER(1), INTENT(IN ) :: avcOUTNAME(*) ! The address of the first record of an array of 1-byte CHARACTERS giving the simulation run name without extension.

TYPE (DLL_Type), INTENT(IN ) :: DLL ! The DLL to be called.

! Local Variables:

PROCEDURE(DLL_Procedure), POINTER :: DLL_ProcAddr

! Call the DLL through a POINTER:

CALL C_F_PROCPOINTER(DLL%ProcAddr,DLL_ProcAddr)

CALL DLL_ProcAddr ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )

RETURN
 END SUBROUTINE CallDLL
 !=======================================================================
 END MODULE DLL_Interface
 </pre>
<p>LINUX</p>
<pre class="brush: cpp; title: ; notranslate">
 MODULE DLL_Interface

USE ISO_C_BINDING

IMPLICIT NONE

!define some function binded to libdl.so exports

INTEGER, PARAMETER, PUBLIC :: RTLD_LAZY=1, RTLD_NOW=2, RTLD_GLOBAL=256, RTLD_LOCAL=0

INTERFACE ! All we need is interfaces for the prototypes in FUNCTION dlOpen(file,mode) RESULT(handle) BIND(C,NAME=&quot;dlopen&quot;)
 ! void *dlopen(const char *file, int mode);
 USE ISO_C_BINDING
 CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: file
 ! C strings should be declared as character arrays
 INTEGER(C_INT), VALUE :: mode
 TYPE(C_PTR) :: handle
 END FUNCTION
 FUNCTION dlSym(handle,name) RESULT(funptr) BIND(C,NAME=&quot;dlsym&quot;)
 ! void *dlsym(void *handle, const char *name);
 USE ISO_C_BINDING
 TYPE(C_PTR), VALUE :: handle
 CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: name
 TYPE(C_FUNPTR) :: funptr ! A function pointer
 END FUNCTION
 FUNCTION dlClose(handle) RESULT(status) BIND(C,NAME=&quot;dlclose&quot;)
 ! int dlclose(void *handle);
 USE ISO_C_BINDING
 TYPE(C_PTR), VALUE :: handle
 INTEGER(C_INT) :: status
 END FUNCTION
 FUNCTION dlError() RESULT(error) BIND(C,NAME=&quot;dlerror&quot;)
 ! char *dlerror(void);
 USE ISO_C_BINDING
 TYPE(C_PTR) :: error
 END FUNCTION
 END INTERFACE

! Defined TYPEs:

TYPE DLL_Type

TYPE(C_PTR) :: FileAddr = C_NULL_PTR
 TYPE(C_FUNPTR) :: ProcAddr = C_NULL_FUNPTR ! The address of procedure ProcName.

CHARACTER(1024) :: FileName ! The name of the DLL file including the full path to the current working directory.
 CHARACTER(1024) :: ProcName ! The name of the procedure in the DLL that will be called.

END TYPE DLL_Type

! DLL Interface:

ABSTRACT INTERFACE
 SUBROUTINE DLL_Procedure ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )
 REAL(4) :: avrSWAP (*)
 INTEGER(4) :: aviFAIL
 INTEGER(1) :: accINFILE (*)
 INTEGER(1) :: avcMSG (*)
 INTEGER(1) :: avcOUTNAME(*)
 END SUBROUTINE DLL_Procedure
 END INTERFACE

CONTAINS
 !=======================================================================
 SUBROUTINE LoadDLL ( DLL )

! This SUBROUTINE is used to load the DLL.

!bjj start of proposed change
 USE NWTC_LIBRARY, ONLY: ProgAbort
 !bjj end of proposed change

IMPLICIT NONE

! Passed Variables:

TYPE (DLL_Type), POINTER :: DLL ! The DLL to be loaded.

DLL%FileAddr = dlOpen( TRIM(DLL%FileName)//C_NULL_CHAR, RTLD_LAZY )
 IF(.NOT. C_ASSOCIATED(DLL%FileAddr)) THEN
 CALL ProgAbort(' The SO '//TRIM(DLL%FileName)//' could not be loaded.')! Error in dlopen: '//C_F_STRING(dlError()))
 ENDIF

DLL%ProcAddr = dlSym( DLL%FileAddr, TRIM(DLL%ProcName)//C_NULL_CHAR )
 IF(.NOT. C_ASSOCIATED(DLL%ProcAddr)) THEN
 CALL ProgAbort( ' The procedure '//TRIM(DLL%ProcName)//' could not be loaded.')
 ENDIF

RETURN
 END SUBROUTINE LoadDLL
 !=======================================================================
 SUBROUTINE CallDLL ( DLL, avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )

! This SUBROUTINE is used to call the DLL.

IMPLICIT NONE

! Passed Variables:

REAL(4), INTENT(INOUT) :: avrSWAP (*) ! The swap array, used to pass data to, and receive data from, the DLL controller.

INTEGER(4), INTENT( OUT) :: aviFAIL ! A flag used to indicate the success of this DLL call set as follows: 0 if the DLL call was successful, &gt;0 if the DLL call was successful but cMessage should be issued as a warning messsage,

INTEGER(1), INTENT(IN ) :: accINFILE (*) ! The address of the first record of an array of 1-byte CHARACTERs giving the name of the parameter input file, 'DISCON.IN'.
 INTEGER(1), INTENT( OUT) :: avcMSG (*) ! The address of the first record of an array of 1-byte CHARACTERS giving the message contained in cMessage, which will be displayed by the calling program if aviFAIL &lt;&gt; 0.
 INTEGER(1), INTENT(IN ) :: avcOUTNAME(*) ! The address of the first record of an array of 1-byte CHARACTERS giving the simulation run name without extension.

TYPE (DLL_Type), INTENT(IN ) :: DLL ! The DLL to be called.

! Local Variables:

PROCEDURE(DLL_Procedure), POINTER :: DLL_ProcAddr

! Call the DLL through a POINTER:

CALL C_F_PROCPOINTER(DLL%ProcAddr,DLL_ProcAddr)

CALL DLL_ProcAddr ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )

RETURN
 END SUBROUTINE CallDLL
 !=======================================================================
 END MODULE DLL_Interface
 </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=360</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TEROM web</title>
		<link>http://www.stefanocottafavi.com/?p=349&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=terom-web</link>
		<comments>http://www.stefanocottafavi.com/?p=349#comments</comments>
		<pubDate>Sun, 17 Jul 2011 22:37:34 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=349</guid>
		<description><![CDATA[TEROM design and builds sugar manufacturing plants, water treatment plants and is specialized in system [...]]]></description>
			<content:encoded><![CDATA[<p>TEROM design and builds sugar manufacturing plants, water treatment plants and is specialized in system involving custom heavy weight structures in general. It&#8217;s based in Bologna, Italy.</p>
<p>This is the recently restiled website: <a href="http://www.terom.it" target="_blank">www.terom.it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=349</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MoneyLeaks</title>
		<link>http://www.stefanocottafavi.com/?p=325&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=moneyleaks</link>
		<comments>http://www.stefanocottafavi.com/?p=325#comments</comments>
		<pubDate>Wed, 13 Jul 2011 16:19:55 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=325</guid>
		<description><![CDATA[A couple of screenshots of an app I&#8217;m developing for Android devices; this app will [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of screenshots of an app I&#8217;m developing for Android devices; this app will help you to track your daily expenses.</p>

<a href='http://www.stefanocottafavi.com/?attachment_id=345' title='device-2011-07-10-230525'><img width="150" height="150" src="http://www.stefanocottafavi.com/wp-content/uploads/2011/07/device-2011-07-10-2305251-150x150.png" class="attachment-thumbnail" alt="device-2011-07-10-230525" title="device-2011-07-10-230525" /></a>
<a href='http://www.stefanocottafavi.com/?attachment_id=346' title='device-2011-07-10-230612'><img width="150" height="150" src="http://www.stefanocottafavi.com/wp-content/uploads/2011/07/device-2011-07-10-2306121-150x150.png" class="attachment-thumbnail" alt="device-2011-07-10-230612" title="device-2011-07-10-230612" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=325</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CpLambda IDE w/ Eclipse+XText</title>
		<link>http://www.stefanocottafavi.com/?p=53&#038;utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cplambda-ide-with-eclipse-xtext</link>
		<comments>http://www.stefanocottafavi.com/?p=53#comments</comments>
		<pubDate>Sun, 03 Jan 2010 02:55:07 +0000</pubDate>
		<dc:creator>Stefano</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MATLAB]]></category>
		<category><![CDATA[XText]]></category>

		<guid isPermaLink="false">http://www.stefanocottafavi.com/?p=53</guid>
		<description><![CDATA[This post is a very quick overview of the attemp to develop a full featured [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a very quick overview of the attemp to develop a full featured IDE for the <a href="http://www.aero.polimi.it/~bottasso/POLI-Wind.htm" target="_blank">Cp-Lambda</a> code by POLI-Wind, a laboratory of the <a href="http://www.aero.polimi.it/IT/" target="_blank">Dipartimento di Ingegneria Aerospaziale of the Politecnico di Milano (DIA-PoliMI)</a> focused on wind energy.</p>
<p><span id="more-53"></span>The IDE is deployed in the form of an <a href="http://www.eclipse.org" target="_blank">Eclipse</a> plugin which exploits all the capabilities offered by the hosting framework such as views (Project Browser, Outline, Error, etc), toolbars and external program launching features.</p>
<p>Specific editor for the various file formats used in Cp-Lambda has been developed using <a href="http://www.eclipse.org/Xtext/" target="_blank">XText</a>, an iimpressive Eclipse technology for development of programming languages and domain specific languages (DSLs): this editor is comprehensive of error/warning check, cross-reference code navigation and source code folding.</p>
<p>A 3D view of the multi-body model is available: such visualization rely on <a href="http://lwjgl.org/" target="_blank">LWJGL</a> plugin for Eclipse. Finally, an Eclipse to MATLAB interface is provided, which grant to the user the possibility to run <a href="http://www.mathworks.com/" target="_blank">MATLAB</a> instances and execute m code (scripts and functions) from Eclipse.</p>
<p><a href="http://www.stefanocottafavi.com/wp-content/uploads/2011/07/cpl_editor.png"><img class="alignnone size-full wp-image-289" style="width: 100%;" title="cpl_editor" src="http://www.stefanocottafavi.com/wp-content/uploads/2011/07/cpl_editor.png" alt="" /></a><a href="http://www.stefanocottafavi.com/?attachment_id=58" rel="attachment wp-att-58"><br />
</a><a href="http://www.stefanocottafavi.com/?attachment_id=59" rel="attachment wp-att-59"><br />
</a><a href="http://www.stefanocottafavi.com/?attachment_id=67" rel="attachment wp-att-67"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stefanocottafavi.com/?feed=rss2&#038;p=53</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

