gaemir / u8glib

Automatically exported from code.google.com/p/u8glib
0 stars 0 forks source link

Promlems with ST7920 in fast parallel mode #130

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. connect ST7920 (8bit parallel interface) to arduino mega2560
2. draw some graphics

What is the expected output? What do you see instead?
Graphics shows but with a lot of artifacts. Adding a little delay (4-5 us) in 
the end of the method "u8g_com_arduino_fast_parallel_write" helps to fix it.

What version of the product are you using? On what operating system?

Original issue reported on code.google.com by dzmitry....@gmail.com on 14 Jan 2013 at 8:03

GoogleCodeExporter commented 9 years ago
thanks for reporting this issue.
Which version do you use?

Original comment by olikr...@gmail.com on 14 Jan 2013 at 9:27

GoogleCodeExporter commented 9 years ago
This issue is reproduced in ver. 1.08 and 1.09

Original comment by dzmitry....@gmail.com on 14 Jan 2013 at 9:49

GoogleCodeExporter commented 9 years ago
This is the code for 1.09. What did you modify? Did you increase the existing 
delay?

void u8g_com_arduino_fast_parallel_write(u8g_t *u8g, uint8_t val)
{
  u8g_com_arduino_fast_write_data_pin( 0, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 1, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 2, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 3, val&1 );
  val >>= 1;

  u8g_com_arduino_fast_write_data_pin( 4, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 5, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 6, val&1 );
  val >>= 1;
  u8g_com_arduino_fast_write_data_pin( 7, val&1 );
  val >>= 1;

  /* EN cycle time must be 1 micro second */
  u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
  u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
  u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
}

Original comment by olikr...@gmail.com on 14 Jan 2013 at 10:14

GoogleCodeExporter commented 9 years ago
No, I added new one delay at the end of this method. The same delay is used in 
method "u8g_com_arduino_parallel_write".

Original comment by dzmitry....@gmail.com on 14 Jan 2013 at 10:24

GoogleCodeExporter commented 9 years ago
oh, you mean:
  /* EN cycle time must be 1 micro second, digitalWrite is slow enough to do this */
  u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
  u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
  u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
  u8g_10MicroDelay(); /* ST7920 commands: 72us */   <<<<<<< YOU ADDED THIS???
}

Original comment by olikr...@gmail.com on 14 Jan 2013 at 10:33

GoogleCodeExporter commented 9 years ago
Yes

Original comment by dzmitry....@gmail.com on 14 Jan 2013 at 10:34

GoogleCodeExporter commented 9 years ago
ok, done

Original comment by olikr...@gmail.com on 14 Jan 2013 at 10:46

GoogleCodeExporter commented 9 years ago
THANKS!!!!

Original comment by olikr...@gmail.com on 14 Jan 2013 at 10:46

GoogleCodeExporter commented 9 years ago
no problem :)

Original comment by dzmitry....@gmail.com on 14 Jan 2013 at 10:52