Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

System.IO.Exception Occurs In MCP23008LcdTransferProvider Constructor

lcd sainsmart i2c

Best Answer carb, 01 February 2013 - 01:15 AM

MonsterHunter,

 

Wlecome to the forum.

 

I don't think that you can use A4 & A5 for I2C yet. The Netduino 2 Plus has its own SDA & SCL pins at the end of the DIO header. I think that you can tie the A4 to the SDA and A5 to the SCL with a jumper. At least until the firmware is updated to allow using the A4 & A5 connections.

 

Search for SDA & SCL on the forum uner the NP2+ and you should find additional information

 

Chuck

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 monsterhunter445

monsterhunter445

    New Member

  • Members
  • Pip
  • 2 posts

Posted 31 January 2013 - 10:23 PM

Hello everyone, I am new to Netduino, I have already done a few things like the blinking LED and light sensor (using photoresistor). When I purchased my Netduino Plus 2, I purchased a SainSmart IIC/I2C/TWI Serial 2004 20x4 LCD Module Shield For Arduino UNO MEGA R3. I assume it is compatible with my Netduino Plus 2. Anyway a link to the LCD will be given below, along with the source code. When I try to print Hello World using the Micro Liquid Crystal library, I get nothing on the screen, And an exception occurs in the constructor of the LCD provider. I have no idea what to do and I do not think it is an address issue since I have tried 0x3F (0011 1111) and 0x27 (0010 0111)  but nothing changes. I know the LCD works because it is being powered up and I believe it requires 5V to power it up and not 3.3V. I will try to so my setup when I can.

 

How I set it up:

 

GND <-> GND

VCC <-> 5V

SDA <-> A4

SCL <-> A5

 

I also put a resistor on A4 and A5 but to no avail. I will be posting a picture soon. I ran this code:

 

// Micro Liquid Crystal Library// http://microliquidcrystal.codeplex.com// Appache License Version 2.0 using System.Threading;using MicroLiquidCrystal;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware.Netduino;using FusionWare.SPOT.Hardware;namespace HelloWorld{    public class Program    {        public static void Main()        {            // create the transfer provider, use direct GPIO provider            // Initialize the library with the numbers of the interface pins            // Use wiring shown here http://arduino.cc/en/uploads/Tutorial/lcd_schem.png            var bus = new I2CBus();                       var lcdProvider = new MCP23008LcdTransferProvider(bus, 0x27, MCP23008LcdTransferProvider.DefaultSetup);            // create the LCD interface            var lcd = new Lcd(lcdProvider);            // set up the LCD's number of columns and rows:             lcd.Begin(20, 2);            // print a message to the LCD.            lcd.Write("Hello world!");            while (true)            {                lcd.Backlight = true;                // set the cursor to the first column on the second line                lcd.SetCursorPosition(0, 1);                // print the number of milliseconds since reset:                lcd.Write((Utility.GetMachineTime().Ticks / 10000).ToString());                Thread.Sleep(100);                lcd.Backlight = false;                //}            }        }    }}

 


 

 

If anybody can help it me it would be appreciated because I am new to electronics but I am pretty good at programming. Thanks in advanced.



External Links:

 

 http://www.sainsmart...no-mega-r3.html

}



#2 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 01 February 2013 - 01:15 AM   Best Answer

MonsterHunter,

 

Wlecome to the forum.

 

I don't think that you can use A4 & A5 for I2C yet. The Netduino 2 Plus has its own SDA & SCL pins at the end of the DIO header. I think that you can tie the A4 to the SDA and A5 to the SCL with a jumper. At least until the firmware is updated to allow using the A4 & A5 connections.

 

Search for SDA & SCL on the forum uner the NP2+ and you should find additional information

 

Chuck



#3 monsterhunter445

monsterhunter445

    New Member

  • Members
  • Pip
  • 2 posts

Posted 01 February 2013 - 02:07 PM

Thanks, good to know.



#4 gabesilva

gabesilva

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 June 2013 - 07:54 PM

@MonsterHunter445, I have the same setup as you - a ND+2 with the same I2C LCD. Instead of connecting the SDA and SCL of the LCD to A4 and A5, I tied it to SD and SC repectively. Unfortunately it does not work. I hope someone can provide a simple "Hello World" sample out there for the ND+2 interfacing an I2C LCD. Please advise. Thanks 



#5 JerryK

JerryK

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 June 2014 - 09:58 PM

I am having the same issue, and have spent days trying to get it to work. Anybody else have any luck?







Also tagged with one or more of these keywords: lcd, sainsmart, i2c

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.