Menu

2 wire lcd

Help
2010-04-06
2013-05-30
  • David Stephenson

    I have got a 2 wire LCD (nokia 4850057).

    It has the data and clock pins which can be handled.

    There are, however, two other pins - a reset pin and a so called command/data switch pin which (looking at projects on other sites) need to be actively connected.

    Is there anyway to get this display to work using GCBasic?

     
  • kent_twt4

    kent_twt4 - 2010-04-06

    Not a problem for GCBasic.  Now, for the programmer? :=)

    Built a very rudimentary driver for the KS0108B and a mono 128x64 glcd.  It's all about getting the lcd driver (part no.?) power up, initialization, data commands, and of course the timing diagram for read and write.

    It helps to have a device with a larger SRAM, when using data arrays.  For instance, the 128x64 glcd would need 1024 bytes to fill up the whole screen.

     
  • David Stephenson

    Looking at the help file I though it was just a matter of putting in

    #define LCD_IO 2
    #define LCD_DB PORTC.0
    #define LCD_CB PORTC.1

    Then connecting the data pin to portc.0 and the clock pin to portc.1

    I take it that it is not that easy.

     
  • kent_twt4

    kent_twt4 - 2010-04-06

    No, not that easy, you would have to build your own module/library.  Wouldn't be an afternoon project, at least for me anyways, but persistence pays off.

    The GCBasic lcd library won't work because the graphics based lcd controller for the Nokia, would be completely different, than the character based (Hitachi) lcd controller.  You could try and port a library from another project (AVR??), but in my mind it would probably easier to start from scratch.

     
  • Nobody/Anonymous

    My hitachi-driven LCD screen  works only sometimes. To get it to work sure-fire, is to connect the RW pin to the MCU (instead of ground)  and power on the LCD before the MCU. Is there a way to delay the GCBASIC code from start using the LCD before the LCD can finish initializing? OR is my screen bad?

     
  • pmielone

    pmielone - 2010-04-13

    I'm starting a project with 128x64 GLCD display. Any code / snippets how to get started i.e. make "hello world" project? Also, is there driver for "KS0108B , mono 128x64 glcd" for download ?

     
  • Dan Damron

    Dan Damron - 2010-04-21

    pmielone,
    I'd be interested in your project.  How's it coming?  I am currently using 40x4 HD44780 with a 74174 in 2 bit mode, and it's working a treat!

     
  • David Stephenson

    Ok I got it to work. Most of these LCD displays (the ones scavenged from old cell phones) have a Philips 8544 driver. The adat sheet for this is readily available (internet).
    It was sill a bit of trial and error and soldering the connections was a nightmare.

    #chip 16F676,4
    #config OSC=INTRC_OSC_NOCLKOUT, MCLRE=OFF, WDT=OFF
    dir porta.4 out
    dir porta.5 out
    dir portc.3 out
    dir portc.4 out
    dir portc.2 out
    dir portc.5 out
    wait 10 ms
    set portc.5 off
    wait 50 ms
    set portc.5 on 'power on
    wait 10 ms
    set portc.3 off 'reset pulse
    wait 10 ms
    set portc.3 on 'reset off
    xi=128
    yi=64
    set portc.4 off 'command mode
    for j=1 to 8
    readtable st1,j,dataout
    shiftout
    next j
    set portc.4 on 'data mode
    for j=1 to 180
    readtable st2,j,char
    if char=99 then exit for
    if char=50 then 'new line
    set portc.4 off
    yi=yi+1
    if yi>69 then yi=64
    dataout=xi
    shiftout
    dataout=yi
    shiftout
    set portc.4 on
    goto wq
    end if
    c1=char*5
    for n=c1-4 to c1
    readtable font,n,dataout
    shiftout
    shiftout 'double wide
    next n
    if char=19 or char=1 then goto wq 'proportional
    readtable st2,j+1,char
    if char=19 or char=1 then goto wq 'spacing
    dataout=b'00000000'
    shiftout
    wq:
    next j
    end
    '
    'shift register
    '
    Sub shiftout
    for k=0 to 7
    porta.5 = 0 ' clk low
    porta.4 = Dataout.7 ' read bit to dat pin.
    porta.5 = 1 ' clk high, load bit.
    Rotate Dataout left Simple ' Move to next bit in Dataout.
    next k
    porta.5 = 0 'clk low on exit
    End Sub
    '
    table st1 'setup data
    b'00100001'
    b'11001000'
    b'00000110'
    b'00010011'
    b'00100000'
    b'00001100'
    b'10000000'
    b'01000000'
    end table
    table st2
    17
    13
    12
    11
    29
    19
    13
    50
    31
    33
    19
    14
    11
    32
    19
    14
    99
    end table
    table font
    b'00000000'   '      
    b'01000010'   '#    #
    b'01111111'   '#######
    b'01000000'   '#     
    b'00000000'   '      
    b'01000010'   '#    #
    b'01100001'   '##    #
    b'01010001'   '# #   #
    b'01001001'   '#  #  #
    b'01000110'   '#   ##
    b'00100001'   ' #    #
    b'01000001'   '#     #
    b'01000101'   '#   # #
    b'01001011'   '#  # ##
    b'00110001'   ' ##   #
    b'00011000'   '  ##  
    b'00010100'   '  # # 
    b'00010010'   '  #  #
    b'01111111'   '#######
    b'00010000'   '  #   
    b'00100111'   ' #  ###
    b'01000101'   '#   # #
    b'01000101'   '#   # #
    b'01000101'   '#   # #
    b'00111001'   ' ###  #
    b'00111100'   ' #### 
    b'01001010'   '#  # #
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'00110000'   ' ##   
    b'00000001'   '      #
    b'01110001'   '###   #
    b'00001001'   '   #  #
    b'00000101'   '    # #
    b'00000011'   '     ##
    b'00110110'   ' ## ##
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'00110110'   ' ## ##
    b'00000110'   '    ##
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'00101001'   ' # #  #
    b'00011110'   '  ####
    b'00111110'   ' #####
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'00111110'   ' #####
    b'01111110'   '###### 
    b'00010001'   '  #   #
    b'00010001'   '  #   #
    b'00010001'   '  #   #
    b'01111110'   '######
    b'01111111'   '#######
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'00110110'   ' ## ##
    b'00111110'   ' #####
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'00100010'   ' #   #
    b'01111111'   '#######
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'00100010'   ' #   #
    b'00011100'   '  ### 
    b'01111111'   '#######
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'01000001'   '#     #
    b'01111111'   '#######
    b'00001001'   '   #  #
    b'00001001'   '   #  #
    b'00000001'   '      #
    b'00000001'   '      #
    b'00111110'   ' #####
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'01010001'   '# #   #
    b'00110010'   ' ##  #
    b'01111111'   '#######
    b'00001000'   '   #  
    b'00001000'   '   #  
    b'00001000'   '   #  
    b'01111111'   '#######
    b'00000000'   '      
    b'01000001'   '#     #
    b'01111111'   '#######
    b'01000001'   '#     #
    b'00000000'   '      
    b'00100000'   ' #    
    b'01000000'   '#     
    b'01000001'   '#     #
    b'00111111'   ' ######
    b'00000001'   '      #
    b'01111111'   '#######
    b'00001000'   '   #  
    b'00010100'   '  # # 
    b'00100010'   ' #   #
    b'01000001'   '#     #
    b'01111111'   '#######
    b'01000000'   '#     
    b'01000000'   '#     
    b'01000000'   '#     
    b'01000000'   '#     
    b'01111111'   '#######
    b'00000010'   '     #
    b'00000100'   '    # 
    b'00000010'   '     #
    b'01111111'   '#######
    b'01111111'   '#######
    b'00000100'   '    # 
    b'00001000'   '   #  
    b'00010000'   '  #   
    b'01111111'   '#######
    b'00111110'   ' #####
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'01000001'   '#     #
    b'00111110'   ' #####
    b'01111111'   '#######
    b'00001001'   '   #  #
    b'00001001'   '   #  #
    b'00001001'   '   #  #
    b'00000110'   '    ##
    b'00111110'   ' #####
    b'01000001'   '#     #
    b'01010001'   '# #   #
    b'00100001'   ' #    #
    b'01011110'   '# ####
    b'01111111'   '#######
    b'00001001'   '   #  #
    b'00011001'   '  ##  #
    b'00101001'   ' # #  #
    b'01000110'   '#   ##
    b'01000110'   '#   ##
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'01001001'   '#  #  #
    b'00110001'   ' ##   #
    b'00000001'   '      #
    b'00000001'   '      #
    b'01111111'   '#######
    b'00000001'   '      #
    b'00000001'   '      #
    b'00111111'   ' ######
    b'01000000'   '#     
    b'01000000'   '#     
    b'01000000'   '#     
    b'00111111'   ' ######
    b'00011111'   '  #####
    b'00100000'   ' #    
    b'01000000'   '#     
    b'00100000'   ' #    
    b'00011111'   '  #####
    b'01111111'   '#######
    b'00100000'   ' #    
    b'00011000'   '  ##  
    b'00100000'   ' #    
    b'01111111'   '#######
    b'01100011'   '##   ##
    b'00010100'   '  # # 
    b'00001000'   '   #  
    b'00010100'   '  # # 
    b'01100011'   '##   ##
    b'00000011'   '     ##
    b'00000100'   '    # 
    b'01111000'   '####  
    b'00000100'   '    # 
    b'00000011'   '     ##
    b'01100001'   '##    #
    b'01010001'   '# #   #
    b'01001001'   '#  #  #
    b'01000101'   '#   # #
    b'01000011'   '#    ##
    b'00000000'   '
    b'00000000'   '
    b'00000000'   '
    b'00000000'   '
    b'00000000'   '
    b'00000000'   '
    b'01100000'   '##
    b'01100000'   '##
    b'00000000'   '
    b'00000000'   '
    end table

     

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.