Graphical Displays with PBP3 - Page 2


+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 108
  1. #41
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    I've just tried that but I'm confused: I can pick a standard font and make something up from that using the tool, but what do I do then? Do I "export" it? Exporting, produces the matrix of hex codes for the font graphics but that's all it produces. The largenum and bigchar files you included have many lines of headers? footers? whatever... above and below the font dot matrix codes and the export button that I'm clicking doesn't appear to generate any of that and it's not really clear what those lines are?

    Regards,

    Troy

  2. #42
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Warning I'm not a teacher

  3. #43
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Thanks. That link eventually lead to the TFT export option needing to be visible to click on. Alas, that appears not useful without some kind of description of what those headers represent. Intuitively I would've thought they'd be some kind of memory addressing but they can't be. The 1st column looks like the font width but no idea what the second byte represents?

    Regards,

    Troy

  4. #44
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    you need to be more explicit, i cannot see the problem

    here is the raw " C " code as exported for chrs 48 to 60 as 11 x 16 sized font

    you simply need to make it comply with pbp limitations , thats it you don't have to understand it
    its pretty simple anyway

    0x00, unused
    0x00, unused
    0x30,0x00, first chr
    0x3C,0x00, last chr
    0x10, height
    0x00,

    0x0B,0x3C,0x00,0x00, width of chr1. offset to font data for chr 1
    0x0A,0x5C,0x00,0x00, width of chr2. offset to font data for chr2
    0x0B,0x7C,0x00,0x00, width of chr3. offset to font data for chr 3
    ...



    Code:
    //Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
    //MikroElektrnika 2011 
    //http://www.mikroe.com 
    
    
    //GLCD FontName : Terminal11x16
    //GLCD FontSize : 11 x 16
    
    
    const unsigned short Terminal11x16[] = {
       0x00,
       0x00,
       0x30,0x00,
       0x3C,0x00,
       0x10,
       0x00,
       0x0B,0x3C,0x00,0x00,
       0x0A,0x5C,0x00,0x00,
       0x0B,0x7C,0x00,0x00,
       0x0B,0x9C,0x00,0x00,
       0x0B,0xBC,0x00,0x00,
       0x0B,0xDC,0x00,0x00,
       0x0B,0xFC,0x00,0x00,
       0x0B,0x1C,0x01,0x00,
       0x0B,0x3C,0x01,0x00,
       0x0B,0x5C,0x01,0x00,
       0x06,0x7C,0x01,0x00,
       0x06,0x8C,0x01,0x00,
       0x09,0x9C,0x01,0x00,
       0xF8,0x00,0xFE,0x03,0x06,0x03,0x03,0x07,0x83,0x07,0xC3,0x06,0x63,0x06,0x33,0x06,0x1B,0x06,0x0F,0x06,0x07,0x06,0x06,0x03,0xFE,0x03,0xF8,0x00,0x00,0x00,0x00,0x00, // Code for char num 48
       0x60,0x00,0x70,0x00,0x7C,0x00,0x7C,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0xFC,0x03,0xFC,0x03,0x00,0x00,0x00,0x00, // Code for char num 49
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x07,0x80,0x03,0xC0,0x01,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x0E,0x00,0xFF,0x07,0xFF,0x07,0x00,0x00,0x00,0x00, // Code for char num 50
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x00,0x06,0x00,0x07,0xF8,0x03,0xF8,0x01,0x00,0x03,0x00,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00, // Code for char num 51
       0xC0,0x01,0xE0,0x01,0xF0,0x01,0xB8,0x01,0x9C,0x01,0x8E,0x01,0x87,0x01,0x83,0x01,0xFF,0x07,0xFF,0x07,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0x00,0x00,0x00, // Code for char num 52
       0xFF,0x07,0xFF,0x07,0x03,0x00,0x03,0x00,0x03,0x00,0xFF,0x01,0xFE,0x03,0x00,0x07,0x00,0x06,0x00,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00, // Code for char num 53
       0xE0,0x01,0xF0,0x01,0x38,0x00,0x1C,0x00,0x0E,0x00,0x06,0x00,0xFF,0x01,0xFF,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00, // Code for char num 54
       0xFF,0x07,0xFF,0x07,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x01,0xC0,0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00, // Code for char num 55
       0xF8,0x00,0xFC,0x01,0x8E,0x03,0x06,0x03,0x06,0x03,0x8E,0x03,0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00, // Code for char num 56
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x07,0xFC,0x07,0x00,0x03,0x80,0x03,0xC0,0x01,0xE0,0x00,0x7C,0x00,0x3C,0x00,0x00,0x00,0x00,0x00, // Code for char num 57
       0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00, // Code for char num 58
       0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x38,0x38,0x38,0x30,0x30,0x18, // Code for char num 59
       0x80,0x01,0xC0,0x01,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x0E,0x00,0x0E,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0xC0,0x01,0x80,0x01,0x00,0x00,0x00,0x00 // Code for char num 60
            };
    becomes

    Code:
    ;//Font Generated by MikroElektronika GLCD Font Creator 1.2.0.0
    ;//MikroElektrnika 2011 
    ;//http://www.mikroe.com 
    ;
    ;//GLCD FontName : Terminal11x16
    ;//GLCD FontSize : 11 x 16
    ;
    ;const unsigned short Terminal11x16[] = {
       0x00,0x00
       
       0x30,0x00
       0x3C,0x00
       0x10,0x00
       
       0x0B,0x3C,0x00,0x00
       0x0A,0x5C,0x00,0x00
       0x0B,0x7C,0x00,0x00
       0x0B,0x9C,0x00,0x00
       0x0B,0xBC,0x00,0x00
       0x0B,0xDC,0x00,0x00
       0x0B,0xFC,0x00,0x00
       0x0B,0x1C,0x01,0x00
       0x0B,0x3C,0x01,0x00
       0x0B,0x5C,0x01,0x00
       0x06,0x7C,0x01,0x00
       0x06,0x8C,0x01,0x00
       0x09,0x9C,0x01,0x00
       0xF8,0x00,0xFE,0x03,0x06,0x03,0x03,0x07,0x83,0x07,0xC3,0x06,0x63,0x06,0x33,0x06,0x1B,0x06,0x0F,0x06,0x07,0x06,0x06,0x03,0xFE,0x03,0xF8,0x00,0x00,0x00,0x00,0x00 ; Code for char num 48
       0x60,0x00,0x70,0x00,0x7C,0x00,0x7C,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0xFC,0x03,0xFC,0x03,0x00,0x00,0x00,0x00 ; Code for char num 49
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x07,0x80,0x03,0xC0,0x01,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x0E,0x00,0xFF,0x07,0xFF,0x07,0x00,0x00,0x00,0x00 ; Code for char num 50
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x00,0x06,0x00,0x07,0xF8,0x03,0xF8,0x01,0x00,0x03,0x00,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00 ; Code for char num 51
       0xC0,0x01,0xE0,0x01,0xF0,0x01,0xB8,0x01,0x9C,0x01,0x8E,0x01,0x87,0x01,0x83,0x01,0xFF,0x07,0xFF,0x07,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0x00,0x00,0x00 ; Code for char num 52
       0xFF,0x07,0xFF,0x07,0x03,0x00,0x03,0x00,0x03,0x00,0xFF,0x01,0xFE,0x03,0x00,0x07,0x00,0x06,0x00,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00 ; Code for char num 53
       0xE0,0x01,0xF0,0x01,0x38,0x00,0x1C,0x00,0x0E,0x00,0x06,0x00,0xFF,0x01,0xFF,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00 ; Code for char num 54
       0xFF,0x07,0xFF,0x07,0x00,0x03,0x00,0x03,0x80,0x01,0x80,0x01,0xC0,0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00 ; Code for char num 55
       0xF8,0x00,0xFC,0x01,0x8E,0x03,0x06,0x03,0x06,0x03,0x8E,0x03,0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x03,0xFC,0x01,0x00,0x00,0x00,0x00 ; Code for char num 56
       0xFC,0x01,0xFE,0x03,0x07,0x07,0x03,0x06,0x03,0x06,0x07,0x07,0xFE,0x07,0xFC,0x07,0x00,0x03,0x80,0x03,0xC0,0x01,0xE0,0x00,0x7C,0x00,0x3C,0x00,0x00,0x00,0x00,0x00 ; Code for char num 57
       0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00 ; Code for char num 58
       0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x00,0x00,0x00,0x38,0x38,0x38,0x30,0x30,0x18 ; Code for char num 59
       0x80,0x01,0xC0,0x01,0xE0,0x00,0x70,0x00,0x38,0x00,0x1C,0x00,0x0E,0x00,0x0E,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0xC0,0x01,0x80,0x01,0x00,0x00,0x00,0x00 ; Code for char num 60
    ;        };
    Warning I'm not a teacher

  5. #45
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Thanks Richard. DUH [slapping forehead again]. I didn't read them properly, nevertheless, you told me everything and more with that description and I'm once again eternally grateful.

    Cheers,

    Troy

  6. #46
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    one more thing
    both pbp and mpasm have limitations on line length , exceed them at your peril

    and always have an even number of bytes ie not odd on every line line other wise pbp will pad the odd byte with an extra 00 the offset indexing will fail.
    do not add or delete any byte to the file or else the offset indexing will fail.
    Warning I'm not a teacher

  7. #47
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Got it and working perfectly

    Thanks again,

  8. #48
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Quote Originally Posted by richard View Post
    and always have an even number of bytes ie not odd on every line line other wise pbp will pad the odd byte with an extra 00 the offset indexing will fail.
    do not add or delete any byte to the file or else the offset indexing will fail.
    Good info! Thanks.
    Is this referred to somewhere?

    Ioannis

  9. #49
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Richard,
    I'm just starting to experiment with displaying a simple number count ie. clearing the screen, incrementing a number and displaying that number using the larger numerical font and looping that process. So, everything's good until I'm getting to either 6 or 7 loops (doesn't matter what number I start with) and then something happens. The count stops where it should be displayed and appears to continue... like... 20 or so pixels above the nominated location and the font is now only 1 pixel high.
    Any ideas what's happening or what I'm doing wrong?


    Code:
        DEFINE OSC 64
    
    
       
        #DEFINE colours 1   ;1 mono 2 rg or 3 rgb
        width  con 128      ;
        height con 64      ;
        'use serial i/f
        #define  stserial 1
        include "grx.pbpMOD" 
        include "st7920b.pbpmod" 
        include "font.bas"
        include "bignum.bas"       
        include "bigchr.bas"
        BUFF       VAR BYTE[4]
        ani_h var word  bank0
        ani_r var byte
        ani_c var byte
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        
        'trisc = %11010101 ;cs,sck,sdo are output
        trisc = %11010101 ;cs,sck,sdo are output
        TRISB = %11111111
        TRISA = %11111111
    
                  
    n var word
    
        gosub st7920_init    'graphic mode
    
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        
        Pause  500      ' LCD initialize time
        lcdout $FE,1
        gosub st7920_init    'graphic mode
    
        n=0
        
     main
     
        gosub grf_clr
        n= n+1
        SETFONT bignum
        ARRAYWRITE BUFF,[dec4 n]
        DMDSTR 40,30, Buff,1
        gosub show 
        pause 1000
        
     goto main

  10. #50
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    BUFF VAR BYTE[4] is too small to hold a 4 digit null terminated string it must be digits + 1

    ARRAYWRITE BUFF,[dec4 n] is not a null terminated string ARRAYWRITE BUFF,[dec4 n,0] is


    SETFONT bignum should not be in the loop , you only need to set the font once unless you want to change to another font

    rather than clearing the whole screen you can "FILLRECT" with the background colour for a restricted area to clr




    Code:
         DEFINE OSC 64
        #DEFINE colours 1   ;1 mono 2 rg or 3 rgb
        width  con 128      ;
        height con 64      ;
        'use serial i/f
        #define  stserial 1
        include "grx.pbpMOD" 
        include "st7920b.pbpmod" 
        include "font.bas"
        include "bignum.bas"       
        include "bigchr.bas"
        BUFF       VAR BYTE[32]
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        
        'trisc = %11010101 ;cs,sck,sdo are output
        trisc = %11010101 ;cs,sck,sdo are output
        TRISB = %11111111
        TRISA = %11111111
    
    
                  
        n var word
    
    
        gosub st7920_init    'graphic mode
    
    
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        
        Pause  500      ' LCD initialize time
        lcdout $FE,1
        gosub st7920_init    'graphic mode
        gosub grf_clr
        n=0
        SETFONT bignum
     
     
     main:   
        n= n+1
        colour=bgcolour
        fillrect 39,29,70,20 ; this is a guess about your font size
        ARRAYWRITE BUFF,[dec4 n,0]
        DMDSTR 40,30, Buff,1
        gosub show 
        pause 1000
        
     goto main
    Warning I'm not a teacher

  11. #51
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Good suggestions thanks again. Yeah ARRAYWRITE BUFF,[dec4 n,0] was producing the same results so I changed it to see what happened and didn't get around to changing it back - will do though.

    Troy

  12. #52
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    One more thing - it's a monochrome LCD display, so the colour of the clearing rectangle would be 0 ?

    Thanks,

    Troy

  13. #53
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    One more thing - it's a monochrome LCD display, so the colour of the clearing rectangle would be 0 ?

    COLOUR [COLOUR] = 1 OR 0
    BACKGROUND COLOUR [BGCOLOUR] = 1 OR 0

    take your pick provided COLOUR <> BGCOLOUR for writing stuff that you can see
    Last edited by richard; - 11th October 2022 at 04:00.
    Warning I'm not a teacher

  14. #54
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Ah, got it. Glad I asked coz I never would've realized you can simply invert the display that simply

  15. #55
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Richard,
    Unfortunately none of those suggestions fixed the issue In fact maybe the RECTFILL made it worse. If I remove all calls for screen clearing within the loop so there's only really the allocating the characters and the "show" call, the output (result) is the same so the issue appears to be with either the DMDSTR or gosub show calls I imagine?

    Troy

  16. #56
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    I've isolated the problem is somewhere within the "show" call. Not sure what it is, but that's definitely the issue. Also, I'm not totally convinced FILLRECT works properly either. DRAWRECT definitely works better for me.

    Troy

  17. #57
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    post your code and i will have a look
    it works ok for me

    https://youtu.be/Jxd4a4XmuDo



    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : richard                                           *
    '*  Notice  : Copyright (c) 2022 caveat emptor                  *
    '*          : All Rights Reserved                               *
    '*  Date    : 11/10/2022                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  PLLCFG = ON
      CONFIG  PRICLKEN = ON
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRTEN = ON
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 190
      CONFIG  WDTEN = OFF
      CONFIG  WDTPS = 32768
      CONFIG  CCP2MX = PORTC1
      CONFIG  PBADEN = OFF
      CONFIG  CCP3MX = PORTB5
      CONFIG  T3CMX = PORTC0
      CONFIG  HFOFST = ON
      CONFIG  P2BMX = PORTB5
      CONFIG  MCLRE = EXTMCLR
      CONFIG  STVREN = ON
      CONFIG  LVP = OFF
      CONFIG  XINST = OFF
      CONFIG  DEBUG = OFF
      CONFIG  CP0 = OFF
      CONFIG  CP1 = OFF
      CONFIG  CP2 = OFF
      CONFIG  CP3 = OFF
      CONFIG  CPB = OFF
      CONFIG  CPD = OFF
      CONFIG  WRT0 = OFF
      CONFIG  WRT1 = OFF
      CONFIG  WRT2 = OFF
      CONFIG  WRT3 = OFF
      CONFIG  WRTC = OFF
      CONFIG  WRTB = OFF
      CONFIG  WRTD = OFF
      CONFIG  EBTR0 = OFF
      CONFIG  EBTR1 = OFF
      CONFIG  EBTR2 = OFF
      CONFIG  EBTR3 = OFF
      CONFIG  EBTRB = OFF
    #ENDCONFIG
        
    
    
    
    
         DEFINE OSC 64
        DEFINE DEBUG_REG PORTB
        DEFINE DEBUG_BIT 7
        DEFINE DEBUG_BAUD 9600
        DEFINE DEBUG_MODE 0
        LATB.7=1
    
    
       
        #DEFINE colours 1   ;1 mono 2 rg or 3 rgb
        width  con 128      ;
        height con 64      ;
        'use serial i/f
        #define  stserial 1
        include "grx.pbpMOD" 
        include "st7920.pbpmod" 
        include "font.bas"
        include "bignum.bas"       
        include "bigchr.bas"
        BUFF       VAR BYTE[32]
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        ANSELB=0
        ANSELC=0
        ANSELA=0 
    '      serial   spi pins used
    '      e is sck        latc.3
    '      rw is sdo       latc.5
    '      rs is cs         latc.1
        'trisc = %11010101 ;cs,sck,sdo are output
        trisc = %11010101 ;cs,sck,sdo are output
        TRISB = %11111111
        TRISA = %11111111
    
    
                  
        n var word
    
    
        gosub st7920_init    'graphic mode
    
    
        OSCCON=$70
        OSCTUNE.6=1
        while ! osccon2.7 :WEND    ;wait for pll
        
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        
        Pause  500      ' LCD initialize time
        lcdout $FE,1
        gosub st7920_init    'graphic mode
        gosub grf_clr
        n=0
        SETFONT bignum
        bgcolour=0
        
     main:   
        n= n+1
        colour=1
        fillrect 39,29,46,16 ; this is a guess about your font size
        ARRAYWRITE BUFF,[dec4 n,0]
        DMDSTR 40,30, Buff,0
        colour=0
        fillrect 39,9,46,16 ; this is a guess about your font size    
        DMDSTR 40,10, Buff,1
        gosub show 
        pause 1000
        
     goto main
    
    Warning I'm not a teacher

  18. #58
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Damn, maybe its my display modules. Your latest code doesn't appear to work properly either on mine.

    So close... everything appears to display correctly* but craps itself after a few screen redraws

    Troy

    *with the exception of FILLRECT

  19. #59
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    i fiddle with the files to suit other projects maybe what you have is out of date
    Attached Files Attached Files
    Warning I'm not a teacher

  20. #60
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    No luck. There is something I should've mentioned though: in post #31 you list the pin connections:

    for a 26k22 i used
    'spi pins used
    'st7920_rst var latc.0
    st7920_cs var latc.1
    'st7920_sck is latc.3
    'st7920_sdi is latc.4
    'st7920_sdo is latc.5

    Now, I don't have "st7920_sdi is latc.4" connected because I have no idea what to connect it to. Could that be the killer?

    Troy

  21. #61
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    no it has no connection , but its best not to try and use that pin for other purposes the mssp module owns it
    the only other conn i have is psb is grounded
    are you using my exact code ?
    Warning I'm not a teacher

  22. #62
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Yeah, started out with the exact code, those latest graphics and LCD controller files and then (after running that) started tweaking the demo code in an attempt to get something working. Can post a video of the output if that helps or happy to send you a module if you're interested in trying one. I've ordered another flavour of st7920 controlled displays from China, so fingers crossed it's better behaved.

    Troy

  23. #63
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    There's one other thing I haven't done which might be required. I haven't pulled up the I2C clock or data lines with weak pull up resistors. Because the static display code appeared to be working well, I assumed it was done within the display module.

    Troy

  24. #64
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    its not i2c its spi , there is no need for pullups.
    one thing i notice is my display cannot be reset with a pic pin it just won't pull the pin low enough . shit design.
    so i have included no reset function. to test i always power the display off/on as it can go to gaga land easily.

    in general a shit display if you don't have need for the usual "LCD commands" it can support along with graphics in parallel i/f mode
    or the reduced pin count of the serial i/f.
    the 20pin h64128 is better imo
    Warning I'm not a teacher

  25. #65
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    I have a few 18F26K83s that I've used for various projects. Worth trying one of these? They can source/sink twice the current on each pin apparently.

    Scrub that... Different architecture

    Troy
    Last edited by rocket_troy; - 12th October 2022 at 07:39.

  26. #66
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    how good is your power supply and your connections ?
    reset wont help here if it starts up ok
    if you want you can pm me to get my address to send a display to be evaluated
    Warning I'm not a teacher

  27. #67
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Power supply going into the PIC was a PicKit2 and that doesn't appear to be the issue. I was doing all these tests on a 18F26K22 SOIC package. After you mentioned the power requirements issues, I tried it on the larger DIP package and that appears to have fixed the show-stopping issue of screen regeneration. FILLRECT still doesn't work correctly, but that's a peripheral issue for me. I can at least now use these displays for the apps I had in mind.

    Thanks again for all the assistance Richard.

    Troy

  28. #68
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    on q43 chips i have to set the high slew rate settings on for really highspeed spi
    the k22 has slew rate control SLRCON.2 for portc , can't hurt to try
    Warning I'm not a teacher

  29. #69
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Worked! I can now run things on the smaller package.

    Legend!

    Troy

  30. #70
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Richard,
    Curious Question:
    I was feeding a 10bit rotary encoder into the PIC (RB0-RB5 & RA0-RA3) with the display connected and I was stumped to figure out why I wasn't getting any input signal into the PortA pins and also 1 of the PortB pins. After a while I realised they were acting as outputs not inputs even though I declared them as inputs before the display initialisation. After some head scratching, I tried setting their TRIS status *after* the display initialisation and that appeared to fix that. So, I think I can maybe see where the PortB pin may have been set (behind the scenes), but can't see where the PortA pins where set as outputs? Does that have anything to do with the LCDOUT command call in the initialisation instructions?

    Troy
    Last edited by rocket_troy; - 14th October 2022 at 02:35.

  31. #71
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Another Question:
    In your graphics file for the FillRect code you have:

    frect:
    s_ystart=y0
    s_yend=y0
    while y1
    s_xstart=x0
    s_xend=x0+s_xend-1
    gosub dLine
    s_ystart=s_ystart+1
    s_yend=s_ystart
    y1=y1-1
    wend
    return

    Shouldn't that line be s_xend=x1+s_xend-1 ?

    Troy

  32. #72
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Does that have anything to do with the LCDOUT command call in the initialisation instructions?
    if you mean the highlighted text below , then yes that an error and should be removed for serial i/f usage
    and may impact portb

    Code:
        ANSELB=0
        ANSELC=0
        ANSELA=0 
        Pause  500      ' LCD initialize time
        lcdout $FE,1
        gosub st7920_init    'graphic mode
        gosub grf_clr
        n=0
        setfont FONT5x7
        ARRAYWRITE BUFF,["- scroll test -"]
        DMDSTR 18,0, Buff,1
        ARRAYWRITE BUFF,["- some  text to    test -"]
        DMDSTR 6,8, Buff,1
        SETFONT bignum
        bgcolour=0
        direction=0
         gosub show
     main:   
        n= n+1


    Shouldn't that line be s_xend=x1+s_xend-1 ?
    my ver is , you are using an old version , the ver of grx.pbpmod in post 10 has vertical line fixed but fillrect got mangled
    post 59 ver has both of those fixed , yet to discover what else may be broken

    Code:
    frect:
        s_ystart=y0
        s_yend=y0
        while y1
            s_xstart=x0
            s_xend=x0+x1-1
            gosub dLine
            s_ystart=s_ystart+1
            s_yend=s_ystart
            y1=y1-1
        wend
    return
    Last edited by richard; - 14th October 2022 at 03:48.
    Warning I'm not a teacher

  33. #73
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Cool, so assuming that fixes the FillRect (I'll find out this evening) everything should be dandy.

    Troy

  34. #74
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Hi Richard,
    Finished up giving up on the serial connection as it was just a bit flaky ie. characters and graphics didn't always display cleanly etc. That might've been a wiring issue - not sure. Anyhow, with your advice on the parallel interface (using the higher 4 bits & grounding the lower 4) I got that working and it appears to be much cleaner.
    Question on fonts: I was trying to make some 28pt fonts but there appeared to be some overrun. Scaled back to 24 and that appeared to work fine. So, there's a size limit on fonts around that 24pt size?

    Thanks,

    Troy

  35. #75
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    post#1

    i wrote this graphics lib to handle led dmd's [1/4 scan dot matrix displays] in mono, red/green or rgb in varing sizes up to 128x32 pixels.
    it occured to me that with a little more effort it would make a general purpose graphic lib for nearly any display. so here it is.
    it uses mikroe fonts that you can easily generate. the variable width fonts can be up to 23 bits wide if you like.
    no guarantee 24 bit wide will be reliable either
    Warning I'm not a teacher

  36. #76
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Okay, so fixed widths can have a wider limitation?

    Troy

  37. #77
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    no there are no fixed width fonts not that that would alter anything.
    the mask is 32bits wide that is used to insert the font row data into the graphics frame memory, 23 bits font + 8 bits to allow insertion at any bit point offset + 1 clr column between chars = 32 bits. to get to 24 bits the mask would need to be 48 bits wide [needs 16 bits to allow insertion at any bit point offset], the code size would double the speed halve. any font over 23 bits wide will intrude on its neighboring chars space at some bit offsets
    Last edited by richard; - 24th October 2022 at 07:22.
    Warning I'm not a teacher

  38. #78
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    169


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Thanks Richard, that clears that up. No biggy anyway.

    edit: actually the one working fine was 18x24 (I was mixing up the width & height)

    Troy
    Last edited by rocket_troy; - 24th October 2022 at 07:32.

  39. #79
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    a driver for the sharp memory lcd's to add to the list
    Attached Files Attached Files
    Warning I'm not a teacher

  40. #80
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: Graphical Displays with PBP3

    Hi Richard.

    Which LCD is this?

    Your lib file looks more like an example file. Is it correct?

    Ioannis

Similar Threads

  1. Replies: 3
    Last Post: - 1st January 2021, 22:28
  2. problem using Graphical LCD
    By Mostafa in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2007, 19:15
  3. Graphical LCDs
    By T.Jackson in forum General
    Replies: 5
    Last Post: - 14th May 2007, 07:29
  4. Vb 6.0 Graphical plug in
    By rocky79 in forum Serial
    Replies: 0
    Last Post: - 8th March 2006, 19:42
  5. Graphical user interface
    By rocky79 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th October 2005, 13:25

Members who have read this thread : 25

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts