|
|
|
Re: Help with ads1115 and 4diac [message #1786532 is a reply to message #1786508] |
Sun, 06 May 2018 07:12 |
|
In IEC 61499 all IO access is handled through Service Interface Function Blocks. These FBs are typically custom tailored for the specific IOs that you have. So one starting point would be to write your one specific FB.
In 4diac we started to introduce a generic set of IO FBs (i.e., IX, IB, IW, ID, Qx, QB, QW, WD) making it easier for you to implement IOs. Here you only have to implement a class called CProcessInterface. These class will then handle the device specific IO part and will be utilized by the generic FBs in a kind of strategy pattern. For your case with I2C you can have a look on I2CDev and raspberrypi sps directories for examples.
However you will need to perform certain i"C messages specific to your chip. You can have a look into the code of the adafruit library to find out how this is performed. But from a previous experience when we tried this for a steppermotor cape I noticed that the adafruit library is quite complicated. Therefore it might be easier to just read through the data sheet of your ads1115 chip [1] and find out about the messages needed for setting it up and for reading the ADC converted values.
[1] https://cdn-shop.adafruit.com/datasheets/ads1115.pdf
|
|
|
|
|
|
Re: Help with ads1115 and 4diac [message #1786672 is a reply to message #1786643] |
Wed, 09 May 2018 07:59 |
|
You can use this also in ECCs. However this is not really straight forward. You have to write algorithms in any_text. There you can write C++ code and the code will be directly put into the generated include files. You can put your include statements in the header field of the compilerinfo of your FB. But this is a little bit cumbersome to do.
For an example that could be an interesting reference you might want to look at the process interface I wrote for the PIFace. This is in principle rather similar to what you would like todo the only difference is that piface is using the SPI and not I2C and has only digital I/Os if I rember correctly. For analog I/Os you could look into the Odriod module.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03931 seconds