CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

reuse of RB6(PGC) and RB7(PGD) with LCD D6/D7 ???

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bob
Guest







reuse of RB6(PGC) and RB7(PGD) with LCD D6/D7 ???
PostPosted: Mon Mar 17, 2003 12:40 am     Reply with quote

hi folks,

two somewhat related questions...

item 1)
i'm using a 16F873A to collect some data and drive an LCD (Optrex PN DMC50747 chip-on-glass type). but pin assignments are getting tight. i'm already using the LCD in "4 bit" mode. ordinarily i would reserve RB6(PGC) and RB7(PGD) for just ICSP. what i'm interested to know is if anyone has re-used RB6(PGC) and RB7(PGD) for LCD D6/D7? did you have to take any special measures to do this? right now i am contemplating something like the following:

// B0 = PB-INT // attached to pushbutton
// B1 = a0 // data/command selection
// B2 = wrbar // read/write select
// B3 = csbar // chip select, also used for LV-ICSP
// B4 = D4 // data bit
// B5 = D5 // data bit
// B6 = D6 // data bit, also used for ICSP: PGC
// B7 = D7 // data bit, also used for ICSP: PGD
// A0 = RES // LCD reset control

does anyone see any potential problems with these assignments in terms of reusing pins B6 and B7? what i plan to do is put a pull-up on B3 to ensure that the LCD is deselected while programming is in process. (more on this in a second).

item 2)
the 16F87xA data sheet is somewhat circumspect when it comes to LV ICSP. for programming at 3.3V, which is what my 16F873A is running at, it appears B3 must be high and/or the LVP bit must be set (which is the default).

but then Table 4.3/Note 3 of the 16F87xA data sheet says the following:

"3: Low Voltage ICSP Programming (LVP) is enabled by default, which disables the RB3 I/O function. LVP must be disabled to enable RB3 as an I/O pin and allow maximum compatibility to the other 28-pin and 40-pin mid-range devices."

furthermore, from Section 14.19:

"In this mode, the RB3/PGM pin is dedicated to the programming function and ceases to be a general purpose I/O pin. During programming, VDD is applied to the MCLR pin. To enter Programming mode, VDD must be applied to the RB3/PGM, provided the LVP bit is set. The LVP bit defaults to on (‘1’) from the factory."

so let me get this straight: if i want to ICSP at 3.3V then i can *NOT* use pin B3 for any type of i/o function??? ever??? this seems very cumbersome unless i am misinterpreting something here. as you can see, my intent from part 1 above was to pull this high (which would allow LV ICSP) and keep the LCD from causing trouble during ICSP. but after the device is programmed i would of course need to use that B3 pin for general I/O (namely the CS functionallity.

thoughts/ideas/comments/reality checks/etc are all welcome.

thanks and regards,
jim




___________________________
This message was ported from CCS's old forum
Original Post ID: 12757
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: reuse of RB6(PGC) and RB7(PGD) with LCD D6/D7 ???
PostPosted: Mon Mar 17, 2003 1:49 pm     Reply with quote

:=
:=i'm using a 16F873A to collect some data and drive an LCD (Optrex PN DMC50747 chip-on-glass type). but pin assignments are getting tight. i'm already using the LCD in "4 bit" mode. ordinarily i would reserve RB6(PGC) and RB7(PGD) for just ICSP. what i'm interested to know is if anyone has re-used RB6(PGC) and RB7(PGD) for LCD D6/D7? did you have to take any special measures to do this? right now i am contemplating something like the following:
:=
:=// B0 = PB-INT // attached to pushbutton
:=// B1 = a0 // data/command selection
:=// B2 = wrbar // read/write select
:=// B3 = csbar // chip select, also used for LV-ICSP
:=// B4 = D4 // data bit
:=// B5 = D5 // data bit
:=// B6 = D6 // data bit, also used for ICSP: PGC
:=// B7 = D7 // data bit, also used for ICSP: PGD
:=// A0 = RES // LCD reset control
:=
:=does anyone see any potential problems with these assignments in terms of reusing pins B6 and B7? what i plan to do is put a pull-up on B3 to ensure that the LCD is deselected while programming is in process. (more on this in a second).

Based on your statements below, you want to use LVP mode.
You can't put a pull-up on B3, or you'll immediately put
the PIC into programming mode. The data sheet says that
if you use LVP, you can no longer use pin B3 for i/o.

With regard to using B6 and B7 for i/o and ICSP, I think
it's easiest if those pins are assigned to drive the
inputs of some peripheral chip. Then, in programming mode,
those pins become inputs on the PIC, and so your programmer
will drive both the PIC and inputs of the peripheral chip.
There won't be any contention, since the only driver will
be your programmer. Even so, you have to decide whether
your peripheral device will be "messed up" if it's driven
by the clock and data that are present during programming.
My basic approach is always to go for super safety. That's
why I don't use those pins for peripherals. But, it could
be done.

You should go to this page and download several of the documents
on ICSP programming. They talk about this issue in more detail.
For example, if pins B6 and B7 are connected to drivers from
peripheral chips, these documents recommend inserting series
resistors.
<a href="http://www.microchip.com/1000/suppdoc/specs/index.htm" TARGET="_blank">http://www.microchip.com/1000/suppdoc/specs/index.htm</a>

:=
:=item 2)
:=the 16F87xA data sheet is somewhat circumspect when it comes to LV ICSP. for programming at 3.3V, which is what my 16F873A is running at, it appears B3 must be high and/or the LVP bit must be set (which is the default).

Yes, once the LVP fuse is set, then RB3 becomes the enable pin
for LVP mode. See the programming spec here:
<a href="http://www.microchip.com/download/lit/suppdoc/specs/39589b.pdf" TARGET="_blank">http://www.microchip.com/download/lit/suppdoc/specs/39589b.pdf</a>

:=
:=but then Table 4.3/Note 3 of the 16F87xA data sheet says the following:
:=
:="3: Low Voltage ICSP Programming (LVP) is enabled by default, which disables the RB3 I/O function. LVP must be disabled to enable RB3 as an I/O pin and allow maximum compatibility to the other 28-pin and 40-pin mid-range devices."

That's true. That's why, if you have a new 16F877, and
you program it in a PicStart-Plus (which uses Hi-Voltage mode)
without setting the NOLVP fuse option, and then you turn
on Port B pull-ups, your PIC program will lock-up. It goes
into LVP programming mode.

:=
:=furthermore, from Section 14.19:
:=
:="In this mode, the RB3/PGM pin is dedicated to the programming function and ceases to be a general purpose I/O pin. During programming, VDD is applied to the MCLR pin. To enter Programming mode, VDD must be applied to the RB3/PGM, provided the LVP bit is set. The LVP bit defaults to on (‘1’) from the factory."
:=
:=so let me get this straight: if i want to ICSP at 3.3V then i can *NOT* use pin B3 for any type of i/o function??? ever??? this seems very cumbersome unless i am misinterpreting something here. as you can see, my intent from part 1 above was to pull this high (which would allow LV ICSP) and keep the LCD from causing trouble during ICSP. but after the device is programmed i would of course need to use that B3 pin for general I/O (namely the CS functionallity.
:=

It's also true if you run the PIC at +5v. The Vdd has nothing
to do with it. It's whether or not the LVP fuse is set.
As far as I can see, the only difference between using a
Vdd of +5v or +3.3v, is that you have a reduced command set
of programming commands at +3.3v. See table 2-1 in the
programming spec.
<a href="http://www.microchip.com/download/lit/suppdoc/specs/39589b.pdf" TARGET="_blank">http://www.microchip.com/download/lit/suppdoc/specs/39589b.pdf</a>

Main download page for programming specs is here:
<a href="http://www.microchip.com/1000/suppdoc/specs/index.htm" TARGET="_blank">http://www.microchip.com/1000/suppdoc/specs/index.htm</a>

More tips:
<a href="http://www.piclist.com/techref/microchip/picstartplusicsp.htm" TARGET="_blank">http://www.piclist.com/techref/microchip/picstartplusicsp.htm</a>

Some important notes on ICSP mode, from a user:
<a href="http://www.piclist.com/techref/microchip/16F877/hvprog.htm" TARGET="_blank">http://www.piclist.com/techref/microchip/16F877/hvprog.htm</a>

Using PicStart+ for HVP:
<a href="http://www.piclist.com/techref/microchip/picstartplusicsp.htm" TARGET="_blank">http://www.piclist.com/techref/microchip/picstartplusicsp.htm</a>
I use a 10K between MCLR and +5v for this. Also, a 10K pulldown
is used on RB3 for safety (see the link above).

"TLVP" programmer. Problem: Requires a very short cable.
<a href="http://www.finitesite.com/d3jsys/" TARGET="_blank">http://www.finitesite.com/d3jsys/</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12774
burnsy



Joined: 18 Oct 2003
Posts: 35
Location: Brisbane, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re-Use of RB6 RB7 with LCD
PostPosted: Fri Dec 19, 2003 6:12 am     Reply with quote

I use RB4-7 to drive LCDs all the time, and use ICSP whenever possible.

At first I had all sorts of problems programming the PIC when the LCD was connected. After a bit off thought I realised that the problem was the LCD WR pin floating high , thus going into READ mode and corrupting the data on RB6 and RB7.

If you are controlling the LCD_RW line with one the PIC pins, tie it low with a resistor to keep it in write mode and the lcd data lines will be in high impedance and not bother you at all.

regards,
burnsy
_________________
This is the last code change until its ready....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group