Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:40 11 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Interupts with Ver 4.5

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 06:20pm 10 Jul 2014
Copy link to clipboard 
Print this post

I have noticed that if I set an interupt using SETPIN pin,INTL,Iroutine then other interupts such as SETTICK period,TARGET,2 will not function. Has this been covered or is this documented somewhere that I may have missed?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 06:26pm 10 Jul 2014
Copy link to clipboard 
Print this post

Micromite or Maximite?

And code which shows the error.

Jim
VK7JH
MMedit
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 06:47pm 10 Jul 2014
Copy link to clipboard 
Print this post

  TassyJim said   Micromite or Maximite?

And code which shows the error.

Jim


I am finding the issue with a colour maximite and there is no error reported the settick just does not happen.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3269
Posted: 08:44pm 10 Jul 2014
Copy link to clipboard 
Print this post

You can have multiple interrupts running. Can you post a short segment of code that demonstrates your problem?

Geoff
Geoff Graham - http://geoffg.net
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 09:38pm 10 Jul 2014
Copy link to clipboard 
Print this post

  Geoffg said   You can have multiple interrupts running. Can you post a short segment of code that demonstrates your problem?

Geoff


Welcome back to winter Geoff and thanks for your reply.
Here is hopefully enough code to demonstrate:

Dim ANALOG(20)
Dim DOW$(6) LENGTH 9
Dim SDDATA(10,10)
Dim KCTWORD(2048)
Dim MESSAGE(16)
SetPin 1,AIN 'ANALOG IN
SetPin 2,AIN 'ANALOG IN
SetPin 3,AIN 'ANALOG IN
SetPin 4,AIN 'ANALOG IN
SetPin 5,AIN 'ANALOG IN
SetPin 6,AIN 'ANALOG IN
SetPin 7,AIN 'ANALOG IN
SetPin 8,AIN 'RADIO AUDIO OUT (DB9/9)
SetPin 9,DOUT 'RADIO PTT(DB9/3)
SetPin 10,INTL,HAVECD 'RADIO CD (DB9/6)
SetPin 11,FIN '
SetPin 12,PWM 'RADIO MIC IN (DB9/7)
:
:
SetPin 40,DIN 'AIN,DIN,DOUT
SetTick 2001,BLINKLED,2
:
HAVECD: ' CD DETECTED GOING LOW NEED TO ANALYSE VF DATA
CD=1
CDDETECT=CDDETECT+1
VFARRAY 'FILL ARRAY WITH INCOMING DATA SAMPLE
GETWORD 'RETURN WITH VFDATA$ SINGLE CHARACTER
BUILDPCKT 'ASSEMBLE EACH CHARACTER TO FORM WORD
IReturn
:
:
BLINKLED: 'FLASH LED & UPDATE TIME
If CD=0 Then
Pin(0)=1
Pause 20
Pin(0)=0
Print @(420,0)Time$
EndIf
IReturn


The program calls the HAVECD routine but ignores the ongoing SetTick to BLINKLED.
I have got around the issue here by looking at Pin 10 in a loop and calling HAVECD when it goes low.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 09:52pm 10 Jul 2014
Copy link to clipboard 
Print this post

Grame
Once you take the interrupt to HAVECD then all other interrupts are locked out until you process the IRETURN. Are you loitering in VFARRAY, GETWORD, or BUILDPCKT?
Bob
Edited by BobD 2014-07-12
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 10:00pm 10 Jul 2014
Copy link to clipboard 
Print this post

  BobD said   Grame
Once you take the interrupt to HAVECD then all other interrupts are locked out until you process the IRETURN. Are you loitering in VFARRAY, GETWORD, or BUILDPCKT?
Bob


Bob Thanks for your input. The program was dealing with the HAVECD and finishing the job, but during idle time (up to 2 hours) it wasn't flashing the LED

As I mentioned the workaround does let the BLINKLED routine happen.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3269
Posted: 12:10am 11 Jul 2014
Copy link to clipboard 
Print this post

Graeme,

We need a short segment of code that works. The problem with your post is that it will not run and is therefore impossible to diagnose and test.

Try this, I bet that it will work:
SetPin 10, INTL, HAVECD
SetTick 2001, BLINKLED, 2
Do : Loop

HAVECD:
Print "Have CD"
IReturn

BLINKLED:
Print "Blink"
IReturn


Geoff
Geoff Graham - http://geoffg.net
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 12:32am 11 Jul 2014
Copy link to clipboard 
Print this post

Graeme
I notice you are using colons : to make blank lines. It's probably harmless but it's also probably not beneficial. You may be better to leave blank lines or a single quote '.

As for your other problem. You need to get in and out of that interrupt routine as quick as possible.

My suggestion is to remove all of those routines from the ISR and just set a flag in the ISR to indicate that it has been called. Then, in your main loop, use that flag to conditionally call your VFARRAY, GETWORD, and BUILDPCKT. When you have finished then clear that flag.

I can't offer you more than that as you haven't shown much of what you are doing.

Have you read the bottom of page 7 in the Maximite Manual or the bottom of page 26 in the MicroMite Manual? There is an explanation of interrupts.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 01:54pm 11 Jul 2014
Copy link to clipboard 
Print this post

  BobD said   Graeme
I notice you are using colons : to make blank lines. It's probably harmless but it's also probably not beneficial. You may be better to leave blank lines or a single quote '.


Bob, I used the colons in the posted example to indicate that there were other subs etc between the posted code.

 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 982
Posted: 01:15pm 15 Jul 2014
Copy link to clipboard 
Print this post

  Geoffg said   Graeme,

We need a short segment of code that works. The problem with your post is that it will not run and is therefore impossible to diagnose and test.

Try this, I bet that it will work:
SetPin 10, INTL, HAVECD
SetTick 2001, BLINKLED, 2
Do : Loop

HAVECD:
Print "Have CD"
IReturn

BLINKLED:
Print "Blink"
IReturn


Geoff


I am afraid that it one of those situations where the hardware controls the software and it is unfortunate that I can't post code that could be tested by others. I will have to concede that the cause of the problem will be an error on my coding although I have not been able to locate and correct it. The work around will have to suffice for now ( testing for the CD signal within a loop).
Thankyou for the support
GM
 
crez

Senior Member

Joined: 24/10/2012
Location: Australia
Posts: 152
Posted: 02:56am 16 Jul 2014
Copy link to clipboard 
Print this post

I have had a similar problem in the following code reading a rotary encoder:

Initialised.....

SETPIN 2, INTH, RInt

Interrupt routine........

RInt:

IF PIN(RB)=1 THEN
'Clockwise rotation
Value=Value+1
ELSE
'Anti-Clockwise rotation
Value=Value-1
ENDIF

IRETURN

I can watch the rising edges on pin 2 using a digital 'scope but about every 1 in 10 does not cause an interrupt. There are no other interrupts active. The code is basically that posted by G8GCF for controlling the AD9850 DDS chip.

It appears that rising edges are being ignored but there maybe something else happening that I will find when I investigate a bit more.

David
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025