oPossum 1,083 Posted December 15, 2011 Author Share Posted December 15, 2011 CCS requires labels in asm code to begin in the first column, so leading spaces will cause problems. This is typical for assembler code. Firefox may have problems with copy/paste from the forum. Chrome, Safari and IE seem to work as expected. To use the printf() with an LCD, just create a function named putc() that sends a single character to the LCD. If you find some sample code for LCD, there will probably a function that does this - just rename it. You will also need a puts() function. That can be this... void puts(char *s) { while(*s) putc(*s++); } woodgrain, timotet and zeke 3 Quote Link to post Share on other sites
timotet 44 Posted December 15, 2011 Share Posted December 15, 2011 thanks Quote Link to post Share on other sites
chimera_786 1 Posted December 17, 2011 Share Posted December 17, 2011 AAAAAAAAAAAAA!!! YES!!! I was using a sprintf to create a character string and was trying to display an integer on an LCD using %i as the format specifier. It was just a luck of the draw that I logged on to this forum and saw someone had posted a reply to this thread! I need %c.. My thanks goes out to oPossum who started this thread!!!! YAY!! Quote Link to post Share on other sites
colosseum 0 Posted March 18, 2012 Share Posted March 18, 2012 Dear All, Im a little bit new with msp430 and uC-s. I saw that here is a lightweight printf fot msp430, im using IAR , but it is not work for me. as i saw it is for CSS. Is any1 here who use IAR with printf? I want to use the printf for debugging. Launchpad -> PC. I have 2 rfm12bs modul today i was able to use them with PIC now i want to use it with msp430g2553. i would like to debug the data what i recieved. here is my simple code for hello world but no output at Putty: #include "msp430g2553.h" #include "intrinsics.h" #include "stdio.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; P1SEL = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD P1SEL2 = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 104; // 1MHz 9600 UCA0BR1 = 0; // 1MHz 9600 UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** //IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt // __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled while(1){ // UCA0TXBUF = 0x31; // UCA0TXBUF = printf("The color: %s\n", "blue"); //printf( "Hello %s, you are %d years old\n", name, age ); printf("Hello World "); __delay_cycles(800); } } Quote Link to post Share on other sites
bluehash 1,581 Posted March 18, 2012 Share Posted March 18, 2012 Hi colosseum,, did you see this post? Quote Link to post Share on other sites
colosseum 0 Posted March 19, 2012 Share Posted March 19, 2012 Dear bluehash, thanks for your fast replay. Somehow i missed it . Actually im pretty new in this , i usedto used pic and i should only used printf for sending texts via rsr32 to my pc. here is a sample snapshot of "my" pic code what i would like to print. printf("\r\n status:%4LX ", temp ); if (temp) // <>0 { if(temp & RGITFFIT) // Check RGIT / FFIT printf("\r\n----TX ready for next byte or FIFO received data Status " ); if(temp & POR) // Check Power on reset printf("\r\n----Power on Reset Status"); As i mentioned im using IAR. If someone cold show me a code part for me what is working i would go to figure out what i need. i hope. Sincerely Balazs Quote Link to post Share on other sites
colosseum 0 Posted March 19, 2012 Share Posted March 19, 2012 After my short post i realized that , printf with IAR works just i need to run debugging with terminal i/o window. Quote Link to post Share on other sites
_Murphy_ 6 Posted February 10, 2013 Share Posted February 10, 2013 Where exactly in CCS do you see the Printf text? I have the sample program running. Quote Link to post Share on other sites
timotet 44 Posted February 10, 2013 Share Posted February 10, 2013 you need a terminal program like putty http://www.chiark.greenend.org.uk/~sgtatham/putty/ Quote Link to post Share on other sites
yyrkoon 250 Posted February 10, 2013 Share Posted February 10, 2013 On windows putty yes, then configure putty for serial use, and point it to the COM port you're using. then down on the bottom were it says "serial" click that and change flow control to XON/XOFF. Quote Link to post Share on other sites
_Murphy_ 6 Posted February 10, 2013 Share Posted February 10, 2013 Thank you. This makes debugging programs so much easier. Quote Link to post Share on other sites
roadrunner84 466 Posted February 10, 2013 Share Posted February 10, 2013 Does this implementation of clib actually implement software flew control? If it doesn't, set flow control to"none" instead of xon/xoff. Or you implement software flow control yourself ;-) Quote Link to post Share on other sites
yyrkoon 250 Posted February 10, 2013 Share Posted February 10, 2013 Works fine on Windows 7, with putty. Works fine with parallax's Serial tool as well. Quote Link to post Share on other sites
chikenlover 0 Posted March 3, 2013 Share Posted March 3, 2013 Istn there supposed to be stardg.h header file? Or am i supposed to write my own? Sorry I dont understand. Quote Link to post Share on other sites
yyrkoon 250 Posted March 6, 2013 Share Posted March 6, 2013 "stdarg.h" should be included with any competent MSP430 toolchain. CCS, or GCC based. Or is there something else you're wondering ? Perhaps you've not setup your include path for your given toolchain yet ? Quote Link to post Share on other sites
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.