Menu

LCD mode 0 - 3 I/O pin I/F

2020-04-12
2022-02-24
1 2 > >> (Page 1 of 2)
  • Geoffrey Younger

    In this time of covid-19 and social isolation a positive has to be - its a great time for 'tinkering' and making video's !! To this end I have come up with yet another LCD i/f. This one uses the humble 74HC595 as a fast, 8bit serial lcd driver. I first developed this i/f in Dec'18 on a picaxe 14M2 and used it successfully since.

    The basic premise is the multiplexing of the Data and RS lines and delivering the data
    at 8MHz clock (32MHz) to the 595+lcd. While it looks like SPI it isn't. Here are some of benefits.

    1. 8 bit i/f - no nibble twiddling, just load and go. The 595 is 'flushed' every transfer, so no resetting required.
    2. The 595 pinout compliments the lcd 16pin connector - made for veroboard.
    3. The normal 4bit i/f is reduced from 6 i/o pins to 3, two of these pins can be used by other spi devices.
      The i/o lines are DRS(data+RS), CLK and ENL.
    4. The ENL(enable+latch) pulse appears at the end of the transfer and on it's +ve edge latches in the RS value, also 8 bits of data are latched on the o/p of the 595
      On the -ve edge that data is latched into the lcd.

    The attached gcb program works in I/O mode 0, has some interesting subs and works well.

     
    • stan cartwright

      stan cartwright - 2020-04-12

      Nice you shareing.
      I got some 2 line lcds somewhere...but prefer spi/i2c glcds.
      I got time to sort shift registers with the led displays gcb supports but don't follow the code.
      I remember Picaxe...what a con..in-line asm it said but it wasn't, it was interpretted.
      Which Anobiums latest video shows...real optimised...better than homemade asm.
      Youtube video shows more :)

       
  • jackjames

    jackjames - 2020-04-12

    The following line is incorrect:
    sub WrEeprom ( in Estring() ) as string * 64 ;

     
    • stan cartwright

      stan cartwright - 2020-04-12

      I don't write code like this using as variable.
      what is wrong? string size?
      what is as string * 64?
      I just tried eeprom read/write on a 328p and amazed it worked!
      Trying to improve my programming style but if I find it un-natural then others would maybe.
      At least you don't dim variables in your subs like some do. I get lost then.
      Wish I could help but digging out 2 line lcd..got one in a psion organiser but best keep it an antique :)

      sub WrEeprom ( in Estring() ) as string * 64 ;
        for ee = 1 to len ( Estring ) ;
        HSersend Estring(ee)          ;
        epwrite location, Estring(ee) ;
        location++                    ;
        next                          ;
      end sub
      
       
  • jackjames

    jackjames - 2020-04-13

    I'd like to understand something:
    "as string * 64" written after the bracket of the data passed in a SUB what is its use?
    What does it mean ?
    A fuction comes out a value but a sub?
    And then where is this data passed?

     
  • Anobium

    Anobium - 2020-04-13

    @JackJames. Great questions.

    This is a sub and returns nothing.

    I am not sure the * 64 does anything (it would if this this a function). I did looked at this code this morning and spotted a few others issues.

    sub WrEeprom ( in Estring() ) 
      Dim ee as Byte 'or Word if the EE is 1024 bytes
      for ee = 1 to len ( Estring ) ;
              HSersend Estring(ee)          ;
              epwrite location, Estring(ee) ;
              location++                    ;  NOT sure what this is....
      next                          ;
    end sub
    
     
  • jackjames

    jackjames - 2020-04-13

    Quite right.
    And also the "location" variable should be defined.

     
    • Anobium

      Anobium - 2020-04-13

      No. Dont specify 'AT location' let Great Cow BASIC do memory management.

      Unless you know of an issue. I am unware of issues with Great Cow BASIC memory management. Got an issue?

       
      • jackjames

        jackjames - 2020-04-13

        Sorry Anobium, so if I do not size and give a value to 'location' and I shoot the data in that way, the compiler automatically attaches a position in the eeprom?
        And then, how do I know where I wrote it?

         
  • jackjames

    jackjames - 2020-04-13

    No problem.

     
  • Geoffrey Younger

    I'm following the discussion with much interest. All I did was to copy an example in the Help file. If you go to here - Help -> Command References ->Liquid Crystal Display ->Example -> Lcd_IO 4 Example , you will find an Example created by Thomas Henry and edited by Evan Venn. At the very bottom of the example you will find the sub in question.
    Anyhow, the focus of this exercise by me was the hardware lcd inerface in MODE 0. I couldn't find any working examples so I created my own. The Hardware is the focus here.
    For some reason I cannot post multiple attachment at once ( please help Evan !) so the attachment here is circuit diagram of the interface and the timing involved. As far as the software side goes, I'm sure there any some bugs in it. My greatest difficulty was - I could not find a ReadArray or ReadString commands !! The ReadTable command gave me much grief. I has to use the 'ASC' command to get the desired effect. There is one more attachment to come - <lcdcommands.h></lcdcommands.h>

    For some reason I now cannot add any attachments - when I press the link ,this page is reset to the top - when I scroll down nothing has changed - No sub window. What am I doing wrong. Any Help would be appreciated.

     
  • Geoffrey Younger

    I'll try again
    2 hours later it works for 1 attachment

     
  • Geoffrey Younger

    I'll try again and again
    2 hours later it works for 1 attachment

     
  • Anobium

    Anobium - 2020-04-14

    OK. You are wanting to add this new One Wire solution to the LCD capabilities.

    The best way to do this is to simply redict the existing subs to your hardware, and hook the existing constants.

    I added a new K107 LCD last week, and, by using redirection all the existing command work.

    @theo0001 Is the man you need. He is the expert on One-Wire LCDs!! I am not the man of this. :-)

     
  • Geoffrey Younger

    Hi Anobium , I am completely confused. At no time did I say I wanted to add this interface to the GCB system, it is an exercise in 'tinkering' using lcd Mode 0. Also, it is not a One Wire solution, the circuit diagram ( jpg ) clearly shows 3 wires. It's main attraction is high speed and ease of use.

    I noticed the use of K107 lcd mode in your video's, does it work like Dr Peter Anderson's K107 and K117 one wire interfces ?
    When can we expect to get our hands on this new software ?
    Thanks for your help.

     
  • Theo

    Theo - 2020-04-14

    Hello Geoffrey,
    there lead many roads to Rome, there are also many manners to solve a display problem with the help/use of GCB.

    I think you missed a very important part of the help file: LCD overview.
    To go there: - Help -> Command References ->Liquid Crystal Display, doubleclick on LCD Overview and it will show you verything about the connection modes 0 to 12.

    Connection mode tells you something about the used wires but not always!

    For any question, don't hesitate to ask in this forum.

    Theo.

     
  • Geoffrey Younger

    Thank you Theo for your kind but condesending words. I can assure you I have NOT missed the lcd overview.
    I've only been using/designing characterLCD interfaces for the past 26 years !! How else do you think I could come up with this 3 wire interface that is fast and easy to use, just look at the jpeg I just posted. End of Transmission !!

     
  • Theo

    Theo - 2020-04-14

    Geoffrey,
    in the first place I did not intend to condescend someone, at my age that is not necessary.
    second, you don't need any help. You've made that clear.

    Have a nice day!
    Theo.

     
  • mkstevo

    mkstevo - 2020-04-14

    I'd just like to say I have built this and will find it very useful. I use 74HC595's in many of my designs and utilising another to drive an LCD will be really handy. I'll be able to attach both a 74HC595 driven LED display and a 74HC595 driven LCD to a 12F1840 (though more probably a 16F1825/1829). Thanks, I appreciate you sharing your design.

     
  • Geoffrey Younger

    Better late than never--thanks @mkstevo for the previous post.
    I have done some modifications and tests to the previous software. This new version
    can now use the 'print' command and the tests shows this. I also took out my old CRO
    to check various waveforms. These are the results -
    1. The ENL pulse rate (for the loop test at the start) is 49 uSec which gives more than
    20,000 characters/sec.
    2. I used the uppercase 'U' because it has a hex code of 55 or binary 01010101. This a
    solid test for the DRS line as the data changes every clock pulse.
    3. The minimum RS setup time (TAS) wrt ENable is only 50 to 100 nanoseconds - depending
    on controller used, clock freq (usually 270KHz) etc. So there could be more speed that
    could be achieved by shortening the DRS setup delay and the ENL pulsewidth.
    4. One of the keys to unlocking the 'print' command was DRS = LCD_RS. This now seems to
    integrate with lcd.h seamlessly.

    I'm sure there are many more enhancements that could be made - by others !!

    Enjoy, as the good farmer says.

     
    • mkstevo

      mkstevo - 2022-02-02

      I'm still following this with great interest. I would have built it into one of my designs if I'd had access to it about one month before your original post. During the first two weeks of the March 2020 lockdown I worked from home designing a circuit and associated software. The design needed both LED display (which uses four 74HC595's for the seven segment displays) and an LCD display. I could have swapped six whole pins used for the LCD using just one 'Enable' pin and the existing (LED) 595 clock and data lines instead of all those for the LCD. I was desperately short of pins as it was and had to perform some software and hardware jiggery-pokery to 'multiplex' some signals onto pins already used for other functions.

      It is an idea I've not forgotten and I'm sure I will be able to put it to some use at some point in the future. I for one am very grateful indeed.

       
  • stan cartwright

    stan cartwright - 2022-02-03

    I use an ili9341 spi with a uno/nano board. Much better. Lots of pins left. Get on with coding a nice display.

     
    • mkstevo

      mkstevo - 2022-02-03

      They are less suited to building into industrial machines and enclosures. I fit 16x2 LCD displays into many machines and find that they really suit where small amounts of information and options need to be displayed permanently. Often an LED display is too limiting, and so a small LCD is needed.

      I did manage to write some software that needed to show options for changing prices, bonus levels and output sequences on just a two digit seven segment display recently. That was a challenge. My circuit and software is to replace an unreliable (though it is forty years old now) credit board with a more recent version that is not limited to a maximum of about 75p, and provide bonus levels but has to use a pre-existing two digit display that is built into the machines.

      Here is the type of thing for which a 16x2 display is ideal. This design is the one for which I would have jumped at the chance of the '3 wire LCD'. It is the one where at least two pins go in and out to multiple points. I really, really neded more pins. The '3 wire LCD' would have made my job so much easier.

       
  • Geoffrey Younger

    I was asked about an AVR equivalent of the 3pin LCD interface - well here it is. I developed this on a Hiland Barebones Board - Mega328P Dip with UNO bootloader running at 16MHz.
    Cheers !

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.