Graphical Displays with PBP3


+ Reply to Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Graphical Displays with PBP3

    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.

    a driver for ssd1306, nokia and the ubiquitious 128x64 glcd are included with a small demo for each.
    note this is pic18 pbp3 only and if a mssp port is warranted then its used. there are more functions in the lib than the USERCMDS
    indicate, i never use them all. i could not be bothered making the usecmd code for everything
    i might publish the led dmd stuff at sometime when i work out dma->spi transfers with a k42


    and some fonts


    and some demos
    Attached Files Attached Files
    This is more entertaining than Free to Air TV

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    880

    Default Re: Graphical Displays with PBP3

    You've done an excellent job. Would you consider posting a small video demo to visualize the results?

    Warm wishes

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    i dropped my camera and its not too happy, the phone makes ridiculous high res movies too big to use online
    so how about a sim still shot
    Name:  glcd.jpg
Views: 120
Size:  159.7 KB

    Name:  n7110.png
Views: 120
Size:  34.3 KB

    nokia 7110 too
    Attached Files Attached Files
    Last edited by richard; - 20th March 2021 at 11:52.
    This is more entertaining than Free to Air TV

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

    Default Re: Graphical Displays with PBP3

    That is awesome!

    Thanks for sharing,
    Ioannis

  5. #5
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Fantastic work again Richard!

    Would you have any particular recommendations for a display to purchase for a newbie just as a play-around learning tool ?

    Regards,

    Troy

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    if you don't mind waiting a few weeks the nokia 5110 from china is <$5 . the 7110 have a weird connector and are best avoided imo ,both are good size
    not too many pins needed, 3-5v ok.
    the ssd1306 are about $8 locally but they are pretty small need only two pins if you get i2c variant, 3-5v ok.
    if you catch a special at https://www.rockby.com.au/Index2012.cfm the 128x64 glcd can be real cheap < $5 but need heaps of pins to drive them 5v only.
    they all work .
    This is more entertaining than Free to Air TV

  7. #7
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Thanks Richard,
    Ordered a 5110 from Ebay. Looking forward to having a play.

    Cheers,

    Troy

  8. #8
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Richard,
    Received my 5110 display today and have just started to have a play. The nokia demo appears to display perfectly - excellent. I'm a bit stumped on one thing I'm trying to do. The nokia demo draws a circle:

    DRAWCIRCLE 64,15,12

    which I assume is a circle located a x=64, y=15 and radius of 12 yeah?

    so I'm trying to draw a line from the centre of the circle to the top of the circle (or vice versa) so I tried:

    DRAWLINE 64,3,64,15,1

    which I assume is drawing a line from starting point X=64, Y=3 to ending point X=64, Y=15

    And indeed the line starts at the correct point (top centre) but only extends down 7 or 8 pixels ie not to centre of the circle?

    Any ideas?

    Regards,

    Troy

  9. #9
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    So, what's happening (for me) is for a line that's wider than it is higher (or equal), it appears from very initial testing to draw correctly. But if it's higher than it is wider, it doesn't?

    Troy

  10. #10
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    it appears there was a bug in drawing vertical lines. this now works
    Attached Files Attached Files
    This is more entertaining than Free to Air TV

  11. #11
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Excellent! Hats off again Richard. This looked like a lot of work in putting it all together. If we ever meet, the drinks will definitely be on me!

    Troy

  12. #12
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Richard,
    Another question: can we pass variables as parameters to these geometric routines?

    Like:

    DRAWLINE My_x1, My_y1, My_x2, My_y2, 1

    So far I'm trying to pass byte size variables but getting illegal opcode messages at compile?

    Troy

  13. #13
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    Another question: can we pass variables as parameters to these geometric routines?
    EASY , Just add the needed macro's to the include file, you can dial up whatever you like

    http://www.picbasic.co.uk/forum/show...hlight=ssd1306
    http://www.picbasic.co.uk/forum/show...hlight=usercmd
    http://support.melabs.com/forum/picb...er/usercommand
    Last edited by richard; - 3rd April 2021 at 13:03.
    This is more entertaining than Free to Air TV

  14. #14
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    EASY , Just add the needed macro's to the include file, you can dial up whatever you like
    oookay

  15. #15
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    DRAWLINE My_x1, My_y1, My_x2, My_y2, 1
    You need a macro like
    DRAWLINE?BBBBC
    the error message will tell you this does not exist

    the existing drawline macros
    Code:
    ;LINE 
    DRAWLINE?WWWW  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?WB    X0in ,_s_xstart
        MOVE?WB    X1in ,_s_xend
        MOVE?WB    Y0in ,_s_ystart
        MOVE?WB    Y1in ,_s_yend
        L?CALL _dline 
        endm  
    DRAWLINE?WWBW  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?WB    X0in ,_s_xstart 
        MOVE?BB    X1in ,_s_xend
        MOVE?WB    Y0in ,_s_ystart
        MOVE?WB    Y1in ,_s_yend
        L?CALL _dline 
        endm 
    DRAWLINE?WWBB  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?WB    X0in ,_s_xstart
        MOVE?BB    X1in ,_s_xend
        MOVE?WB    Y0in ,_s_ystart
        MOVE?BB    Y1in ,_s_yend
        L?CALL _dline 
        endm  
    DRAWLINE?WWCC  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?WB    X0in ,_s_xstart
        MOVE?CB    X1in ,_s_xend
        MOVE?WB    Y0in ,_s_ystart
        MOVE?CB    Y1in ,_s_yend
        L?CALL _dline 
        endm       
    DRAWLINE?WWWB  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?WB  X0in ,_s_xstart
        MOVE?WB  X1in ,_s_xend 
        MOVE?WB  Y0in ,_s_ystart
        MOVE?BB  Y1in ,_s_yend
        L?CALL _dline 
        endm        
    DRAWLINE?BBBB  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?BB     X0in ,_s_xstart
        MOVE?BB     X1in ,_s_xend
        MOVE?BB     Y0in ,_s_ystart
        MOVE?BB     Y1in ,_s_yend
        L?CALL _dline 
        endm  
    DRAWLINE?CCCC  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?CB  X0in ,_s_xstart
        MOVE?CB  X1in ,_s_xend
        MOVE?CB  Y0in ,_s_ystart
        MOVE?CB  Y1in ,_s_yend
        L?CALL   _dline 
      endm  
    DRAWLINE?CCCB  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?CB  X0in ,_s_xstart
        MOVE?CB  X1in ,_s_xend
        MOVE?CB  Y0in ,_s_ystart
        MOVE?BB  Y1in ,_s_yend
        L?CALL   _dline 
      endm  
    DRAWLINE?CCCW macro X0in ,Y0in ,X1in ,Y1in
        MOVE?CB  X0in ,_s_xstart
        MOVE?CB  X1in ,_s_xend
        MOVE?CB  Y0in ,_s_ystart
        MOVE?WB  Y1in ,_s_yend
        L?CALL   _dline 
      endm      
    DRAWLINE?BBCC  macro X0in ,Y0in ,X1in ,Y1in
        MOVE?BB  X0in ,_s_xstart
        MOVE?CB  X1in ,_s_xend
        MOVE?BB  Y0in ,_s_ystart
        MOVE?CB  Y1in ,_s_yend
        L?CALL _dline 
        endm 
    DRAWLINE?CCCCC  macro X0in ,Y0in ,X1in ,Y1in,Col
        MOVE?CB  Col ,_colour
        MOVE?CB  X0in ,_s_xstart
        MOVE?CB  X1in ,_s_xend
        MOVE?CB  Y0in ,_s_ystart
        MOVE?CB  Y1in ,_s_yend
        L?CALL   _dline 
      endm


    you could add this



    Code:
    DRAWLINE?BBBBC  macro X0in ,Y0in ,X1in ,Y1in,Col
        MOVE?BB     X0in ,_s_xstart
        MOVE?BB     X1in ,_s_xend
        MOVE?BB     Y0in ,_s_ystart
        MOVE?BB     Y1in ,_s_yend
        MOVE?CB     Col  ,_colour
        L?CALL _dline 
        endm

    or set the colour manually
    eg colour=1

    and use
    DRAWLINE My_x1, My_y1, My_x2, My_y2
    which already exists
    DRAWLINE?BBBB
    with a mono display you probably wont change the colour too often
    This is more entertaining than Free to Air TV

  16. #16
    Join Date
    May 2013
    Location
    australia
    Posts
    1,839

    Default Re: Graphical Displays with PBP3

    a 5 input user command has the potential to need 5 raised to the 7th power of macros to cover every input permutation possible
    a ridiculous number, i only ever create what seems useful to me. it's trivially easy to add any other combination you app calls for
    and the compiler error virtually spells it out for you
    This is more entertaining than Free to Air TV

  17. #17
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    75

    Default Re: Graphical Displays with PBP3

    Quote Originally Posted by richard View Post
    a 5 input user command has the potential to need 5 raised to the 7th power of macros to cover every input permutation possible
    a ridiculous number, i only ever create what seems useful to me. it's trivially easy to add any other combination you app calls for
    and the compiler error virtually spells it out for you
    Yeah, I did get that part from reading the links you provided - which makes it understandable (I guess) why you don't include that broad functionality.

    Thanks for the example though. I now get it

    Cheers,

    Troy

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

Posting Permissions

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