This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

problem while reading character from lcd display

Other Parts Discussed in Thread: TM4C123GH6PGE

Hi,

I interfaced LCD(JHD204A) to my controller(TM4C123GH6PGE). I displayed some text on lcd it is working fine, but when i'm trying to read from  lcd i unble to get it. could you please tell me the procedure to read from lcd.

Thanks & Regards

Radhika

  • Hi,

    See first your display data sheet, pages 10 and 14.

    From page 10: see the conditions for hardware signals, RS and R/W.

    From page 14: you must set first the address of RAM/CGRAM where the read will be performed and after that emit read intruction.

    One note: your request is unusual, although may be done, few uses this, including me - never needed to read back.

    Petrei

  • Thanks,

          when i'm reading r/w signal should be high(1), but before reading i need to give particular address. this address i need write into port. when i'm writting address into port  what value i need to set into  RS signal.

          In my application i'm reading voltage, current  frequency and etc from Lcd.according to these values i want to increase or decrease the v galues using keypad,and these set parameters i'm going to store in eeprom. For this purpose i want to read from display.

    thanks&regards

    Radhika 

  • Hi, 

    There are two separate situations:

    a) voltage, current, frequency are "live" values, they come from outside and need to be updated at regular time intervals. These should only be sent at the display as they are, nothing else, no need to be read back, since you have a RAM variable holding them.

    b) threshold values for above parameters - also must be kept as binary variables and set as ASCII only when displayed; reading back is not a good idea, since you must first to read back the whole string, then transform to binary for increase/decrease and then convert back to ASCII for display - all these operations are time consuming, slowing down your application. For EEPROM use only binary values for both threshold values or logged data. 

    RS=RW=1

    Petrei

  • thanks,

     Yes i agree with you, all these operations will slow down my processor but first of all i need to workout it then i will try to optimize my code.

      here frequency and voltage are set parameters. suppose if i set 50Hz this should be the max frequency it should not cross this limit. I thought you understood my requirement.

    thanks&regards

    Radhika

  • In my application i'm reading voltage, current  frequency and etc from Lcd.according to these values i want to increase or decrease the v galues using keypad,and these set parameters i'm going to store in eeprom. For this purpose i want to read from display.

    For writing these data to the LCD, you must have had them in RAM before. And trying to read back a value from a LCD screen you had in RAM before seems extremely cumbersome, not to say crazy...

  • hi,

    I'm using  20x4 lcd, for each character there is an address right. If i want to perform read operation i need to write particular address into port or automatically detect the address according to cursor position. please give me clarity on this.

    thanks &regards

    Radhika

  • Hi,

    Well, the best thing is, if you can, to post a picture with your parameters and messages on display, so to be able to show something concrete, since simple explanations can not be so simple.

    This is because you do not show how you managed the writing - software dependent. Basically: determine the location of the first digit of a parameter (i.e. this is letter #11) and add this to the base of row address; use this to write it with RS=RW=1, and after that, read back, same address. Increment for the next display digit and repeat.

    But keep in mind the best thing is to avoid this... is there something which forces you to do it?

    Petrei

  • I'm using  20x4 lcd, for each character there is an address right. If i want to perform read operation i need to write particular address into port or automatically detect the address according to cursor position. please give me clarity on this.

    I am suggesting you do not need to read anything back from the LCD - the LCD is a DISPLAY (data sink). I wager you have the very same information present in RAM.

  • To begin - I agree w/posters Petrei & fm - any such data read from the display is likely unnecessary, demanding, & inefficient.

    That said - as a producer of such displays - here's the recommended procedure to achieve your objective.  (this from the HD44780, character Lcd data manual)

    I'll summarize the procedure for added clarity - and I'll suggest that you first "seed" the display with the numbers, 12345 starting from the display's "home" position.  (DDRam location 0x80)  Now a proper "read" should extract 31, 32, 33, 34, 35. (those all are hex values)

    a) First write the display's home position cursor address (0x80) with RS=RW=0 and a proper pulse upon E.  The cursor (if enabled) should appear @ the home position - beneath the previously entered "1".

    [edit 1: 10:55]  D'uh - completely missed this (rather important) point!  After the address has been sent & processed - you must change your MCU's data bus from 8 bit output to 8 bit input! (otherwise you'll "enjoy" dreaded bus contention as  both the MCU and your display will be in output mode.)  While popular & practiced here - on beloved lunchpads via their 0R pin to pin MCU connections - such is not good engineering practice!

    b) Now order RS=RW=1 and after proper set-up/hold times properly pulse E.  Now - while E is high - the Lcd's data @ 0x80  (0x31) should appear upon the display's data bus. 

    c) If you've set the cursor to "auto increment" you need no further addressing.  You should now note the cursor has moved to the 2nd position (top row) (0x81) and if RS=RW=1 and E is again properly pulsed - the Lcd's data @ 0x81 (0x32) should now appear upon the display's data bus.  Likewise for the remaining data.

    d) Should your desired data appear elsewhere on the display - you must "steer" the cursor to the left-most display address - containing such data.  Then - executing the steps as I've noted - should harvest display resident data.  You'll have to switch your MCU from 8 bit port input to port output - when you desire to write to and/or address the display again!

    Again - data on the display is ASCII - you'll require much code & effort to drag it (kicking/screaming) from the display - and process it into more (usable) form.  But at least - now you (and others) know how to read from a character display module.

    Note: it's been years since I've done this - from review of the image I've posted - your first read after locating the cursor - may yield rubbish.  The 2nd read will then contain the proper data.  (I don't think that the "rubbish read" will cause the cursor to move - allowing you to capture your first targeted display data via the 2nd read.)

    [Edit 2: 14:26] Dawns that should your Lcd module be 5V powered - bus output from display to your MCU will approach 5V!  Insure that the port you select for the Lcd D-Bus is 5V tolerant.  (or clamp each/every data line to 3V3.)  MCU's 3V3 output is fine for CMOS/TTL input of HD44780/clone.  (both D-Bus & Ctl. Sigs.)

    One notes there's far more detail/effort from responders than requester - strange that!  (or not)

  • Thanks,

    I taken values from RAM instead from display working fine. 

    But problem is my program is not running when i remove the power supply. I'm downloading in flash even though if i removed power i need to download the program again. could please tell me the solution.

    Thanks & regards

    Radhika 

  • Radhika Anabathula said:

    I taken values from RAM instead from display working fine. 

    At least three times you asked for detailed assistance to, "Read existing data from your character Lcd module."  I (alone) responded in great detail.  To silence!  (where is the justice?)

    CB1 (once again) locks/loads - slowly raises pistol to head...  (high cliffs not w/in reasonable distance...)

  • I (alone) responded in great detail.  To silence!  (where is the justice?)

    CB1 (once again) locks/loads - slowly raises pistol to head...  (high cliffs not w/in reasonable distance...)

    You got suckered in, and led astray  -  I feel with you ;-)

    Don't shoot yet ...

  • f. m. said:
    You got suckered in, and led astray 

    Not the first time!  (for you as well)  Do appreciate your kindness.

    Damn bullet must be equally NRND - trigger squeeze yielded faint pop - simple graze wound.  (yet bullet's {not yet} EOL)

    There is some advantage/justification to employing the Lcd module as, "Data Ram" - that was an added reason for my (labored) response.  Assume the Lcd module is less than 80 characters.  (poster's was not)  Then - those off-screen Lcd ram locations may be used by the MCU as RAM storage locations.  (reads/writes are unnoted by the display - as they're directed to "off-screen" locations.)   We past used this technique when MCU exhausted it's RAM - and another 40 or so bytes of storage proved useful.  Trick is to direct the display cursor "just outside" the visible display area - and write (then read) the data there...

  • Albeit my experience with display is certainly far more superficial than yours, I know that several displays have RAM. And I find it reasonable to "reuse" it, where you run out of RAM, and cost pressure forbids adding anything.

    However, from the initial description and wording of the problem by the OP, I "extrapolated" he had a rather fuzzy idea of how his system works.

    Perhaps the "advantage" of a non-native speaker, who needs to read the posts more carefully ...

  • Hi f.m.,

    Agree w/you (& Petrei) - case never made (here - by this poster) for the use of display RAM.

    Yet - you/Petrei/RobertoI/Robert/I others often write here in service "beyond" the OP.  Thus my detail rose to that purpose - and OP's subject/title aptly serves to "mark" this post for future (Lcd module data reads) search efforts...