Author Topic: Shift position after "clear screen" instruction  (Read 2898 times)

dreiss

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Shift position after "clear screen" instruction
« on: September 17, 2015, 12:30:54 AM »
On the NHD-0420CW, is the shift position expected to be restored to 0 when issuing a "clear screen" instruction (command 0x01)?  What about "return home" when the display is off (the "D" bit in the "Display ON / OFF Control" command)?  I'm seeing some very strange behavior.

After completely powering off the module (0 volts, all capacitors drained), I power it on and issue these commands:

Code: [Select]
// Set 4-line mode
command(0x3A);
command(0x09);
command(0x38);
// Display off
command(0x08);
// Clear screen
command(0x01);
// Display on
command(0x0C);
// Write two characters at current location.
data(0x30);
data(0x41);
// Move to second line and write two more characters.
command(0xA0);
data(0x32);
data(0x42);

I expect that all four characters will be on the left side of the screen (or right, because it is reversed), but instead I see them split: two on the left and two on the right.

This behavior is very fragile.  In *only* happens after a power-on.  After asserting the reset pin, the same command sequence gives the proper result.  Also, small changes to the code fix it.  For example, replacing the
Code: [Select]
command(0x08) with
Code: [Select]
0x08,0x0C,0x08 (display off, on, off) fixes it.  Issuing a
Code: [Select]
command(0x02) (return home) fixes it, but only if it is *after*
Code: [Select]
command(0x08).

Can anyone else replicate this behavior?  I am using I2C.

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: Shift position after "clear screen" instruction
« Reply #1 on: September 17, 2015, 04:37:55 PM »
I was wondering if you could post a picture of what you are seeing.

dreiss

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Shift position after "clear screen" instruction
« Reply #2 on: September 18, 2015, 02:45:34 AM »
This is what the code produces after a hard power off (which seems wrong):



This is what the modified code produces, or what the original code produces after asserting the reset pin:



I'm not concerned about the mirror-image effect.  I can fix that with the bidirection register.

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: Shift position after "clear screen" instruction
« Reply #3 on: September 18, 2015, 12:16:51 PM »
This might have something to do with the initialization of the display. This seems like it might be an issue with the Entry Mode command where the display isn't incrementing the position after a datawrite properly.

If you are sending an initialization sequence can you post that as well?

dreiss

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Shift position after "clear screen" instruction
« Reply #4 on: September 18, 2015, 02:39:23 PM »
The first code snippet is my initialization sequence.

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: Shift position after "clear screen" instruction
« Reply #5 on: September 18, 2015, 03:50:30 PM »
I would take a look at page 22 on the Datasheet of the display for a example initialization sequence. The sequence does address the flipped bits. I would suggest adding those along with what you already have.

I will wire one up to see if I can recreate what you were seeing.

 

NHD‐2.4‐240320SF‐CTXL#‐FTN1 touch-screen problem

Started by hbcelebiBoard TFTs

Replies: 5
Views: 3981
Last post December 10, 2014, 11:19:05 AM
by Michael_L
Resistive/Capacitive Touch Screen - Sample Code

Started by daotaBoard TFTs

Replies: 1
Views: 1127
Last post July 14, 2016, 07:57:46 AM
by Saurabh_B
NHD-7.0-800480EF-ATXV#-CTP touch screen details

Started by lakshminarayananBoard TFTs

Replies: 1
Views: 2718
Last post June 24, 2014, 10:33:38 AM
by Michael_L
Touch Screen - NHD-2.4-240320SF-CTXL#-FTN1

Started by marcelocrrBoard TFTs

Replies: 2
Views: 2273
Last post November 23, 2014, 10:07:16 AM
by PeterT
ATSAM4E -NHD-2.4-240320CF-CTXI#-F - White Screen

Started by gentlemannBoard TFTs

Replies: 2
Views: 1969
Last post February 18, 2016, 01:08:35 PM
by Paul_B