Problem reading byte from LCD (SED1335 / RA8835)

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello to everybody.

In the war for making my LCD works properly, which uses a RA8835 chipset, SED1335 compatible) I found alibrary which includes ports to AVR, AT91, and a few more. Which can be downloaded from http://en.radzio.dxp.pl/sed1335/

My problem, with this labrary and with my own one, it's that I can write in Text Mode, and I can place a byte in graphic mode, but when you place a byte on the screen, you first read it in order to manipulate bits, and that read is failing. If I read a position on the Graphic RAM I always read 0b00010011.

The only differnece with the code that comes with the library is that I'm using PORTA for Control and PORTC for data on the Mega644.

Anyone successed with this LCD controller?

Thanks

Ezequiel

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

can you read anything back reliably in text mode?

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't try to read in text mode.

I have read again the RA8835 datasheet and implemented my own driver from the beginning, the results are:

* Good initialization, screen is clean
* I can write text
* I can write a byte in graphic mode but overwrites the previous one.

This is my "read" rutine:

unsigned char lcd_read_byte() {
	unsigned char data = 0;

	asm("nop"); asm("nop");
	GLCD_DATA_DDR = 0x00;
	GLCD_CTRL_PORT &= ~(BIT(GLCD_nRD) | BIT(GLCD_nCS));
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");

	data = GLCD_DATA_PIN;
	GLCD_CTRL_PORT |= (BIT(GLCD_nRD) | BIT(GLCD_nCS));
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");
	asm("nop"); asm("nop");

	return data;
}

unsigned char lcd_read_data () {
	GLCD_CTRL_PORT |= BIT(GLCD_A0);
	return lcd_read_byte();
}

And this is my setPixel

void glcd_setPixel(unsigned int x, unsigned int y, unsigned char color) {
	unsigned int address;
	unsigned int baseAddress = 0x2580;
	unsigned char offset;
	unsigned char low;
	unsigned char high;
	unsigned char byte = 0;

	address = (y * (GLCD_X_SIZE/8)) + (x / 8);
	offset = x - ((x / 8) * 8);

	address += baseAddress;

	low = (unsigned char) (address & 0x00ff);
	high = (unsigned char) ((address & 0xff00) >> 8);

	/// me posiciono en la memoria
	lcd_write_command(GLCD_COMMAND_CSRW);
	lcd_write_data(low);
	lcd_write_data(high);

	// leo byte en esa posicio
	lcd_write_command(GLCD_COMMAND_MREAD);
	byte = lcd_read_data();

	// e interpolo
	if (color != 0) {
	  byte |= (0x80 >> offset);
	}
	else {
	  byte &= (~(0x80 >> offset));
	}

	// me posiciono nuevamente en address
	lcd_write_command(GLCD_COMMAND_CSRW);
	lcd_write_data(low);
	lcd_write_data(high);


	// escribo el nuevo byte
	lcd_write_command(GLCD_COMMAND_MWRITE);
	lcd_write_data(byte);
}

I found that when I use "setPixel", on the screen I see the bit I wanted to switch on plus 0x43.

How I see this? Because I have run this:

glcd_setPixel(0,10,1);
glcd_setPixel(7,11,1);

and In the screen I see something like this on line 10 and 11:

**----**
-*----**

where * is bit on and - is bit off..

I think I have a mess when reading the data port...

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try reading in text mode. If that shows a problem then you may have a problem in the hardware, or with your timing. (reads from these controllers can be very slow compared to writes, so be sure to consult with the timing waveforms)

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think it's a timing issue, because the other drivers in the project section doesn't work with my board (ATMega644 at 16Mhz).

The timing waveforms are not so clear in the RA8835 datasheet.

Did you implement this driver or any other 8080 like with AVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't have any direct experience with this particular GLCD chip. So I'm only advising on what my experiences have been in the past with other chips. At a quick glance I don't see any glaring errors in your code.

As I said, try writing to the LCD in text mode, and then reading it back. If you can't read back what you wrote you definitely have a read problem. IF you do read back what you wrote, you likely have a problem elsewhere.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.