• Pic® Basic


  • Print Blank To

    One of the problems using Pprint and variable width fonts highlighted itself when I wrote a menuing system, I needed to over write what was a line already. Normally I would just count up the spaces needed and add them to the string being printed i.e. 10 characters from the 16 places needing to be overwritten, that’s 6 spaces added to the end.

    Variable width fonts are as it says, variable in width. The Letter “i” is smaller that “W”, now you could count up the number of pixels in each character and then add enough spaces at the end to make up the difference. Spaces though are only 2 pixels wide; to make up the 6 normal spaces required would require 18 variable width spaces. It was to solve this problem I wrote “PBT.INC”

    The PRINT_BLNK_TO macro enables you to define an end point on the currently printed line and print blank spaces to it.

    Syntax: PRINT_BLNK_TO Variable - Variable can be a constant, variable, or expression

    Example:

    INCLUDE "PROTON_G4.INT" ' board defaults
    INCLUDE "PBT.INC" ' THE MACRO
    GLCD_EXTERNAL_PRINT=PPRINT ' FORCE PRINTING VAI PPRINT
    DIM A AS BYTE
    PRINT FONT TIMES_B__9 ' WHAT PRINT TO USE
    CLS
    A = 100
    PRINT INVERSE 1 ' INVERTED PRINTING
    PRINT AT 30, 0,"HELLO" '
    PRINT_BLNK_TO A + 27 ' PRINT TO THE END OF THE LINE
    STOP INCLUDE "TIMES_BOLD_9.FNT"

    contributed by Timothy Box.
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 22:50 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post