Benoit Posted May 29, 2018 Report Share Posted May 29, 2018 View File MCP2221A library There it is. The complete library for the MCP2221A. I2c adapter, I/O in a single IC. I love that one. Let me know if any bug is found. I try to make that library as much convenient as possible to use. Two version available 32 bit and 64 bit. little note: to open by serial number, the enumeration need to be activated on the device first. (open by index, enable the enumeration) It needs to be done only once in the life time of the device. PLEASE do not take ownership of this work since it is not yours. You have it for free, but the credit is still mine... I spent many hours of my life to make it works. Submitter Benoit Submitted 05/29/2018 Category *Uncertified* LabVIEW Version 2017 License Type BSD (Most common) Quote Link to comment
Matt Aldous Posted February 26, 2019 Report Share Posted February 26, 2019 Hi Benoit, I have downloaded this package and it looks like you've put a lot of work into it! But, I can't use the VIs on the older version of LabVIEW, which is all I currently have available. Please could you provide a version compatible with LabVIEW 2015? It would be very much appreciated. All the best, Matthew Quote Link to comment
Tainaka Posted December 27, 2019 Report Share Posted December 27, 2019 Hello Benoit, This library is very useful. I'm really appreciate your work. By the way, there seems to be a bug in "Mcp2221 Set Gpio Values.vi". The image is attached. Regards, Tainaka Quote Link to comment
Francois Normandin Posted December 30, 2019 Report Share Posted December 30, 2019 Apparently @Benoit does not have access to LabVIEW anymore. At least until the Community Edition is released... I took the liberty of backsaving to LV 2013 and correcting the *char GpioValues bit representation as described in the programmer manual. (Only for 32-bit library) Microchip MCP2221A_x86 (2013).zip *Please note that I have never used this library and have no way of testing whether the 2013 version works. Quote Link to comment
permartin Posted April 1, 2020 Report Share Posted April 1, 2020 Hi I am very new to I2C bus. Does any of you have some simple example code using this library ? Best regards and thank you in advance Martin Quote Link to comment
Tainaka Posted May 2, 2020 Report Share Posted May 2, 2020 I used this library to measure ADT7410 (Analog Devices) and BME280 (Bosch). The Sample code can be found at the end of the link. https://momijimomimomi.com/makers/LabVIEW_MCP2221A_I2C_ADT7410.html https://momijimomimomi.com/makers/LabVIEW_MCP2221A_I2C_BME280.html (Sorry, these are the Japanese language) 1 Quote Link to comment
Ing Roberto Cisneros Posted December 16, 2020 Report Share Posted December 16, 2020 how can fix it? Quote Link to comment
Fábio Nicolas Schmidt Posted March 25, 2021 Report Share Posted March 25, 2021 Hello Mr. Benoit, I am using the MCP2221 to read analog values from an ADC MCP3424, and noticed a bug when reading bytes from the analog data register. The problem only happens when reading i2c and the first bytes are 0x00, but even trying to read 5 bytes, it does not reply any further bytes that aren't 0x00. Please see images below. First received byte is 0x00: First received byte is 01: Do you have any workaround for this issue? I tried to download latest driver and DLL, but still no luck solving this. Note: It works fine inside MCP3331 I2C/SMBus Terminal (see below) Thank you, Fabio Nicolas Quote Link to comment
Dimitri Becker Posted April 16, 2021 Report Share Posted April 16, 2021 Dear All I would like to set only one GPIO (configured as output) at once, not touching other 3. VIs "set gpio values" and "set gpio settings" only setting all 4 together, right? Or am I missing something? Is there any solution for my problem? P:S: i could read the GPIO status before every setting, and then set the needed one, leaving other 3 unchanged... but this is very "hacky" solution. P.P.S. i'm not very familiar with Labview drivers. How could i create a "set one GPIO" - VI, with GPIO Number and value being set? Quote Link to comment
Rolf Kalbermatter Posted April 17, 2021 Report Share Posted April 17, 2021 On 4/16/2021 at 12:12 PM, Dimitri Becker said: Dear All I would like to set only one GPIO (configured as output) at once, not touching other 3. VIs "set gpio values" and "set gpio settings" only setting all 4 together, right? Or am I missing something? Is there any solution for my problem? P:S: i could read the GPIO status before every setting, and then set the needed one, leaving other 3 unchanged... but this is very "hacky" solution. P.P.S. i'm not very familiar with Labview drivers. How could i create a "set one GPIO" - VI, with GPIO Number and value being set? The underlaying API does not support that and it is quite logical. I2C and SPI are not really designed as bit protocols but as byte protocols. They address typical multiples of 8 or 16 bit per data transfer. The method to do what you want to do involves reading back the full 8 bit port, modify the bit in question and send back everything. Quote Link to comment
Dimitri Becker Posted April 21, 2021 Report Share Posted April 21, 2021 (edited) On 4/17/2021 at 6:59 PM, Rolf Kalbermatter said: The underlaying API does not support that and it is quite logical. I2C and SPI are not really designed as bit protocols but as byte protocols. They address typical multiples of 8 or 16 bit per data transfer. The method to do what you want to do involves reading back the full 8 bit port, modify the bit in question and send back everything. Thank you for the response. I've checked the *.dll and you are right I found out, there is an "unchage" option in the "Set GPIO Values" VI, so it's very easy to implement one Pin opereations, simply making the rest "unchange" Edited April 21, 2021 by Dimitri Becker Quote Link to comment
Rolf Kalbermatter Posted April 21, 2021 Report Share Posted April 21, 2021 3 hours ago, Dimitri Becker said: Thank you for the response. I've checked the *.dll and you are right I found out, there is an "unchage" option in the "Set GPIO Values" VI, so it's very easy to implement one Pin opereations, simply making the rest "unchange" The unchange is in other solutions called mask. And it is in reality simply doing a read, with a boolean combined OR of the value and an AND of the mask and then writing it back. Quote Link to comment
jasser saad Posted June 4, 2023 Report Share Posted June 4, 2023 On 4/1/2020 at 11:10 AM, permartin said: Hi I am very new to I2C bus. Does any of you have some simple example code using this library ? Best regards and thank you in advance Martin Quote Link to comment
Rolf Kalbermatter Posted June 9, 2023 Report Share Posted June 9, 2023 On 3/25/2021 at 2:45 PM, Fábio Nicolas Schmidt said: I am using the MCP2221 to read analog values from an ADC MCP3424, and noticed a bug when reading bytes from the analog data register. Do you have any workaround for this issue? I tried to download latest driver and DLL, but still no luck solving this. This library has a bug. The underlying Read VI should use byte arrays as input and output data and the Call Library Node should be configured accordingly for this parameter to be Array, 8 bit unsigned Integer, Pass as C array pointer. With the current C String configuration in the Call Library Node, LabVIEW will scan the string after the Call Library Node has finished, and terminate it after the first 0 byte (since that is how in C strings are terminated). 1 Quote Link to comment
maetamo Posted September 22, 2023 Report Share Posted September 22, 2023 Dear Benoit, Thank you for providing the library. I noticed that I cannot write 27 byte or more. Mcp2221 I2C Write.vi (x86) stops right after 27th byte transaction and no STOP condition generated nor further byte generated for 28 byte or more transaction. Would it be possible to duplicate on your end? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.