Show Posts
Pages: 1 ... 29 30 [31]
451  Forum 2005-2010 (read only) / Interfacing / Re: Redefine "on fly" custom CGRAM characters problem on: March 16, 2010, 09:21:55 am
Oops, I missed this post..
It's exactly the same thing I'm doing ^.^
I'll see to adapt it for serial use, thank you Sparks -.^
452  Forum 2005-2010 (read only) / Interfacing / Re: Redefine "on fly" custom CGRAM characters problem on: March 15, 2010, 06:10:47 pm
Harf... indeed, my English is "possibly" not very good  :smiley
Of course, like I said, there's no easy way to have more than 8 customs chars.
I'll try to be more... Clear, next time -.^
453  Forum 2005-2010 (read only) / Interfacing / Re: Redefine "on fly" custom CGRAM characters problem on: March 15, 2010, 05:43:52 pm
I don't read it somewhere, in fact.
When I saw how CGRAM access works I just imagine it could be possible >.>

And for my previous code, there's something strange.. Maybe a timing RAM access problem.

But I rewrite some parts, and if the re-definition loop is not ending by a delay(), it's working ^.^

Here is a code where you can see it's working:

Code:
#include <SoftwareSerial.h>

#define txPin 2
SoftwareSerial LCD = SoftwareSerial(0, txPin);

void setup()
{
  pinMode(txPin, OUTPUT);
  LCD.begin(9600);
  // définition des graphiques par défaut
  setGFX(0,152,152,128,131,132,132,131,128); // °C
  setGFX(1,128,128,130,135,130,128,128,128); // +
  setGFX(2,128,128,128,135,128,128,128,128); // -
  setGFX(3,138,159,145,142,132,132,152,128); // prise 220V
  setGFX(4,142,145,145,145,145,145,159,128); // batterie (vide à l'origine)
  setGFX(5,128,128,128,159,128,128,159,128); // sortie 12V
  setGFX(6,128,128,136,149,130,128,159,128); // sortie 220V
  setGFX(7,128,128,135,133,135,130,129,128); // petite prise
  // initilisation de l'affichage
  setBackLight();
  clearLCD();
}

void loop()
{
  selectLineOne();
  LCD.print(3, BYTE);
  LCD.print(" 14.21V");
  LCD.print(" ");
  LCD.print(1, BYTE);
  LCD.print("19.4");
  LCD.print(0, BYTE);
  selectLineTwo();
  LCD.print(4, BYTE);
  LCD.print("  3.12A");
  LCD.print(" ");
  LCD.print(7, BYTE);
  LCD.print(6, BYTE);
  LCD.print(7, BYTE);
  LCD.print(5, BYTE);
  LCD.print(7, BYTE);
  LCD.print(5, BYTE);
  LCD.print(" ");
  animGFX();
}

void animGFX(){
  delay(500);
  setGFX(4,142,145,145,145,145,159,159,128); // batterie 1/5
  delay(500);
  setGFX(4,142,145,145,145,159,159,159,128); // batterie 2/5
  delay(500);
  setGFX(4,142,145,145,159,159,159,159,128); // batterie 3/5
  setGFX(6,128,128,130,149,136,128,159,128);
  delay(500);
  setGFX(4,142,145,159,159,159,159,159,128); // batterie 4/5
  delay(500);
  setGFX(4,142,159,159,159,159,159,159,128); // batterie pleine
  delay(750);
  setGFX(4,142,145,145,145,145,145,159,128); // batterie vide
  setGFX(6,128,128,136,149,130,128,159,128);
}

void setGFX(byte pos, byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8){
  LCD.print(0xFE, BYTE); // appel de fonction sur le HD44780
  LCD.print(64 + pos * 8, BYTE); // accès à la CGRAM
  LCD.print(b1, BYTE);
  LCD.print(b2, BYTE);
  LCD.print(b3, BYTE);
  LCD.print(b4, BYTE);
  LCD.print(b5, BYTE);
  LCD.print(b6, BYTE);
  LCD.print(b7, BYTE);
  LCD.print(b8, BYTE);
}
void selectLineOne(){ // place le curseur au début de la ligne 1
  LCD.print(0xFE, BYTE);
  LCD.print(128, BYTE);
  delay(2);
}
void selectLineTwo(){ // place le curseur au début de la ligne 2
  LCD.print(0xFE, BYTE);
  LCD.print(192, BYTE);
  delay(2);
}
void setBackLight(){
  LCD.print(0x7C, BYTE);
  LCD.print(130, BYTE);
  delay(100);
}
void clearLCD(){
  LCD.print(0xFE, BYTE);
  LCD.print(0x01, BYTE);
  delay(10);
}
void resetLCD(){
  LCD.print(0xFE, BYTE);
  LCD.print(0x72, BYTE);
}

I imagine it can help some people who's looking for a solution to use more than 8 customs chars -.^
Or who want to make animate icons, like you can see in the code just here ^.^
454  Forum 2005-2010 (read only) / Interfacing / Re: Redefine "on fly" custom CGRAM characters problem on: March 14, 2010, 01:24:47 pm
Nobody can help meh?..  :-[
455  Forum 2005-2010 (read only) / Interfacing / Redefine "on fly" custom CGRAM characters problem on: March 13, 2010, 10:02:07 pm
Hi all -.^

[With Arduino2009 + SparkFun SerLCD 16x2]

Since I'm trying to define more than 8 CGRAM characters without success (HD44780 speak about more ?) I saw what is possible to redefine "on fly" custom characters because CGRAM is refresh continuously.
It could be another way to make small animate icons etc. ^.^

But I get something unexpected: When I try to write after half the bottom line of the LCD it compromises other parts of the screen O.o
(start blinking, etc.)

I'm a bit noob with those gears, so here is a simple code:

Code:
#include <SoftwareSerial.h>

#define txPin 2
SoftwareSerial LCD = SoftwareSerial(0, txPin);

void setup()
{
  pinMode(txPin, OUTPUT);
  LCD.begin(9600);
  // définition des graphiques par défaut
  setGFX(0,152,152,128,131,132,132,131,128); // °C
  setGFX(1,128,128,130,135,130,128,128,128); // +
  setGFX(2,128,128,128,135,128,128,128,128); // -
  setGFX(3,138,159,145,142,132,132,152,128); // prise
  setGFX(4,142,145,145,145,145,145,159,128); // batterie (vide à l'origine)
  setGFX(5,128,128,128,128,128,128,128,128); //
  setGFX(6,128,128,128,128,128,128,128,128); //
  setGFX(7,128,128,128,128,128,128,128,128); //
  // initilisation de l'affichage
  setBackLight();
  clearLCD();
}

void loop()
{
  selectLineOne();
  LCD.print(3, BYTE);
  LCD.print(" 14.21V");
  LCD.print(" ");
  LCD.print(1, BYTE);
  LCD.print("19.4");
  LCD.print(0, BYTE);
  selectLineTwo();
  LCD.print(4, BYTE);
  LCD.print("  3.12A");
  //LCD.print("  ");
  //LCD.print("test");
  setGFX(4,142,145,145,145,145,145,159,128); // batterie vide
  delay(500);
  setGFX(4,142,145,145,145,145,159,159,128); // batterie 1/5
  delay(500);
  setGFX(4,142,145,145,145,159,159,159,128); // batterie 2/5
  delay(500);
  setGFX(4,142,145,145,159,159,159,159,128); // batterie 3/5
  delay(500);
  setGFX(4,142,145,159,159,159,159,159,128); // batterie 4/5
  delay(500);
  setGFX(4,142,159,159,159,159,159,159,128); // batterie pleine
  delay(750);
}

void setGFX(byte pos, byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8){
  LCD.print(0xFE, BYTE); // appel de fonction sur le HD44780
  LCD.print(64 + pos * 8, BYTE); // accès à la CGRAM
  LCD.print(b1, BYTE);
  LCD.print(b2, BYTE);
  LCD.print(b3, BYTE);
  LCD.print(b4, BYTE);
  LCD.print(b5, BYTE);
  LCD.print(b6, BYTE);
  LCD.print(b7, BYTE);
  LCD.print(b8, BYTE);
}
void selectLineOne(){ // place le curseur au début de la ligne 1
  LCD.print(0xFE, BYTE);
  LCD.print(128, BYTE);
  delay(2);
}
void selectLineTwo(){ // place le curseur au début de la ligne 2
  LCD.print(0xFE, BYTE);
  LCD.print(192, BYTE);
  delay(2);
}
void setBackLight(){
  LCD.print(0x7C, BYTE);
  LCD.print(130, BYTE);
  delay(100);
}
void clearLCD(){
  LCD.print(0xFE, BYTE);
  LCD.print(0x01, BYTE);
  delay(10);
}
void resetLCD(){
  LCD.print(0xFE, BYTE);
  LCD.print(0x72, BYTE);
}
If you uncomment lines 36 & 37 you can see what's append.

I hope my code and my English is not too bad,
thanks for any help *.*
Pages: 1 ... 29 30 [31]