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 CCS Technical Support

where is the mistake......
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
soulraven



Joined: 08 Feb 2009
Posts: 72
Location: campulung muscel

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Jul 08, 2009 4:48 am     Reply with quote

now the code is like this

Code:
//---------------------------------------------------------
void Scroll(unsigned char row,const char *Message)
{
char Temps[30];
unsigned int  MHead=0;
unsigned int Done=0;
unsigned int count;
   if(row >1) row=1;
   row=row*40;
while(Done==0)
{
   for(count=0;count<20;count++)
   {
   Temps[count]=Message[MHead+count];
   if(Message[MHead+count+1]==0) Done=1;
   }
   MHead++;
   lcd_gotoxy(1,row);
   lcd_putc(Temps);
   Delay_ms(200);
   }
}
//-----------------------------------------------------


no change when compile
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Jul 08, 2009 4:50 am     Reply with quote

See my last post, I edited it.

The problem is the const keyword.

You can use
Code:
char Message[]

or
Code:
char *Message

Both are the same but *Message is the right way to do it.
soulraven



Joined: 08 Feb 2009
Posts: 72
Location: campulung muscel

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Jul 08, 2009 4:52 am     Reply with quote

now is it compile, but on the lcd is now show any messange
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Jul 08, 2009 5:17 am     Reply with quote

First of all comment out the scroll(1, message); line and put
Code:
lcd_gotoxy(0, 0);
lcd_putc('A');

Does it work ?

Try
Code:
lcd_gotoxy(0, 0);
lcd_putc("Hello");

Does this work ?

you may need to be using
Code:
lcd_outtext(Temps);
instead of the
lcd_putc(Temps);

as the putc version doesn't allow for non const strings!
soulraven



Joined: 08 Feb 2009
Posts: 72
Location: campulung muscel

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Jul 08, 2009 5:27 am     Reply with quote

Now, it is working, I have a question. How do I use this function for multiple strings? I want to have something like
Code:

scroll(1, text 1);

scroll (1, text 2);

scroll(1, text n);
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Jul 08, 2009 6:04 am     Reply with quote

If they are fixed strings you just
Code:
strcpy(message, "Message 1..................");
Scroll(1, message);
strcpy(message, "Message 2..................");
Scroll(1, message);
strcpy(message, "Message 3..................");
Scroll(1, message);
strcpy(message, "Message 4..................");
Scroll(1, message);
soulraven



Joined: 08 Feb 2009
Posts: 72
Location: campulung muscel

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Jul 08, 2009 6:21 am     Reply with quote

no, is dynamic, appears more times in code, is it possible to make like the original function code?

scroll(1, text 1);
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Jul 08, 2009 6:50 am     Reply with quote

I sugest you just try it and see Smile
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

PostPosted: Tue Jun 22, 2010 10:19 am     Reply with quote

Wayne_ wrote:

you may need to be using
Code:
lcd_outtext(Temps);
instead of the
lcd_putc(Temps);

as the putc version doesn't allow for non const strings!


Anybody knows where to get that function : lcd_outtext()

I would like to try this scroll function !!

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 22, 2010 11:53 am     Reply with quote

Just a little bit of Googling finds it. It's here:
http://www.mydarc.de/dl3hrt/AS509-Dateien/MLX90614.C
You could translate it to CCS by substituting the lcd_gotoxy() function
for his switch-case code. You could substitute for the while() statement
with a printf() with the "%s" and 'text' as the parameters. Also,
re-direct the printf() to lcd_putc(). Also, remove the 'const' from his
function definition. It has a different meaning in CCS and isn't needed
for this function.
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

PostPosted: Tue Jun 22, 2010 11:59 am     Reply with quote

Thanks PCM , I did solved the problem few minutes ago using
Code:
printf(lcd_putc, "%",Tmp_Msg);
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, 3
Page 3 of 3

 
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