Hi again,
thanks for the cleaned and full working sample.
I'm much scared about "its not interrupt proof , other pbp functons may and do use FSR2 and TBLPTR" ....
I'll try to ask Melabs if it's safe or not.
Marco
Hi again,
thanks for the cleaned and full working sample.
I'm much scared about "its not interrupt proof , other pbp functons may and do use FSR2 and TBLPTR" ....
I'll try to ask Melabs if it's safe or not.
Marco
marco
I will give you three options
1. intcon.7=0 ' I'm assuming it was set
@ Flash2Ram _buff,_String1' Get a String from flash memory
intcon.7=1
2 . examine your .lst file and determine if any of your isr routines use FSR2 or TBLPTR
if none of them do then don't worry (this is the most likely case)
3. there are two other indirect addressing pointers FSR0 and FSR1 maybe one of them would be free
as groucho would say if you don't like these I have others
this is the best I can offer without seeing your code
Hi,
Looking at the DT-INTS_18 file Darrel is declaring variables for saving the FSR's:There's also a section towards the end that saysCode:fsave0H var WORD BANK0 SYSTEM ' locations for FSR registers fsave1H var WORD BANK0 SYSTEM fsave2H var WORD BANK0 SYSTEM fsave0L var WORD BANK0 SYSTEM ' low priority FSR locations fsave1L var WORD BANK0 SYSTEM fsave2L var WORD BANK0 SYSTEMWhich sets a flag SAVE_TBLPTR = 1 when any PBP command that uses TBLPTR is used and in the ReEnterPBP-18 file he's declaring variables for TBLPTR like:Code:; ---[See if we need to save TBLPTR]------------------------------------------And then, further down in that file:Code:TBLPTRU_H VAR HP_Vars[31] TBLPTRU_SaveH VAR TBLPTRU_H.lowbyte TBLPTR_H VAR HP_Vars[32] TBLPTRH_SaveH VAR TBLPTR_H.highbyte TBLPTRL_SaveH VAR TBLPTR_H.lowbyteSo, to me, it looks like DT-INTS is handling all that stuff and you would/should only need to worry about it of you're using the FSR's or TBLPTR in any other ASM routines which would mean that DT-INTS does't detect them being used and therefor doesn't save them.Code:@ if Save_TBLPTR == 1 TBLPTRU_SaveH = TBLPTRU TBLPTRH_SaveH = TBLPTRH TBLPTRL_SaveH = TBLPTRL @ endif
Of course I may have it all wrong in which case I hope someone who can understand the ASM in DT-Ints better then me can explain what's going on.
/Henrik.
thanks for that henrik I never thought to look at how dt ints works . dt's code leaves nothing to chance ,I'm left humbled again
Guys,
about Darrel code I could put my hand on fire.
about my code I can bet there are bugs ...
but with your help now I have everything clear and know where problems can be or not. I have DTint and other ISR where I'll take care about FSR and TBLPTR.
so, many thanks again for your support !
bye
Marco
Hi Richard,
maybe I'm doing some confusion and about to say something of funny, but I have a doubt:
How do you ensure in this code that you are in the correct bank reading the address of "buffer" ?
Code:ASM Flash2Ram macro buffer, msg ; Fills the buffer from flash msg movlw UPPER msg movwf TBLPTRU movlw HIGH msg movwf TBLPTRH movlw LOW msg movwf TBLPTRL movlw low buffer movwf FSR2L movlw High buffer movwf FSR2H L?CALL _bfill endm ENDASM
buffer does not actually exist its just a label in the macro , when assembled
@ Flash2Ram _buff , _String1 , produces
the label "buffer" is replaced with the symbol of the intended targetCode:000168 0E00 M movlw UPPER _String1 0016A 6EF8 M movwf TBLPTRU 00016C 0E01 M movlw HIGH _String1 00016A 6EF8 M movwf TBLPTRU 00016C 0E01 M movlw HIGH _String1 00016E 6EF7 M movwf TBLPTRH 000170 0E3E M movlw LOW _String1 000172 6EF6 M movwf TBLPTRL 000174 0E1A M movlw low _buff 000176 6ED9 M movwf FSR2L 000178 0E00 M movlw High _buff 00017A 6EDA M movwf FSR2H M L?CALL _bfill
at no stage do we actually write directly to the "buffer" we simply load its address (from the symbol table) into the fsr regs
the bfill subroutine then fills the "buffer" indirectly via the fsr regs
macro's are not subroutines they are just another shortcut way to save typing, every time the macro is encountered the real code as above is inserted into your program
Last edited by richard; - 20th April 2015 at 14:31.
Bookmarks