Menu

PICSimLab with GLCD

2018-10-24
2018-11-08
  • Chris Roper

    Chris Roper - 2018-10-24

    I have been Playing round with PICSimLab, with some help from Google Translate as the Board Documentation is in Portuguese, and am very impressed by its capabilities, especially when teamed with GCBASIC.

    I will be documenting it more fully in time but as an example of its capabilities here is a shot of the GLCD Demo Code running on a Simulated Arduino Uno.

    And in true GCBasic style the same code Runs on the PICGenios Simulation just by changing to

    #chip 18F4550
    

    If you want to try GCBasic without spending any cash on Boards and Programmers, need to test a peripheral you don't have yet or, as in my case, the curiosity to try out Arduino Hardware as GCBasic Dev Board, then I recommend you give PICSimLab a try.

    Cheers
    Chris

     

    Last edit: Chris Roper 2018-10-24
  • Chris Roper

    Chris Roper - 2018-10-24

    As an idea of what you can do in PICSimLab with the Arduino UNO, or any of the other simulated boards, here is a quick look.

    In addition to the Nokia 5110 48x48 Mono GLCD shown above it has a Nokia 6100 display with 132 x 132 pixels with 12-bit color and the standard 16x2 / 16x4Character LCD's.

    Animated Graphics extend to Servo and Stepper motors:

    RGB LED Simulation

    A game Controller with both Analogue and Digital functions

    The run of the mill Potentiometers for Analogue work

    And, ofcourse, a full complement of LED’s, Buttons and Switches.

    All of the above are in addition to what you see mounted on the Simulated Boards which include Seven Segment Displays, Serial port I/O, Buzzers etc..

    With that lot you could probably simulate and test most microcontroller type applications without breaking the Bank, not even the Piggy Bank, and it is a great learning tool to boot.

    It is limited as to the devices it can simulate but that is not an Issue for GCBasic as portability is often as simple as Changing the Chip and recompiling. So you can test with something similar, as long as the peripherals are the same.

    Cheers
    Chris

     

    Last edit: Chris Roper 2018-10-24
  • Anobium

    Anobium - 2018-10-24

    Very good. :)

    Can you post a working project?

    Well done.

     
  • Chris Roper

    Chris Roper - 2018-10-24

    OK - I fond the time:
    Simple PICSimLab Project

    Original (Now Obsolete Message)
    No, I am still translating the manuals and learning the features, far to soon to now design and build a project, but if you have a project for me to port to it I will give it a shot.

    My main interest is to use it to create a series of training exercises on a platform that is accessible to anyone for Free.

    With no barrier to entry we should be able to attract a lot more users and maybe even convert some Arduino-nuts to the power of GCBasic.

     

    Last edit: Chris Roper 2018-10-24
  • stan cartwright

    stan cartwright - 2018-10-24

    I just downloaded the 32 bit version to a win7 laptop..(I did upgrade my 32bit win10 pc to win64 to use newer software version to find I have crappy open gl graphics).
    I'll try this BUT I never used picaxe sim when I used picaxe...in fact never used a simulator.
    So...I write a prog for say uno in gcb and save hex, then load hex into sim and run..yes?
    I'll try now and let you know.
    The scope tool is handy.
    edit- Not enough info to use and right click transate option doesn't appear. Another frustrating program.

     

    Last edit: stan cartwright 2018-10-24
  • Chris Roper

    Chris Roper - 2018-10-24

    What do you need to know Stan?
    What Board are you wanting to use?
    What is it that you need to translate?
    Did you see the English section under Help, though the help is not extensive, I asume he told his class how to use it.

    Say what you are trying to do and I can try and help you but saying:
    "Not enough info to use and right click transate option doesn't appear. "
    Is not giving me much of a clue as to where to start.

    That said, if you have compiled a program in GCBASIC from the emulator Click File-> load Hex.
    Nothing to translate there so still a bit confused as to your issue.

     

    Last edit: Chris Roper 2018-10-24
  • stan cartwright

    stan cartwright - 2018-10-24

    I could do a youtube video as normal video files are not accepted...a chore
    It's open on screen now , it's uno, 328, I set clock to 16..
    I looked at help an it's not click and translate in my win7...it's not a web thing,it's help file, so translate page at a time with another app or wp.
    IMHO if the sim is not easy to use then recommending it for gcb is going to make gcb less attractive if one has not tried using gcb with chips and progamming software.....which I've posted is easy..cos people seem to make it look complicated.
    The non English instructions is a problem for me..it doesn't seem to do much.

    I wrote this,saved the hex and loaded into sim
    then I used the scope tool to check portb.o and got the screen shot...groovy
    Let you know other things as I find out.

    #chip mega328p,16
    #option explicit
    dir portb.0 out
    do
    set portb.0 on
    wait 1 ms
    set portb.0 off
    wait 1 ms
    loop
    
     
  • Chris Roper

    Chris Roper - 2018-10-24

    For the Help did you try scrolling down?

    Help-->Contents

    It has Portuguese followed by english.

    The Schematic Pdfs are the most useful parts of Help

    I am posting a Sample Project in a new thread.

     

    Last edit: Chris Roper 2018-10-24
  • stan cartwright

    stan cartwright - 2018-10-24

    Modules/spare parts/potentiometer....black screen. what's happening, how do you set anything up?

     
  • stan cartwright

    stan cartwright - 2018-10-24

    I didn't find English but Osciloscopio is like Welsh :)
    I got the servo graphic demo to work so getting the idea. I think I'm not into simulators, moving a real servo is more fun.

     
    • Chris Roper

      Chris Roper - 2018-10-24

      "I think I'm not into simulators, moving a real servo is more fun."

      That may well be Stan but you are missing the Point.

      This is FREE software that simulates EXPENSIVE hardware.
      I am doing this research and posting these notes to benefit NEW users who have NO prior experience with hardware and want to try GCBASIC without having to purchase anything.

      You are NOT my target and though I appreciate any constructive feedback your negative, off topic, comments are far more likely to scare off new users than any simulator regardless of the language.

       
      • stan cartwright

        stan cartwright - 2018-10-26

        True, I was being negative ...vdd but the simulators, other than this, I've tried, had a learning curve. At 64 I'm picky about what I have time to learn. This simulator seems easy with no help.. I got a hex file to go first attempt with gcb. For me that's amazing :)
        As the Title post says glcd I'll see if the displays it sims are supported by gcb and see if the graphics work as way of positive vss support for your efforts and if so provide an example.

         
  • Chris Roper

    Chris Roper - 2018-10-24

    Simple Tutorial on the way, just busy formating it:

     
  • stan cartwright

    stan cartwright - 2018-10-26

    I have the sim on screen and added pcd lcd that is supported by gcb. Now if I write some code to use that display and load hex it will run on the screen? ...before I try and it doesn't
    edit I right click and pins I use I program and select here...... this is user feedback using sim and gcb.
    What are the sim lcd pins using gcb please?

     

    Last edit: stan cartwright 2018-10-26
  • Chris Roper

    Chris Roper - 2018-10-26

    Whatever you want them to be.
    You are the Arduino Expert not me, but I got it to run fist time.

    Treat it like you would any other Arduino UNO board.

    Looking at the first picture in this thread it looks like I used PD3, PD4, PD5, PD6 and PD7 in that sequance.

    The code is from the GCB demos fiolder and #Chip was set at mega328a

     

    Last edit: Chris Roper 2018-10-26
  • Chris Roper

    Chris Roper - 2018-10-26

    Found the Code:

    '
    '
    '
    #chip Mega328, 16
    #option Explicit
    
    #include <glcd.h>
    
    #DEFINE GLCD_TYPE GLCD_TYPE_PCD8544
    
    ' Pin mappings for software SPI for Nokia 3310 Device
    '                                  (PICSimLab pcd8544)
    #define GLCD_RESET  PortD.3       ' PICSimLab /RST
    #define GLCD_CS     PortD.4       ' PICSimLab /CE
    #define GLCD_DC     PortD.5       ' PICSimLab  DC
    #define GLCD_DO     PortD.6       ' PICSimLab  DIN
    #define GLCD_SCK    PortD.7       ' PICSimLab  CLK
    
    Dim outString as string
    Dim ccount, byteNumber as Byte
    Dim longNumber as Long
    Dim wordNumber as Word
    GLCDCLS
    
    DO forever
       for CCount = 31 to 127
            GLCDPrint (0, 0, "PrintStr")
            GLCDDrawString (0, 9, "DrawStr")
            GLCDPrint ( 44 ,  21, "     ")
            GLCDPrint ( 44 ,  29, "     ") ' word value
            GLCDPrint ( 44 ,  37, "   ") ' Byte value
    
            outstring = hex( longNumber_U)
            GLCDPrint ( 44 , 21,outstring )
            outstring = hex( longNumber_H)
            GLCDPrint ( 55 , 21, outstring)
            outstring = hex( longNumber)
            GLCDPrint ( 67 , 21,  outstring )
            GLCDPrint ( 44 , 29, mid( str(wordNumber),1, 6))
            GLCDPrint ( 44 , 37, byteNumber)
    
            box 46,9,57,19
            GLCDDrawChar(48, 9, CCount )
            outString = str( CCount )
            ' draw a box to overwrite existing strings
            FilledBox(58,9,GLCD_WIDTH-1,17,GLCDBackground )
            GLCDDrawString(58, 9, outString )
    
             box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1
             box GLCD_WIDTH-5, GLCD_HEIGHT-5,GLCD_WIDTH- 1, GLCD_HEIGHT-1
             filledbox 2,30,6,38, wordNumber
             Circle( 25,30,8,1)            ;center
             FilledCircle( 25,30,4,longNumber xor 1) ;center
    
             line 0,  GLCD_HEIGHT-1 , GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1
             line  GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1 ,0, (GLCD_HEIGHT /2) +1
    
    
            longNumber = longNumber + 7
            wordNumber = wordNumber + 3
            byteNumber++
        NEXT
    LOOP
    
    end
    

    have fun

    Cheers
    Chris

     
  • Chris Roper

    Chris Roper - 2018-10-26

    Reproduced as a test, took les than 5 min

     
  • stan cartwright

    stan cartwright - 2018-10-26

    Well I'll be. Well done Chris. It's repeatable. You have to press debug to make it work...all with no instructions.
    I think a video is needed. This free screen capture first time use.

     

    Last edit: stan cartwright 2018-10-26
  • Chris Roper

    Chris Roper - 2018-10-26

    I am glad you got it working you but you shouldn't need Debug, I certainly didn't.
    Still I am glad to see you got It working and I hope it inspires you to take it further.

    Did you see that I managed to translate the McLAB1 and McLAB2 manuals?
    https://sourceforge.net/p/gcbasic/discussion/579125/thread/9155944b13/

    If you want to try exploring the PIC these boards should help, no need to buy a development board and you can do a lot of experimenting, GCBASIC has a lot of examples that can be ported and the McLab boards cover old and Newish PIC16 devices as well as PIC18.

    I am having fun testing Ideas on devices such as 16 x 4 LCD displays that, until now, I never had on a development board as well as playing with AVR and portability. I already have some Ideas for Core Changes, or at least major contribution to the architecture, all stuff that would require a fortune in hardware to test without PICSimLab.

    Expect a slew of posts in the future as my explorations continue and inspiration grows.

    Any experiments or examples you come up with will also be welcomed and add to the general pool of knowledge, let’s educate the rest of the GCBasic world and beyond.

    I will add examples for all of the Simulated boards into the Vendor Boards category of GCBASIC as I go.

    Cheers
    Chris

     
  • Randall Young

    Randall Young - 2018-11-08

    This is a great post, thanks for sharing!

     

Log in to post a comment.