Searching \ for '[PIC]: 16F877 problem' 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/microchip/devices.htm?key=16F
Search entire site for: '16F877 problem'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F877 problem'
2001\07\17@190537 by Barnaby Thieme

flavicon
face
Hello List

I'm taking an existing circuit board from the 16C67 to the 16F877.
Everything seems to work normally except for a bit-banging routine which
manually controls an RS-232 driver (the USART is tied up elsewhere).  For
some reason, the 232 communication fails frequently on the 877 but not on
the 67.  To make matters more confusing, this problem only occurs with
burned chips, and does not occur on the MPLAB ICE.  The 232 handling is NOT
going through the USART -- it is being handled directly by code.

As far as I know, the only code differences that are necessary to move over
to the 877 are the following initialization commands:


 bsf  ADCON1, PCFG2 ; the F877 automaitically configures
 bsf  ADCON1, PCFG1 ; certain pins as AtoD.  This makes all the pins
digital.


 clrf PIR2   ; added for 877
 clrf ADCON0

page_2 ; added for 877
 clrf p2_EEDATA
 clrf p2_EEADR
 clrf p2_EEDATH
 clrf  p2_EEADRH

 page_3   ; added for 877
 clrf p3_EECON1   ; disables writes to onboard EEPROM
 clrf p3_EECON2

My initial suspicion was that some register was not being initialized
properly.  My thought is that the Emulator initializes unspecified registers
differently than the ProMate programmer and that this explains why the one
fails where the other succeeds.  However, I have examined every register and
bit which differs between the two units and I believe that I have addressed
whatever differences exist.

I have checked and triple-checked the ProMate settings.  Stepping through
code is of limited use since it works on the Emulator and not on the burned
chip.

Any ideas?

A million thanks,

Barnaby Thieme
Product Engineer, SP Controls, Inc.
spam_OUTbthiemeTakeThisOuTspamspcontrols.com

--
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


2001\07\17@192237 by Jerry Merrill

flavicon
face
1. Look carefully at the RAM MEMORY MAP.  The last 16 bytes of each bank in
the 16F87x family are mirrored in various ways.  I don't remember if the
877 and 67 were the same in this respect.

2. Could you have an unknown dependency on the power-up state of a
variable?  Try randomizing registers (if MPLAB supports that) in the
emulator and see if it breaks it.  You could try clearing all used variable
space at startup so that the ICE and the DEVICE both start from a known
state every time; whether power-up, reset or WDT timeout.  IF that makes
the ICE and the DEVICE act the same, then there is probably a dependency.


At 06:03 PM 7/17/01, you wrote:
{Quote hidden}

Jerry Merrill

jerrymspamKILLspamtech-tools.com
http://www.tech-tools.com
FAX: (972) 494-5814   VOICE:(972) 272-9392
TechTools  PO Box 462101  Garland,  TX  75046-2101

Join our PIC discussion list at
http://www.tech-tools.com/picsource.htm

--
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


2001\07\17@195835 by Dan Michaels

flavicon
face
Barnaby wrote:
>Hello List
>
>I'm taking an existing circuit board from the 16C67 to the 16F877.
>Everything seems to work normally except for a bit-banging routine which
>manually controls an RS-232 driver (the USART is tied up elsewhere).  For
>some reason, the 232 communication fails frequently on the 877 but not on
>the 67.  To make matters more confusing, this problem only occurs with
>burned chips, and does not occur on the MPLAB ICE.  The 232 handling is NOT
>going through the USART -- it is being handled directly by code.
.............>


Are you using RB0/external interrupt for your RS232 RxD
line, or just polling to sense receipt?

--
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


2001\07\18@090619 by Olin Lathrop

face picon face
> I'm taking an existing circuit board from the 16C67 to the 16F877.
> Everything seems to work normally except for a bit-banging routine
> ...
> To make matters more confusing, this problem only occurs with
> burned chips, and does not occur on the MPLAB ICE.

This is probably not a programming bug.  The main difference between the ICE
and a real chip is the capacitance on the lines.  This can effect an
improperly designed oscillator and any lines that are floating or have
passive pullups/pulldowns.  I had a problem once where an IIC bus between
two PICs that worked fine when either chip was replaced with the ICE, but
failed when both were real chips.  It turned out the extra capacitance from
the ICE made the system work.

I don't know how this relates to your RS-232 problem, but maybe the RS-232
is fine but getting hit with an unexpected interrupt somewhere?  I'd like to
know what this is when you find it.

>   bsf  ADCON1, PCFG2 ; the F877 automaitically configures
>   bsf  ADCON1, PCFG1 ; certain pins as AtoD.  This makes all the pins
> digital.

Yes, this is a real gotcha and a dumb choice of defaults by Microchip.

{Quote hidden}

This is a waste of time.  Except for the A/D, all the extra stuff wakes up
so that it won't bother you if you don't touch it.  I noticed that you
trusted the PCFG3 bit in ACCON1 to wake up 0, so why is the rest of this
stuff any different?


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

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


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