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 - robin.abbott@dial.pipex.com ************************************************************************** * * Forest Electronic Developments * http://dspace.dial.pipex.com/robin.abbott/FED * ************************************************************************** ----- Original Message ----- From: Mark Crankshaw To: Sent: 07 October 1999 11:34 Subject: 'F84 to 'F877 problems > 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.