chipKIT® Development Platform

Inspired by Arduino™

Nokia 5110 GLCD library and wire library cause program hang

Created Wed, 15 Jun 2016 00:44:33 +0000 by andcvi


andcvi

Wed, 15 Jun 2016 00:44:33 +0000

I have been playing around with the Nokia 5110 display library from Rinky-Dink Electronics http://www.rinkydinkelectronics.com/library.php?id=48 and also I2c devices on my Cmod type board which uses the Cmod bootloader.

The demo programs for the Nokia work without any problems and the I2c devices I have tested LSM303 and I2c LCD display work as well separate to the Nokia 5110 library, but if I combine the libraries then my program hangs, if I delete out the Wire.begin(); and the compass lines then the graphics demo works.

I have also tried an Adafruit PCD8544 library for Chipkit boards, same result.

any solution to this problem would be greatly appreciated.

// LCD5110_Graph_Demo 
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of most of the functions
// in the library.
//
// This program requires a Nokia 5110 LCD module and home-made Cmod board
//
// It is assumed that the LCD module is connected to
// the following pins:
//      SCK  - Pin 19
//      MOSI - Pin 24
//      DC   - Pin 26
//      RST  - Pin 30
//      CS   - Pin 25
//
#include <LCD5110_Graph.h>
LCD5110 myGLCD(19,24,26,30,25);
extern unsigned char SmallFont[];
extern unsigned char MediumNumbers[];

#include <Wire.h>
#include <LSM303.h>
LSM303 compass;

void setup()
{
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
  myGLCD.setContrast(70);

  Wire.begin();
  compass.init();
  compass.enableDefault();
    
  // Calibration values. Use the Calibrate example program to get the values for
  // your compass.
  compass.m_min.x = -520; compass.m_min.y = -570; compass.m_min.z = -770;
  compass.m_max.x = +540; compass.m_max.y = +500; compass.m_max.z = 180;

}

void loop()
{
  myGLCD.clrScr();
  compass.read();
  int heading = compass.heading((LSM303::vector){0,-1,0});
  myGLCD.setFont(SmallFont);
  myGLCD.print(" Heading ", CENTER, 10);
  myGLCD.setFont(MediumNumbers);
  myGLCD.printNumI(heading, CENTER, 20);
  myGLCD.update();
  delay(1000);
}

[attachment=2]LCD5110_LSM303_Demo.zip[/attachment]

[attachment=1]LSM303.zip[/attachment]

[attachment=0]Chipkit Nokia 5110 Libraries.zip[/attachment]


majenko

Wed, 15 Jun 2016 08:07:06 +0000

Which version of the ide are you using? This sounds like a double begin problem that existed a while back.

Sent from my One Mini 2 using Tapatalk


andcvi

Wed, 15 Jun 2016 23:11:45 +0000

hello majenko,

Thanks for the reply.

Doesn't matter which IDE I use, mpide-0150, Arduino 1.6.7 or UECIDE 0.8.8alpha22, same result.

Anyway, I use UECIDE pretty much most of time since I downloaded it.