PDA

View Full Version : Creating and Writing to Editable Fields on 4x20 HCD44780-Based Character LCD



mikeRho
- 16th November 2014, 04:35
Hi everyone.

I am fairly new to PicBasic programming. I have the PicBasic Pro compiler and have some of the basics down. I have made a 40-pin demo board and have successfully gotten analog input values and written them to the on-board LCD.

I have the LCD set up in a standard parallel configuration on PortD (all 8) with PortE (RE0, RE1, & RE2) as control.

I have familiarized myself with the LCDOut statement, and it is working fine on my board.


What I need to do now is learn how to, using the on-board keypad, enter and edit editable fields on the LCD, then save the values to variables to be used in the program. Is there a document somewhere that covers this? Thank you for any and all input!

Best Regards,
mikerho

I'm including this in case it helps:

I am currently using a PIC18F4455 microprocessor; pin-mapping is as follows:
============ ===== ======
Function/
Component Pin ID Pin #
============ ===== ======
Reset MCLR 1
Pot01 RA0(AN0) 2
Pot02 RA1(AN1) 3
Pot03 RA2(AN2) 4
Pot04 RA3(AN3) 5
DQ001 RA4 6
DQ002 RA5 7
20MHz Crystal OSC1 13
20MHz Crystal OSC2 14
DQ003 RC0 15
DQ004 RC1 16
DQ005 RC2 17
DQ006 RC3 18
DI001 RC4 23
DI002 RC5 24
DI003 RC6 25
DI004 RC7 26
LCD RS RE0 8
LCD R/W RE2 10
LCD E RE1 9
LCD DB0 RD0 19
LCD DB1 RD1 20
LCD DB2 RD2 21
LCD DB3 RD3 22
LCD DB4 RD4 27
LCD DB5 RD5 28
LCD DB6 RD6 29
LCD DB7 RD7 30
Key Row1 RB0 33
Key Row2 RB1 34
Key Row3 RB2 35
Key Row4 RB3 36
Key Col1 RB4 37
Key Col2 RB5 38
Key Col3 RB6 39
Key Col4 RB7 40

rsocor01
- 16th November 2014, 05:49
Do you know how to read the input from a 4x4 keypad? If the answer is no, there are many threads here that cover that. Maybe, somebody else can find the right thread for you. You say that you are familiarized with the LCDOUT command. So, that part shouldn't be a problem. About saving the values to a variable, if you post the code that you have so far we can guide you in the right direction.

rsocor01
- 16th November 2014, 06:00
Ok. Here is a keypad include file that MisterE wrote,

http://www.picbasic.co.uk/forum/content.php?r=215-Matrix-Keypad-routine

Amoque
- 16th November 2014, 13:35
[B]What I need to do now is learn how to, using the on-board keypad, enter and edit editable fields on the LCD, then save the values to variables to be used in the program. Is there a document somewhere that covers this? Thank you for any and all input!



As I understand it, the LCD is a display only device - you will not be able to edit anything on screen; rather, you must edit the underlying variables and display the changed values. What I mean is that if you are displaying variable "A" at position 1, changing the value of "A" and rewriting it to the LCD will be the "edit". You might then change only limited values - say as in setting a clock (which BTW there are plenty of examples of on the forums that should give you ideas how this may be done) or, perhaps, you might want to define an array as an area of video memory and reprint that as the values change.

If you wish to incorporate some "rollback" feature (not finalize the change until approved, perhaps) you will copy the original value of "A" to say... "B", then display "B" until the final step where you write A=B to finalize - or B=A to rollback.

Generally, I find numeric fields easier (less tedious) to "edit" as addition or subtraction may be used to scroll through a range of numbers, but alphanumeric isn't too bad - I designate an area in EEPROM and manipulate READ values to increment or decrement values rather than deal with alphas directly.

HTH-

mark_s
- 16th November 2014, 19:35
This article has some really good info on keypad entry. He shows how to count key presses
and convert individual entries to a usable variables. Ignore the circuit since you are directly
connecting your keypad.

http://www.rambal.com/descargas/libros/Nuts%20and%20Volts/4/Keypad%20Entry%20Display.pdf