element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
element14's The Ben Heck Show
  • Challenges & Projects
  • element14 presents
  • element14's The Ben Heck Show
  • More
  • Cancel
element14's The Ben Heck Show
Forum Strange Behavior with 20*4 LCD (BASIC-Computer with Arduino)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join element14's The Ben Heck Show to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 7 replies
  • Subscribers 30 subscribers
  • Views 999 views
  • Users 0 members are here
  • lcd
  • computer
  • episode
  • retro
  • ben_heck
  • basic
  • ben
  • arduino
Related

Strange Behavior with 20*4 LCD (BASIC-Computer with Arduino)

Former Member
Former Member over 12 years ago

I already posted about this issue in this thread, but I think, my issue is different.

I have changed ca. 10-15 lines in the original source code provided by Ben Heck. The 20*4 LCD now outputs Data without line-problems, but the 4 characters in the topright corner are displayed at the beginning of the third line!?

It looks like this:

                    
TinyBasic
1146 Free.
>10 print "1234567"_

TinyBasic           
1146 Free
>10 print "1234567"
>_

1146 Free.
>10 print "1234567"
>
>_

>10 print "12345
>
>7"
>_

in the fourth frame, after pressing LF, until the entered command goes up to the first line, only the left 16 chars are shown (the rest are blanked out), and the other 4 are in the third line, although the 17th is overwritten by the cursor > (in fact, up to all 4 could be overwritten if something would be written in this line)

Does anyone knows how to fix this? I am desperately trying to figure this out.

I marked the changes I made in the source code in the link in the first line in this post. I don't know if I am allowed to post the script here.

 

Thanks!

  • Sign in to reply
  • Cancel
Parents
  • benheck
    0 benheck over 12 years ago

    Some RAM is set aside as "screen memory" in that code. It is then mapped to the display.

     

    Check that enough has been allocated, since youre display is larger than the one I used.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • benheck
    0 benheck over 12 years ago

    Some RAM is set aside as "screen memory" in that code. It is then mapped to the display.

     

    Check that enough has been allocated, since youre display is larger than the one I used.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 12 years ago in reply to benheck

    First of all, thanks for responding!

     

    I initially changed int screenMem[72]; (at the beginning of the script) to 76, which took away most display errors. I now tried to increase this array to 80, then 100, but it did not work. When I increase it even more, (103 or more), nothing is displayed at all.

    I also figured out that your lcdChar () function (called by outchar) overlaps, but changing anything only results in a very strange display behaviour (all the text is in wrong places, like so: http://www.element14.com/community/message/81178#81178).

     

    1574
    for (int xg = 0 ; xg < 20 ; xg++) {
    1575
    screenMem[0 + xg] = screenMem[40 + xg];00-19 -> 40-59
    1576
    screenMem[40 + xg] = screenMem[20 + xg];  40-59 -> 20-39
    1577
    screenMem[20 + xg] = screenMem[56 + xg];20-39 -> 56-75
    1578
    screenMem[56 + xg] = 32;56-75

     

    When I increase screenMem[xy], the "bytes free" (shown at the beginning, Tinybasic - 1146 free), does not get smaller. Do I need to manually decrease that value? if yes, where?

     

    Thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • benheck
    0 benheck over 12 years ago in reply to Former Member

    ScreenMem is divided into 4 lines. Should be 80 total (20 times 4)

     

    As for free space, check the beginning of the code, it might manually reserve the free space, or use a large array as its RAM.

     

    It's been over a year since I hacked that Tiny BASIC code, I don't really remember all that I did.

     

    At a certain point, wouldn't it just be easier to use the original sized screen?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to benheck

    I'll check that when I'm home again next week. It is not *that* important, it just looks hgrrrrr!! image I can live with it, if I can't get it to work!

     

     

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to benheck

    Xg ++ should be put inside the loop and not in the declaration of the For (  ){ }

    That is because your variable enters the loop already added by one "1" so the loop begins with your variable higher by one more than you expected to be.

    So instead of beginning with zero it begins with one so you have 19 repeats not 20.

    All of my posts refer to the C++ language ,for the basic as language adjust accordingly.


     

    Message was edited by: Gerasimos Kokkinos

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube