Name: | Mr. chong wei choong |
Company: | CHONG |
Web Site: | |
Questions:
i m doing my final project.
i use RB0 as external interrupt ..
i set very REGISTER BIT . ( ITCON, OPTION and so on ) .
programmer seem is ok ... but can not work in citcuit ( MPLAB simulate OK but when use circuit test it can not work)the problem in circuit is . when RB) straight connect to 5 VDC interrupt happen. but can not return (retfie can not work)
1) is it circuit problem ???
this is my prigramLIST P=16F876 INCLUDE "P16F876.INC" __CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC & _BODEN_OFF & _LVP_OFF CBLOCK 0X20 ADELAY BDELAY CDELAY WTEMP STATUSTEMP PCLATHTEMP FSRTEMP ENDC ORG 0X00 GOTO UTAMA ORG 0X04 GOTO KENA UTAMA CLRF STATUS CLRF PORTA CLRF PORTB CLRF PORTC CLRF INTCON CLRF PCLATH CLRF TRISA CLRF TRISB CLRF TRISC BSF STATUS,RP0 MOVLW 0X06 MOVWF ADCON1 MOVLW 0X01 MOVWF TRISB MOVLW 0X06 MOVWF TRISA BSF OPTION_REG,NOT_RBPU BSF OPTION_REG,INTEDG BCF STATUS,RP0 BSF INTCON,GIE BCF INTCON,PEIE BCF INTCON,T0IE BSF INTCON,INTE BCF INTCON,RBIE BCF INTCON,T0IF BCF INTCON,INTF BCF INTCON,RBIF TUGAS CALL JALAN CALL TNGCE CALL TNGCE CALL TNGCE CALL PUSING CALL TNGCE CALL TNGCE CALL TNGCE GOTO TUGAS JALAN BCF PORTB,1 BCF PORTB,2 BSF PORTB,3 BCF PORTB,4 RETURN PUSING BCF PORTB,1 BCF PORTB,2 BCF PORTB,3 BSF PORTB,4 RETURN UNDUR BCF PORTB,1 BSF PORTB,2 BCF PORTB,3 BCF PORTB,4 BTFSS PORTA,0 GOTO LAMBAT GOTO UNDUR KENA MOVWF WTEMP SWAPF STATUS,W MOVWF STATUSTEMP MOVF PCLATH,W MOVWF PCLATHTEMP BCF STATUS,RP0 BCF INTCON,GIE LAMBAT BTFSS PORTB,0 GOTO BALIK BSF PORTB,1 BCF PORTB,2 BCF PORTB,3 BCF PORTB,4 BTFSS PORTA,0 GOTO LAMBAT GOTO UNDUR BALIK SWAPF STATUSTEMP,W MOVWF STATUS SWAPF WTEMP,F SWAPF WTEMP,W BSF STATUS,RP0 BSF OPTION_REG,NOT_RBPU BSF OPTION_REG,INTEDG BCF STATUS,RP0 BSF INTCON,GIE BCF INTCON,PEIE BCF INTCON,T0IE BSF INTCON,INTE BCF INTCON,RBIE BCF INTCON,T0IF BCF INTCON,INTF BCF INTCON,RBIF RETFIE TNGCE MOVLW D'255' MOVWF ADELAY MOVWF BDELAY DELAYCE DECFSZ ADELAY,F GOTO DELAYCE DECFSZ BDELAY,F GOTO DELAYCE RETLW 0 END