Pages: [1]   Go Down
Author Topic: serial display examples matrix orbital display  (Read 1420 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried using this example in the learning section it seems outdated? http://arduino.cc/playground/Learning/SerialLCD

It says to replace the BYTE and serial.print with serial.write. I did a find and replace for both of those then it just starts nit picking everything on down the page. i used thsi link http://blog.makezine.com/2011/12/01/arduino-1-0-is-out-heres-what-you-need-to-know/ to find out about replacing the serial.print etc.

I just need a real simple example that says hello world to my display and that is it. All the other examples have like 50 lines of code and expect me to know what to leave in or out.

and links on serial lcd displays using arduino I am actually quite dissapointed as i cant seem to find any and all my displays are serial matrix orbital displays.

here is my code so far after doing the find and replace, i get sketch_sep23c:153: error: expected primary-expression before ')' token on most any line i dont delete.

Code:
//  *
//  * ------------
//  *  Control a Serial LCD Display
//  *  
//  *  Tested on a Matrix Orbital model LCD0821 display.
//  *  Other diplays will work but may have slightly different
//  *  command codes and hardware setups.
//  *  
//  *  Copyleft 2006 by djmatic
//  *  
//  *   ------------
//  *
//  *


// Declare your program variables here


// Arduino and LCD setup

void setup()
{
  Serial.begin(19200); // era beginSerial


//       LCD setup commands: uncomment the ones you want to use
//       Note: These codes (i.e. the ones following 254) may have to be changed for
//       different manufacturer's displays

//       Turn Auto scroll ON
//         Serial.write(254, );
//         Serial.write(81, );    
//      
//       Turn Auto scroll OFF
//         Serial.write(254, );
//         Serial.write(82, );

//       Turn ON AUTO line wrap
//         Serial.write(254, );
//         Serial.write(67, );              

//       Turn OFF AUTO line wrap
//         Serial.write(254, );
//         Serial.write(68, );

//       Turn OFF the block cursor    
//       Note that setting both block and underline
//       cursors may give unpredictable results.
           Serial.write(254, );
           Serial.write(84, );              

//       Turn ON the block cursor
//         Serial.write(254, );
//         Serial.write(83, );  

//       Turn ON the underline cursor
//         Serial.write(254, );
//         Serial.write(74, );              

//       Turn OFF the underline cursor
//         Serial.write(254, );
//         Serial.write(75, );              
}




//  MAIN CODE

void loop()
{
  //backlightOn(0);  // turn the backlight on all the time

  clearLCD();
  Serial.write(" Hello");  // print text to the current cursor position
  newLine();              // start a new line
  Serial.write("Arduino");
  delay(5000);
}




//  LCD  FUNCTIONS-- keep the ones you need.

// clear the LCD
void clearLCD(){
  Serial.write(12, );
}


// start a new line
void newLine() {
  Serial.write(10, );
}


// move the cursor to the home position
void cursorHome(){
  Serial.write(254, );
  Serial.write(72, );
}


// move the cursor to a specific place
// e.g.: cursorSet(3,2) sets the cursor to x = 3 and y = 2
void cursorSet(int xpos, int ypos){  
  Serial.write(254, );
  Serial.write(71, );              
  Serial.write(xpos);   //Column position  
  Serial.write(ypos); //Row position
}


// backspace and erase previous character
void backSpace() {
  Serial.write(8, );
}


// move cursor left
void cursorLeft(){    
  Serial.write(254, );
  Serial.write(76, );  
}


// move cursor right
void cursorRight(){
  Serial.write(254, );
  Serial.write(77, );  
}


// set LCD contrast
void setContrast(int contrast){
  Serial.write(254, );
  Serial.write(80, );  
  Serial.write(contrast);  
}


// turn on backlight
void backlightOn(int minutes){
  Serial.write(254, );
  Serial.write(66, );  
  Serial.write(minutes); // use 0 minutes to turn the backlight on indefinitely  
}


// turn off backlight
void backlightOff(){
  Serial.write(254, );
  Serial.write(70, );  
}

can anyone edit that code down so a serial matrix orbital display hooked up like he shows using rx and tx pins can just say hello world to me etc. then i can take a breath adn move on but this is really annoying.
« Last Edit: September 23, 2012, 07:53:56 pm by ghost2501 » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can't do this:
Quote
           Serial.write(254, );
           Serial.write(84, );               

You should do this:
Code:
           Serial.write(254);
           Serial.write(84);               

regardless what they do to your display.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thanks like i said i used find and replace to get rid of the BYTE in his examples as that was the first error that came up. I am trying to figure out if i should stick with serial or go to i2c with this.

Regardless liek i said i cant find a serial display example that even compiles the code let alone talks to my display.

I wish there was a real simple serial lcd display test example everyones always says i remade thsi library etc and has a thousand commands or they have every command on the page adn have the hash marks blocking them all.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You should find ",BYTE" or ", BYTE" and replace with "". Not a joke. You can do that.

Every serial display is different from every other serial display. You need to stick to the program provided by your display seller. Once you know the baud rate the display is using, just use Serial.print("Hello"); to display on it.

The hash marks mean the line is commented out, so not to be executed.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i thought serial.print was replaced with the .write anyway it said that when i tried to compile/send it hence i replaced them all.

also random question is TTL to do with serial or does it have to to with i2c if i try to hook it up that way. There are jumpers that let the display talk using ttl  just wondering if i need to worry about ttl for i2c for troubleshooting.
« Last Edit: September 23, 2012, 11:29:33 pm by ghost2501 » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is the manual?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here is the link to the Manual http://www.matrixorbital.ca/manuals/LK_Series/LK162-12/LKVK162-12%20%28Rev4.0%29.pdf. I have since answered most of my questions i made the code compile just by deleting the space you suggested. The display kind of works it actually says:

Hello10Arduino12 or it could be 12 Hello10Arduino

I am still hoping for a more simplified sketch to use there is way way to much going on for me to start learning etc. I need the most basic sketch possible really. I did notice That on the sketch it says right below lcd functions serial print 12 and serial print 10 by start new line and clear display So I am assuming that maybe the code is just a little wrong there otherwise everything would work.

Code:
//  *
//  * ------------
//  *  Control a Serial LCD Display
//  * 
//  *  Tested on a Matrix Orbital model LCD0821 display.
//  *  Other diplays will work but may have slightly different
//  *  command codes and hardware setups.
//  *   
//  *  Copyleft 2006 by djmatic
//  * 
//  *   ------------
//  *
//  *


// Declare your program variables here


// Arduino and LCD setup

void setup()
{
  Serial.begin(19200); // era beginSerial


//       LCD setup commands: uncomment the ones you want to use
//       Note: These codes (i.e. the ones following 254) may have to be changed for
//       different manufacturer's displays

//       Turn Auto scroll ON
//         Serial.print(254);
//         Serial.print(81);     
//       
//       Turn Auto scroll OFF
//         Serial.print(254);
//         Serial.print(82);

//       Turn ON AUTO line wrap
//         Serial.print(254);
//         Serial.print(67);             

//       Turn OFF AUTO line wrap
//         Serial.print(254);
//         Serial.print(68);

//       Turn OFF the block cursor   
//       Note that setting both block and underline
//       cursors may give unpredictable results.
           Serial.print(254);
           Serial.print(84);               

//       Turn ON the block cursor
//         Serial.print(254);
//         Serial.print(83); 

//       Turn ON the underline cursor
//         Serial.print(254);
//         Serial.print(74);               

//       Turn OFF the underline cursor
//         Serial.print(254);
//         Serial.print(75);               
}




//  MAIN CODE

void loop()
{
  //backlightOn(0);  // turn the backlight on all the time

  clearLCD();
  Serial.print(" Hello");  // print text to the current cursor position
  newLine();              // start a new line
  Serial.print("Arduino");
  delay(5000);
}




//  LCD  FUNCTIONS-- keep the ones you need.

// clear the LCD
void clearLCD(){
  Serial.print(12);
}


// start a new line
void newLine() {
  Serial.print(10);
}


// move the cursor to the home position
void cursorHome(){
  Serial.print(254);
  Serial.print(72);
}


// move the cursor to a specific place
// e.g.: cursorSet(3,2) sets the cursor to x = 3 and y = 2
void cursorSet(int xpos, int ypos){ 
  Serial.print(254);
  Serial.print(71);               
  Serial.print(xpos);   //Column position   
  Serial.print(ypos); //Row position
}


// backspace and erase previous character
void backSpace() {
  Serial.print(8);
}


// move cursor left
void cursorLeft(){   
  Serial.print(254);
  Serial.print(76);   
}


// move cursor right
void cursorRight(){
  Serial.print(254);
  Serial.print(77);   
}


// set LCD contrast
void setContrast(int contrast){
  Serial.print(254);
  Serial.print(80);   
  Serial.print(contrast);   
}


// turn on backlight
void backlightOn(int minutes){
  Serial.print(254);
  Serial.print(66);   
  Serial.print(minutes); // use 0 minutes to turn the backlight on indefinitely   
}


// turn off backlight
void backlightOff(){
  Serial.print(254);
  Serial.print(70);   
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well now its acting weird and i didn't change anything. If i have the lcd tx pin to the ground like the playground tutorial shows there is a double bar (almost looks like a new paragraph symbol before the welcome screen and the program dosent get transferred to the display but if i unplug it from ground it receives it This is not how it was earlier. so now to get the same results as my above post i have to leave the displays tx wire unplugged completley from the arduino. Why is this so hard I cant find jack for any good serial lcd tutorial all the ones i find are hopelessly outdated or have like 50 different commands some hidden some not with cryptic remarks and i am supposed to know what all that is.

so now the lcd isnt even acting like it was earlier so I dont even have a solid reference or starting point anymore who knows whats going on. any help?
Logged

Georgia, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

looks like you changed all the Serial.write back into Serial.print

for one byte commands, instead of:
Code:
//       Turn Auto scroll ON
//         Serial.print(254);
//         Serial.print(81);     
//
use:
Code:
//       Turn Auto scroll ON
//         Serial.write(254);
//         Serial.write(81);     
//

for printing text use:
Code:
Serial.print("Hello");
or
Code:
Serial.println("Hello");

the serial.write command will only allow one byte per statement. Sending a NUL character is different. then you have to send Serial.write(\0);
Logged

Pages: [1]   Go Up
Jump to: