NKC Electronics

NKC Electronics Support, Project and Discussion Forums
It is currently Fri Oct 20, 2017 12:24 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Oct 12, 2012 8:25 pm 
Offline

Joined: Tue Oct 09, 2012 5:50 am
Posts: 1
Trying to get a NKC LCM1602K3 16x2 LCD working over I2C.
After much time determined that although the available documentation shows the pin connections for I2C, most everything else is incorrect.

The default address is 0x28 and the correct jumper to install is R1

The unit will function using low-level Wire calls, but this is very slow to code.

Has anyone found a LCD library that works with this module? Arduino 1.0.1 is preferred environment.


Top
 Profile  
 
PostPosted: Wed Oct 17, 2012 9:11 pm 
Offline

Joined: Thu Sep 08, 2011 9:59 pm
Posts: 71
Quote:
Has anyone found a LCD library that works with this module? Arduino 1.0.1 is preferred environment.

SerialLCD library created for i2c, SPI and RS232 (UART) interfaces: https://github.com/downloads/nkcelectronics/SerialLCD/SerialLCD.zip

Example sketch to use the library:
Code:
/*
  NKC Electronics serial display - Custom Characters
 
 Demonstrates how to add custom characters on an LCD  display. 
 This sketch prints "I <heart> Arduino!" and a little dancing man
 to the LCD.
 
  The circuit:
 * LCD SCL pin to Arduino SCL pin or Analog 5
 * LCD SDA pin to Arduino SDA pin or Analog 4
 * LCD VSS pin to GND
 * LCD VDD pin to +5V
 
 Based on the original CustomCharacter example from Arduino
 */
 
#include <SerialLCD.h>
#include <Wire.h>
 
// make some custom characters:
byte heart[8] = {
  0b00000,
  0b01010,
  0b11111,
  0b11111,
  0b11111,
  0b01110,
  0b00100,
  0b00000
};

byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};

byte frownie[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b00000,
  0b01110,
  0b10001
};

byte armsDown[8] = {
  0b00100,
  0b01010,
  0b00100,
  0b00100,
  0b01110,
  0b10101,
  0b00100,
  0b01010
};

byte armsUp[8] = {
  0b00100,
  0b01010,
  0b00100,
  0b10101,
  0b01110,
  0b00100,
  0b00100,
  0b01010
};

// Constructor.  Parameters: rows, columns, baud/i2c_address, interface (RS232, I2C, SPI)
SerialLCD lcd(2,16,0x28,I2C);

void setup() {
 
  // Initialize LCD module
  lcd.init();
 
  // create a new character
  lcd.createChar(0, heart);
  // create a new character
  lcd.createChar(1, smiley);
  // create a new character
  lcd.createChar(2, frownie);
  // create a new character
  lcd.createChar(3, armsDown);
  // create a new character
  lcd.createChar(4, armsUp);
   
  // Set Contrast
  lcd.setContrast(40);
  // Set Backlight
  lcd.setBacklightBrightness(8);
 
  lcd.home();
  lcd.displayVersion();
  delay(2000);
  lcd.clear();
  lcd.displayBaudRate();
  delay(2000);
  lcd.clear();
  lcd.displayI2CAddress();
  delay(2000);
  lcd.clear();
 
  // Write some text to the display
  lcd.home();
  lcd.print("I ");
  lcd.write((byte)0);
  lcd.print(" Arduino! ");
  lcd.write(1);
}

void loop() {
  // read the potentiometer on A0:
  int sensorReading = analogRead(A0);
  // map the result to 200 - 1000:
  int delayTime = map(sensorReading, 0, 1023, 200, 1000);
  // set the cursor to the bottom row, 5th position:
  lcd.setCursor(2, 5);
  // draw the little man, arms down:
  lcd.write(3);
  delay(delayTime);
  lcd.setCursor(2, 5);
  // draw him arms up:
  lcd.write(4);
  delay(delayTime);
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group