> ----- Original Message ----- > From: "Hardware Engineering" > To: > Sent: Monday, August 21, 2000 2:56 PM > Subject: [PIC]:LCD question > I'm looking at using an '871 to interface with a Scott Edwards serial LCD, and > wonder (after looking at some of the code), can you write to just a certain > part of the LCD line by simply pointing to the beginning address for the > location in display memory? > ie, I want the display to show > Time Left xx:xx > and only update the xx:xx values Yes, you can do exactly that, and it's pretty easy to do. I'm assuming here that you're using the character LCD, I've not played with their graphics one yet but there was a good article on either the Circuit Cellar or Nuts'n'Volts website which covered that model. The character display has a bank of RAM into which the characters are loaded. For a 2 lines x 16 display the addresses for the first line are 128-143 and the second line is 192-207. You can also load characters into the higher addresses on each line (i.e. above 143 or 207) and then scroll them into view. On a four line LCD things work slightly differently, the first line wraps onto the third and the second onto the fourth. E.g. A 4x20 has first line addresses of 128-147, second line is 192-211, third line is 148-167 and fourth is 212-231. This next bit is based on notes I have in my project book about a serial backpack I used quite a while back so it's worth checking on the datasheets on the SEE site that all the details apply to your particular display, though I don't think much has changed in the interim. To write to a particular screen position just work out which address you need and then send 254, which tells the LCD that the next byte is an instruction rather than data to display, and then send the address you want the cursor to move to. Subsequent characters will be printed starting at the new cursor position. So, to display something halfway along the second line of a 2x16 display send 254 (instruction mode) then 200 (address of middle of second row), the cursor will then appear there ready to display the next characters you send. Other useful commands you can send after the 254 are: 1 = clear screen and erase data 2 = cursor home (cancels scrolling too) 8 = blank the display but don't erase data 12= unblank the display and/or hide the cursor 13= blinking block cursor 14= underline type cursor 16= step cursor one place left 20= step cursor one place right 24= scroll display one place left 28= scroll cursor one place right (Note that on a 4 line display the 1st and 3rd lines scroll into one another as do the 2nd and 4th, which is pretty useless as far as I can see but no doubt simplifies designing the LCD drivers.) I hope all this is clear, just ask if there's anything more you need to know. I think you'll find it is pretty easy to use these diaplays and there is a good amount of info on the website (www.seetron.com). Basically just send 254 followed by the address (or other command is all you need to know). Don't forget to comment your code :> Cheers, Andy. . -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu