Hi Brent, Thanks for your help! Unfortunately, I don't have any C compiler for the PIC. I just use MPLAB. Thomas >From: "Brent A. Crosby" >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC]: Display Method. Need help! >Date: Thu, 26 Jul 2001 16:53:16 -0700 > >Thomas: > > Use the LCD's "set address" to move to the appropriate coordinates, then >just write the 3 bytes. Here is some code: > >//============================================================================ >void LCD_Position_Cursor(ubyte x, ubyte y) > { > //Valid x is 0-15, valid y is 0-1 > if((x<=15)&&(y<=1)) > Write_LCD_Control(0x80|(y<<6)|x); > } >//============================================================================ >//Prints a 3 character string of input at the current location. >void LCD_put_dec(ubyte input) > { > ubyte > digit; > ubyte > no_blank; > digit=input/100; > if(digit) > { > Write_LCD_Data(digit+'0'); > no_blank=1; > } > else > { > Write_LCD_Data(' '); > no_blank=0; > } > input%=100; > digit=input/10; > if(digit|no_blank) > Write_LCD_Data(digit+'0'); > else > Write_LCD_Data(' '); > Write_LCD_Data(input%10+'0'); > } >//============================================================================ > > >| Brent A. Crosby >| Crystalfontz America, Incorporated >| 15611 East Washington Road >| Valleyford, WA 99036-9747 >| brent@crystalfontz.com http://www.crystalfontz.com >| voice (509) 291-3514 fax (509) 291-3345 US toll-free (888) 206-9720 > > >On Thu, 26 Jul 2001 23:28:25 +0000, Thomas N wrote: > >I am using the PIC16F877 with an 16x2 LCD module. I am trying to display > >the A/D results on the LCD, 4 numbers per each row. > > > >What I did is that I set aside 32 bytes of memory and each byte of memory > >represents one ASCII character on the LCD (16 bytes for Line 1 and the > >others for Line2). Then I store the A/D results in appropriate >"coordinate" > >in the memory. After that, I "copy" the entire memory block (the 32 >bytes > >block) to the LCD. Whenever I want to update a certain A/D number, I go >to > >its memory location and update the number, then do the "copy" to the LCD > >again. > > > >Is there a better way to do this? There must be... > > > >Another "pain" I have to go through is to convert the A/D number to >ASCII. > >Let say the A/D result is 173 decimal, I have to separate number 1, >number > >7, and number 3. Then covert them to ASCII, then store them in the >memory > >block, then copy the memory block to the LCD. > > > >There must be a better way to do this too, right? > > > >Thank you in advance! > >Thomas > >-- >http://www.piclist.com hint: PICList Posts must start with ONE topic: >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads