Jump to content
Sign in to follow this  
danutz

Assembler Constants Not Recognized

Recommended Posts

I get this error: error in built-in assembly

 

void MyFunction(unsigned int unCmd)

{

clear_bit(PORTNSEL, nSEL_BIT);

asm

{

movf param00_TrimiteComandaWord+1, W

movwf SSPBUF

bsf STATUS, RP0

}

...

}

 

the compiler doesn't recognize SSPBUF and STATUS. If I replace them with _sspbuf and _status it works. Should I include some specific header or BoostC doesn't recognize Microchip's definitions?

 

Also, how can I access the input variables of a function? In the example I tried like in C2C-Plus, and it doesn't work.

 

Dan

Share this post


Link to post
Share on other sites

danutz,

I get this error: error in built-in assembly

 

void MyFunction(unsigned int unCmd)

{

  clear_bit(PORTNSEL, nSEL_BIT);

  asm

  {

    movf param00_TrimiteComandaWord+1, W

    movwf SSPBUF

    bsf STATUS, RP0

  }

...

}

 

the compiler doesn't recognize SSPBUF and STATUS. If I replace them with _sspbuf and _status it works. Should I include some specific header or BoostC doesn't recognize Microchip's definitions?

 

Also, how can I access the input variables of a function? In the example I tried like in C2C-Plus, and it doesn't work.

 

Dan

BoostC recognises C variable definitions in inline assembler when the are prefixed by an "_" (including function arguments).

All the usual registers have defined in header files (the correct one automatically include with #include<system.h>).

 

Here is picking up the function argument:

void MyFunction(unsigned int unCmd)
{
// clear_bit(PORTNSEL, nSEL_BIT);
asm
{
	movf _unCmd+1, W
	movwf _sspbuf
	bsf _status, RP0
}

}

Note: Don't add any bank switching to your code, leave it to the BoostC linker other wise it can cause problems.

 

BTW: Transistion from C2C to BoostC is not really easy, but its well worth it.

 

Regards

Dave

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...