0

I am using an MSP430F5418 with the ST7565R LCD controller with easyGUI. I am using SPI to communicate with the LCD.

Suppose I have a screen like this:

Actual Screen

But sometimes (rarely) when I press a key (anything which make the testing board to move, usually it comes when pressing the key) the screen goes like this:

Jumbled

I didn't do anything on the code for this change... Why did it happen?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Harikrishnan
  • 3,664
  • 7
  • 48
  • 77
  • 1
    bad connectors? if the board moves then you're likely having a HW-related malfunction. One pin gets disconnected and instead of starting at 00000001b, you'll start at 00000000b and scrool a line up. go figure:-) – littleadv Jul 28 '11 at 05:57
  • 2
    this belongs to http://electronics.stackexchange.com/ – duedl0r Jul 28 '11 at 05:58
  • Sorry I will post it there. I read about the bad connectors. is there any chance to come it programatically – Harikrishnan Jul 28 '11 at 06:02
  • Since I am a new user in http://electronics.stackexchange.com/ they are not allowing me to post images – Harikrishnan Jul 28 '11 at 06:05

3 Answers3

2

It sounds like a bug in your code -- I am not familiar with the particulars of easyGUI or the particular controller, so this is just a wild guess, but would it so happen that somewhere in your code you would do a printf or write to stdout which then would go to the same device which is also your display, and when one of these characters is a newline or when the line wraps around the display would roll up one character?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Soren
  • 14,402
  • 4
  • 41
  • 67
  • No sir, I didn't do any printf. None of the c api is implemented. easygui is a tool to generate display data according to some value in the variable. – Harikrishnan Jul 28 '11 at 06:07
  • If it is interrupt related it must came for all presses. – Harikrishnan Jul 28 '11 at 06:07
  • If it is interrupt related could it not just be a bad interrupt handler which does not save/restore registers correctly? If so, then not **all** keypresses would cause this, but some could. – Soren Jul 28 '11 at 06:13
  • Yes. But I have only 4 keys. The four keys are working perfectly for some time. this display corruption not usual but is an accidental error. – Harikrishnan Jul 28 '11 at 06:19
  • When is say *some keys* -- I mean that it is non-deterministic, or rather it is determined with what else is happening at the exact time when the interrupt is received -- anyway, these are just guesses, and without any code to look at it would be hard to tell -- do you have access to a debugger where you can single-step though the code as it happens? – Soren Jul 28 '11 at 06:23
  • Sorry for incomplete info. actually On key press I am setting some values. And after that I call a function to refresh the screen. this function will generate the display data for these variables. then it sends to the LCD. That time is there any possibility to occur such an error? – Harikrishnan Jul 28 '11 at 06:27
  • And you are doing all this from withing your interrupt handler? What other interrupt would there be running on your system -- like would a timer-interrupt (or similar) break your interrupt handler when it takes too long to process? – Soren Jul 28 '11 at 06:32
  • No. The interrupt handler only sends a message to another task and the task is processing remaining info – Harikrishnan Jul 28 '11 at 06:39
  • @Soren let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1912/discussion-between-hari-and-soren) – Harikrishnan Jul 28 '11 at 07:18
1

I tried by adding the 'Display start line to zero' command before each LCD command so that the screen will never be corrupted. And That works for me :-). So it avoid the loose connections while moving the device.

Harikrishnan
  • 3,664
  • 7
  • 48
  • 77
0

It looks like you are using custom LCD glass. If that's the case check your connections between the display controller and the LCD glass. If the connections are not good it's possible that the display controller is turning on the wrong segments.

Check the pinout of the LCD glass along with the segments that are programmed to be on vs. the segments that are actually on to see if they are on adjacent pins. If they are then your connector is likely the problem.

mjh2007
  • 776
  • 1
  • 8
  • 17