Show Posts
Pages: [1]
1  Using Arduino / Displays / Re: 12864 ST7920 LCD + Universal Serial Digole: UART/IIC/I2C/SPI Adapter on: July 18, 2013, 11:45:34 am
Hello!
I also received a 12864 LCD but mine has an I²C interface.
I have identified it on channel 68 (0x68) of the I²C bus.
After reading the forum and information about it at the Arduino.cc website, I am even more confused on how to make it do anything.
If anyone has a basic example sketch to post, I would be very appreciative as I have found I learn best by picking apart other peoples examples then modifying them to my needs.

Thank you!
2  Using Arduino / Displays / Re: Multiple I²C (I2C) LCD Displays on: June 12, 2013, 10:18:34 pm
Quote
How Did you change the addresses of the I2C ? I bought 3 and they all have the same address and I cant change it.
I use three of these I got them off eBay.
http://www.ebay.com/itm/190844921332?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
http://i1270.photobucket.com/albums/jj620/dykb1982/new/fsdjkkl-2_zps0031289b.jpg

I am using three 16x2 LCDs that were hacked out of old Networking equipment.
The 4th 16x2 LCD and I²C control board, I got together months ago, but I can't remember from where.
The chips used on the one I've been using for months and the three I got from the link above are completely different
so to run both in the same sketch, it requires both libraries and two different initialization codes.
If I initialize the older one with LiquidCrystal_I2C(0x20,16,2), the it doesn't respond but the others will.
It will only respond to LiquidCrystal (0) and in void setup() it will initialize with lcd.begin(16,2);

hope this clears it up a little.
3  Using Arduino / Displays / Re: Multiple I²C (I2C) LCD Displays on: June 12, 2013, 02:53:39 pm
Thanks to some great members from The Geek Group, it was brought to my attention that 3 of my I²C LCD Controllers required a different library than the I²C LCD Board I've had for the last couple months.

Now with a modified test sketch, I managed all 4 LCD's to display test messages simultaneously.

Code:
/*
 * Displays text sent over the serial port (e.g. from the Serial Monitor) on
 * an attached LCD.
 */
#include <Wire.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal lcd0(0);
LiquidCrystal_I2C lcd1(0x21,16,2);  // set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd2(0x22,16,2);
LiquidCrystal_I2C lcd3(0x23,16,2);

void setup()
{
  lcd0.begin(16,2);
  lcd1.init();                      // initialize the lcd
  lcd1.backlight();
  lcd2.init();                      // initialize the lcd
  lcd2.backlight();
  lcd3.init();                      // initialize the lcd
  lcd3.backlight();
  Serial.begin(9600);
  lcd0.print("Test 1");
  lcd1.print("Test 2");
  lcd2.print("Test 3");
  lcd3.print("Test 4");
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd1.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd1.write(Serial.read());
    }
  }
}

https://docs.google.com/file/d/0BzJvWIL7mrfcWktXak1kbXNER0E/edit
4  Using Arduino / Displays / Re: Multiple I²C (I2C) LCD Displays on: June 10, 2013, 03:19:00 pm
That's the thing. I don't know.
I want to learn but there aren't too many places I can find.
5  Using Arduino / Displays / Re: Multiple I²C (I2C) LCD Displays on: June 10, 2013, 02:41:47 pm
This is a straight forward sketch that doesn't work.
I think it gets the point across of what I'm trying to do.
I have never tried to do multiple addresses on I²C before.
this is all just experimentation for possible future projects.

Code:
#include <LiquidCrystal.h>
#include <Wire.h>
LiquidCrystal lcd(0);
LiquidCrystal lcd1(0x21);
LiquidCrystal lcd2(0x22);
LiquidCrystal lcd3(0x23);

void setup() {
  lcd.begin(16,2);
  lcd1.begin(16,2);
  lcd2.begin(16,2);
  lcd3.begin(16x2);
  lcd.setBacklight(HIGH);
  lcd1.setBacklight(HIGH);
  lcd2.setBacklight(HIGH);
  lcd3.setBacklight(HIGH);
  lcd.clear();
  lcd1.clear();
  lcd2.clear();
  lcd3.clear();
  lcd.setCursor(0,0);
  lcd.print("Test");
  Wire.beginTransmission (0x21);
  lcd1.setCursor(0,0);
  lcd1.print("Test1");
  Wire.endTransmission (0x21);
  Wire.beginTransmission (0x22);
  lcd1.setCursor(0,0);
  lcd1.print("Test2");
  Wire.endTransmission (0x22);
  Wire.beginTransmission (0x23);
  lcd1.setCursor(0,0);
  lcd1.print("Test3");
  Wire.endTransmission (0x23);
}
6  Using Arduino / Displays / Multiple I²C (I2C) LCD Displays on: June 10, 2013, 02:16:24 pm
Hello.
I have 4 16x2 LCD Displays all connected to the same I²C bus.
Their addresses are 0x20, 0x21, 0x22, & 0x23.
I am trying to get them to all show different information at the same time but the only one I can get to do anything is the one at 0x21.
I currently don't have any example sketched as I am trying to modify existing incomplete sketches.

I use the #include <LiquidCrystal.h> & #include <Wire.h> libraries.
I tried to use Wire.beginTransmission (0x21); & Wire.endTransmission (0x21); along with lcd.clear(); & lcd.write("Hello"); to no avail.
My LCD remains unresponsive.

I know it's a software issue. I just can't figure out the code, nor can I find an example code for using multiple LCD Displays.

Any help would be appreciated.
7  Using Arduino / Programming Questions / Re: Time and TimeAlarms Libraries – Ask here for help or suggestions on: April 09, 2013, 09:25:50 am
Last night, I got this message. I re-enabled the two lines in question then resent the time code.
I then applied external power and removed the Serial Line and shut down my computer to leave it running without the computer.
It ran all night. I just got home from work and turned on my computer. The Arduino Clock is still in perfect sync with my PC.
It is displaying all the correct information.

Thank you for your help!
8  Using Arduino / Programming Questions / Re: Time and TimeAlarms Libraries – Ask here for help or suggestions on: April 08, 2013, 09:47:29 am
Hello,
I'm sorry if this has been covered but I couldn't find it.
I modified the 'TimeSerialDateStrings' to include a 16x2 I²C LCD Display.
It seems to display okay for a minute, but then seems to get erroneous data causing it to display incorrect information.

It would start off displaying:
10:38:16 Mon
Apr 08, 2013

but after a minute it would change to something seemingly random like:
21:11:26 Fri
Aug 29, 2104

and it doesn't do this once. I haven't been able to get a time interval of when these errors occur, but if I could get some help fixing them, it would be appreciated. I have also seen it display years that contain 5 digits. That may have been an alignment issue tho.

Code:
/*
 * TimeSerialDateStrings.pde
 * example code illustrating Time library date strings
 *
 * This sketch adds date string functionality to TimeSerial.pde
 *
 */
 
#include <Time.h> 
#include <Wire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(0); //I²C

#define TIME_MSG_LEN  11   // time sync to PC is HEADER followed by unix time_t as ten ascii digits
#define TIME_HEADER  'T'   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message

void setup()  {
  lcd.begin(16,2);lcd.setBacklight(HIGH);
  Serial.begin(9600);
  setSyncProvider( requestSync);  //set function to call when sync required
  Serial.println("Waiting for sync message");
}

void loop(){   
  if(Serial.available() )
  {
    processSyncMessage();
  }
  if(timeStatus()!= timeNotSet)
  {
    digitalClockDisplay(); 
  }
  //delay(1000); //Disabled because I am not sending time to the Serial Monitor.
                 //I'm sending it to an LCD and the 1 second delay causes it to apear like it skips 1 second every 11 seconds even tho it really doesn't.
}

void digitalClockDisplay(){
  // digital clock display of the time
  lcd.setCursor(2,0);
  printDigits(hour());
  lcd.setCursor(4,0);
  lcd.print(":");
  lcd.setCursor(5,0);
  printDigits(minute());
  lcd.setCursor(7,0);
  lcd.print(":");
  lcd.setCursor(8,0);
  printDigits(second());
  lcd.print(" ");
  lcd.print(dayShortStr(weekday()));
  lcd.print(" ");
  lcd.setCursor(2,1);
  lcd.print(monthShortStr(month()));
  lcd.print(" ");
  printDigits(day());
  lcd.print(", ");
  lcd.print(year());
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  //lcd.print(":"); //seemed to be getting in the way, nut I may be wrong
  if(digits < 10)
    lcd.print('0');
  lcd.print(digits);
}

void processSyncMessage() {
  // if time sync available from serial port, update time and return true
  while(Serial.available() >=  TIME_MSG_LEN ){  // time message consists of a header and ten ascii digits
    char c = Serial.read() ;
    lcd.clear();
    Serial.print(c); 
    if( c == TIME_HEADER ) {       
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){   
        c = Serial.read();         
        if( c >= '0' && c <= '9'){   
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number   
        }
      }   
      setTime(pctime);   // Sync Arduino clock to the time received on the serial port
    } 
  }
}

time_t requestSync()
{
  //Serial.print(TIME_REQUEST,BYTE); 
  //return 0; // the time will be sent later in response to serial mesg
}
Pages: [1]