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

About the LCD display again

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mcad



Joined: 25 Nov 2007
Posts: 48

View user's profile Send private message

About the LCD display again
PostPosted: Wed Dec 05, 2007 11:39 am     Reply with quote

Hello all,
I ve a question to you about LCD Display again.
Code:

lcd_init();
While(...)
{
  if(condition)
     lcd_gotoxy(1,1)
  if(condition)
     lcd_gotoxy(1,2)
}


the first row display a A value, and the second row display B value. however, I can not see both of the value in the LCD screen. I just see the A value on the first row.

Would you please help me for this?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 11:52 am     Reply with quote

You have not displayed anything with that code. You need to call
the lcd_putc() function to display the text. Or, you can use printf()
and re-direct the output of printf to the lcd_putc() function. But at
some point, you must call lcd_putc(). Your code above only sets
the cursor position.
mcad



Joined: 25 Nov 2007
Posts: 48

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 11:55 am     Reply with quote

Sir, of course I used them to display. But, I can only manage to display one row at a time.

I began to consider whether it is legal to change the cursor within the same iteration or not.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 11:59 am     Reply with quote

Post a test program that shows what you want to do.
Put in the lines of code for lcd_putc().
mcad



Joined: 25 Nov 2007
Posts: 48

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 12:06 pm     Reply with quote

Code:



                                                                     
                                                                     
                                                                     
                                             


taken out for a while





Last edited by mcad on Wed Dec 05, 2007 1:35 pm; edited 3 times in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 12:33 pm     Reply with quote

Quote:
#int_TIMER2
void INCREASE_CLOCKCYCLE_VALUE(void)
{
if(dec =! 0)
{dec--;}
else
{
check=1;
}
}

The line in bold is not correct. There is no "=!" operator in C.
Your code just sets 'dec' equal to !0, so dec = 1.
mcad



Joined: 25 Nov 2007
Posts: 48

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 12:38 pm     Reply with quote

Thanks very much sir for this.
I am correcting it.
would you please tell me any other error you would observe ?

Thanks again
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 12:58 pm     Reply with quote

Quote:

int dec;
int speed;
int check;
int val = 70;

dec = ( 3276800 /(4 * val) );

This code won't work. The intended result is 11702. But 'dec' is
declared as an 'int'. In CCS, an 'int' is an unsigned 8-bit integer.
It can only hold from 0 to 255. It can't hold 11702.

Also, the expression (4 * val) is equal to 280. This result requires a
16-bit integer to hold it. The compiler will not automatically promote
the result to 16-bits. You have to tell the compiler to do it by casting
'val' to 16 bits. See the changes shown below:
Quote:

int16 dec;
int speed;
int check;
int val = 70;

dec = ( 3276800 /(4 * (int16)val) );
mcad



Joined: 25 Nov 2007
Posts: 48

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 1:05 pm     Reply with quote

Thanks and thanks again sir.
I wold really appreciate you for your all clarifications.
I now traced the code and I think that there is no any more error in the code, is there ?

Regards
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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