Page 1 of 1

Printing to LCD in 4 languages ​​in C

Posted: Wed Jul 17, 2013 12:33 pm
by tello
Hey guys, I'm making a macro that Quierí print on the LCD in 4 languages. Apparently it's very simple but I can not fix the error, and if I do another mistake out later.
Can anyone help me out to correct the fault? do not know how to fix it.

Thank you. attached screenshot program

Re: Printing to LCD in 4 languages ​​in C

Posted: Wed Jul 17, 2013 2:03 pm
by tello
Hello again, I made ​​some changes and there is no error but does not work properly.
I think the problem is that I have to declare the variable Byte "Idioma" in the C code of the macro.
As I can declare the variable within the macro??

When the macro ends and work properly will put at the disposal of all.

thanks

Re: Printing to LCD in 4 languages ​​in C

Posted: Wed Jul 17, 2013 2:18 pm
by LeighM
Hi

You are very close to working.
Just a little bug in that your custom C code IDOMAS parameter Idioma is confused.
The switch is looking for the character 1 (hex 0x31) rather than the number 1
Here…

Code: Select all

switch (Idioma) {
case '1':
so change it to

Code: Select all

case 1:
and same for case 2:

Regards
Leigh

Re: Printing to LCD in 4 languages ​​in C

Posted: Wed Jul 17, 2013 4:46 pm
by LeighM
.. and just a reminder that Custom C macros will not simulate
Leigh

Re: Printing to LCD in 4 languages ​​in C

Posted: Thu Jul 18, 2013 7:51 am
by tello
comparacion.JPG
comparacion.JPG (143.86 KiB) Viewed 5937 times
Thank you very much LeighM. The macro is now working well.
I have a question, my intention to make the macro was to save program memory, but the result is greater with the macro setting separate blocks, why?? I do not understand.

Someone can explain??

Thank you very much again

Re: Printing to LCD in 4 languages ​​in C

Posted: Thu Jul 18, 2013 8:34 am
by LeighM
Hi,
Compare the two generated .casm files. These will show you which macros are being used and how much assembler code and hence memory space they require.
Leigh

Re: Printing to LCD in 4 languages ​​in C

Posted: Thu Jul 18, 2013 11:04 am
by tello
Thanks, I looked CASM file but do not understand much of anything.