VARIOUS STANDARD AND BDF FONTS

Code Examples ››
Parent Previous Next

DEMO VARIOUS STANDARD AND BDF FONTS


Device = 18F67K22


Declare Xtal = 64

Declare Watchdog = OFF

Declare Warnings = Off

Declare Optimiser_Level = 3


'================ TFT SCREEN ================

$define TFT_IC               ST7789V

$define TFT_COM              SPI_1

$define TftScreenWidth       320

$define TftScreenHeight      240

$define TFT_CS               PORTF.7

$define TFT_RESET            PORTC.7

$define TFT_DC               PORTC.2

$define TFT_MOSI             PORTC.5

$define TFT_MISO             PORTC.4

$define TFT_SCLK             PORTC.3

$define _TFT_MOSI            _PORTC.5

$define _TFT_MISO            _PORTC.4

$define _TFT_SCLK            _PORTC.3


'================ TFT TOUCH ================

$define TOUCH_IC             XPT2046

$define TOUCH_COM            SPI_SW

$define Z_Threshold          600

$define TouchAveragePoints   2

$define TouchMedianDistance  8

$define T_CS                 PORTG.1

$define T_IRQ                PORTA.5

$define T_MOSI               PORTC.5

$define T_MISO               PORTC.4

$define T_SCLK               PORTC.3

$define _T_MOSI              _PORTC.5

$define _T_MISO              _PORTC.4

$define _T_SCLK              _PORTC.3


'================ MCU ================

$define McuType              0


'================ SD CARD ================

$define SDCardUsed           1

$define SDCardFatUsed        1

$define SD_COM               SPI_2

$define SD_CS                PORTG.3

$define SD_SDO               PORTD.4

$define SD_SDI               PORTD.5

$define SD_CLK               PORTD.6

$define _SD_SDO              _PORTD.4

$define _SD_SDI              _PORTD.5

$define _SD_CLK              _PORTD.6


'================ MEMORY ================

$define MemoryType           2

$define MEM_COM              SPI_2

$define MEM_CS               PORTA.2

$define MEM_MOSI             PORTD.4

$define MEM_MISO             PORTD.5

$define MEM_SCLK             PORTD.6

$define _MEM_MOSI            _PORTD.4

$define _MEM_MISO            _PORTD.5

$define _MEM_SCLK            _PORTD.6

$define MEM_PAGE_SIZE        256

$define MEM_SECTOR_SIZE      4096

$define MEM_SECTOR_COUNT     2048

$define MEM_FILE_COUNT       256

$define MEM_WRITE_DELAY      5


'================ FONT ================

$define FontSmooth           1

$define FontMaxSpace         16

$define FontMaxPixels        16

Include                      "TftLib\Fonts\BDF\F2_BDF_Margarine-Regular-24.inc"

Include                      "TftLib\Fonts\BDF\F3_BDF_ProtestGuerrilla-Regular-22.inc"

Include                      "TftLib\Fonts\BDF\F4_BDF_Ranchers-Regular-23.inc"

Include                      "TftLib\Fonts\BDF\F5_BDF_Sail-Regular-25.inc"

Include                      "TftLib\Fonts\BDF\F6_BDF_Sunshiney-Regular-25.inc"

Include                      "TftLib\Fonts\SND\F0_SND_8x8_Basic.Inc"

Include                      "TftLib\Fonts\SND\F4_SND_16x16_Regular.Inc"

Include                      "TftLib\TFT_Graphic_Lib.inc"

    

Main:

    Clear

    SetCrystal()

    SetPins()

    TftBmpMemSet()

    TftSetUp(0)  

    TftResetScreen(AZURE)

    

    TftSetBdfFont(2) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Democritus1, 22,160, 295,22, 1, ANTIQUE_RUBY,BLACK, 1, 71)

    DelayMS 1500

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Democritus2, 22,160, 295,22, 1, ANTIQUE_RUBY,BLACK, 1, 81)

    DelayMS 1500

    

    TftSetBdfFont(3) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Socrates1, 22,160, 295,22, 1, RED,BLACK, 1, 0)

    DelayMS 1500

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1) 

    TftPrintBdfText(Socrates2, 22,160, 295,22, 1, RED,BLACK, 1, 0)

    DelayMS 1500

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1) 

    TftPrintBdfText(Socrates3, 22,160, 295,22, 1, RED,BLACK, 1, 0)

    DelayMS 1500

    

    TftSetBdfFont(4) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Plato1, 22,160, 295,22, 1, ST_PATRICK_S_BLUE,BLACK, 1, 65)

    DelayMS 1500

    

    TftSetBdfFont(5) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Heraclitus1, 22,160, 295,22, 1, BYZANTIUM,BLACK, 1, 91)

    DelayMS 1500

    

    TftSetBdfFont(6) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfText(Thales1, 22,160, 295,22, 1, COSMIC_COBALT,BLACK, 1, 0)

    DelayMS 1500

    

    TftSetBdfFont(6) 

    TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

    TftPrintBdfString("StringTEST$1234abcd$+", 40, 50, 318, 0, BLACK, BLACK, 1)

    DelayMS 1500

    

    

    TftResetScreen(AZURE)

    TftPolygon(160,120, 100, 10, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 90, 9, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 80, 8, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 70, 7, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 60, 6, 0, 0, GREEN, 0, 0)

    TftSetSndFont(0, 1)

    TftPrintSndString("8x8-TEST1234abcd$+", 1, 0, 0, 1, ERIN, BLACK, 0)

    TftPrintSndString("8x8-TEST1234abcd$+", 1, 0, 1, 1, ERIN, BLACK, 1)

    TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 2, 1, FRENCH_VIOLET, FULVOUS, 0)

    TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 3, 1, FRENCH_VIOLET, FULVOUS, 1)

    TftSetSndFont(0, 0)

    TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 4, 1, RED, OLD_GOLD, 0)

    TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 5, 1, RED, OLD_GOLD, 1)

    DelayMS 3000

    TftResetScreen(AZURE)

    TftPolygon(160,120, 100, 10, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 90, 9, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 80, 8, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 70, 7, 0, 0, GREEN, 0, 0)

    TftPolygon(160,120, 60, 6, 0, 0, GREEN, 0, 0)

    TftSetSndFont(4, 1)

    TftPrintSndString("16x16-TEST1234abcd$+", 1, 0, 1, 1, ERIN, BLACK, 0)

    TftPrintSndString("16x16-TEST1234abcd$+", 1, 0, 2, 1, ERIN, BLACK, 1)

    TftPrintSndString("16x16+ABcd$", 2, 0, 2, 1, FRENCH_VIOLET, FULVOUS, 0)

    TftPrintSndString("16x16+ABcd$", 2, 0, 3, 1, FRENCH_VIOLET, FULVOUS, 1)

    TftSetSndFont(4, 0)

    TftPrintSndString("16x16+ABcd$", 2, 0, 4, 1, BLACK, OLD_GOLD, 0)

    TftPrintSndString("16x16+ABcd$", 2, 0, 5, 1, RED, OLD_GOLD, 1)

End 

  

'Set Fosc    

Proc SetCrystal()

    Clear 

    OSCTUNE.6 = 1

    DelayMS 100

EndProc   


Proc SetPins()

    'Set all digital

    ANCON0 = 0

    ANCON1 = 0

    ANCON2 = 0


    SSP1STAT.6 = 1

    SSP1CON1 = %00100000

    

    SSP2STAT.6 = 1

    SSP2CON1 = %00100000

EndProc


Config_Start

  RETEN = On        ;Enabled

  INTOSCSEL = Low        ;LF-INTOSC in Low-power mode during Sleep

  SOSCSEL = Dig        ;digital

  XINST = OFF        ;Disabled

  FOSC = EC2        ;HS oscillator (High power, 16 MHz - 25 MHz)

  PLLCFG = On        ;Enabled

  FCMEN = OFF        ;Disabled

  IESO = OFF        ;Disabled

  PWRTEN = OFF        ;Disabled

  BOREN = OFF        ;Disabled in hardware, SBOREN disabled

  BORV = 0        ;3.0V

  BORPWR = High        ;BORMV set to high power level

  WDTEN = OFF        ;WDT disabled in hardware; SWDTEN bit disabled

  WDTPS = 1048576        ;1:1048576

  RTCOSC = SOSCREF        ;RTCC uses SOSC

  CCP2MX = PORTBE        ;RC1

  MSSPMSK = MSK7        ;7 Bit address masking mode

  MCLRE = On        ;MCLR Enabled, RG5 Disabled

  STVREN = On        ;Enabled

  BBSIZ = BB2K        ;2K word Boot Block size

  Debug = OFF        ;Disabled

  Cp0 = OFF        ;Disabled

  CP1 = OFF        ;Disabled

  CP2 = OFF        ;Disabled

  CP3 = OFF        ;Disabled

  CP4 = OFF        ;Disabled

  CP5 = OFF        ;Disabled

  CP6 = OFF        ;Disabled

  CP7 = OFF        ;Disabled

  CPB = OFF        ;Disabled

  CPD = OFF        ;Disabled

  WRT0 = OFF        ;Disabled

  WRT1 = OFF        ;Disabled

  WRT2 = OFF        ;Disabled

  WRT3 = OFF        ;Disabled

  WRT4 = OFF        ;Disabled

  WRT5 = OFF        ;Disabled

  WRT6 = OFF        ;Disabled

  WRT7 = OFF        ;Disabled

  WRTC = OFF        ;Disabled

  WRTB = OFF        ;Disabled

  WRTD = OFF        ;Disabled

  EBRT0 = OFF        ;Disabled

  EBRT1 = OFF        ;Disabled

  EBRT2 = OFF        ;Disabled

  EBRT3 = OFF        ;Disabled

  EBRT4 = OFF        ;Disabled

  EBRT5 = OFF        ;Disabled

  EBRT6 = OFF        ;Disabled

  EBRT7 = OFF        ;Disabled

  EBRTB = OFF        ;Disabled

Config_End  


Dim Democritus1 As Flash8 = "Nothing exists except atoms and empty space, everything else is just opinion. - Democritus", 0

Dim Democritus2 As Flash8 = "It is hard to fight desire; but to control it is the sign of a reasonable man.  - Democritus", 0 

Dim Socrates1 As Flash8 = "One thing I know is that I know nothing. This is the source of my wisdom. - Socrates", 0

Dim Socrates2 As Flash8 = "An unexamined life is not worth living. - Socrates", 0

Dim Socrates3 As Flash8 = "Worthless people live only to eat and drink; people of worth eat and drink only to live. - Socrates", 0

Dim Plato1 As Flash8 = "The worst of all deceptions is self-deception. - Plato", 0

Dim Heraclitus1 As Flash8 = "There is nothing permanent except change. - Heraclitus", 0

Dim Thales1 As Flash8 = "Time is the wisest of all things that are; for it brings everything to light. - Thales", 0




Created with the Personal Edition of HelpNDoc: Easily convert your WinHelp HLP help files to CHM with HelpNDoc's step-by-step guide