Durisian Posted July 11, 2007 Report Posted July 11, 2007 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 Quote
stryd_one Posted July 11, 2007 Report Posted July 11, 2007 I got stuck at the typo:event or evernt?If you copy/pasted those then that might be your answer :) Quote
Durisian Posted July 11, 2007 Author Report Posted July 11, 2007 hehe, event...nice catch, wrote it from memory... no typo's this time... i swear :)So... to keep it simplerif variable[5] = "abcd"MIOS_PrintCString(variable) should print abcd on the screen Quote
audiocommander Posted July 11, 2007 Report Posted July 11, 2007 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 Quote
stryd_one Posted July 11, 2007 Report Posted July 11, 2007 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) Quote
Durisian Posted July 12, 2007 Author Report Posted July 12, 2007 hmm.. cool will play with it some moreCheers Quote
Rio Posted July 13, 2007 Report Posted July 13, 2007 MIOS_LCD_PrintCString works only for const char arrays Quote
stryd_one Posted July 13, 2007 Report Posted July 13, 2007 Of course thanks Rio! Those table reads in there are program memory only so it has to be a 'const' Quote
Durisian Posted July 13, 2007 Author Report Posted July 13, 2007 Ahhhhh.... I don't feel so much like a 'complete' idiot anymore ;DThanks Quote
stryd_one Posted July 13, 2007 Report Posted July 13, 2007 Is it just me, or would it be handy to have such a function that worked in RAM? Quote
ilmenator Posted July 13, 2007 Report Posted July 13, 2007 I want to have it too :)Best regards, ilmenator Quote
stryd_one Posted August 5, 2007 Report Posted August 5, 2007 Hey dudes if someone would like to test this out come and meet me in the chatroom... my lcd cable is shorting somewhere ::) Quote
stryd_one Posted September 11, 2007 Report Posted September 11, 2007 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 :) Quote
TK. Posted January 2, 2008 Report Posted January 2, 2008 The MIOS_LCD_PrintCString function of the updated MIOS wrapper is now able to handle strings located in code and RAMSo, a special function is not required anymore. :)Best Regards, Thorsten. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.