Jump to content
Sign in to follow this  
george

Linking more modules

Recommended Posts

Hi,

I have problems with my project. I have some assembler routines and I want to use them in my C-project. One way is in-line assembler, but in this case compiler is very stupid. See this:

;;;;;;;;asm{

;;;;;;;; BCF STATUS, 0x0006

;;;;;;;; BCF STATUS, 0x0005 ; Bank 0

;;;;;;;; bsf PORTB,5 ;LED ;network activity LED

;;;;;;;; movlw _INBUFFER

;;;;;;;; movwf FSR

;;;;;;;; movlw 0FH

;;;;;;;; movwf _COUNTER

;;;;;;;; bcf STATUS,0x0000

;;;;;;;; clrwdt

;;;;;;;; clrwdt

;;;;;;;;

;;;;;;;;

;;;;;;;;}

bcf STATUS, RP0

bcf STATUS, RP1

BCF STATUS, 0x0006

BCF STATUS, 0x0005 ; Bank 0

bsf PORTB,5 ;LED ;network activity LED

movlw _INBUFFER

movwf FSR

movlw 0FH

movwf _COUNTER

bcf STATUS,0x0000

clrwdt

clrwdt

 

 

First two lines sets memory bank to 0. Compiler, becase next instruction use PORTB in bank 0 !!adds!! same instructions again. Also when calling subrutine, instructions for handling PCLATH are added. I have assembler rutine for right timing of my application (an communication application),  but this destroys my code and timing.

 

So, is there an way how to link more modules (assembler and C) together and is there an way how to set assembler code to specified memory area? (typically, I want to write assembler rutine for interrupt ORG 4 .............. retfie)

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...