View previous topic :: View next topic |
Author |
Message |
soulraven
Joined: 08 Feb 2009 Posts: 72 Location: campulung muscel
|
|
Posted: Wed Jul 08, 2009 4:48 am |
|
|
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
|
|
Posted: Wed Jul 08, 2009 4:50 am |
|
|
See my last post, I edited it.
The problem is the const keyword.
You can use
or
Both are the same but *Message is the right way to do it. |
|
|
soulraven
Joined: 08 Feb 2009 Posts: 72 Location: campulung muscel
|
|
Posted: Wed Jul 08, 2009 4:52 am |
|
|
now is it compile, but on the lcd is now show any messange |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Wed Jul 08, 2009 5:17 am |
|
|
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
|
|
Posted: Wed Jul 08, 2009 5:27 am |
|
|
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
|
|
Posted: Wed Jul 08, 2009 6:04 am |
|
|
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
|
|
Posted: Wed Jul 08, 2009 6:21 am |
|
|
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
|
|
Posted: Wed Jul 08, 2009 6:50 am |
|
|
I sugest you just try it and see |
|
|
mindstorm88
Joined: 06 Dec 2006 Posts: 102 Location: Montreal , Canada
|
|
Posted: Tue Jun 22, 2010 10:19 am |
|
|
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
|
|
Posted: Tue Jun 22, 2010 11:53 am |
|
|
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
|
|
Posted: Tue Jun 22, 2010 11:59 am |
|
|
Thanks PCM , I did solved the problem few minutes ago using
Code: | printf(lcd_putc, "%",Tmp_Msg); |
|
|
|
|