Jump to content
43oh

Tiny printf() - C version


Recommended Posts

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is a tiny printf() function that can be used with the chips that come with the Launchpad. Code size is about 640 bytes with CCS.   There are 7 format specifiers: %c - Character %s - String %

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. C

This code was written when the MSP430 Lauchpad shipped with chips that had 128 bytes of RAM, 2k of flash, and no hardware serial port. So it was important to keep code very compact and a software UART

Posted Images

So I tried just for fun to re-build the project from scratch.

 

I started a new project in CCS.

I copied the code from the beginning of this thread, and the serial.asm code from the post oPossum pointed out.

 

3 separate files one project. Tried to compile no dice!

 

compared the project with the one you posted that works great.

The only difference I found was when I copied and pasted the .asm file from the the other post the file ends up indented

to the right by 4 spaces in the editor window , and wont compile.

I removed the 4 spaces from each line and it works great.

 

Maybe this will help someone maybe not.

 

thanks for the great code oPossum, and thanks for helping me get it going bluehash!

This forum is awesome!!! :clap:

Link to post
Share on other sites

so I've been using this with my project and it is awesome.

 

2 questions :

 

1. Does the above post make any sense? A friend of mine that has programmed for a long time says it shouldn't matter if it is spaced over. CCS didn't seem to like it though.

 

2. oPossum could you give an example of a putc function for writing to an LCD with the printf code you posted.

I am not understanding how the printf would interact with the LCD code.

 

thanks

Tim

Link to post
Share on other sites

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.


×
×
  • Create New...