• 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

    towlerg-21522

    Mysterious PORTB problem

    Thread Starter: xldaedalus

    I'm using Proton+ to develop firmware for a product with switches. The MCU is an 18F26K22. Most of the switches reside on PORTB. I am NOT using a...

    towlerg Today, 15:45 Go to last post
    tumbleweed-20435

    PIC18F1330 PLL problem

    Thread Starter: rcurl

    I'm just starting out on a new project that uses a PIC18F1330. I haven't used this specific chip before, so I began by trying to blink an LED just...

    tumbleweed Today, 18:02 Go to last post
    towlerg-21522

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    towlerg Today, 15:59 Go to last post