thanks for ur solution.. erm... the tris i tried before... i follow the datasheet format... set to bank 1 then assign the TRIS, when compile with MPLAB, it shows warning.. o.... is that an error o not?? but i using my this method... the program run prefectly also.. why ya???
erm... one more thing, act program after the main .. still got program one.... its not staight go to ISR subroutine.......!!! u can try to see my whole short program from the attachment there!!!!!! hope can give me suggetion...........and solution!!!! i want to know where is the problem..!!!! i want to learn more thing!!!!
;=================================================================================
;=Program for the PIC16f84a second PIC in the five-axis multitasking robot =
;=Aim: to control the base motor, vaccum and gripper + interrupt function
=================================================================================
list p=pic16f84a
#include "p16f84a.inc"
__CONFIG _WDT_OFF & _PWRTE_ON & _XT_OSC & _CP_OFF
D EQU 0X0C
D1 EQU 0X0D
D2 EQU 0X0E
;------------------------------------------------------------------------------------
ORG 0X00 ; STARTING LOCATION
GOTO INITIAL
ORG 0x04
GOTO ISR ; Go to start of foreground ISR
INITIAL: BSF STATUS,RP0 ; SELECT BANK 1
MOVLW 0X1F
MOVWF PORTA
MOVLW 0X03 MOVWF PORTB
BCF STATUS,RP0
CLRF PORTA
CLRF PORTB
CLRF INTCON
BSF INTCON,GIE ; Enable all interrupts
BSF INTCON,INTE ; Enable external INT-pin interrupts
;------------------------------------------------------------------------------------
START:
BTFSC PORTA,0 ; TEST PIN 19
GOTO FORWARD ; GOTO FORWARD IF PIN 19 IS SET,ELSE SKIP
BCF PORTB,4 ; OFF FORWARD
;------------------------------------------------------------------------------------
BTFSC PORTA,1 ; TEST PIN 20
GOTO REVERSE ; GOTO REVERSE IF PIN 20 IS SET,ELSE SKIP
BCF PORTB,5 ; OFF REVERSE
;------------------------------------------------------------------------------------
BTFSC PORTA,2 ; TEST PIN 1
GOTO LEFT ; GOTO LEFT IF PIN 1 IS SET,ELSE SKIP
BCF PORTB,6 ; OFF LEFT AND FORWARD
BCF PORTB,4
;------------------------------------------------------------------------------------
BTFSC PORTA,3 ; TEST PIN 2
GOTO RIGHT ; GOTO RIGHT IF PIN 2 IS SET,ELSE SKIP
BCF PORTB,7 ; OFF RIGHT AND FORWARD
BCF PORTB,4
;------------------------------------------------------------------------------------
BTFSC PORTA,4 ; TEST PIN 3
GOTO VACCUM ; GOTO VACCUM IF PIN 3 IS SET,ELSE SKIP
;------------------------------------------------------------------------------------
BTFSC PORTB,1 ; TEST PIN 8
GOTO GRIPPER ; GOTO GRIPPER IF PIN 8 IS SET,ELSE SKIP
GOTO START
;------------------------------------------------------------------------------------
FORWARD: BSF PORTB,4 ; ON FORWARD
GOTO START ; GO BACK
REVERSE: BSF PORTB,5
GOTO START
LEFT: BSF PORTB,6
BSF PORTB,4
GOTO START
RIGHT: BSF PORTB,7
BSF PORTB,4
GOTO START
VACCUM: COMF PORTB,3
GOTO START
GRIPPER: BSF PORTB,2
GOTO START ; GO BACK
;-------------------------------------------------ISR-------------------------------
ISR: CLRF PORTA
CLRF PORTB
BSF PORTB,5
CALL DELAY
BCF PORTB,5
BCF INTCON,INTF ; CLEAR THE TMR0 INTERRUPT FLAG BIT
RETFIE ; RETURN FROM INTERRUPT
;----------------------------------------DELAY-SUBROUTINE------------------------------------------------
DELAY: MOVLW B'00000001'
MOVWF D
DELAY2: MOVLW B'00001100'
MOVWF D1
DELAY3: DECFSZ D1,F
GOTO DELAY3
DECFSZ D,F
GOTO DELAY2
RETURN
END