Shop OBEX P1 Docs P2 Docs Learn Events
VGA_Text.spin and formatted printing — Parallax Forums

VGA_Text.spin and formatted printing

K2K2 Posts: 693
edited 2010-03-11 20:06 in Propeller 1
I'm writing a simple application in Spin that makes much use of a relatively low-res VGA screen using the VGA_Text.spin object (v1.0), and a PS/2 keyboard using Keyboard.spin. The integration has been fabulous thanks to such well-crafted objects and such a great chip.

(I absolutely love the fact that just a small portion of the microcontroller can provide a VGA display output while I merrily write my app...it's nothing short of phenomenal!)

What I wish to know is if there is some sort of utility that would provide formatted printing similar to the printf function in C? Also, is there a better way to maintain a time-of-day clock than by using waitcnt in a synchronized delay fashion on a separate cog? (I'm so used to real-time programming on a serial processor that it's difficult to make proper decisions in a parallel processing environment right now. I presume it will get easier with time.)

Comments

  • jazzedjazzed Posts: 11,803
    edited 2010-03-11 18:07
    David Jensen said...

    What I wish to know is if there is some sort of utility that would provide formatted printing similar to the printf function in C? ...
    Attached is what I use. There is a small demo.

    The memory cost to feature benefit ratio is very high if you only have a few calls to printf.
    As the number of printf calls grows, the benefit exceeds that available by the VGA, etc... utilities.
    There may be a bug with negative numbers - I don't remember exactly. Obviously YMMV.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-03-11 19:06
    I am working on a C function·library written in spin.· The attached file contains a printf, scanf and a few C string routines.· It is a work in progress, so some of the routines are a little messy.· I'm in the middle of working on putfloat and scanf at this time.

    I accomodate a variable number of arguments by using multiple versions of printf, such as printf0 when there is only a format string and no argument, printf1 for one argument, and so on.· If your not using serial I/O you will need to change the start, putchar, putstr and getchar functions at the beginning of the file.

    Dave
  • jazzedjazzed Posts: 11,803
    edited 2010-03-11 19:44
    @Dave Hein
    Very nice library.
  • K2K2 Posts: 693
    edited 2010-03-11 20:06
    ¡Gracias a Uds!
Sign In or Register to comment.