PDA

View Full Version : Darrel Taylor - Instant Interrupts-Problem 16F877A



Megahertz
- 19th December 2009, 22:50
Using Darrel Taylor Intsrrupts

Hi, I am using 16F877A and I tried to compile first by just adding statements:
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
I am getting following error messeges:


Executing: "C:\PBP\PBPW.EXE" -ampasmwin -oq -z -p16F877A "GSM.bas"
PICBASIC PRO(TM) Compiler 2.50b, (c) 1998, 2008 microEngineering Labs, Inc.
All Rights Reserved.
Error[113] C:\PBP\PBPPIC14.LIB 1160 : Symbol not previously defined (INT_ENTRY)
Error[113] C:\PBP\PBPPIC14.LIB 1162 : Symbol not previously defined (INT_ENTRY)
Error[101] D:\BACKUP\DESKTOP\GSM GPS PROJECT\GSM.ASM 934 : ERROR: (Temp variables exceeding T4)
Loaded D:\Backup\Desktop\GSM GPS Project\GSM.COD.
BUILD SUCCEEDED: Sat Dec 19 23:43:28 2009

Can someone help me to resolve this please. Thanks

P.S: Do these interrupts work on 12F635?

Darrel Taylor
- 19th December 2009, 23:25
By themselves, the include files will not compile.

There must be an INT_LIST and INT_CREATE in your program.

INCLUDE "DT_INTS-14.bas"
INCLUDE "ReEnterPBP-14.bas"

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

@ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts




P.S: Do these interrupts work on 12F635?
Yes they do.
But I anticipate you will have more problems, because you already have more than 4-T? vars used.
So the program probably has a lot of math or logical conditions and there's going to be very little (if any) RAM left.

The 12F635 only has 64-bytes.
<br>

Megahertz
- 20th December 2009, 10:08
Hi, I added rest of the statements and now I am having following errors:


Executing: "C:\PBP\PBPW.EXE" -ampasmwin -oq -z -p16F877A "GSM.bas"
PICBASIC PRO(TM) Compiler 2.50b, (c) 1998, 2008 microEngineering Labs, Inc.
All Rights Reserved.

C:\PBP\DT_INTS-14.BAS ERROR Line 14: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 21: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 22: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 23: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 26: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 27: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 28: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 29: Redefinition of VAR.
C:\PBP\DT_INTS-14.BAS ERROR Line 30: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 14: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 20: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 21: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 22: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 23: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 24: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 25: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 26: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 27: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 28: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 29: Redefinition of VAR.
C:\PBP\REENTERPBP.BAS ERROR Line 30: Redefinition of VAR.
FATAL ERROR: Too many errors. (21)
Halting build on first failure as requested.
BUILD FAILED: Sun Dec 20 11:02:38 2009

Also is there any way out to get rid of 4-T error? and how it will affect my running code?

Thanks for the help in advance

Megahertz
- 21st December 2009, 21:58
Someone - Anyone there?
I am looking forward to use RB0 interrupt in my program........help me get rid of these errors please......Thanks

Darrel Taylor
- 21st December 2009, 23:44
It looks like you've put the includes in there twice.

Megahertz
- 21st December 2009, 23:57
Yes that's true. I just figured that out few minutes ago only. My code is streched so long that it's getting difficult to spot small errors and also I can be excused because it's the first time I am trying to use your interrupts. Anyways, thanks for the reply.

Can you please also brief me about T4 error? Though the Build succeed is appearing fine, but so is the error of T4. Should I try to reduce the code or the variables? Should I don't worry about it as far Build Succeed is there?Thanks

Darrel Taylor
- 22nd December 2009, 06:46
As long as none of the complex math or logical conditions are in the Interrupt handlers themselves, ...
you can open the ReEnterPBP.bas file and comment the ERROR "Temp variables exceeding T4" line with a semicolon (;).

Megahertz
- 22nd December 2009, 13:56
As long as none of the complex math or logical conditions are in the Interrupt handlers themselves, ...
you can open the ReEnterPBP.bas file and comment the ERROR "Temp variables exceeding T4" line with a semicolon (;).

Just to understand it correctly, I want to ask you few more questions:

1) Can I use the following statements:

ToggleLED1:
goto main ' Is it ok to send the program to a label. Also no complex match or logical conditions here
@ INT_RETURN

main:
'All complex code and calculations are here
@INT_ENABLE INT_INT 'Can I place this statement here?
@SLEEP 'Since my application is battery powered, so PIC to sleep if no command is present
Goto main

2) Will the next interrupt only be enabled after the code encounters @INT_ENABLE (Regardless of where I put it in the code)?

BIG thanks for the help upto now.

Darrel Taylor
- 22nd December 2009, 18:05
NO! That is not OK at all.

And if all you want to do is restart the program after an interrupt, then you don't even need interrupts.
<hr>
Once enabled, interrupts will continue to fire.
They do not need to be enabled again, unless manually DISABLED in your program.

Megahertz
- 22nd December 2009, 19:22
.... if all you want to do is restart the program after an interrupt, then you don't even need interrupts.

Well, I don't think I can manage without interrupts. In my code the program waits for serial data on one pin from an RF receiver. And if RI pin of my modem attached to RB0 pin goes low, the code should check any sms received as well. So, interrupt is needed.


Once enabled, interrupts will continue to fire.
They do not need to be enabled again, unless manually DISABLED in your program.

How I can do that-disable the interrupts (Is it by adding DISABLE before the code) ? and also can they be enabled again when needed by using @INT_ENABLE?

Regards

Darrel Taylor
- 22nd December 2009, 20:53
ENABLE and DISABLE have no effect with DT_INTS.
Those are only for ON INTERRUPT.

With DT_INTS there are two commands ...

@ INT_ENABLE TMR1_INT
@ INT_DISABLE TMR1_INT
They can be used anywhere in your program.
Once disabled, you will not receive any interrupts from that source or peripheral until you execute another @ INT_ENABLE.

When you INT_ENABLE, the flag is automatically cleared so you don't get an interrupt immediately if the flag was set.
<br>

Megahertz
- 22nd December 2009, 22:08
Thanks for the quick relply, just some last bit of confusion left:
1) When interrupt will happen while waiting for an RF signal - How do I send the code to go from ISR to main label?

2) Can I disable the interrupt in the ISR? for eg:

_ToggleLED:
@INT_Disable
goto main
@INT_Return ' Should I use this if I am sending the code to another label?

Darrel Taylor
- 23rd December 2009, 03:58
How do I send the code to go from ISR to main label?Like I said before.
You should NOT jump out of an interrupt handler to the main loop.
<br>

Megahertz
- 31st December 2009, 13:19
Hello Darrel
I am using the interrupts on 12F635 for a different program now and I am getting the following errors:

Executing: "C:\PBP\PBPW.EXE" -ampasmwin -oq -z -p12F635 "TxRx.bas"
PICBASIC PRO(TM) Compiler 2.50b, (c) 1998, 2008 microEngineering Labs, Inc.
All Rights Reserved.

ERROR: Variable wsave3 position request 416 beyond RAM_END 127.
ERROR: Variable wsave2 position request 288 beyond RAM_END 127.
ERROR: Variable wsave1 position request 160 beyond RAM_END 127.
ERROR: Unable to fit variable wsave
ERROR: Unable to fit variable RS1_Save
ERROR: Unable to fit variable RS2_SaveHalting build on first failure as requested.
BUILD FAILED: Thu Dec 31 14:13:38 2009

Any advise as to how to get rid of these?
I am trying to put interrupts for getting proper timeout for Serin command, is it a good way to it? Thanks for your help.