CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

#INT Global

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MCW
Guest







#INT Global
PostPosted: Thu Aug 21, 2003 5:15 am     Reply with quote

Hello,

I´ve got still a problem with the following interrupt service. The program steps into the isr, as planned, but then a reset follows. I´ve looked to the .lst file and found a retlw 00 instruction at the end of my isr.
At the memory address 0x00 is the goto 0x0200 instruction ( my main function is located at this address)

I need some more help in this situation !!!

Best Wishes

#INT_GLOBAL
{
#asm
goto VECTOR_MY_ISR_HIGH
#endasm
}

...
...
...

#org VECTOR_MY_ISR_HIGH, VECTOR_MY_ISR_HIGH + VECTOR_LEN3
void myISR_Vector_High( void )
{
if ( bit_test(INTCON,2) )
{
if (bit_test(INTCON, 5))
{
Var.ISR |= 0x01; }
Bit_Clear(INTCON, 2);
}

if (bit_test(PIR3, 0))
{
if (bit_test(PIE3, 0)) {
Var.ISR |= 0x02; }
BIT_CLEAR(PIR3,0); }

#asm
retfie
#endasm
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517124
R.J.Hamlett
Guest







Re: #INT Global
PostPosted: Thu Aug 21, 2003 7:15 am     Reply with quote

:=Hello,
:=
:=I´ve got still a problem with the following interrupt service. The program steps into the isr, as planned, but then a reset follows. I´ve looked to the .lst file and found a retlw 00 instruction at the end of my isr.
:=At the memory address 0x00 is the goto 0x0200 instruction ( my main function is located at this address)
:=
:=I need some more help in this situation !!!
:=
:=Best Wishes
You are still not saving the registers...
This has to be done by you (it is not automatic).
Also, since you have not actually defined a 'function' now, the compiler does not treat this as an interrupt handler...
//You will need the addresses of the status register, and BSR defined
//to suit your processor.

#INT_GLOBAL
void isr_handler(void) {
static int save_w;
static int save_status;
static int save_BSR;
#asm
MOVWF save_w
SWAPF status,W
BCF status,5
BCF status,6
MOVWF save_status
//If you want to start jumping around, you will have to
//save PCLATH/L as well
MOVF BSR
MOVWF save_BSR
#endasm
if ( bit_test(INTCON,2) ) {
if (bit_test(INTCON, 5)) {
Var.ISR |= 0x01;
}
Bit_Clear(INTCON, 2);
}

if (bit_test(PIR3, 0)) {
if (bit_test(PIE3, 0)) {
Var.ISR |= 0x02;
}
BIT_CLEAR(PIR3,0);
}
#asm
MOVF save_BSR
MOVWF BSR
SWAPF save_status,W
MOVWF status
SWAPF save_w,F
SWAPF save_w,W
#endasm
}

Best Wishes

:= #INT_GLOBAL
:= {
:= #asm
:= goto VECTOR_MY_ISR_HIGH
:= #endasm
:= }
:=
:= ...
:= ...
:= ...
:=
:= #org VECTOR_MY_ISR_HIGH, VECTOR_MY_ISR_HIGH + VECTOR_LEN3
:= void myISR_Vector_High( void )
:= {
:= if ( bit_test(INTCON,2) )
:= {
:= if (bit_test(INTCON, 5))
:= {
:= Var.ISR |= 0x01; }
:= Bit_Clear(INTCON, 2);
:= }
:=
:= if (bit_test(PIR3, 0))
:= {
:= if (bit_test(PIE3, 0)) {
:= Var.ISR |= 0x02; }
:= BIT_CLEAR(PIR3,0); }
:=
:= #asm
:= retfie
:= #endasm
:= }
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517126
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group