Rules | Recent posts | topic RSS | Search | Register  | Log in

Reading LCD's Current Cursor Position


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Reading LCD's Current Cursor Position
Author Message
saeed_pk



Joined: 20 May 2006
Posts: 198
Helped: 5
Location: Islamabad, Pakistan


Post06 May 2009 10:39   

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.
Back to top
AMK1971



Joined: 13 Nov 2007
Posts: 35
Helped: 2
Location: 33.688°N73.035°E


Post08 May 2009 9:53   

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.
Back to top
saeed_pk



Joined: 20 May 2006
Posts: 198
Helped: 5
Location: Islamabad, Pakistan


Post08 May 2009 11:42   

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
Back to top
Google
AdSense
Google Adsense




Post08 May 2009 11:42   

Ads




Back to top
AMK1971



Joined: 13 Nov 2007
Posts: 35
Helped: 2
Location: 33.688°N73.035°E


Post13 May 2009 6:59   

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.
Back to top
sau_sol



Joined: 27 Feb 2008
Posts: 249
Helped: 27
Location: India


Post19 May 2009 7:03   

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
Back to top
manish12



Joined: 21 Nov 2006
Posts: 1018
Helped: 31


Post09 Jun 2009 4:55   

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 .
Back to top
ravimarcus



Joined: 09 May 2005
Posts: 204
Helped: 19
Location: Bangalore, INDIA


Post14 Jun 2009 6:16   

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
Back to top
umair67



Joined: 25 May 2009
Posts: 17
Helped: 1
Location: Pakistan


Post23 Jun 2009 6:29   

access current cursor position


read from the status register
Back to top
vistapoint



Joined: 20 Feb 2005
Posts: 91
Helped: 2


Post05 Jul 2009 4:44   

lcd + cursor


I used buffers too and I felt safer to follow this way.
______________________________________________________
low cost 1/4W resistor kit:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=300320789926
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Reading LCD's Current Cursor Position
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Reading current with INA168 (1)
voltage and current reading (14)
voltage,frequency current reading (2)
Where to buy 'custom' LCD's? (2)
How to recognize my 3310 LCD's chip? (2)
How fast are graphic LCD's (eg 64 x 128) (2)
cadence IC5 mouse cursor (1)
need help using old lcd's and computer cards to make useful (1)
How to change the color of cursor in Allegro (2)
image current, eddy current and surface current (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS