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.

!!! Array... pls help with some idea..

Status
Not open for further replies.

Joyhtidas

Member level 4
Joined
Nov 30, 2009
Messages
72
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Bangalore, India
Activity points
1,709
Hi..
I am interfacing keyboard and Graphics Display.
I am tying to build a set of programs which is similar to "Notepad".
At present I am reading characters from keyboard,displaying in LCD and at the same time saving in one dimensional array named "Temp_Data_Save".

I have four arrow keys to scroll the cursor on all the directions.. say "Left,Right,Up,Down"

My doubt is that at the cursor position, i need to insert a character which is read
from keyboard.... Similarly there is a option for Delete also....
How it can be made..??

( Each line is terminating with enter key )

Pls share your thoughts ....:idea:
Thanks
 

There are two ways to do this, which is most appropriate depends on the size of the data you are storing.

1. When delete is pressed, copy all array data down one position so you close the gap that would be left.
2. When inserting, copy everything from the insertion point into the next array position and put the new data at the insertion point.

The carriage return will be stored as a normal character so it just moves along with the rest of the data. You only use it as a control character when writing to the display.

The other method is to use linked lists, this is far more memory hungry but can work quicker if there is a lot of data. What you do is store address pointers to the character as well as the character itself. When you do this, the position in the array becomes unimportant so you can just keep adding more and more to the end of the array. This is the method used by some word processors. When you delete a character, you leave it in the array but change its pointers so it is 'jumped over'. When you enter a character, you add it to the end of the array then set the pointer of the character before the insertion point to its address. The pointer associated with the new character is set to the position after the insertion point. When you update the LCD you read along the chain of pointers so their actual storage positions in the array can be anywhere.

Finding the insertion point from the cursor keys is more of a problem because you have not given details of the display you are using. The basic method is to keep track of the X/Y coordinate of the cursor position and add it to the display start address. What you are trying to do is find the offset from the beginning of the array that corresponds to the cursor location.

Brian.
 

Hi..
I am using graphical LCD JHD12864
I would like t o do this in arrays than the linked list...
My cursor movement is separate function and editing is separate.... I need to integrate both ... I will paste the image of the LCD later..

Thank you
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top