Jump to content

Recommended Posts

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
  • Submitted
    05/29/2018
  • Category
  • LabVIEW Version
    2017
  • License Type
    BSD (Most common)

 

Link to post
  • 8 months later...

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

Link to post
  • 10 months later...

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.

Link to post
  • 3 months later...
  • 1 month later...

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)

  • Like 1
Link to post
  • 7 months later...
  • 3 months later...

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:

image.png.376b2154206a8f93b3329d913e2bd756.pngimage.png.498516db113516551c5bacd533cc47eb.png

First received byte is 01:

image.png.31f9d09a6b338789e7c1ba327ae95285.pngimage.png.40e27cadb62c4a80c0552fccce08e0c8.png

 

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)

image.png.d09af23b78137abc64c2fc0ababb2a47.png

 

Thank you, Fabio Nicolas

Link to post
  • 3 weeks later...

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? 

Link to post
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.

Link to post
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 by Dimitri Becker
Link to post
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.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By drjdpowell
      I am just starting on trying to be able to use Python code from a LabVIEW application (mostly for some image analysis stuff).  This is for a large project where some programmers are more comfortable developing in Python than LabVIEW.  I have not done any Python before, and their seem to be a bewildering array of options; many IDE's, Libraries, and Python-LabVIEW connectors.  
      So I was wondering if people who have been using Python with LabVIEW can give their experiences and describe what set of technologies they use.
    • By Yaw Mensah
      I have installed Labview 2020 on Dedian Buster using the rpm to deb conversion method via alien. Due to Architecture mismatch i deleted the *i386.rpm files before conversion.
      My Problem is that after creating a project at "Build Specification"-> "rigth click" i am only able to select "Source Distribution". Application does not show up as an option. 
      I will be grateful for any suggestions.
      Thank you in advance.
    • By javier_r
      VIPM.io now allows you to post LabVIEW Resources, Ideas, and Tools. For example, you could post a link to a video tutorial or blog article about a package. You can also post ideas, like feature requests or new tools. Best of all, package developers are notified when you post your ideas and resources, and you can comment and discuss posts with the community. Take a look at this video to learn more: https://www.vipm.io/posts/664960df-f111-4e13-989a-24be8207182d/

    • By Shuvankar Das
      I want to connect My ccd camera with labview. The details of my system is given bellow. I cannot connect it please help   OS:  WINDOWS 7, 64bit   LabView Run-Time 2013(64-bit) NI-IMAQ 4.8 NI-IMAQdx 4.3   Camera: QICAM Monochrome Cooled (QIC-F-M-12-C) Model QICAM Resolution 1392 x 1040 Sensor 1/2" Sony ICX205 progressive-scan interline CCD Pixel Size 4.65 x 4.65µm Cooling Type Peltier thermoelectric cooling to 25˚C below ambient Digital Output 12 bit Video Output FireWire (IEEE 1394b) Max. Frame Rate 10 fps full resolution @ 12 bits Pixel Scan 20, 10, 5, 2.5MHz Mount Type C-mount optical format  
       
    • By javier_r
      Hello everybody!
      Wondering how many people have tried the new vipm.io site. We have added a ton of features to make it easy to Discover LabVIEW Tools and there are some cool ones coming soon.
      Check it out and let me know what you think 😀
       
      Javier

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.