No exact or substring matches. trying for part
PICList
Thread
'[PIC]: LCD From 16F84 to 16F877'
2001\04\29@202632
by
Aart
Hello,
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.
Am i doing something wrong here?
;----------------------------------------------------------------------;
; Initialize the ports ;
;----------------------------------------------------------------------;
init:
clrf PORTE
clrf PORTD
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 return
================================================================
Thanks for reading this far...
Aart.
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\04\29@203300
by
Tony Nixon
|
Aart wrote:
{Quote hidden}>
> Hello,
>
> 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.
>
> Am i doing something wrong here?
>
> ;----------------------------------------------------------------------;
> ; Initialize the ports ;
> ;----------------------------------------------------------------------;
> init:
> clrf PORTE
> clrf PORTD
>
> 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
>
>
> return
> ================================================================
PORTE will be in ANALOG mode.
Change the ADCON1 register to make it work in digital mode.
bsf STATUS,RP0
movlw 6h ; all analog pins = digital
movwf ADCCON1
bcf STATUS,RP0
Make sure the unused pins on the other ports are set as outputs.
--
Best regards
Tony
mICros
http://www.bubblesoftonline.com
spam_OUTsalesTakeThisOuT
picnpoke.com
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\04\29@205415
by
Drew Vassallo
|
> > 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\29@222913
by
Aart
> PORTE will be in ANALOG mode.
>
> Change the ADCON1 register to make it work in digital mode.
>
> bsf STATUS,RP0
> movlw 6h ; all analog pins = digital
> movwf ADCCON1
> bcf STATUS,RP0
>
>
> Make sure the unused pins on the other ports are set as outputs.
>Tony
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.
2001\04\30@001154
by
Tony Nixon
Aart wrote:
>
> > PORTE will be in ANALOG mode.
> >
> > Change the ADCON1 register to make it work in digital mode.
> >
> > bsf STATUS,RP0
> > movlw 6h ; all analog pins = digital
> > movwf ADCCON1
> > bcf STATUS,RP0
> >
> >
> > Make sure the unused pins on the other ports are set as outputs.
> >Tony
Try adding this...
movlw B'00000000' ; RA0-5 = outputs
movwf TRISA
movlw B'00000000' ; RB0-7 = outputs
movwf TRISB
movlw B'00000000' ; RC0-7 = outputs
movwf TRISC
--
Best regards
Tony
mICros
http://www.bubblesoftonline.com
.....salesKILLspam
@spam@picnpoke.com
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listserv
KILLspammitvma.mit.edu with SET PICList DIGEST in the body
2001\04\30@001952
by
Tony Nixon
|
Aart wrote:
> 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).
OutMessage:
movwf FSR ; Point at first letter
OutLoop:
movf FSR, w ; Get pointer into W
incf FSR, f ; Set up for next letter
call shomsg ; Get character to output
iorlw 0 ; At the End of the Message?
btfsc STATUS, Z ; Skip if not at end
return ; Yes - Equal to Zero
call SendCHAR ; Output the ASCII Character
goto OutLoop ; Get the next character
I would change the FSR references to "Temp1", or define a new RAM
location like "CharIndex".
Eg
OutMessage:
movwf CharIndex
OuLoop:
movf CharIndex, w ; Get pointer into W
incf CharIndex, f ; Set up for next letter
etc...
etc...
Although the FSR is primarily intended for indirect addressing, it can
be used in the way presented, but it is best to use a GP RAM location
instead.
--
Best regards
Tony
mICros
http://www.bubblesoftonline.com
.....salesKILLspam
.....picnpoke.com
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUT
TakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body
2001\04\30@004731
by
Aart
2001\04\30@035437
by
Ben Suffolk
|
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 <RemoveMEPICLISTTakeThisOuT
MITVMA.MIT.EDU>
To: spamBeGonePICLISTspamBeGone
MITVMA.MIT.EDU
cc: (bcc: Ben SUFFOLK/EN/HTLUK)
Subject: Re: [PIC]: LCD From 16F84 to 16F877
{Quote hidden}> PORTE will be in ANALOG mode.
>
> Change the ADCON1 register to make it work in digital mode.
>
> bsf STATUS,RP0
> movlw 6h ; all analog pins = digital
> movwf ADCCON1
> bcf STATUS,RP0
>
>
> Make sure the unused pins on the other ports are set as outputs.
>Tony
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 TakeThisOuTlistservEraseME
spam_OUTmitvma.mit.edu with SET PICList DIGEST in the body
2001\04\30@142359
by
Aart
> 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 RemoveMElistserv
TakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body
2001\04\30@172201
by
Olin Lathrop
> 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, olinEraseME
.....embedinc.com, http://www.embedinc.com
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistserv
mitvma.mit.edu with SET PICList DIGEST in the body
'[PICLIST] From 16F84 to 16F877'
2002\03\06@184403
by
Larry Bradley
|
I've built a couple of project using the 16F84, using an ancient programmer
designed by Steve Marchant driven from a PC parallel port; I have the PC
source for the programmer. It is very similar to the programmer described
in the Microchip documentation, as I recall - it has been a couple of years
since I have "PICed"
I now would like to play around with the newer PICs, such as the 16F877.
Question 1: is the physical programming of the new units the same as the
F84 (in terms of voltages and timing)?.
Question 2: Are there different registers etc that have to be set up
compared to the F84 (during programming)?
I have the data sheets for both products, but if someone out there has gone
through this type of thing already, I'd appreciate any guidance.
I'm not a large user of PICs, so buying a commercial programmer doesn't
make economic sense.
Thanks in advance
Larry
Larry Bradley
Orleans (Ottawa), Ontario, CANADA
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservEraseME
EraseMEmitvma.mit.edu with SET PICList DIGEST in the body
2002\03\06@185013
by
Tony Nixon
2002\03\07@054112
by
Peter Onion
On 06-Mar-02 Tony Nixon wrote:
>
> The only diference, will be ROM/EEPROM size.
>
> Also, take note of the LVP pin, RB3. Keep it LOW while programming.
I don't believe RB3 needs to be controled if you are using
traditional "high voltage" programing method.
If you are using "low voltage" programing then of course RB3 must be controled
Peter
--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam
spamBeGonemitvma.mit.edu
2002\03\07@055340
by
cdb
2002\03\07@061327
by
Peter Onion
Somewhere in the middle of a load of html you said
"I have found keeping the LVP pin low during high voltage programming
has eradicated programming errors I had been having if I left it floating."
I've built my own "high voltage" programmer which doesn't do anything with
RB3 and not had any problems with errors at all.
I wouldn't expect the state of RB3 to have any importance if LVP isn't
enabled in the config word.
YMMV
Peter.
--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestSTOPspam
EraseMEmitvma.mit.edu
2002\03\07@082528
by
Bob Ammerman
2002\03\07@083557
by
Peter Onion
2002\03\07@105046
by
Mike Mansheim
>> The only diference, will be ROM/EEPROM size.
>> Also, take note of the LVP pin, RB3. Keep it LOW while programming.
>I don't believe RB3 needs to be controled if you are using
>traditional "high voltage" programing method.
When the F87x flash parts first came out, a lot of programming problems
were solved by grounding RB3 during high voltage programming. It's
documented in the archives, and we certainly had that experience here.
You are right - it shouldn't matter, but it did. I don't know if there
was a problem with the chip that Microchip subsequently fixed, but we
keep doing it whenever we use those parts.
--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-request.....
TakeThisOuTmitvma.mit.edu
2002\03\07@155748
by
Byron A Jeff
On Thu, Mar 07, 2002 at 10:44:44AM -0000, Peter Onion wrote:
> On 06-Mar-02 Tony Nixon wrote:
> >
> > The only diference, will be ROM/EEPROM size.
> >
> > Also, take note of the LVP pin, RB3. Keep it LOW while programming.
>
> I don't believe RB3 needs to be controled if you are using
> traditional "high voltage" programing method.
There has been at least one errata sheet published by Microchip that indicates
that on some silicon revisions that a floating LVP pin can cause the chip to
screw up going into programming mode, even when programming in HVP mode.
It's always best to ground RB3/LVP when programming.
>
> If you are using "low voltage" programing then of course RB3 must be controled
Of course.
BAJ
--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestKILLspam
spammitvma.mit.edu
2002\03\07@160629
by
Thomas N
2002\03\07@195346
by
Byron A Jeff
On Thu, Mar 07, 2002 at 09:04:27PM +0000, Thomas N wrote:
> What is the different between High voltage Programming and LVP?
HVP uses a nominal 13V signal on the MCLR pin to indicate that the PIC should
go into programming mode.
LVP uses a separate dedicated I/O (RB3 onthe 16F87X series, RB4 on the 16F62X
series) to indicate to the PIC when to go into programming mode.
The HVP/LVP mode is controlled by the LVP config bit in the config word. Note
that the LVP bit cannot be reprogrammed in LVP mode.
Note that HVP is just an indicator signal for all flash parts. All of the
flash chips have an internal high voltage generator for actually programming
the flash cells.
> Why do we want LVP or HVP?
Each has pros and cons. The primary question is the cost of an I/O pin vs.
having to dedicate a programmable high voltage source in the programmer which
makes it more complicated to design.
In broad strokes HVP is probably better for the professional PIC user. LVP
is great for the hobbiest because you can get started cheaply and quickly.
For example my Trivial LVP programmer (http://www.finitesite.com/d3jsys) only
consists of two parts, cables, and a 5V power source which is easily obtainable
from the programmer host. Changing to HVP would require at minimum the high
voltage supply and a transistor switch.
However LVP has its issues too. First and foremost is that an I/O pin is
permanently unavailable. I've been using 16F877's recently and I haven't
missed it too much. The next annoying thing is that since all of the midrange
PIC's pins on the edges of ports had already been allocated for special
functions, they had to pick a pin that's in the middle of a port (RB3 or RB4)
which breaks up a perfectly good 8 bit I/O port. I've learned to live with it.
That's the scoop. Hope it helps,
BAJ
--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseME
spam_OUTmitvma.mit.edu
2002\03\08@095018
by
Herbert Graf
LVP is just that, low voltage programming. The benefit is that you don't
need a high voltage (~13VDC) to program the PIC. The con is that you lose an
I/O. TTYL
> {Original Message removed}
2002\03\09@165106
by
uter van ooijen & floortje hanneman
> I don't believe RB3 needs to be controled if you are using
> traditional "high voltage" programing method.
>
> If you are using "low voltage" programing then of course RB3 must be
controled
Oh oh, not again! At the very least there are versions of the various new
flash chips that DO require that LVP is low *even when using HVP*. So just
do it (pull LVP low) and don't spend time solving strange programming
problems...
Wouter van Ooijen
--
Van Ooijen Technische Informatica: http://www.voti.nl
Jal compiler, Wisp programmer, WLoader bootloader, PICs kopen
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
More... (looser matching)
- Last day of these posts
- In 2002
, 2003 only
- Today
- New search...