CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

S1D13305 driver will not work
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Nov 18, 2007 2:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 18, 2007 2:35 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 18, 2007 3:04 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 19, 2007 3:34 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 19, 2007 5:14 pm     Reply with quote

Try putting in a delay, instead of these two statements:
Code:

glcd_sendByte(0x00);
glcd_sendByte(0x00);


Try doing this instead:
Code:
delay_ms(1);


Does that also work ?
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 12:08 pm     Reply with quote

@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

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 12:16 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 12:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 12:30 pm     Reply with quote

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 Sad
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 12:59 pm     Reply with quote

@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

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 1:19 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 1:24 pm     Reply with quote

Ok, this work, thanks.

Then i now why this driver did not function
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 20, 2007 2:03 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 11:12 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group