PDA

View Full Version : GOTO absolut address - is that possible?



keymuu
- 8th November 2008, 01:15
Hi!

I have been looking around for some info how to jump to an absolute address (not label) but without success. So, I have not found that info...

I have a need to jump to the absolute address 0F4C.

Knowing that the banks are one byte wide and for example a bra instruction needs to calculate the address to the final location, jumping over the bank borders.

How do one calculate a long jump address?
Or how can on do that with the assembler?

If you know how to do it, please advice...:)

Darrel Taylor
- 8th November 2008, 01:46
@ GOTO 0x0F4C

Ioannis
- 8th November 2008, 10:20
Isn't necessary to change pages? As this is in assembly, PBP does not take care of this, I suppose.

Ioannis

Darrel Taylor
- 8th November 2008, 10:53
From another thread I saw he's using an 18F4550 with a USB bootloader.

So nope. No Pages to worry about.
<br>

Acetronics2
- 8th November 2008, 14:41
Hi, Darrel

While on that subject ...

I use, on a 16F88 :




' If program lost

@ ORG 4094 ' Pointer to the end of program
@ CLRF PCLATH ' pointer in the right page ( lol )
@ GOTO INIT ' It's gone for another round...
'
@ END



Works and compiles fine ... BUT

No way to use Breakpoints in MPSIM when lines not commented ...

Do you have any idea about that ??? ( µChip tells ... go and see Melabs !!! - as always ... )

Alain

keymuu
- 8th November 2008, 19:41
@ GOTO 0x0F4C

Thank you Darrel! :)

As not being so familiar with the assembler I did not see/realize that there is also GOTO and not just BRA. Now I know that BRA is for short jumps only and GOTO can jump anywhere.

Can you find a "good" 4550 tutorial (not datasheet) somewhere on the web?

Tanks again...

Darrel Taylor
- 9th November 2008, 12:03
Don't know of any 4550 tutorials.

The PIC18C Reference Manual has a little more info regarding the instruction set. But not enough more to be of much help.
http://ww1.microchip.com/downloads/en/DeviceDoc/39500a.pdf

Really, the datasheet has the best info available.
Once you get used to reading them, it gets easier.

Alain,

I haven't used mpsim for awhile, and there's been a few MPLAB upgrades in the mean time. I was going to try your problem, but now PBP isn't even an option in my MPLAB anymore.

I'll have to reinstall the dll again. Been too long, I forget how. :eek:
<br>

Archangel
- 9th November 2008, 21:07
Hi, Darrel

While on that subject ...

I use, on a 16F88 :




' If program lost

@ ORG 4094 ' Pointer to the end of program
@ CLRF PCLATH ' pointer in the right page ( lol )
@ GOTO INIT ' It's gone for another round...
'
@ END



Works and compiles fine ... BUT

No way to use Breakpoints in MPSIM when lines not commented ...

Do you have any idea about that ??? ( µChip tells ... go and see Melabs !!! - as always ... )

Alain
Hi Alain, Just curious . . . ASM comment is ; not ' yes?

Darrel Taylor
- 9th November 2008, 21:35
Hi Alain, Just curious . . . ASM comment is ; not ' yes?
Way to go Joe!
I didn't even see that.

Can't imagine how it compiled.
<br>

Archangel
- 9th November 2008, 21:46
Thanks Darrel :) 30 years of snivel service teaches you to pick fly specks out of the pepper ELSE Nazi bosses frag your reputation.

Acetronics2
- 10th November 2008, 08:06
Hi Alain, Just curious . . . ASM comment is ; not ' yes?

Hi, joe

YES ... looks right, but compiles and runs fine.

After all, It's a PBP program ... intelligent compiler ? lol : might be.

In fact, MPLAB accept both " ; " and " ' " ... as MPLAB Editor is set to "Basic" mode. Why not use what computers offer for ease of work ( Humour ...)

Changing " ' " to " ; " do not change anything ...

You're quite right : Manual says " line is sent verbatim" ... but, obviously, comments are not sent !!!


Alain

Archangel
- 10th November 2008, 09:18
Hi, joe

YES ... looks right, but compiles and runs fine.

After all, It's a PBP program ... intelligent compiler ? lol : might be.

In fact, MPLAB accept both " ; " and " ' " ... as MPLAB Editor is set to "Basic" mode. Why not use what computers offer for ease of work ( Humour ...)

Changing " ' " to " ; " do not change anything ...

You're quite right : Manual says " line is sent verbatim" ... but, obviously, comments are not sent !!!


Alain
Ask questions and learn, Right? <br>PBP & Assembler, like mixing 10 oz alcohol and 10 oz water, you do not get 20 oz of liquid.
I read books AND this forum, sometimes experience and books do not agree. Anyway I try to help and am not embarrassed to learn from the masters.

Acetronics2
- 11th November 2008, 10:08
Hi,

Here is the Melabs answer :




Below is the response that I received from MicroEngineering Labs regarding your issue:

I've found that the problem only occurs when the assembly-language jump to our INIT routine is included:

@ GOTO INIT

I'm guessing that since the INIT label isn't a label in the program source code (it is an internal label PBP creates), it is not something that can be resolved for source-level debugging.

User code should not jump to our INIT routine. If he wants to restart his program, he should declare a label in the source and use it instead.

Charles Leo
microEngineering Labs, Inc.



... now just have to find WHERE to place this "dummy" label ...

ring you asap.

Alain

Acetronics2
- 11th November 2008, 10:31
Ok, it's solved




'Defines

DEFINE OSC 4


'************************************************* ****************************
'************************************************* ****************************
'Config

'Program Configuration Register 1
@ __CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_ON & _XT_OSC

'Program Configuration Register 2
@ __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF


'************************************************* ****************************
Restart:

INTCON = %01000000 ' RB0 interrupt
OPTION_REG = %11000111 ' TMR0 pour sous régime PS = 256 ( Rpm = 460 )
T1CON = %01010000 ' %01000000
CCP1CON = %00000101
PIE1 = %00000100

CMCON = 7
CVRCON = 0

ANSEL = 0
ADCON0 = 0

....

'************************************************* ****************************
'************************************************* ****************************
' If Program counter lost

@ ORG 4094 ' Goto the very last lines ( µP is a 16F88 )
@ CLRF PCLATH ' right page for 12/16F( lol )
@ GOTO _Restart ' Go on again !!! ...
'
@ END



Look at the "Restart" Label ... it must be placed before the very first PBP command : here, an " INTCON = " statement.

The ASM " Init " ( no underscore !!! ) label is automatically placed here by PBP in the .asm generated.

This way, all the registers are re-set to the convenient values ...