Nokia 5110 GLCD library and wire library cause program hang

Post Reply
andcvi
Posts: 12
Joined: Fri Oct 31, 2014 11:33 pm

Nokia 5110 GLCD library and wire library cause program hang

Post by andcvi » Wed Jun 15, 2016 1:44 am

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.

Code: Select all

// 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);
}

LCD5110_LSM303_Demo.zip
(1.79 KiB) Downloaded 31 times
LSM303.zip
(5.48 KiB) Downloaded 29 times
Chipkit Nokia 5110 Libraries.zip
(390.6 KiB) Downloaded 36 times

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Nokia 5110 GLCD library and wire library cause program hang

Post by majenko » Wed Jun 15, 2016 9:07 am

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
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

andcvi
Posts: 12
Joined: Fri Oct 31, 2014 11:33 pm

Re: Nokia 5110 GLCD library and wire library cause program hang

Post by andcvi » Thu Jun 16, 2016 12:11 am

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.

Post Reply