Graphical Displays with PBP3


+ Reply to Thread
Results 1 to 40 of 115

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    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

  2. #2
    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,

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    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

  4. #4
    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

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    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

  6. #6
    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

  7. #7
    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

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    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 03:00.
    Warning I'm not a teacher

Similar Threads

  1. Replies: 3
    Last Post: - 1st January 2021, 21:28
  2. problem using Graphical LCD
    By Mostafa in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2007, 18:15
  3. Graphical LCDs
    By T.Jackson in forum General
    Replies: 5
    Last Post: - 14th May 2007, 06:29
  4. Vb 6.0 Graphical plug in
    By rocky79 in forum Serial
    Replies: 0
    Last Post: - 8th March 2006, 18:42
  5. Graphical user interface
    By rocky79 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th October 2005, 12: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