VGA_Text.spin and formatted printing
K2
Posts: 693
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.)
(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
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.
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
Very nice library.