Hello there!
I need help regarding my project. I have designed the Hardware completely. I am designing a path learning car.
However i am having trouble with the code. I am using PIC16F877 mc. the code is attached.
MY PROBLEMS: When i am trying to send an interrupt to pin RB0 then no pulse is detected. which means no interrupt. I want to know the problem. Can anyone help me?
I need help regarding my project. I have designed the Hardware completely. I am designing a path learning car.
However i am having trouble with the code. I am using PIC16F877 mc. the code is attached.
MY PROBLEMS: When i am trying to send an interrupt to pin RB0 then no pulse is detected. which means no interrupt. I want to know the problem. Can anyone help me?
Rich (BB code):
list p=16f877 ; list directive to define processor
#include <p16f877.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
CHECK EQU 0X20
TEMP EQU 0X21
A1 EQU 0X022
B1 EQU 0X023
C1 EQU 0X024
;**********************************************************************
ORG 0x000 ; processor reset vector
clrf PCLATH ; ensure page bits are cleared
GOTO MAIN ; go to beginning of program
ORG 0x004 ; interrupt vector location
MOVF CHECK,0
XORLW D'1'
MOVWF CHECK
MOVLW b'10000000'
MOVWF PORTD
; clearing in software
BCF INTCON,1;
RETFIE
MAIN
MOVLW B'10100101';
MOVWF TEMP;
MOVLW D'1';
MOVWF CHECK;
;;;;;;;;;;;;;;;PORTS
BANKSEL TRISC
MOVLW B'00000000'
MOVWF TRISC
BANKSEL TRISB
MOVLW B'11111111'
MOVWF TRISB
BANKSEL INTCON
;;;On Interrupts
BCF INTCON,1;
BSF INTCON,4;
BSF INTCON, 6;
BSF INTCON, 7;
BSF INTCON, 3;
;; stop the car
LOOP
;;;;;;;;;;;;;;;;;;;;;;
MOVF CHECK,0
XORLW D'1'
BTFSS STATUS,Z;
GOTO LOOP1
;; START CAR ( any pin on port C)
MOVLW B'11111111'
MOVWF PORTC;
; CALL DELAY1
GOTO LOOP
LOOP1
MOVF CHECK,0
XORLW D'1'
BTFSC STATUS,Z;
GOTO LOOP
BANKSEL PORTC
MOVLW B'00000000'
MOVWF PORTC;
GOTO LOOP1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
END