View previous topic :: View next topic |
Author |
Message |
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Sun Nov 18, 2007 2:22 pm |
|
|
With te test code above not, but with the ccs-c driver
This driver did't work for me.
Strange that this code put correct the word 'test' on the lcd and that the glcd_text57(int16 x,int16 y,char* textptr,int8 size,int1 color) from the graphics.c file get some strange outputs
Code: | glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
delay_us(200);
TGLCD_DATA
glcd_sendByte('t');
glcd_sendByte('e');
glcd_sendByte('s');
glcd_sendByte('t');
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 18, 2007 2:35 pm |
|
|
Try increasing the delays. For example, this code has
delays of 1 or 2 cycles.
Quote: | void lcd_write_data(byte data)
{
output_c((data));
output_low(GLCD_CS);
delay_cycles(1);
output_low(GLCD_WR);
delay_cycles(2);
output_high(GLCD_WR);
output_high(GLCD_CS);
} |
As a quick test, try adding a '0' on the end of every delay_cycles()
line in the driver. Example:
Quote: | void lcd_write_data(byte data)
{
output_c((data));
output_low(GLCD_CS);
delay_cycles(10);
output_low(GLCD_WR);
delay_cycles(20);
output_high(GLCD_WR);
output_high(GLCD_CS);
} |
See if that helps. |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Sun Nov 18, 2007 3:04 pm |
|
|
This is not the problem
I use this code already in the above that working
I can remove the delay_us(200) on the above code,
then the also works ok |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Mon Nov 19, 2007 3:34 pm |
|
|
I have the following problem
The setCursorAddress routine didn't work correctly
If i use this it work
Code: | glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
glcd_sendByte(0x00);
glcd_sendByte(0x00);
glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
TGLCD_DATA
for(i=GLCD_TEXT_ADDR;i<GLCD_GRAPHICS_ADDR;i++){
glcd_sendByte('A');
}
|
But if i use the cursor routine the letter 'A' will not display
Code: | setCursorAddress(GLCD_TEXT_ADDR);
glcd_sendCMD(GLCD_CMD_DISPLAY_WRITE);
TGLCD_DATA
for(i=GLCD_TEXT_ADDR;i<GLCD_GRAPHICS_ADDR;i++) {
glcd_sendByte('A');
}
|
i think there is a problem with the setCursorAddress routine
Who can help me?? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 19, 2007 5:14 pm |
|
|
Try putting in a delay, instead of these two statements:
Code: |
glcd_sendByte(0x00);
glcd_sendByte(0x00);
|
Try doing this instead:
Does that also work ? |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Nov 20, 2007 12:08 pm |
|
|
@PCM programmer,
If i use this for setting the beginning of the text _adress to 0000
then it works
Code: | glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
glcd_sendByte(0x00); /// GLCD_TEXT_ADDR
glcd_sendByte(0x00); /// GLCD_TEXT_ADDR
|
but if i use the include routine from the ccs-c file then it did't working
Code: | setCursorAddress(GLCD_TEXT_ADDR); |
This is the code of the setCursorAddress
Code: | ////////////////////////////////////////////////////////////////////////////
// Purpose: Set the cursor address
// Inputs: A 16 bit integer containing the new cursor address
////////////////////////////////////////////////////////////////////////////
void setCursorAddress(int16 addr) {
glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
glcd_sendByte(*(int8*)(&addr));
glcd_sendByte(*(int8*)(&addr+1));
}
|
Why did this not work? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 20, 2007 12:16 pm |
|
|
I don't know. I wanted to see if those two lines of code just effectively
performed a delay. You don't want to do that experiment. So, that is all. |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Nov 20, 2007 12:22 pm |
|
|
Must i do then the following?
Code: | glcd_sendByte(*(int8*)(&addr));
delay_ms(1);
glcd_sendByte(*(int8*)(&addr+1));
delay_ms(1);
}
|
|
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Nov 20, 2007 12:30 pm |
|
|
So i have do this and it works now
Code: | void setCursorAddress(int16 addr) {
glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
delay_us(200);
glcd_sendByte(*(int8*)(&addr));
glcd_sendByte(*(int8*)(&addr+1));
}
|
Find it strange that this works without an delay
Code: | glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
glcd_sendByte(0x00);
glcd_sendByte(0x00);
|
EDIT
The setCursorAddress did't work correctly,
if i pass GLCD_GRAPHICS_ADDR to the setcuraddress
then i get as value for
(*(int8*)(&addr)); --> B0h
(*(int8*)(&addr+1)); --> B0h
The last one should be --> 04h
Code: |
#ifndef GLCD_WIDTH
#define GLCD_WIDTH 320
#endif
#ifndef GLCD_HEIGHT
#define GLCD_HEIGHT 240
#define GLCD_GRAPHICS_ADDR GLCD_WIDTH*GLCD_HEIGHT/64 |
This gives as result 1200d == 04B0h
Very strange |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Nov 20, 2007 12:59 pm |
|
|
@PCM Programmer
Please can you look at this test lines below
I have put a breakpoint on the var l and the var k
Got the following results
var addr gives as result 0x04B0 = OK
var l gives as result 0xB0 = OK
var k gives as result 0x00 = NOT OK, this should be 0x04
Please can you test this code, is there an bug??
Code: | addr=GLCD_GRAPHICS_ADDR;
glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
l=(*(int8*)(&addr));
delay_us(1);
k=(*(int8*)(&addr+1));
delay_us(1);
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 20, 2007 1:19 pm |
|
|
Yes, there is a bug. CCS made a mistake when they changed the
driver to work with compiler versions starting with vs. 4.021:
Quote: |
4.021 The & unary operator by default no longer returns a generic (int8 *)
|
The change that they made is incorrect.
Here is the correct way to do it. Substitute this code and it should
fix the problem:
Code: | void setCursorAddress(int16 addr)
{
glcd_sendCMD(GLCD_CMD_SET_CSR_ADDR);
TGLCD_DATA
glcd_sendByte(*(int8*)&addr);
glcd_sendByte(*((int8*)&addr+1));
} |
|
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Nov 20, 2007 1:24 pm |
|
|
Ok, this work, thanks.
Then i now why this driver did not function |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 20, 2007 2:03 pm |
|
|
This bug is in vs. 4.061, so I sent an email to CCS just now, to inform
them about it. Hopefully it will be fixed in the next version. |
|
|
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Wed Nov 21, 2007 11:12 am |
|
|
Ok, the initializing and display of text function now,
but i use a routinefrom the graphics.c file then this work not good
If i use the glcd_text57 function, the text is bad
also for drawing a circle |
|
|
|