Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Chris O.

Pages: 1 2 [3]
31
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 25, 2015, 10:11:48 PM »
Hi

I do not own this display so it's hard to do testing.
Please test this sketch for me, not sure if this will print H and then Clear the display.
Code: [Select]
// Test print [ H ] and then Clear display with Wire Library.

// Wire Library, This library allows you to communicate with I2C / TWI devices
// Board           I2C / TWI pins
// Uno, Ethernet   A4 (SDA), A5 (SCL)
// Mega2560        20 (SDA), 21 (SCL)
// Leonardo         2 (SDA),  3 (SCL)
// Due             20 (SDA), 21 (SCL), SDA1, SCL1
#include <Wire.h>
#define I2C_ADDR 0x3c  // Define I2C Address, For the US2066 0x3c or 0x3d
// NOTE: Important to include Wire.h before OLedI2C.h
#include <OLedI2C.h>  // OLedI2C library http://gadjetsblog.blogspot.com/2013/09/oled-1602-display-and-library-for.html
//library by Phil Grant 2013 www.gadjet.co.uk
OLedI2C LCD;


void setup() {
  Wire.begin(); // Start Wire Library
  LCD.init(); // initialize the lcd
}

void loop() {

  //Set cursor position to col and row, top row is 0, first col is 0
  // no longer required LCD.cursPos(4,0); //(col,row)
  LCD.sendString("Test print >", 4, 0);    //("String", col, row)
  delay(2000); //2sec

  // test 1 / print H
  // For the US2066, the slave address is either “b0111100”/0x3c or “b0111101”/0x3d
  Wire.beginTransmission(I2C_ADDR); // start condition + Define I2C Address where the US2066 is, and set  R/W# bit to logic “0” write mode.

  // 5) After the transmission of the slave address, either the control byte or the data byte may be sent across the SDA. A control
  // byte mainly consists of Co and D/C# bits following by six “0”’s.
  // a. If the Co bit is set as logic “0”, the transmission of the following information will contain data bytes only.
  // b. The D/C# bit determines the next data byte is acted as a command or a data. If the D/C# bit is set to logic “0”,
  // it defines the following data byte as a command. If the D/C# bit is set to logic “1”, it defines the following data
  // byte as a data which will be stored at the DDRAM. The DDRAM address counter will be increased by one
  // automatically after each data write.

  // Co bit is set as logic “0”data bytes only,  D/C# bit is set to logic “1”[data]
  ////////////cd+6“0”’s.  // Co & D/C# bits
  Wire.write(B01000000); // control byte or the data byte, Co and D/C# bits following by six “0”’s.
  Wire.write(B01001000); // print H  [8bit (hi bit 0100/low bit 1000
  Wire.endTransmission(); // stop condition, 7) The write mode will be finished when a stop condition is applied.
  delay(5000); // 5sec. delay

  // test 2 / Clear display
  LCD.sendString("Clear dis.in 2sec.", 1, 1);
  delay(2000);
  //Clear display
  Wire.beginTransmission(I2C_ADDR); //Define I2C Address where the US2066 is
  // control byte or the data byte, Co and D/C# bits following by six “0”’s.
  Wire.write(B10000000); //  Co bit is set to logic “1”, D/C# bit is set to logic “0”, it defines the following data byte as a command.
  Wire.write(B00000001);  // Clear display
  Wire.endTransmission(); // stop condition.
  delay(5000); // 5sec. delay
}

32
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 22, 2015, 08:52:57 PM »
This is other way of printing a  char
lcd.print((char)1); //print char

Code: [Select]
#include <OLEDFourBit.h> // Works with NewHAVEN NHD-0420DZW-AY5-ND
//#include <LiquidCrystal.h>
OLEDFourBit lcd(7, 4, 10, 5, A3, A4, A5);
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte newChar0[8] = {
  B00000,
  B00000,
  B10101,
  B11101,
  B11101,
  B10101,
  B00000,
  B00000
};

byte newChar1[8] = {
  B10000,
  B01000,
  B00101,
  B00100,
  B00100,
  B00101,
  B01000,
  B10000
};

byte newChar15[8] = {
  B10001,
  B01010,
  B01110,
  B00100,
  B00100,
  B01110,
  B01010,
  B10001
};
void setup() {
  lcd.createChar(0, newChar0);
  lcd.createChar(1, newChar1);
  lcd.createChar(15, newChar15);
  lcd.begin(20, 4);


}
void loop() {
  lcd.setCursor(2,0); //line 1
  lcd.write(1); //PRINT
  lcd.setCursor(0,1); ////line 2

  lcd.write(0); //PRINT
  lcd.setCursor(0,2); //line 3
  lcd.print("lcd.print((char)15)");
  lcd.setCursor(10,3); //line 4
  lcd.print((char)15); //other way of printing a  char
  delay(1000);
}

33
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 22, 2015, 07:03:52 PM »
Liquid Crystal Display Custom Character Designer

http://mikeyancey.com/hamcalc/lcd_characters.php

34
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 22, 2015, 06:52:13 PM »
Two Custom Characters
Code: [Select]

#include <OLEDFourBit.h> //  NewHAVEN NHD-0420DZW-AY5-ND
//#include <LiquidCrystal.h>
OLEDFourBit lcd(7, 4, 10, 5, A3, A4, A5);
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte newChar1[8] = {
  B00000,
  B00000,
  B10101,
  B11101,
  B11101,
  B10101,
  B00000,
  B00000
};

byte newChar2[8] = {
  B10000,
  B01000,
  B00101,
  B00100,
  B00100,
  B00101,
  B01000,
  B10000
};

void setup() {
  lcd.createChar(0, newChar1);
  lcd.createChar(1, newChar2);
  lcd.begin(20, 4);
 

}
void loop() {
  lcd.setCursor(2,0);
  lcd.write(0); //PRINT
  lcd.setCursor(2,1);
  lcd.write(1); //PRINT

  delay(1000);
}

35
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 22, 2015, 06:13:15 PM »
Hmm ok
Can you try this.

Code: [Select]
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte newChar[8] = {
        B00000,
        B00000,
        B10101,
        B11101,
        B11101,
        B10101,
        B00000,
        B00000
};

void setup() {
    lcd.createChar(0, newChar);
    lcd.begin(20, 4);
    lcd.write(0);
}

void loop() {}

36
OLEDs / Re: Library that works fine on the NHD-0420CW-A*3
« on: March 20, 2015, 10:36:35 PM »
Quote
The only missing function, at least one I'd like to see is a custom character. Most controllers allow for this, and the NHD420CW does. Just not in this library. And I speak entirely about Arduino Uno. But it is doing what I needed, with the exception of needing 8 custom characters I need to represent with letters. I tried adding it but while I think I got the character creation right, for all I've looked, I cannot see how to select a custom character (anybody give me a pointer on THAT??

Hi
I hope this will help.
It's for my arduino-matrixorbital
A software emulator for Matrix Orbital character display commands on Arduino.
Example sketch that uses Matrix Orbital type commands, look at case 78: // Define custom character

Code: [Select]
#include <OLEDFourBit.h> // Works with NewHAVEN NHD-0420DZW-AY5-ND
// Added fixes by Chris O. to OLEDFourBit library, Compatibility with previous versions of IDE. NOTE tested on Aduino 023 IDE <---> Aduino 1.0.4 IDE
// NOTE: Arduino Micro Pin Mapping i used.
OLEDFourBit lcd(12, A0, A1, A2, A3, A4, A5); //with rw pin (12, 11, 10, 5, 4, 3, 2);
//OLEDFourBit lcd(12, 14, 15, 16, 17, 18, 19);

// these constants won't change.  But you can change the size of
// your LCD using them:
const int numRows = 4; // 4x20 LCD
const int numCols = 20;
//
byte rxbyte = 0; // incoming data storage

void setup() {
  Serial.begin(19200); // Default baudrate.
  lcd.begin(numCols, numRows); // Change this for other screen sizes. 
  lcd.print("Arduino Emulator for");
  lcd.setCursor(1, 1);
  lcd.print("Matrix Orbital!");
  lcd.setCursor(2, 2);
  lcd.print("Character Display!");
  lcd.command(0b00010000); //Moves the cursor back one space before the blinking cursor
  lcd.command(0b00001101); // 0b00001DCB Show Blinking Block Cursor with out Underscore

  delay(5000); //delay 5 sec
  // while (serial_getch() == 0 ){   //delay [ Wait for OS to load ]
  //   rxbyte = serial_getch();
  //}
  lcd.command(0b00001100); //Turn off the blinking cursor: on exit
  //lcd.noBlink(); // Turn off the blinking cursor: on exit / no good it will turn off the display ????????? lib. problem?

  lcd.clear(); // clear the screen
  lcd.setCursor(0,0);
}
void loop() {
  // incoming data storage
  byte temp; // Parameter storage
  byte temp2; //2nd Parameter storage

  rxbyte = serial_getch(); //get byte and store in rxbyte

  if (rxbyte == 254) { //Matrix Orbital uses 254 prefix for commands
    switch (serial_getch()) { //get byte

    case 71:  //set cursor position
      temp = (serial_getch() - 1);  //get column byte
      switch (serial_getch())  //get row byte
      {
        //line 1 is already set up
      case 2:
        temp += 0x40;
        break;
      case 3:
        temp += 0x14;
        break;
      case 4:
        temp += 0x54;
        break;
      default:
        break;
      }
      lcd.command(0b10000000 + temp);
      delay(1);
      break;

    case 72: // Cursor home (doesn't clear the screen!)
      //lcd.home();
      lcd.setCursor(0,0);
      break;

    case 76: // Move cursor left  0b00010000 / dec16 /hex10
      lcd.command(16);//Cursor/Display Shift  hex(0x10); //set cursor position one character to the left
      break;

    case 77: // Move cursor right 0b00010100 / dec20 /hex14
      lcd.command(20);
      break;

    case 78: // Define custom character (2 parameters, id, data)
      lcd.command(64 + (serial_getch() * 8));
      for (temp = 8; temp != 0; temp--) {
        lcd.write(serial_getch()); //works with Adafruit_CharacterOLED library
      }
      break;
    }
    return; // Stop and start again.
  }

  // Otherwise its a plain char so we print it to the LCD.
  //lcd.write(rxbyte);
  lcd.print((char)rxbyte);  //otherwise a plain char so we print it to lcd
} // END of main loop

// ***********************************************************************************************************
// *           Get byte
// *             
// *           Waits for a byte to be available, reads and returns it.
// *
// ***********************************************************************************************************
byte serial_getch() { // Get byte from Serial
  while (Serial.available() == 0);
  return Serial.read();
}

NOTE: This is not a complete code its missing many commands.

37
OLEDs / Re: NHD-0420DZW-AB5 SPI Clarification
« on: December 05, 2014, 09:38:48 PM »
Hi
I'm a happy user of the Newhaven-NHD-0420DZW-AY5.
But i use this datasheets http://www.adafruit.com/datasheets/WS0010.pdf

The main differences in the instructions.
1) Has a Character mode and a Graphic Mode so it requires one additional step to specify the mode which it runs in.
2) The "Function Set" instruction requires you to specify which Font Tables (2 available) to use.
3) Has a Bit in one of the instructions to allow you to turn enable/disable the internal power, Embedded DC-DC voltage converter ,Brightness DIM/FULL  :)

I'm not 100% sure if Newhaven Display use ( WS0010 OLED ) Driver/Controller IC utilizing CMOS Technology specially designed to display
alphanumeric and Japanese kana characters as well as symbols and graphics.
But i did get the Brightness DIM/FULL  control by going in the graphic mode and set the internal power ON/OFF.

I hope this helps.
Chris O.
 ;)

Pages: 1 2 [3]