Searching \ for ''F84 to 'F877 problems' 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=877
Search entire site for: ''F84 to 'F877 problems'.

Truncated match.
PICList Thread
''F84 to 'F877 problems'
1999\10\07@064544 by Mark Crankshaw

flavicon
picon face
I'm still quite new to PICs (and have just returned to the list after a
break) but have used 'F84s successfully for a couple of projects. Now that
I can obtain 'F877s I am trying to convert my projects to use the 'F877 so
that I can then expand the projects.

However I'm having problems. I started by simply changing register
addresses to suit the 'F877 but that didn't work. To cut a long story
short I'm now back to trying to get LEDs to flash! I have a simple circuit
on stripboard with an 'F877, voltage reg.,0.1 uF cap. across the supply, 4
MHz crystal with 2 15 pF caps., MCLR tied directly to 5V and 8 LEDs with
resistors on PORTB. The following program works, well kind of - the
LEDs come on one at a time and then go off rather one running up and
down the line, but at least it does something (WDT enabled of course):

;-------------------------------------------------------------
       LIST P=16F877
;
PORTB   EQU     6
TRISB   EQU     86H
OPTREG  EQU     81H
STATUS  EQU     3
CARRY   EQU     0
RP0     EQU     5
MSB     EQU     7              ;BIT POSITION OF LEFTMOST LED
;
       CLRF    PORTB           ;ALL LEDS OFF
       BSF     STATUS,RP0      ;SELECT REGISTER BANK 1
       CLRF    TRISB^80H       ;SET PORTB TO ALL OUTPUTS
       MOVLW   0AH
       MOVWF   OPTREG^80H      ;ASSIGN PRESCALER (1:4) TO WDT
       BCF     STATUS,RP0      ;SELECT REGISTER BANK 0
       INCF    PORTB,F         ;TURN ON RIGHTMOST LED
       BCF     STATUS,CARRY    ;CLEAR CARRY
LEFT    SLEEP                   ;WAIT FOR WDT TIMEOUT
       RLF     PORTB,F         ;TURN ON LED TO LEFT
       BTFSS   PORTB,MSB       ;REACHED LEFTMOST?
       GOTO    LEFT            ;LOOP IF NOT
RIGHT   SLEEP                   ;WAIT FOR WDT TIMEOUT
       RRF     PORTB,F         ;TURN ON LED TO RIGHT
       BTFSS   PORTB,0         ;REACHED RIGHTMOST?
       GOTO    RIGHT           ;LOOP IF NOT
       GOTO    LEFT            ;START NEW CYCLE
       END
;-------------------------------------------------------------

However the following doesn't (WDT off):

;-------------------------------------------------------------
       LIST P=16F877
;
PORTB   EQU     6
TRISB   EQU     86H
OPTREG  EQU     81H
STATUS  EQU     3
CARRY   EQU     0
RP0     EQU     5
MSB     EQU     7              ;BIT POSITION OF LEFTMOST LED
LOOP1   EQU     20H
LOOP2   EQU     21H
;
       CLRF    PORTB           ;ALL LEDS OFF
       BSF     STATUS,RP0      ;SELECT REGISTER BANK 1
       CLRF    TRISB           ;SET PORTB TO ALL OUTPUTS
       MOVLW   0AH
       MOVWF   OPTREG^80H      ;ASSIGN PRESCALER (1:4) TO WDT
       BCF     STATUS,RP0      ;SELECT REGISTER BANK 0
       INCF    PORTB,F         ;TURN ON RIGHTMOST LED
       BCF     STATUS,CARRY    ;CLEAR CARRY

START   MOVLW   0FFH
       MOVWF   LOOP1
L1      MOVLW   0FFH
       MOVWF   LOOP2
L2      DECFSZ  LOOP2
       GOTO    L2
       DECFSZ  LOOP1
       GOTO    L1
       INCF    PORTB,F
       GOTO    START
       END
;-------------------------------------------------------------

I also tried the above with the WDT on and with a CLRWDT in L2 but that
didn't help. I don't think you can get much simpler than this yet I can't
get it to work. Incidentally I've tried two different 'F877s, three
crystals and also with and without a 1k resistor between CLKOUT and the
oscillator in case that was the problem.

So can anyone help? I'm sure I must be overlooking something very simple
but I don't know what.

Thanks,

Mark.

1999\10\07@080428 by Myke Predko

flavicon
face
Hey Mark,

How are you setting your configuration fuses?  You are defining your
registers instead of including the Microchip definition file (you should be
including "P16F877.INC"), so I wonder if you are not setting your
configuration fuses properly.

I had a similar problem to what you are seeing a few weeks ago that was
cleared up by setting the configuration flags as:

__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON  & _WDT_OFF & _LVP_OFF &
_WRT_ENABLE_ON

Note that the "_LVP_OFF" and "_WRT_ENABLE_ON" Parameters have to be
specified for the '877 to work properly.

I've talked to Microchip about this and asked them to make this very obvious
in the "Configuration Fuse" section of the data sheets.

myke
{Original Message removed}

1999\10\07@081657 by gdaniel

flavicon
face
Mark Crankshaw wrote:

> I'm still quite new to PICs (and have just returned to the list after a
> break) but have used 'F84s successfully for a couple of projects. Now that
> I can obtain 'F877s I am trying to convert my projects to use the 'F877 so
> that I can then expand the projects.
>
> However I'm having problems. I started by simply changing register
> addresses to suit the 'F877 but that didn't work. To cut a long story
> short I'm now back to trying to get LEDs to flash! I have a simple circuit
> on stripboard with an 'F877, voltage reg.,0.1 uF cap. across the supply, 4
> MHz crystal with 2 15 pF caps., MCLR tied directly to 5V and 8 LEDs with
> resistors on PORTB. The following program works, well kind of - the
> LEDs come on one at a time and then go off rather one running up and
> down the line, but at least it does something (WDT enabled of course):
>

Mark, you can use include files to set the values for each PIC special
function register:
example:
#INCLUDE        <P12C671.INC>
(*.inc files will be hild in your MPLAB directory)

you can set config registers like this:
__CONFIG _MCLRE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _PWRTE_ON & _CP_ON

free ram file registers can be set in bulk like this:
   CBLOCK  H'20'        ;(substitute free ram start value for your processor)

       INT_W,INT_STATUS,INT_FSR
       TRX_PTR,XBITPOS
(etc)
   ENDC

Check the initialisation values for special function registers, ports may be
set for analogue input etc.

regards,
Graham.

1999\10\07@110030 by Dan Larson

flavicon
face
Dont' forget a pull-down resistor on RB3, if low voltage
ICSP is enabled.

Don't forget to setup ADCON1 to disable A/D configuration
or port A and some port E pins.  They default to A/D mode
at reset and you need to disable A/D in ADCON1 in order
to use them as digital I/O.

Dan

On Thu, 7 Oct 1999 11:34:54 +0100, Mark Crankshaw wrote:

{Quote hidden}

1999\10\07@141457 by Robin Abbott

flavicon
face
Mark

Apart from config fuses which your programmer may let you change anyway, the
obvious problems are that on reset the 877 sets port A to analogue inputs
and needs setting to digital input/output (see data sheet for details of the
ADCONF registers), the RAM is at different addresses but I notice you've
sorted that problem.

Multi-processor projects can be quite easy, just use plenty of #ifdef
statements to set up variables:

#ifdef __P16F84
F84 stuff here
#endif

#ifdef __P16F877
F877 stuff here
#endif

etc.


Robin Abbott - spam_OUTrobin.abbottTakeThisOuTspamdial.pipex.com

**************************************************************************
*
* Forest Electronic Developments
* http://dspace.dial.pipex.com/robin.abbott/FED
*
**************************************************************************

{Original Message removed}

1999\10\07@155436 by Tom Handley

picon face
  Myke, the 877 will work fine with WRT_ENABLE_OFF. You would normally
only enable it if you want to modify the program memory `on the fly'.
While you have to `jump through hoops' to modify the memory, unless
you intend to, I would recommend leaving this Bit off.

  As you noted, the big issue is LVP. New chips have this Bit set by
default. This means that RB3 is now dedicated to programming and it
must be held low for the device to operate. It's also important to
make sure DEBUG is disabled (Bit set) though it normally is by default.

  In Mark's case, he needs to be sure LVP and DEBUG are off as well as
the A/D if he is expecting digital I/O on those pins.

  - Tom

At 08:00 AM 10/7/99 -0400, Myke Predko wrote:
{Quote hidden}

>{Original Message removed}

1999\10\08@054617 by Mark Crankshaw

flavicon
picon face
Thanks to everyone who offered help on my problems getting a '877 to work.

With regard to config fuses, the programmer I use is the EPE PICToolkit
mk2 which can program them. I've had PWRTE set but no CP, no WDT, LVP
DEBUG or WRT. I have XT_OSC set. However, Graham, what are _MCLRE_OFF and
_INTRC_OSC_NOCLKOUT? I think I can work it out but I don't think I've come
across them before.

As far as PORTA and PORTE defaulting to analogue input, I was aware of
that and decided to use PORTB for the initial tests to avoid any
problems with that. I could then move on to checking that I could change
the configuration of PORTA as a next step but I haven't got past using
PORTB yet!

When I first tried to convert the existing '84 program I simply replaced
the '84 .inc file for the '877 one, moved user file registers between 1C
and 1F to above 20 and (hopefully) configured PORTA and PORTE as digital
I/O. I stopped using the .inc file really just to make everything as
simple as possible.

But, all is not yet lost! Yesterday I downloaded the code for the EPE data
logger which uses an '877 and put it's header on simple code for flash the
LEDs and that worked! The header didn't use the .inc file just defining
what was used in the data logger. I have only found one difference between
it and the unsuccessful attempts and that is that TRISA is defined as 05h
rather that 85h (similarly TRISB as 06h etc.). Both change to page 1
before writing to it and as I understand it there should be no difference
- any comments?

Thanks again for your help,

Mark.

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