Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Reading LCD's Current Cursor Position

Status
Not open for further replies.

saeed_pk

Full Member level 4
Joined
May 20, 2006
Messages
237
Helped
35
Reputation
68
Reaction score
28
Trophy points
1,308
Location
Islamabad, Pakistan
Activity points
2,655
reading lcd

Hi all,
i am working on 20x4 LCD with PIC18F452 and Hi-Tech PICC-18 Compiler
I am using LCD module given in samples directory.

My Project Continuously updates a counter on LCD and whenever RCIF goes high (Serial Reception Interrupt) I have to show a Pause Sign on the Upper Right Corner.

Whenever an Interrupt occur it does display it but after ISR my counter data which is to be displayed in the center start displaying in third line i figured the problem is the cursor location whenever i returned from ISR LCD cursor did not returned to the previous location where it was.
I need a routine /method how to read the cursor's current location and so i can get rid of this problem please advice.
 

lcd cursor position

You can get rid of this problem using following methods

1. Donot access LCD from interrupt, instead set a flag in interrupt and update the LCD in main loop.

2. Before sending any data to LCD, set the cursor location. Make sure that the interrupt does not occur until the complete data is sent to the LCD.

3. Check the current cursor location, and set it if is found wrong. (Although coding is almost same, it will be quicker than 2.) you can get the cursor location by reading the command register if using Hitachi 44780 controller. Other controller also provide similar functionality.

I prefer option 1 discussed above.
 

lcd cursor

I have done second method,
what happens i have to recieve serial interrupt detecting a character 'A' what happens when i disable interrupt that character comes inside this and i miss it.

your first option seems to be useful but it let me to REDESIGN sort of thing.

in third way you told of reading

if I select Control Register (RS) and Select Read(R/W) and i read a byte will it give me cursor position or what please advice me
 

lcd cursor on

The Text LCDs that are built on 44780 controller give you the current Display RAM location (cursor location) when you read the command register. (MSB is busy Flag and cursor location is in 7 LSBs, so you need to AND the result with 0x7F)

If your Text LCD is not built over 44780, then you will need to read its documentation to see how you can read the cursor location.
 

lcd move cursor

I am also facing similar problem in 16x2 LCD
So I changed my code to use 2 registers for each line

I am updating the second line in UART ISR and the first line by keypad
so whenever i returned from the ISR I was loosing cursor position
so I used registers to store the location of the cursor
In the ISR

First load the second row register value and move the cursor to that place increament the register
then display the data
then load the first row register value and move cursor to that value

hence I am not loosing my cursor positions and maintaining the same for any type of display

you can also try this method and get rid of any display problem
 

lcd read cursor position

use different variable for locating cursor in different routings .

do not use inbuilt routings for locating the cursor for 16*4 lcd module .
 

lcd cursor line position

I use the following method.

I have a buffer1 to buffer20. I disable the cursor. What ever I want to write, I write to the buffer and then transfer the whole lot in one go to the LCD module.

If I want to write to the 12th location, I write to buffer12 and update the LCD.

I use the same buffers for all the lines.

I initialise the cursor to home position, select the line beginning of the line and then write 20 bytes to the LCD.

Hope this helps

Cheers

Ravi
 

access current cursor position

read from the status register
 

lcd + cursor

I used buffers too and I felt safer to follow this way.
______________________________________________________
low cost 1/4W resistor kit:
**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top