CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

how place asm routine in specific RAM address

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nanard_bis
Guest







how place asm routine in specific RAM address
PostPosted: Mon Jun 16, 2003 2:16 am     Reply with quote

Hello,

For reduce input and output #int_rtcc timing,
i want place an asm (goto0x...) in 0x0005 address.

#org{0x0004,0006){}
don't run in this range.

thank you for you help
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515277
Tomi
Guest







Re: how place asm routine in specific RAM address
PostPosted: Mon Jun 16, 2003 3:12 am     Reply with quote

Check out the #INT_GLOBAL compiler directive to write your own IT dispatcher.

:=Hello,
:=
:=For reduce input and output #int_rtcc timing,
:=i want place an asm (goto0x...) in 0x0005 address.
:=
:=#org{0x0004,0006){}
:=don't run in this range.
:=
:=thank you for you help
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515282
R.J.Hamlett
Guest







Re: how place asm routine in specific RAM address
PostPosted: Mon Jun 16, 2003 7:26 am     Reply with quote

:=Hello,
:=
:=For reduce input and output #int_rtcc timing,
:=i want place an asm (goto0x...) in 0x0005 address.
:=
:=#org{0x0004,0006){}
:=don't run in this range.
:=
:=thank you for you help
A goto, costs extra time. The way to do a short interrupt handler, is to use the #int_global declaration, and take over control yourself. The following is the 'casing', I use for such applications on the 16 family.

#int_global
void inthdlr(void) {
static int WSCRATCH,STSCRATCH;
#ASM
//First save registers
MOVWF WSCRATCH
SWAPF STATUS,0
CLRF STATUS
MOVWF STSCRATCH
//Clear the interrupt
//Add the bit clear here to reset the interrupt flag

//Now you can have your own interrupt handler, but _beware_,
//it should be in assembler, and not change any of the
//memory storage locations used in the C code.

EXIT:
//Now tidy up and return
SWAPF STSCRATCH,0
MOVWF STATUS
SWAPF WSCRATCH,0
#ENDASM
}

As shown, this can only be used for a single interrupt (since there is no attempt to test for which source is interrupting), but it is relatively fast. You can obviously add your own interrupt dispatcher if more than one source is required.
The code at the #ASM directive, will automatically be put at address 0004.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515295
R.J.Hamlett
Guest







Re: how place asm routine in specific RAM address
PostPosted: Mon Jun 16, 2003 9:13 am     Reply with quote

:=Hello,
:=
:=For reduce input and output #int_rtcc timing,
:=i want place an asm (goto0x...) in 0x0005 address.
:=
:=#org{0x0004,0006){}
:=don't run in this range.
:=
:=thank you for you help
As an ongoing 'comment', though using the goto, adds extra overhead, if you feel you must do this, you can use your 'org' construct, as:

#ORG 004,006 DEFAULT
void dummy(void) {
#ASM
goto address
#ENDASM
}
#ORG DEFAULT

The 'default' option, only exists on the latter compilers, but allows routines to be located anywhere. :-)

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515297
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group