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

store data in C lang..

Hi everyone,

I've some problem storing the data in register on C lang. My SBUF was stored with some data and i want to view what data was inside. I want to store my SBUF value into R0 but i not sure how to write the code in C lang.

I know that in asembly lang, it was MOV R0, #01H<<<<<example

Can anyone help me on this? Thanks alot

Parents
  • When you write in a High-Level Language (HLL) - any HLL - you give responsibility for managing the processor registers to the compiler.

    Therefore, you should not attempt to write to specific processor registers (as opposed to SFRs) from 'C'!

    If you need to store data in 'C', then create a suitable variable to do it!

    eg,

    void my_func( void )
    {
       char received_byte;   // define a variable
    
       received_byte = SBUF; // read the value from SBUF into the variable
    }
    

    http://www.keil.com/books/

Reply
  • When you write in a High-Level Language (HLL) - any HLL - you give responsibility for managing the processor registers to the compiler.

    Therefore, you should not attempt to write to specific processor registers (as opposed to SFRs) from 'C'!

    If you need to store data in 'C', then create a suitable variable to do it!

    eg,

    void my_func( void )
    {
       char received_byte;   // define a variable
    
       received_byte = SBUF; // read the value from SBUF into the variable
    }
    

    http://www.keil.com/books/

Children