Jump to content

Assigning Valuse To Constants


Recommended Posts

Header file

#define nrf24l01_CE_IOREGISTER PORTB

#define nrf24l01_CE_PINMASK 0x01

 

C file

nrf24l01_CE_IOREGISTER &= ~nrf24l01_CE_PINMASK;

 

I’m receiving the following compiler error:

c(510): error: left operand must be l-value c(510:9): error: failed to generate expression

 

I understand that this is because im trying to assign a value to a constant. Is there anyway around this???

Link to post
Share on other sites

In C you can not assign a value to a constant (don't confuse this with const variable thought). The expression you quoted will look like this after passing the pre-processor:

 

6 &= ~1

 

This is an assignment expression and in C left side of an assignment expression must be an l-value.

 

Regards,

Pavel

Link to post
Share on other sites
...Also does the sourceBoost compiler have a spi.h header for the spi on the 16F pic's?...

 

There are no SPI libraries or headers supplied in SourceBoost. We recommend to aks on the BoostC programming forum. There are a lot of talented BoostC users there.

 

Regards,

Pavel

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...
×
×
  • Create New...