Netduino home hardware projects downloads community

Jump to content


Photo

VB Libraries - 24LCXX, MCP230XX, MicroLiquidCrystal, MFToolkit XBee

VB I2C 24LCXX MCP230XX MicroLiquidCrystal MFToolkit

  • Please log in to reply
5 replies to this topic

#1 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 14 January 2014 - 08:38 PM

I haven't seen much activity on the VB forum recently, so I am not sure if folks are busy programming or if there is a general lack of interest in the Netduino / Micro Framework community for developing in VB... but I figured I'd throw this out there.

 

I'm working on an upgrade to my homebrewing (yes beer) pump control box by going wireless, implementing the Netduino platform, and a few other things, all in VB.NET, and have in the course of development ported over several libraries. These include:

 

  • I2C digital I/O expanders in the MCP230XX family (MCP23008, MCP23016, and MCP23017)
  • I2C EEPROMs in the 24LCXX class, such as 24LC16, 24LC32, 24LC256, etc.
  • The MicroLiquidCrystal library (by Szymon Kobalczyk) for connecting to LCD screens via I2C (such as the Adafruit backpack)
  • The XBee classes within the MFToolkit

I can't say they've been 100% tested top to bottom because as I find things that were incorrect (either in my porting to VB or in the original classes) I fix them, but the ones I have tested are functional.

 

If you are interested in following my project as it develops, I'm posting occasionally over at http://brewznet.wordpress.com/. I do intend on posting full source code & schematics for the project when it is complete. In the meantime, if there is interest in any of the above functionality, I'd be happy to post the relevant library here.



#2 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 16 January 2014 - 11:11 AM

Attached is the MFToolkit Xbee library  and associated test program. I will try to post the MicroLiquidCrystal and I2C Device libraries this evening / weekend.

 

Regards,

-Garrett

Attached Files



#3 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 17 January 2014 - 10:06 AM

Attached is the code for the MCP230XX expanders, 24LCXX EEPROMs, and DS1307 digital clock I2C devices. All have been pretty thoroughly tested. The EEPROM class does not address the page write buffer size cited in this thread, although it could be easily incorporated.

 

Attached Files



#4 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 17 January 2014 - 10:32 AM

Attached is the VB Port of [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Szymon Kobalczyk's Micro Liquid Crystal library. I didn't include a test program, but if there is a need I can add one. [/color]

 

As in the original C# library, the classes use a MCP230XX digital I/O expander to interface with the LCD screen through I2C. There are some commercially available backpacks out there that use the MCP230XX chips, such as the Adafruit backpack, but you can just as easily use your own if you have some. The ShifterSetup class defines which functions are connected to which pins on the expander. You can either use the DefaultSetup values or define your own setup.

 

Some example code for initializing and setting up the device is shown below. 

Dim lcdProvider As MCP23008LcdTransferProviderDim aLcd As LcdDim anI2CBus as I2CBus' Address the digitial I/O expander chip on the I2C BuslcdProvider = New MCP23008LcdTransferProvider(anI2CBus, &H0)' Create the LCD interface using that provideraLcd = New Lcd(lcdProvider)' Initialize the display size - Using a 20x4 screen.aLcd.Begin(20, 4)' Set the cursor positionaLcd.SetCursorPosition(0,0)' Write out a stringaLcd.Write("This is a test.")

I have used the custom character function extensively in my project, so I know that works. If you make changes to the custom character definitions while one is displayed on the screen, it will change on the screen as well.

 

Attached Files



#5 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 02 February 2014 - 06:14 PM

I did find a small issue with the MCP23017LcdTransferProvider class related to the sequential write capabilities of the two banks. Whenever I wrote out to the LCD, it was messing up the I/O states for the other bank. The cause is one of the settings in the IOCON register. Adding the following to the end of the SetUpExpander subroutine resolves that:  

            ' In either case, you do not want the expander doing sequential writes...            lExpander.WriteRegister(MCP23017.Registers.IOCONA, MCP23017.IOCONBits.SEQOP)            lExpander.WriteRegister(MCP23017.Registers.IOCONB, MCP23017.IOCONBits.SEQOP)


#6 kiwi65

kiwi65

    Member

  • Members
  • PipPip
  • 23 posts

Posted 13 June 2015 - 11:56 PM

Hi GDSever, I've been looking for a C# library to drive my 24LC256. Can't find one. Did you port from C#?







Also tagged with one or more of these keywords: VB, I2C, 24LCXX, MCP230XX, MicroLiquidCrystal, MFToolkit

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.