This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Meaning of operator %=

Hello everybody,

I have seen the operator %= used in a code meant for Keil C. Can somebody explain me its purpose? Thanks.

www.8051projects.net/.../forum_viewtopic.php

char getchar()
   {
   volatile char c;

   while(RxInChar == RxOutChar);
   ES = 0;                         /* Disable Interrupts */
   c = RxBuffer[ RxOutChar++ ];
   RxOutChar %= BUF_SIZE;
   ES = 1;                         /* Enable Interrupts */

   return( c );
   }

Parents Reply Children
  • Note that this is basic, standard 'C' syntax - nothing specifically to do with Keil or embedded or the 8051...

  • Really sorry about that. I am new to C as well as to Keil.

  • I am new to C
    C51 is just about the lousiest platform there is to learn C on.

    Get a "teach yourself C" book (I recommend Kochan: "programming in ANSI C") and a (free) PC C compiler and start learning.

    Make sure you get a C book, not a C++ book if you want to move forward with the '51

    Erik

  • If you were new to swimming, would you start by jumping off a ship in the middle of the ocean, and hoping that you learned before you drowned?

    blog.antronics.co.uk/.../

  • Can you suggest a compiler with simple IDE to practice my code for Windows XP. I should be able to write the code, run it & view the result in output window.

    I have an old DOS version of Turbo C. But it is not comfortable to use in windows. I have DevC++ but I am not been able to view output window, & secondly it is(may be) C++

    Thanks

  • But it is not comfortable
    do you want to be comfortable or do you want to learn.

    you will, I presume, have a problem finding a C textbook that work with windows, C++ became the rage just about the same time that windows came out.

    again C51 is NOT C++

    Erik

  • Definitely Sir, I want to learn. I just wanted to say that as TurboC is not a windows application, is just somewhat cumbersome to use. Still I am ready to use it if I can's find one.

    But I also figured out that Dev C++ can be used for C programs. It provides option to use either C or C++ while you select a new project. Similarly in 'Project Options' there are many settings regarding the compiler. You can use any compiler. I will try it later on.

    The link provided by JJ Jotgietar is REALLY THE BEST!!! Thanks.

  • Dev-C++ is old an ancient and not maintained.

    Do look for Code::Blocks instead. It supports a large number of different compilers and is a way better environment than Dev-C++.

  • Thank you for your suggestion. I downloaded it, it is really much better than dev c++.

    I know, it is enough for me to have such an IDE with flexible compiler options for testing/practice purpose. I can easily practice C basics in it.

    While installation, it gives a list of compilers & asks for the default compiler to use. In the list only 2 compilers namely 'GNU GCC Compiler' & 'SDCC Compiler' are marked as available.

    Which one should I use to be more closer to KIEL compiler, or Can I use the Keil compiler which is installed in 'C:\Keil\C51\BIN'

  • While installation, it gives a list of compilers & asks for the default compiler to use. In the list only 2 compilers namely 'GNU GCC Compiler' & 'SDCC Compiler' are marked as available.

    Which one should I use to be more closer to KIEL compiler, or Can I use the Keil compiler which is installed in 'C:\Keil\C51\BIN'
    using Keil/SDCC will just bring you back to the worst possible platform for learning (small embedded).
    the advantage of learning on a PC is that you never have to wonder "is it the hardware?" you get immediate results, hello world appear on the monitor instead of being sent through some serial line that may or may not be correctly configured .....

    your desire for 'convenience' worries me a bit there is absolutely nothing 'convenient' about developing small embedded.

    Erik