Searching \ for '[PIC]: LCD From 16F84 to 16F877' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
Search entire site for: 'LCD From 16F84 to 16F877'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: LCD From 16F84 to 16F877'
2001\04\29@205415 by Drew Vassallo

picon face
> > i'm working with a LCD (HD44780, 2x16 4 wire mode) i used code from
>called WKTIM4M.ASM (thx :). This worked great with a 16F84 but now i want
>to use it at an 16F877 but it won't work.
> >             bsf STATUS, RP0
> >             movlw B'00000000'          ;  RE all as outputs
> >             movwf TRISE
> >             movlw B'00001111'          ;  RD7-RD4 outputs others Input
> >             movwf TRISD
> >             bcf STATUS, RP0

This probably doesn't affect anything you're doing here, but it's worth
mentioning that in changing from a 16F84 to a 16F87x chip, you have to
concern yourself with the RP1 status bit as well as the RP0 bit when
selecting banks.

To be correct, use bcf STATUS, RP1 and bsf STATUS, RP0 for bank 1.  It could
trick you up, especially since some files can be accessed through banks 0
and 2, and 1 and 3.
Unless you know from where you're coming in your code, you should try to set
both bank bits to what you really need, not just the RP0 bit.

--Andrew

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\04\30@035437 by Ben Suffolk

flavicon
face
Aart,

You were using a 4Mhz Xtal on the '84, and you also using a 4Mhz Xtal on
the'877, if not you might want to check the delay routines for the LCD init are
correct.

Here is a snippit of code I use to give 100us delay

LCD_D1          equ     0x30
LCD_D2          equ     0x31
#DEFINE LCD_xtal        0xA5    ;This should divide the clock to be 100us

LCD_delay
   MOVWF       LCD_D1
LCD_delay1
   MOVLW       LCD_xtal
   MOVWF       LCD_D2
LCD_delay2
   DECFSZ      LCD_D2,F
   GOTO        LCD_delay2
   DECFSZ      LCD_D1,F
   GOTO        LCD_delay1
   RETURN

My init code is like this :-

LCD_init
   LCD_delaym  150                     ;Delay 15ms
   LCD_nibble  LCD_4_init              ;First Init Byte
   LCD_delaym  41                      ;Delay 4.1ms
   LCD_nibble  LCD_4_init              ;Second Init Byte
   LCD_delaym  1                       ;Delay 100us
   LCD_nibble  LCD_4_init              ;Third Init Byte
   LCD_delaym  41                      ;Delay 4.1ms
   LCD_nibble  LCD_4_mode_n            ;Set 4 bit interface, busy flag now
readable, from this point on use busy flag on not time delays

   LCD_command LCD_4_2_5x8             ;Select 2 line 5X8 4 bit mode
   LCD_command LCD_disp                ;Display off Command
   LCD_command LCD_disp | LCD_d_on     ;Display on, Cursor off
   LCD_command LCD_i_right             ;Increment Cursor, No Scroll
   LCD_command LCD_clear               ;Clear the display
   RETURN


I include the LCD_init not for use as you have on that works anyway, but just to
show the timings I use with LCD_delaym which is just a macro to move the litral
to W and call LCD_delay.

LCD_delaym  macro   argv
           MOVLW   argv
           CALL    LCD_delay
           endm

I can let you have the full source if you want it, just ask.

Regards

Ben




Please respond to pic microcontroller discussion list <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU>




To:   .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
cc:    (bcc: Ben SUFFOLK/EN/HTLUK)


Subject:  Re: [PIC]:  LCD  From 16F84 to 16F877



{Quote hidden}

Hi,

The code is now changed (as above) all unused pins were set as output and i
made sure i was refering to the right page:

bcf  STATUS, RP1
bsf  STATUS, RP0
---code---

There was a slight change, there are some characters (all the same and
unreadable) at the display now when turning on. Maybe somone would take a
look at the full code (it's short).

http://aart.myip.org/test/

the 84 code is working and the 877 aint, i'm using a bootloader these are
the first few lines.

Thanks a lot,
Aart.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


- att1.eml







*******************************************************************************
Important. This E-mail is intended for the above named person and may be
confidential and/or legally privileged. If this has come to you in error you
must take no action based on it, nor must you copy or show it to anyone; please
inform the sender immediately.
*******************************************************************************

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\30@142359 by Aart

picon face
> Aart,
>
> You were using a 4Mhz Xtal on the '84, and you also using a 4Mhz Xtal on
> the'877, if not you might want to check the delay routines for the LCD
init are
> correct.
>

Not necessary anymore.. IT WORKS! i made a mistake with the CBLOCK, didn't
change the variable "CBLOCK    0Ch"  to  "CBLOCK   20h" which is necessary
for the '877.

Thank you all for your help so far!

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\04\30@172201 by Olin Lathrop

face picon face
> Not necessary anymore.. IT WORKS! i made a mistake with the CBLOCK, didn't
> change the variable "CBLOCK    0Ch"  to  "CBLOCK   20h" which is necessary
> for the '877.

Yet another reason for using relocatable mode and the RES directive.  Too
bad you can't go back and spend the time wasted on this bug to learn about
relocatable mode instead.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, EraseMEolinspam_OUTspamTakeThisOuTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...