PIC18F8720 proteus and mplab

Thread Starter

techkumar

Joined Sep 14, 2008
2
Hi. I'm new to assembly language.I'm doing running light using 25 leds and pic18f8720. Testing on proteus. I'm unable to make it work.

Kindly see the attached source code and proteus dsn file. Hope some one can correct my mistakes here.

Source asm, hex and dsn files here:
http://www.4shared.com/file/mXSlyfpo/Project_mplab.html

Thank you.



Rich (BB code):
#include<p18F8720.inc>
 
org 0X00
goto start
org 0X08
goto ISR_timer
org 0X18
goto ISR_reset
retfie
 
start setf TRISB;
clrf TRISD;
clrf TRISE;
clrf TRISF;
clrf TRISH;
clrf TRISJ;
BCF RCON,IPEN, A;
BSF INTCON,GIEH,A;
BSF INTCON,INT0IE;
goto patt1;
 
patt1 movlw B'00010101';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
clrf WREG;
movlw B'00001010';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
BTFSS PORTB,2,A;
goto patt1;
goto patt2;
patt2 movlw B'00011001';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
clrf WREG;
movlw B'00000110';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
BTFSS PORTB,2,A;
goto patt2;
goto patt3;
patt3 movlw B'00000111';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
clrf WREG;
movlw B'00011000';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
BTFSS PORTB,2,A;
goto patt3;
goto patt4;
patt4 movlw B'00000111';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
clrf WREG;
movlw B'00011000';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
BTFSS PORTB,2,A;
goto patt4;
goto patt5;
patt5 movlw B'00000111';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
clrf WREG;
movlw B'00011000';
movwf PORTD,A;
movwf PORTE,A;
movwf PORTF,A;
movwf PORTH,A;
movwf PORTJ,A;
CALL ISR_timer;
CALL ISR_reset;
BTFSS PORTB,2,A;
goto patt5;
goto patt1;
 
ISR_reset BTFSS PORTB,1,A;
goto patt1;
return;
 
 
ISR_timer BCF T0CON,PSA;
BSF T0CON, 0;
BSF T0CON, 1;
BSF T0CON, 2;
MOVLW 0XB3;
MOVWF TMR0H;
MOVLW 0XB4;
MOVWF TMR0L;
BCF INTCON, TMR0IF;
BSF T0CON, TMR0ON;
BTFSS INTCON,TMR0IF;
RETURN;
END
 
Last edited by a moderator:

t06afre

Joined May 11, 2009
5,934
Have you set the configuration word(s) mentioned in the data-sheet section special futures of the CPU. Even if you just simulate in proteus I think these bits must be correct.
 

Thread Starter

techkumar

Joined Sep 14, 2008
2
Hi. I have followed those bits as per data sheet.

It seems i'm having problem with my software as well. Error as the reset interrupt is not working well.
 
Top