Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Transforming constant char - animation with ascii

Status
Not open for further replies.

soulraven

Newbie level 6
Joined
Feb 13, 2009
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Campulung Muscel, Romania
Activity points
1,349
flex_lcd.c

hi, i nead help:(

i vant to make an animation with ascii

something like this /-|-\

you know the animation, the rotation, but i want to make a function more generaly

animation(LCD_x, LCD_Y, "/-|-\")

how to animate the strings?
i use ccs comiler and for now i make this code

Code:
void animatie(unsigned char coloana, unsigned char rand, char *animatie[11])
{
int frame;
char top[11];
strcpy(top,animatie.c_str());
//strncpy(top,animatie,2);

for (frame=0;frame<=strlen(animatie);frame++);
{
	lcd_gotoxy(coloana,rand);
	printf(lcd_putc,"%i",frame);
//	lcd_putc(top);
	lcd_outtext(animatie[frame]);

}

but is not working, how to put the strings on the pointer or matrix, and read step by step the ponter or the matrix?
 

Re: transform constant char

soulraven said:
hi, i nead help:(

i vant to make an animation with ascii

something like this /-|-\

you know the animation, the rotation, but i want to make a function more generaly

animation(LCD_x, LCD_Y, "/-|-\")

how to animate the strings?

I haven't used CSS compiler but I would suggest try this

animation(LCD_x, LCD_Y, (char*)"/-|-\")
 

transform constant char

is not working:(

i can't put the string in pointer, and acces the pointer like this
strings[0]="/"
strings[1]="-"
etc
 

Re: transform constant char

Buna ziua:D

Unfortunately, I don't use CCS and I couldn't find in the manual of CCS none of the following function: lcd_outtext, lcd_gotoxy, c_str so I really don't know what they do.

But I try to offer you a suggestion:

Code:
void animatie(unsigned char coloana, unsigned char rand, const char *animatie, unsigned char len) 
{ 
unsigned char frame; 
for (frame=0; frame<len; frame++); 
{ 
   lcd_gotoxy(coloana,rand); 
   lcd_putc((char)animatie[frame]); 
   /* PUT HERE A DELAY OF AT LEAST 50ms IF YOU REALLY WANT TO SEE THE ANIMATION. OTHERWISE YOU WILL SEE ONLY THE LAST CHARACTER, I THINK...*/
}

Parameter len is the length of the text you want to animate: for "/-|-\" len is 5. If you want to animate a string, you should declare it as pointer to const char and not as an array of 11 pointers to char as you did in your code.

I'm not sure if it works, but try. Spor!
 

Re: transform constant char

is not working

Code:
void animatie(unsigned char coloana, unsigned char rand, const char *animatie, unsigned char len)
{
//int frame;
//char top[11];
//strcpy(top,animatie.c_str());
//strncpy(top,animatie,2);
unsigned char frame; 

for (frame=0; frame<len; frame++); 
{
	lcd_gotoxy(coloana,rand);
   lcd_putc((char)animatie[frame]);
delay_ms(50);
}
//for (frame=0;frame<=strlen(animatie);frame++);
//{
//	lcd_gotoxy(coloana,rand);
//	printf(lcd_putc,"%i",frame);
//	lcd_putc(top);
//	lcd_outtext(animatie[frame]);

//}
}

Executing: "G:\PIC Programmers IDE\PICC\Ccsc.exe" +FM "main.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 28 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 381(69,73): Expecting an identifier
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 381(70,78): Expecting a (
*** Error 36 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 381(94,97): Expecting a ; or ,
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 382(1,2): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(1,4): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(5,6): Expecting a declaration
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(6,11): Expecting a (
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(12,13): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(13,14): Expecting a declaration
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(15,20): Expecting a (
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(21,24): Expecting a (
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(26,31): Expecting a (
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(33,34): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 389(34,35): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 390(1,2): Expecting a declaration
*** Error 28 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(13,14): Expecting an identifier
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(18,19): Expecting a declaration
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(19,27): Expecting a (
*** Error 48 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(28,33): Expecting a (
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(34,35): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 392(35,36): Expecting a declaration
*** Error 28 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 393(10,12): Expecting an identifier
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 393(13,14): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 394(1,2): Expecting a declaration
*** Error 43 "K:\dacia 1300\proiect DACIA\proteous project\Cod sursa MPLAB\flex_lcd.c" Line 403(1,2): Expecting a declaration
*** Error 58 "main.c" Line 32(27,28): Expecting a close paren
26 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Fri Jul 10 10:16:40 2009
 

Re: transform constant char

Why don't you fix first the compiler errors??? :?:

First of all you have to remove ; from the for(...);
I don't know which are the lines 381, 382, 398, 390, 392, 393, 394, 403 in your code but the compiler reports errors on that lines.

Fix the compiler errors and try to run the code.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top