Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help me with interrupt problem in my program!

Status
Not open for further replies.

Raju C

Member level 2
Joined
Sep 17, 2009
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Bangalore
Activity points
1,558
interrupt problem ??

Hi all..
I am using external interrupt,when i set INTCON2 as 44 and INTCON as 92h it will go to the subroutine where i want TX operation to be done and when it release it does rx operation but problem is tx_operation data it is sending correct but when i go to rx operation it sending both tx and rx data ,if i poll that bit means it will send but in iterrupt once program comes to an end means it will start from beginning and again INTCON2 44h will execute and sending data with RX also .. so how to get this seperate , where this interrupt should be written ?? i have attached my program to this pls tell me where is that going wrong ?
 

Re: interrupt problem ??

Hi.

Think you are asking a lot for someone to debug 7 pages of your quiet complex assembler coding which isn't even fully commented.

Have you tried running it on a simulator or debugger and single stepped though the code so you can monitor the state of things and see where it is failing.
If you cannot do that, then break your code down in to smaller, simpler sections and run those until you find the point of error.

If you do post big code lists, use a free utility like WinRar so you can save /compress your actual .assembler file so it can be properly viewed in Mplab.
 

interrupt problem ??

ya i have checked by the pin polling and it is working fine only problem with interrupt part .. i have assained INCON2 as 44h and their it goes to ISR as i am writing that after the main it will take TX correct only but when i back to RX again that interrupt instruction will execute and gives both TX and RX value ..i will reduce the program and only the interrupt part i will keep so that you can check out ..

Added after 23 minutes:



list p=18f8722
#include p18f8722.inc
ORG 00H
GOTO START

ORG 08H
BTFSS PORTE,7
BRA NEXT
BRA TX_OPEARATION

ORG 100H

START:
MOVLW 0x00
MOVWF INTCON
CLRF INTCON2
CLRF INTCON3

SAVE: SENDING SOME DATA

BRA channel_check
Channel_check:btfss porta,2
Btfss porta,3

MOVLW 92H
MOVW F INTCON
MOLW 44 H ; WHEN IT EXECUTES IT JUMPS TO ISR
MOW INTCON2
BRA RX_OPERATION

TX_OPERATION:SOME CALCULATION
RETFIE

RX_OPERATION: SOME CALCULATION
BRA START ; when it executes this after rx operation inbetween again movlw 44h will come so it sends both value

end
 

Re: interrupt problem ??

Hi,

Think you need to look at your ISR.

You interrupt and goto the High ISR at 008h, but you then jump out of it - that is not the way to do it.

When an interrupt occurs, all the key registers, W , STATUS etc are saved before entering the ISR and restored when you leave the ISR by using the RETFIE instruction , so that you can continue you normal program.
If you do not do that, then anything can happen.

Also when an interrupt occurs and the ISR is entered, it is normal to reset that interrupt flag ready for the next event.
 

interrupt problem ??

I have idea that it will work when i cotrol outside but i am not getting with only the value 44h which we assaign to INTCON2 to tell interrupt occured . so every time it execute it tells that interrupt occur , after disabling also it will be in main routine so .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top