Jump to content

Recommended Posts

Posted

Is this a limitation of mios/sdcc?

MIOS_LCD_PrintCString(event_map[found_event.entry].name);
doesn't work, I think it was an incompatable type error when compiling I use this as a work around... which i believe the mios wrapper does this anyway.
for (t=0; t<12; t++) MIOS_LCD_PrintChar(event_map[found_evernt.entry].name[t]);

Just curious... might be one for the wiki

Posted

hehe, event...

nice catch, wrote it from memory... no typo's this time... i swear :)

So... to keep it simpler

if variable[5] = "abcd"

MIOS_PrintCString(variable) should print abcd on the screen

Posted

To be honest, I have no clue what you are asking exactly, but I guess you want to print a predefined char-array to the LCD. As you are giving not much information, I just can say, that it works pretty well for me, so the problem is possibly in your datastructure.

[tt]

const unsigned char scaleNames[3][4] = {

  { "---" }, { "min" }, { "MAJ" }

};

MIOS_LCD_PrintCString(scaleNames[1]);  // prints "min"

[/tt]


also:

[tt]if (variable[5] == "abcd"[/tt]) {

    [tt]MIOS_PrintCString(variable) [/tt] //doesn't print anything, because you are trying to print the whole array.

}

Regards,

Michael

Posted

Yeh, you should just give a pointer to a memory location for it to work.

MIOS_PrintCString(variable[0]);

Might work... the function should continue until it hits the '0' (the end of the quotes)

  • 4 weeks later...
  • 1 month later...
Posted

cmios.h (or header file of your choice):

extern void MIOS_LCD_PrintRAMString(unsigned char *str); // not supported by MIOS itself, but by the wrapper
mios_wrapper.asm (Right down the bottom, but ABOVE where it says "END"!)
;; --------------------------------------------------------------------------
.MIOS_LCD_PrintRAMString code
_MIOS_LCD_PrintRAMString
	global	_MIOS_LCD_PrintRAMString
	movff	PREINC0, FSR2L
	movff	PREINC0, FSR2H
_MIOS_LCD_PrintRAMStringLoop
	movf	POSTINC2, W
	bz	_MIOS_LCD_PrintRAMString_End
	call	MIOS_LCD_PrintChar
	bra	_MIOS_LCD_PrintRAMStringLoop
_MIOS_LCD_PrintRAMString_End
	return
Make yourself a string somehow (note **)
unsigned char foo[6];
....

    foo[0] = 'T';

    foo[1] = 'e';

    foo[2] = 's';

    foo[3] = 't';

    foo[4] = '.';
Call it
  MIOS_LCD_PrintRAMString(foo);
** Note: Actually filling the array with a string is not so straightforward. You cannot just do
foo = "New 1";
Because "New 1" is a string in code space and 'foo' is in RAM. That is probably bad pracice anyway. As has been suggested prieviously you could use a pointer to the string in code (like PrintCString) or you could use something like strcpy(). If you are printing a number you can use the BCD functions provided by TK. However - and this is untested - If you were filling the array from another variable then it could be useful. Maybe you'd like to try:

unsigned char foo[64];

MIOS_BANKSTICK_ReadPage(0x07ff, foo);

MIOS_LCD_PrintRAMString(foo);

I think that should work.

Have fun and post any requests and stuff :)

  • 3 months later...
Posted

The MIOS_LCD_PrintCString function of the updated MIOS wrapper is now able to handle strings located in code and RAM

So, a special function is not required anymore. :)

Best Regards, Thorsten.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...