Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7758429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:21:29+00:00 2026-06-01T13:21:29+00:00

I am using MISRA C 2004 standards in Code Composer Studio . I am

  • 0

I am using MISRA C 2004 standards in Code Composer Studio. I am always getting errors with respect to bitwise operations during initialization of the peripherals.

In the compiler .h file, the definition is like this.

#define SFR_8BIT(addr)  extern volatile unsigned char addr

SFR_8BIT(REG1);

#define REG2  REG1

Now in my code, if I use

REG2 |= 0x01;

The MISRA C is popping out these errors:

  1. Bitwise operators shall not be applied to operands whose underlying type is signed – #1393-D (MISRA-C:2004 10.1/R)

  2. The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a integer type of the same signedness.

I don’t want to change the compiler .h file, and I want to eradicate these warnings.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:21:30+00:00Added an answer on June 1, 2026 at 1:21 pm

    At a guess, your char is 8 bits and int is (at least) 16. That means all values of unsigned char can be represented as (signed) ints. That, in turn, means in your expression REG2 |= 0x01;, your unsigned char will be promoted to int, then the OR operation carried out, then the result of that cast back to unsigned char.

    If I’m not mistaken, changing your constant to an unsigned char should prevent that:

    REG2 |= (unsigned char)0x01;
    

    or:

    unsigned char one = (unsigned char)0x01;
    
    REG2 |= one;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using IAR Workbench compiler with MISRA C:2004 checking on. The fragment is: #define
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I am using the below code: <div class=business-bottom-content onMouseOver=javascript:this.className='business-bottom- content-hover'; onMouseOut=javascript:this.className='business-bottom-content';> The jQuery script
Using UIWebview with basic authentication ( authentication works ) however I am not getting
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; N00b here, I've got the gridview to look the way
using the jquery ui modal dialog , the background shades grey (i assuming this
Using of mobile dialog authentication is working well for other mobile devices except on
Using ruby(1.8.7) , rails(2.3.8) , rspec(1.3.1) and rspec-rails(1.3.3) how do I test a method
using chrome 15 on osx 10.6.8 When adding event listeners, I've found that putting
Using Browserlab, it appears that the background image is not centred in Firefox7 for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.