20X2 interrupts again

alhoop

Member
First off - I don't completely understand Hardware Interrupts and after reading what seems
like more than 20 posts here on the forum concerning same, it seems
that I am not alone.
In the code below programA will handle interrupts without fail when 'dir' is either 0 or 1.
ProgramB will do the same when 'dir' is 0 but will only handle one interrupt when 'dir' is 1.
I cannot discern why this is so - so I come to the gurus here.
All testing done with simulation.
Thanks
Al
Code:
interrupt:			;partial program A
	if cnt = 1 then	
	timf = timer3
	else tim = tim
	endif 
	inc cnt
	if dir = 0 then
	hInt2Flag = 0
	hintsetup %01000100
	setintflags %00000100,00000100
	else 
 	hInt1Flag = 0
 	HIntSetup   %00100010
  	SetIntFlags %00000010,%00000010
  	endif
	return
Code:
interrupt:			;Partial program B

	if cnt = 1 then
	timf = timer3
	else tim = tim
	endif 
	inc cnt
	if dir = 1 then
	hInt1Flag = 0
	hintsetup %00100010
	setintflags %00000010,00000010
	else 
 	hInt2Flag = 0
 	HIntSetup   %01000100
  	SetIntFlags %00000100,%00000100
  	endif
	return
 
Last edited by a moderator:

Technical

Technical Support
Staff member
You have unreliable behaviour because you are missing the second % in this line

setintflags %00000010,00000010
 
Top