Hi,
Never done with a LCD but have done similar things when outputting data to a PC/Terminal, which is basically the same thing as you're doing since the LCD is serial enabled. In my case though I've used the hardware UART.
Anyway, yes, you can declare an array of 80 characters (or 4 arrays of 20 each might be easier) and to create a "buffer" of the display content in the PIC. Problem with that is that the 12F683 only has 128bytes of RAM, PBP needs a couple of those for its internal use. Do you have 80 bytes free?
Are you going to constantly update the LCD, one char each time thru your main loop? Or will you "trig" a refresh of the display only when some data which are on the display changes?
Are there any static text on the display which never changes, like labels, units etc? In that case there's no need to rewrite the full display every time. Set it up once at the beginning of the program then only update the "fields" that actually changes.
Here's some code that illustrates one concept of doing it, ie an example. Obviously I don't know if it'll fit your application. And again, I don't think you'll be able to fit an 80byte buffer in the 12F683.
Code:
Buffer VAR BYTE[80]
Index VAR BYTE
ValuesDirty VAR BIT
Sample VAR BYTE
Result VAR WORD
ValuesDirty = 0
Index = 0
Main:
If GPIO.0 = 1 THEN ' Just somethig to trig a new ADC reading.
ADCIN 0, Result
ArrayWrite Buffer, ["Sample number ", DEC Sample, ": ", DEC Result]
ValuesDirty = 1
Sample = Sample + 1
WHILE GPIO.0 : WEND ' Wait for button to be released.
ENDIF
If ValuesDirty THEN GOSUB UpdateDisplay
Pause 30
Goto Main:
UpdateDisplay:
DEBUG Buffer[Index]
Index = Index + 1
If Index = 80 THEN
Index = 0
ValuesDirty = 0
ENDIF
RETURN
/Henrik.
Bookmarks