Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

interrupt problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
hast66

Bascom Member



Joined: 18 Aug 2005
Posts: 28

PostPosted: Fri Aug 26, 2005 3:27 pm    Post subject: interrupt problem Reply with quote

Hi

On PIND.3 of a 90S2313 I connect a pushbutton and I use this as an interrupt
Every time I push short the prg should wait 1500sec. When I push longer(>1sec) it should go to the ISR "RESETTEN"

Code:


Config Portd = Input

Reset Portd

Config Int0 = Falling                                      
Config Int1 = Rising                                        
Enable Interrupts
Enable Int0
Enable Int1
On Int0 Resetten , Nosave
On Int1 Uitstel , Nosave

'main program

Do
‘something with some wait instructions in between
Loop

'ISR 1 rising uitstel
Uitstel:
         Wait 1
         Enable Interrupts                                  
         Enable Int1

         If Pind.3 = 0 Then                                
                              Wait 1500                    
                              Goto Resetten                
         End If
         
         Bitwait Pind.3 , Reset
         Goto Resetten
Return                                                      

'ISR 0 falling resetten
Resetten:
         jmp 0                                            ' soft reset
Return                                                      

End                                                         'end program

 


when I push short the prg goes to the wait 1500 instruction (I think) and I can interrupt this with an INT0 signal but not with a longer(>1sec) INT1 signal
What am I doing wrong???
[/code]
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1198
Location: France

france.gif
PostPosted: Sat Aug 27, 2005 2:08 pm    Post subject: Reply with quote

hello,
for a keyboard, I carried out a similar program without used interruption.

the idea was as follows: in the main loop I question the keyboard perpetually.
if I do not have an answer I return to the loop
if I have an answer corresponding to the pushed key, I makes leave another loop where I control the time where the key is pushed with
waitms and exit do
You can make the same thing by controlling the reserved pin
bon courage
JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
naicheben

Bascom Member



Joined: 18 Nov 2004
Posts: 47
Location: Leck

germany.gif
PostPosted: Tue Sep 06, 2005 8:18 am    Post subject: Reply with quote

how about:


Config Portd = Input

Reset Portd

Config Int0 = Falling
Config Int1 = Rising
Enable Interrupts
Enable Int0
Enable Int1
On Int0 Resetten , Nosave
On Int1 Uitstel , Nosave

'main program

Do
‘something with some wait instructions in between
Loop

'ISR 1 rising uitstel
Uitstel:
waitms 1500 'since 1500sec= 25 min ... you didn't wait, did you?
If Pind.3 = 0 Then 'so if its still pressed ... reset
Goto Resetten
End If
'Do what so ever ....
Return

'ISR 0 falling resetten
Resetten:
jmp 0 ' soft reset
Return

End 'end program
Back to top
View user's profile
hast66

Bascom Member



Joined: 18 Aug 2005
Posts: 28

PostPosted: Tue Sep 06, 2005 11:12 am    Post subject: Reply with quote

I found the solution.
Due to contactvibrations(I don't know the right word), the flags in the GIFR ar set unintentionelly, so you get another interrupt as soon as you enable interrupts again.
A way to prefent this :
Code:
Gifr = Gifr Or 192
(= setting(discarding) the pending INT0 en INT1.) just before enableing interrupts. Of course you can play with the number 192 to choose the right INT

Another silly thing I've searched for: with external interrupts and sleep mode: you can only wake up with a LEVEL interrupt
Back to top
View user's profile
hast66

Bascom Member



Joined: 18 Aug 2005
Posts: 28

PostPosted: Tue Sep 06, 2005 11:20 am    Post subject: Reply with quote

oh yes Naicheben

It was the intention to interrupt the wait 25minutes with a longer push on the button or to re-begin the 25minutes loop with a shorter push.

I make this small project to automatically close my garage after 5 minutes with some postpone options.

thanks anyway
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum