Error : overwrite same program counter location
Hallo everybody
I nebie with SXB and I don't know assembly... I write a program and it seems correct, but when I try to run it some errors appear.
The main problem is that the errors are in assembly code (geneterd by SX KEY I think).
This is my SXB code :
[code]
'
' Program Description
'
'
' GRIPOne
I nebie with SXB and I don't know assembly... I write a program and it seems correct, but when I try to run it some errors appear.
The main problem is that the errors are in assembly code (geneterd by SX KEY I think).
This is my SXB code :
[code]
'
' Program Description
'
'
' GRIPOne
Comments
Do this:
You have some problems in your code though. For example from within the interrupt routine you are using "GOTO Check_Spinning", but that is a subroutine. If you really just want to call the Check_Spinning subroutine, just use "Check_Spinning" without the goto.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
You are very kind and fast to reply...
I'll try like you show me.
I change the position of SUB declaration because If I try to put it after the INTERRUPT code, it was impossible call the SUB.
But like this should be ok.
Thanks again
Loojade
"overwriting same program location"
and to the next row: "address exceeds memory limit"
this is the SXB code:
[code]
'
' Program Description
'
'
' GRIPOne
Actually, things can be simply improved if the flag is replaced by a counter (as in my more recent examples), and the foreground simply tests it for a non-zero value, then proceeds with the foreground code (as it did with the flag), and decrements the counter by one. If, on completing the foreground task, the counter still is not zero, perhaps because it took longer than one interrupt tick, the foreground program is again immediately launched with another round, repeating all this until the couner is empty.
In this manner, no ticks are lost, regardless (almost) of the size of the foreground program. At worst a bit of jitter is introduced.
Interrupt······· ·inc········· Intcounter··················· ;indicate another interrupt has occurred
···················· mov······ ·w, #IntValue··············· ·;return to main or scheduler
···················· retiw
Scheduler······ test·········IntCounter··················· ;test for non-zero
····················snz
··················· jmp········ Scheduler···················· ·;no tick is detected
··················· dec·········IntCounter···················· ;subtract one interrupt event
··················· scheduler code··························· ·;scheduler and application code as per "flag" examples
··················· .
··················· .
··················· scheduler code
··················· jmp······· Scheduler······················ ·;wait for another interrupt
Cheers,
Peter (pjv)
Post Edited (pjv) : 2/26/2008 5:41:52 AM GMT
But I change a lot the program. JonnyMac spoken about lot of code in interrupt so I change the code. Now I use the asichro interrupt to fix the counter
and the main program to INC the counter:
[code]
...
Start:
WKPND_B = %00000000 ' clear pending
WKED_B = %11111111 ' falling edge detect
WKEN_B = %11111000 ' use bits 0..2 for inputs
TRIS_B = %00011111 ' imposto gli ingressi e le uscite della porta B
TRIS_C = %00000000 ' imposto gli ingressi e le uscite della porta C
INPUT SDA ' float I2C bus pins
INPUT SCL
counter_fr_l = 255
counter_fr_h = 255
counter_rr_l = 255
counter_rr_h = 255
last_fr_l = 255
last_fr_h = 255
last_rr_l = 255
last_rr_h = 255
controllo = 0
byte_interrupt = 0
addr = 0
byte1 = 0
Main:
IF button_1 = 1 THEN 'il pulsante di scelta