1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Discussion in 'Oshonsoft' started by camerart, Mar 12, 2017.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi B,
    Thanks for your initialisation set-up, I've attached a program using it as a starting point.

    It will take me a little time to go through the programs posted in #15 and test them.

    I'll look into your suggestion of (external) eeprom, once I've got some results. The 5110s are in the post:)

    Thanks for your input, C.
     

    Attached Files:

  2. blinky465

    blinky465 New Member

    Joined:
    Mar 10, 2009
    Messages:
    22
    Likes:
    0
    I'm pretty sure the 1827 can run at 32Mhz too - that's twice as fast (not a lot slower) than a typical Arduino (which are usually limited to 16Mhz or 8Mhz depending on the bootloader). The '27s are pretty stingy with RAM, but for driving an LCD should have enough memory. I'm surprised you found them to be a lot slower than an Arduino - I don't know of any (mainstream) Arduino board running at 32Mhz (most are '328 based with either a 16Mhz crystal or an internal oscillator set to 8Mhz).

    Free PIC compilers are usually pretty terrible. The code generated by Oshonsoft, however, I've always found to be really tight. Long before I used the Arduino IDE I used to use Oshonsoft AVR simulator to dump code onto AVR chips; the BASIC complier created compiled code nearly a half the size that the Arduino IDE did. Oshonsoft even created (slightly) smaller code than SourceBoost C. I guess it's a trade off - Arduino does make things relatively simple, but at the cost of code bloat and processing speed (try writing an LED POV display using digitalWrite instead of direct port access and you'll get the idea!).

    For larger LCDs you can always stream bitmaps off external eeprom; even a mid-range PIC should have enough programming space to store a font-table of upper and lower case characters (you don't need to store the entire font map in RAM, just 8-bytes per character and read each character from ROM as needed). A lot of colour LCDs use R5G6B5 (5-bits red, 6-bits green, 5-bits blue) which means 2 bytes per pixel; on a 320x240 QVGA display, that's 150kb to store the entire screen image in memory! For displaying a bitmap, reading each pixel from eeprom and displaying it on the fly requires maybe 4-6 bytes (2 for the pixel data, maybe 2 or 4 for the pointer to the data?).

    I'm pretty sure a PIC 16F1829 will be more than adequate for driving your LCD.
    And if it's using SPI/I2C so you can control the clock line, probably twice as fast as an Arduino would, if you crank it up to 32Mhz!
     
  3. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,824
    Likes:
    959
    Location:
    Rochdale UK
    Ahh you are forgetting that a pic is only running at FOSC / 4... So a pic with 20Mhz crystal will have a system clock of 5Mhz... Having said that, I have run several graphical screens and I get quite fast refresh rates.. The biggest draw back on a pic 14 is there will only ever be up to 1k of ram...
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,719
    Likes:
    709
    Location:
    Derbyshire, UK
    As Ian has already pointed out, your error is confusing clock speeds with MIPS and an Arduino at 16MHz is a lot faster than a 16F at 32MHz.

    The 24F series is a different matter though, as it's faster :D

    Just not enough RAM or ROM, the amount of set-up data alone means you're struggling with a 16F - easier to just move to the 24F where you've got the speed, plus more RAM and ROM than an Arduino. Adding an external EEPROM (I'd use a FRAM anyway) is pretty pointless just to make it work, just use a 24F (or better).

    As for SPI speeds, again you're confused over clock and running speeds :D
     
  6. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi I and N,

    Can you suggest a more suitable PIC, especially if you used one with one of these screens, please? I'm looking for the minimum needed.

    Do either of you have any Oshonsoft programs for these screens, similar to the ones Blinky has posted?

    C.
     
  7. blinky465

    blinky465 New Member

    Joined:
    Mar 10, 2009
    Messages:
    22
    Likes:
    0
    Aha! I did forget the old fosc/4 MIPS!=clock speed issue!

    But - and maybe it's to do with the Arduino IDE/compiler or even just the way the code was written - I've found that in practice, code running on a 16F1825/9 runs (or at least appears to run) "faster" than the equivalent on Arduino; for example, when playing audio files from an sd card with Arduino, I struggled to get the data off the card (including navigating the necessary fat tables) quickly enough to play audio at anything better than 8-bit 22khz. The equivalent code on a 16F1825 could play 16-bit audio without any glitching. I found that putting a logic probe on the i/o lines of a PIC at 32Mhz resulted in "faster" performance than the same routines on an Arduino. Similarly, I had to really work to get a flicker-free LED POV working with Arduino, but the PIC (despite having "slower hardware") could keep the LEDs strobing more than quickly enough to maintain the illusion.
    I'm by no means an Arduino expert so maybe there's something I should (or shouldn't) be doing to get better performance out of the avr chips with Arduino!
    With all that said, I reckon I might need to look at some PIC24/32 chips one of these days - although I don't think the Oshonsoft compiler (that the original poster said he was using) supports these yet.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    I started using the 18F4620 PIC some time ago for SD work, check out the spec.
    BTW: Oshonsoft supports the 18F4620.
    E.
    A002.gif
     
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,719
    Likes:
    709
    Location:
    Derbyshire, UK
    Can't help you with Oshonsoft, but the 5110 is perfectly fine with the 16F1827, as it has enough RAM and ROM for that small device, including enough RAM for a full screen buffer, as you need one to draw to and then transfer to the screen (as you can't read back from the screen).
     
  11. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Ok, thanks for the suggestions, including the Arduino ones, but I prefer my little system using Oshonsoft and PICs.

    So for the simplest 5110 driving circuit a 16F1827 is fine.
    E, Once I've got this going, I'll look at larger PICs that include hopefully images + screen + program here: http://www.electro-tech-online.com/...ceiving-using-scr-radio-modules.149198/page-6

    Now we need to select the best program to try out from the selection from #15, using the initialisation in #21
    C.
     
  12. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,824
    Likes:
    959
    Location:
    Rochdale UK
    I use the pic18f4620.... I have nearly 4k RAM and 64k of Code... This can run at 32Mhz..

    As of today, I have moved to the pic18f45k22... This is a beast... 64k code nearly 4k ram 1k eeprom 64Mhz and more peripherals than you can imagine, two seial ports ( Why I need it )... I won't need any more... Pin compatable with my system.... Job done...
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi I,
    Thanks, Would you please repeat yourself, following the thread I posted above, and I'll check it once I've got these screens working. (As I soon overload with information:arghh:)
    C.
     
  14. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    I've tried a program attached. I changed a few things for 16F877A to 16LF1829 (I chose it instead of 16LF1827)
    It compiles, but I'm puzzled about the LCD and readout settings.
    C.
     

    Attached Files:

  15. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,824
    Likes:
    959
    Location:
    Rochdale UK
    Don't let me confuse you... I was just throwing other chips that available into the mix... If you need to use Pic16, by all means.. I'll shut up!!
     
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi I,
    I looked up the PIC and it is impressive, I'll note it on the other thread, for when I need it. Thanks for the suggestion. (Don't shut up;))
    C.
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    I've been thinking!!! My initial plan was to make the smallest PIC controlled screen, which could be unplugged, leaving the rest of any circuit. After re-thinking, and after Ian's suggestion of a larger PIC, my plan now is to use the larger PIC on the main circuit which can control the whole project while also being able to control the screen.
    C.
     
    Last edited: Apr 4, 2017
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Can anyone tell, if the screens we are now talking about (84x48 graphic serial type) has a module in the Oshonsoft SIM?
    I've looked and don't see how to set up the choices I found, and doesn't appear to be compatible with the programs at #15
    C.
     
  19. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,824
    Likes:
    959
    Location:
    Rochdale UK
    The beauty of programming micro's is you can write any driver!! If you need to write to a nokia 5110 then write a driver..

    This guy has written a nokia 5110 diver in proton basic... You would only need a few functions to get it up and running.. He has a good write up about using pic18's as opposed to pic16's..

    http://www.protonbasic.co.uk/conten...iver-for-the-Nokia-3310-and-5110-Graphic-LCDs
     
  20. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi I,
    Interesting link!
    Regarding the Oshonsoft SIM. Can I use the program I posted in #32 to simulate a graphics screen? If so, will you explain how please. For my programming limitations, I need to see it simulate for verification.
    C.
     
  21. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,824
    Likes:
    959
    Location:
    Rochdale UK
    What you need is some hardware... A pickit3 and MPLAB.... Then you can sim in real time on real hardware..

    I'm lucky I have Proteus... All these things are available.... I output an asm file from Oshonsoft then single step from each basic staement to the next... Its very difficult to sim a graphical screen..
     
  22. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi I,
    I use Pickit3 and MPLAB, but even though I've tried, I have difficulty with ASM. I prefer to simulate in software = Oshonsoft simulator. I can then make the circuit after my findings.

    I follow what you say regarding graphical screens, and I'll have to see how I get one once the screens have arrived. Perhaps I can make the circuit and keep trying it with on board programming?

    From memory proteus is out of my price range:(
    C.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice